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-default-acl"><structname>pg_default_acl
</structname></link></entry>
118 <entry>default privileges for object types
</entry>
122 <entry><link linkend=
"catalog-pg-depend"><structname>pg_depend
</structname></link></entry>
123 <entry>dependencies between database objects
</entry>
127 <entry><link linkend=
"catalog-pg-description"><structname>pg_description
</structname></link></entry>
128 <entry>descriptions or comments on database objects
</entry>
132 <entry><link linkend=
"catalog-pg-enum"><structname>pg_enum
</structname></link></entry>
133 <entry>enum label and value definitions
</entry>
137 <entry><link linkend=
"catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper
</structname></link></entry>
138 <entry>foreign-data wrapper definitions
</entry>
142 <entry><link linkend=
"catalog-pg-foreign-server"><structname>pg_foreign_server
</structname></link></entry>
143 <entry>foreign server definitions
</entry>
147 <entry><link linkend=
"catalog-pg-foreign-table"><structname>pg_foreign_table
</structname></link></entry>
148 <entry>additional foreign table information
</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-db-role-setting"><structname>pg_db_role_setting
</structname></link></entry>
213 <entry>per-role and per-database settings
</entry>
217 <entry><link linkend=
"catalog-pg-shdepend"><structname>pg_shdepend
</structname></link></entry>
218 <entry>dependencies on shared objects
</entry>
222 <entry><link linkend=
"catalog-pg-shdescription"><structname>pg_shdescription
</structname></link></entry>
223 <entry>comments on shared objects
</entry>
227 <entry><link linkend=
"catalog-pg-statistic"><structname>pg_statistic
</structname></link></entry>
228 <entry>planner statistics
</entry>
232 <entry><link linkend=
"catalog-pg-tablespace"><structname>pg_tablespace
</structname></link></entry>
233 <entry>tablespaces within this database cluster
</entry>
237 <entry><link linkend=
"catalog-pg-trigger"><structname>pg_trigger
</structname></link></entry>
238 <entry>triggers
</entry>
242 <entry><link linkend=
"catalog-pg-ts-config"><structname>pg_ts_config
</structname></link></entry>
243 <entry>text search configurations
</entry>
247 <entry><link linkend=
"catalog-pg-ts-config-map"><structname>pg_ts_config_map
</structname></link></entry>
248 <entry>text search configurations' token mappings
</entry>
252 <entry><link linkend=
"catalog-pg-ts-dict"><structname>pg_ts_dict
</structname></link></entry>
253 <entry>text search dictionaries
</entry>
257 <entry><link linkend=
"catalog-pg-ts-parser"><structname>pg_ts_parser
</structname></link></entry>
258 <entry>text search parsers
</entry>
262 <entry><link linkend=
"catalog-pg-ts-template"><structname>pg_ts_template
</structname></link></entry>
263 <entry>text search templates
</entry>
267 <entry><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link></entry>
268 <entry>data types
</entry>
272 <entry><link linkend=
"catalog-pg-user-mapping"><structname>pg_user_mapping
</structname></link></entry>
273 <entry>mappings of users to foreign servers
</entry>
281 <sect1 id=
"catalog-pg-aggregate">
282 <title><structname>pg_aggregate
</structname></title>
284 <indexterm zone=
"catalog-pg-aggregate">
285 <primary>pg_aggregate
</primary>
289 The catalog
<structname>pg_aggregate
</structname> stores information about
290 aggregate functions. An aggregate function is a function that
291 operates on a set of values (typically one column from each row
292 that matches a query condition) and returns a single value computed
293 from all these values. Typical aggregate functions are
294 <function>sum
</function>,
<function>count
</function>, and
295 <function>max
</function>. Each entry in
296 <structname>pg_aggregate
</structname> is an extension of an entry
297 in
<structname>pg_proc
</structname>. The
<structname>pg_proc
</structname>
298 entry carries the aggregate's name, input and output data types, and
299 other information that is similar to ordinary functions.
303 <title><structname>pg_aggregate<
/> Columns
</title>
310 <entry>References
</entry>
311 <entry>Description
</entry>
316 <entry><structfield>aggfnoid
</structfield></entry>
317 <entry><type>regproc
</type></entry>
318 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
319 <entry><structname>pg_proc
</structname> OID of the aggregate function
</entry>
322 <entry><structfield>aggtransfn
</structfield></entry>
323 <entry><type>regproc
</type></entry>
324 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
325 <entry>Transition function
</entry>
328 <entry><structfield>aggfinalfn
</structfield></entry>
329 <entry><type>regproc
</type></entry>
330 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
331 <entry>Final function (zero if none)
</entry>
334 <entry><structfield>aggsortop
</structfield></entry>
335 <entry><type>oid
</type></entry>
336 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid
</literal></entry>
337 <entry>Associated sort operator (zero if none)
</entry>
340 <entry><structfield>aggtranstype
</structfield></entry>
341 <entry><type>oid
</type></entry>
342 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
343 <entry>Data type of the aggregate function's internal transition (state) data
</entry>
346 <entry><structfield>agginitval
</structfield></entry>
347 <entry><type>text
</type></entry>
350 The initial value of the transition state. This is a text
351 field containing the initial value in its external string
352 representation. If this field is null, the transition state
353 value starts out null.
361 New aggregate functions are registered with the
<xref
362 linkend=
"sql-createaggregate">
363 command. See
<xref linkend=
"xaggr"> for more information about
364 writing aggregate functions and the meaning of the transition
371 <sect1 id=
"catalog-pg-am">
372 <title><structname>pg_am
</structname></title>
374 <indexterm zone=
"catalog-pg-am">
375 <primary>pg_am
</primary>
379 The catalog
<structname>pg_am
</structname> stores information about index
380 access methods. There is one row for each index access method supported by
381 the system. The contents of this catalog are discussed in detail in
382 <xref linkend=
"indexam">.
386 <title><structname>pg_am<
/> Columns
</title>
393 <entry>References
</entry>
394 <entry>Description
</entry>
400 <entry><structfield>amname
</structfield></entry>
401 <entry><type>name
</type></entry>
403 <entry>Name of the access method
</entry>
407 <entry><structfield>amstrategies
</structfield></entry>
408 <entry><type>int2
</type></entry>
410 <entry>Number of operator strategies for this access method,
411 or zero if access method does not have a fixed set of operator
416 <entry><structfield>amsupport
</structfield></entry>
417 <entry><type>int2
</type></entry>
419 <entry>Number of support routines for this access method
</entry>
423 <entry><structfield>amcanorder
</structfield></entry>
424 <entry><type>bool
</type></entry>
426 <entry>Does the access method support ordered scans?
</entry>
430 <entry><structfield>amcanbackward
</structfield></entry>
431 <entry><type>bool
</type></entry>
433 <entry>Does the access method support backward scanning?
</entry>
437 <entry><structfield>amcanunique
</structfield></entry>
438 <entry><type>bool
</type></entry>
440 <entry>Does the access method support unique indexes?
</entry>
444 <entry><structfield>amcanmulticol
</structfield></entry>
445 <entry><type>bool
</type></entry>
447 <entry>Does the access method support multicolumn indexes?
</entry>
451 <entry><structfield>amoptionalkey
</structfield></entry>
452 <entry><type>bool
</type></entry>
454 <entry>Does the access method support a scan without any constraint
455 for the first index column?
</entry>
459 <entry><structfield>amindexnulls
</structfield></entry>
460 <entry><type>bool
</type></entry>
462 <entry>Does the access method support null index entries?
</entry>
466 <entry><structfield>amsearchnulls
</structfield></entry>
467 <entry><type>bool
</type></entry>
469 <entry>Does the access method support
<literal>IS NULL<
/>/
<literal>NOT NULL<
/> searches?
</entry>
473 <entry><structfield>amstorage
</structfield></entry>
474 <entry><type>bool
</type></entry>
476 <entry>Can index storage data type differ from column data type?
</entry>
480 <entry><structfield>amclusterable
</structfield></entry>
481 <entry><type>bool
</type></entry>
483 <entry>Can an index of this type be clustered on?
</entry>
487 <entry><structfield>amkeytype
</structfield></entry>
488 <entry><type>oid
</type></entry>
489 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
490 <entry>Type of data stored in index, or zero if not a fixed type
</entry>
494 <entry><structfield>aminsert
</structfield></entry>
495 <entry><type>regproc
</type></entry>
496 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
497 <entry><quote>Insert this tuple
</quote> function
</entry>
501 <entry><structfield>ambeginscan
</structfield></entry>
502 <entry><type>regproc
</type></entry>
503 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
504 <entry><quote>Start new scan
</quote> function
</entry>
508 <entry><structfield>amgettuple
</structfield></entry>
509 <entry><type>regproc
</type></entry>
510 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
511 <entry><quote>Next valid tuple
</quote> function, or zero if none
</entry>
515 <entry><structfield>amgetbitmap
</structfield></entry>
516 <entry><type>regproc
</type></entry>
517 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
518 <entry><quote>Fetch all valid tuples
</quote> function, or zero if none
</entry>
522 <entry><structfield>amrescan
</structfield></entry>
523 <entry><type>regproc
</type></entry>
524 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
525 <entry><quote>Restart this scan
</quote> function
</entry>
529 <entry><structfield>amendscan
</structfield></entry>
530 <entry><type>regproc
</type></entry>
531 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
532 <entry><quote>End this scan
</quote> function
</entry>
536 <entry><structfield>ammarkpos
</structfield></entry>
537 <entry><type>regproc
</type></entry>
538 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
539 <entry><quote>Mark current scan position
</quote> function
</entry>
543 <entry><structfield>amrestrpos
</structfield></entry>
544 <entry><type>regproc
</type></entry>
545 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
546 <entry><quote>Restore marked scan position
</quote> function
</entry>
550 <entry><structfield>ambuild
</structfield></entry>
551 <entry><type>regproc
</type></entry>
552 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
553 <entry><quote>Build new index
</quote> function
</entry>
557 <entry><structfield>ambulkdelete
</structfield></entry>
558 <entry><type>regproc
</type></entry>
559 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
560 <entry>Bulk-delete function
</entry>
564 <entry><structfield>amvacuumcleanup
</structfield></entry>
565 <entry><type>regproc
</type></entry>
566 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
567 <entry>Post-
<command>VACUUM
</command> cleanup function
</entry>
571 <entry><structfield>amcostestimate
</structfield></entry>
572 <entry><type>regproc
</type></entry>
573 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
574 <entry>Function to estimate cost of an index scan
</entry>
578 <entry><structfield>amoptions
</structfield></entry>
579 <entry><type>regproc
</type></entry>
580 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
581 <entry>Function to parse and validate
<structfield>reloptions<
/> for an index
</entry>
591 <sect1 id=
"catalog-pg-amop">
592 <title><structname>pg_amop
</structname></title>
594 <indexterm zone=
"catalog-pg-amop">
595 <primary>pg_amop
</primary>
599 The catalog
<structname>pg_amop
</structname> stores information about
600 operators associated with access method operator families. There is one
601 row for each operator that is a member of an operator family. An operator
602 can appear in more than one family, but cannot appear in more than one
603 position within a family.
607 <title><structname>pg_amop<
/> Columns
</title>
614 <entry>References
</entry>
615 <entry>Description
</entry>
621 <entry><structfield>amopfamily
</structfield></entry>
622 <entry><type>oid
</type></entry>
623 <entry><literal><link linkend=
"catalog-pg-opfamily"><structname>pg_opfamily
</structname></link>.oid
</literal></entry>
624 <entry>The operator family this entry is for
</entry>
628 <entry><structfield>amoplefttype
</structfield></entry>
629 <entry><type>oid
</type></entry>
630 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
631 <entry>Left-hand input data type of operator
</entry>
635 <entry><structfield>amoprighttype
</structfield></entry>
636 <entry><type>oid
</type></entry>
637 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
638 <entry>Right-hand input data type of operator
</entry>
642 <entry><structfield>amopstrategy
</structfield></entry>
643 <entry><type>int2
</type></entry>
645 <entry>Operator strategy number
</entry>
649 <entry><structfield>amopopr
</structfield></entry>
650 <entry><type>oid
</type></entry>
651 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid
</literal></entry>
652 <entry>OID of the operator
</entry>
656 <entry><structfield>amopmethod
</structfield></entry>
657 <entry><type>oid
</type></entry>
658 <entry><literal><link linkend=
"catalog-pg-am"><structname>pg_am
</structname></link>.oid
</literal></entry>
659 <entry>Index access method operator family is for
</entry>
667 An entry's
<structfield>amopmethod<
/> must match the
668 <structname>opfmethod<
/> of its containing operator family (including
669 <structfield>amopmethod<
/> here is an intentional denormalization of the
670 catalog structure for performance reasons). Also,
671 <structfield>amoplefttype<
/> and
<structfield>amoprighttype<
/> must match
672 the
<structfield>oprleft<
/> and
<structfield>oprright<
/> fields of the
673 referenced
<structname>pg_operator<
/> entry.
679 <sect1 id=
"catalog-pg-amproc">
680 <title><structname>pg_amproc
</structname></title>
682 <indexterm zone=
"catalog-pg-amproc">
683 <primary>pg_amproc
</primary>
687 The catalog
<structname>pg_amproc
</structname> stores information about
688 support procedures associated with access method operator families. There
689 is one row for each support procedure belonging to an operator family.
693 <title><structname>pg_amproc
</structname> Columns
</title>
700 <entry>References
</entry>
701 <entry>Description
</entry>
707 <entry><structfield>amprocfamily
</structfield></entry>
708 <entry><type>oid
</type></entry>
709 <entry><literal><link linkend=
"catalog-pg-opfamily"><structname>pg_opfamily
</structname></link>.oid
</literal></entry>
710 <entry>The operator family this entry is for
</entry>
714 <entry><structfield>amproclefttype
</structfield></entry>
715 <entry><type>oid
</type></entry>
716 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
717 <entry>Left-hand input data type of associated operator
</entry>
721 <entry><structfield>amprocrighttype
</structfield></entry>
722 <entry><type>oid
</type></entry>
723 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
724 <entry>Right-hand input data type of associated operator
</entry>
728 <entry><structfield>amprocnum
</structfield></entry>
729 <entry><type>int2
</type></entry>
731 <entry>Support procedure number
</entry>
735 <entry><structfield>amproc
</structfield></entry>
736 <entry><type>regproc
</type></entry>
737 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
738 <entry>OID of the procedure
</entry>
746 The usual interpretation of the
747 <structfield>amproclefttype<
/> and
<structfield>amprocrighttype<
/> fields
748 is that they identify the left and right input types of the operator(s)
749 that a particular support procedure supports. For some access methods
750 these match the input data type(s) of the support procedure itself, for
751 others not. There is a notion of
<quote>default<
/> support procedures for
752 an index, which are those with
<structfield>amproclefttype<
/> and
753 <structfield>amprocrighttype<
/> both equal to the index opclass's
754 <structfield>opcintype<
/>.
760 <sect1 id=
"catalog-pg-attrdef">
761 <title><structname>pg_attrdef
</structname></title>
763 <indexterm zone=
"catalog-pg-attrdef">
764 <primary>pg_attrdef
</primary>
768 The catalog
<structname>pg_attrdef
</structname> stores column default values. The main information
769 about columns is stored in
<structname>pg_attribute
</structname>
770 (see below). Only columns that explicitly specify a default value
771 (when the table is created or the column is added) will have an
776 <title><structname>pg_attrdef<
/> Columns
</title>
783 <entry>References
</entry>
784 <entry>Description
</entry>
790 <entry><structfield>adrelid
</structfield></entry>
791 <entry><type>oid
</type></entry>
792 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
793 <entry>The table this column belongs to
</entry>
797 <entry><structfield>adnum
</structfield></entry>
798 <entry><type>int2
</type></entry>
799 <entry><literal><link linkend=
"catalog-pg-attribute"><structname>pg_attribute
</structname></link>.attnum
</literal></entry>
800 <entry>The number of the column
</entry>
804 <entry><structfield>adbin
</structfield></entry>
805 <entry><type>pg_node_tree
</type></entry>
807 <entry>The internal representation of the column default value
</entry>
811 <entry><structfield>adsrc
</structfield></entry>
812 <entry><type>text
</type></entry>
814 <entry>A human-readable representation of the default value
</entry>
821 The
<structfield>adsrc
</structfield> field is historical, and is best
822 not used, because it does not track outside changes that might affect
823 the representation of the default value. Reverse-compiling the
824 <structfield>adbin
</structfield> field (with
<function>pg_get_expr<
/> for
825 example) is a better way to display the default value.
831 <sect1 id=
"catalog-pg-attribute">
832 <title><structname>pg_attribute
</structname></title>
834 <indexterm zone=
"catalog-pg-attribute">
835 <primary>pg_attribute
</primary>
839 The catalog
<structname>pg_attribute
</structname> stores information about
840 table columns. There will be exactly one
841 <structname>pg_attribute
</structname> row for every column in every
842 table in the database. (There will also be attribute entries for
843 indexes, and indeed all objects that have
<structname>pg_class
</structname>
848 The term attribute is equivalent to column and is used for
853 <title><structname>pg_attribute<
/> Columns
</title>
860 <entry>References
</entry>
861 <entry>Description
</entry>
867 <entry><structfield>attrelid
</structfield></entry>
868 <entry><type>oid
</type></entry>
869 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
870 <entry>The table this column belongs to
</entry>
874 <entry><structfield>attname
</structfield></entry>
875 <entry><type>name
</type></entry>
877 <entry>The column name
</entry>
881 <entry><structfield>atttypid
</structfield></entry>
882 <entry><type>oid
</type></entry>
883 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
884 <entry>The data type of this column
</entry>
888 <entry><structfield>attstattarget
</structfield></entry>
889 <entry><type>int4
</type></entry>
892 <structfield>attstattarget
</structfield> controls the level of detail
893 of statistics accumulated for this column by
894 <xref linkend=
"sql-analyze">.
895 A zero value indicates that no statistics should be collected.
896 A negative value says to use the system default statistics target.
897 The exact meaning of positive values is data type-dependent.
898 For scalar data types,
<structfield>attstattarget
</structfield>
899 is both the target number of
<quote>most common values
</quote>
900 to collect, and the target number of histogram bins to create.
905 <entry><structfield>attlen
</structfield></entry>
906 <entry><type>int2
</type></entry>
909 A copy of
<literal>pg_type.typlen
</literal> of this column's
915 <entry><structfield>attnum
</structfield></entry>
916 <entry><type>int2
</type></entry>
919 The number of the column. Ordinary columns are numbered from
1
920 up. System columns, such as
<structfield>oid
</structfield>,
921 have (arbitrary) negative numbers.
926 <entry><structfield>attndims
</structfield></entry>
927 <entry><type>int4
</type></entry>
930 Number of dimensions, if the column is an array type; otherwise
0.
931 (Presently, the number of dimensions of an array is not enforced,
932 so any nonzero value effectively means
<quote>it's an array<
/>.)
937 <entry><structfield>attcacheoff
</structfield></entry>
938 <entry><type>int4
</type></entry>
941 Always -
1 in storage, but when loaded into a row descriptor
942 in memory this might be updated to cache the offset of the attribute
948 <entry><structfield>atttypmod
</structfield></entry>
949 <entry><type>int4
</type></entry>
952 <structfield>atttypmod
</structfield> records type-specific data
953 supplied at table creation time (for example, the maximum
954 length of a
<type>varchar
</type> column). It is passed to
955 type-specific input functions and length coercion functions.
956 The value will generally be -
1 for types that do not need
<structfield>atttypmod<
/>.
961 <entry><structfield>attbyval
</structfield></entry>
962 <entry><type>bool
</type></entry>
965 A copy of
<literal>pg_type.typbyval<
/> of this column's type
970 <entry><structfield>attstorage
</structfield></entry>
971 <entry><type>char
</type></entry>
974 Normally a copy of
<literal>pg_type.typstorage<
/> of this
975 column's type. For TOAST-able data types, this can be altered
976 after column creation to control storage policy.
981 <entry><structfield>attalign
</structfield></entry>
982 <entry><type>char
</type></entry>
985 A copy of
<literal>pg_type.typalign<
/> of this column's type
990 <entry><structfield>attnotnull
</structfield></entry>
991 <entry><type>bool
</type></entry>
994 This represents a not-null constraint. It is possible to
995 change this column to enable or disable the constraint.
1000 <entry><structfield>atthasdef
</structfield></entry>
1001 <entry><type>bool
</type></entry>
1004 This column has a default value, in which case there will be a
1005 corresponding entry in the
<structname>pg_attrdef
</structname>
1006 catalog that actually defines the value.
1011 <entry><structfield>attisdropped
</structfield></entry>
1012 <entry><type>bool
</type></entry>
1015 This column has been dropped and is no longer valid. A dropped
1016 column is still physically present in the table, but is
1017 ignored by the parser and so cannot be accessed via SQL.
1022 <entry><structfield>attislocal
</structfield></entry>
1023 <entry><type>bool
</type></entry>
1026 This column is defined locally in the relation. Note that a column can
1027 be locally defined and inherited simultaneously.
1032 <entry><structfield>attinhcount
</structfield></entry>
1033 <entry><type>int4
</type></entry>
1036 The number of direct ancestors this column has. A column with a
1037 nonzero number of ancestors cannot be dropped nor renamed.
1042 <entry><structfield>attacl
</structfield></entry>
1043 <entry><type>aclitem[]
</type></entry>
1046 Column-level access privileges, if any have been granted specifically
1052 <entry><structfield>attoptions
</structfield></entry>
1053 <entry><type>text[]
</type></entry>
1056 Attribute-level options, as
<quote>keyword=value<
/> strings
1065 In a dropped column's
<structname>pg_attribute
</structname> entry,
1066 <structfield>atttypid
</structfield> is reset to zero, but
1067 <structfield>attlen
</structfield> and the other fields copied from
1068 <structname>pg_type<
/> are still valid. This arrangement is needed
1069 to cope with the situation where the dropped column's data type was
1070 later dropped, and so there is no
<structname>pg_type<
/> row anymore.
1071 <structfield>attlen
</structfield> and the other fields can be used
1072 to interpret the contents of a row of the table.
1077 <sect1 id=
"catalog-pg-authid">
1078 <title><structname>pg_authid
</structname></title>
1080 <indexterm zone=
"catalog-pg-authid">
1081 <primary>pg_authid
</primary>
1085 The catalog
<structname>pg_authid
</structname> contains information about
1086 database authorization identifiers (roles). A role subsumes the concepts
1087 of
<quote>users<
/> and
<quote>groups<
/>. A user is essentially just a
1088 role with the
<structfield>rolcanlogin<
/> flag set. Any role (with or
1089 without
<structfield>rolcanlogin<
/>) can have other roles as members; see
1090 <link linkend=
"catalog-pg-auth-members"><structname>pg_auth_members
</structname></link>.
1094 Since this catalog contains passwords, it must not be publicly readable.
1095 <link linkend=
"view-pg-roles"><structname>pg_roles
</structname></link>
1096 is a publicly readable view on
1097 <structname>pg_authid
</structname> that blanks out the password field.
1101 <xref linkend=
"user-manag"> contains detailed information about user and
1102 privilege management.
1106 Because user identities are cluster-wide,
1107 <structname>pg_authid
</structname>
1108 is shared across all databases of a cluster: there is only one
1109 copy of
<structname>pg_authid
</structname> per cluster, not
1114 <title><structname>pg_authid<
/> Columns
</title>
1121 <entry>Description
</entry>
1127 <entry><structfield>rolname
</structfield></entry>
1128 <entry><type>name
</type></entry>
1129 <entry>Role name
</entry>
1133 <entry><structfield>rolsuper
</structfield></entry>
1134 <entry><type>bool
</type></entry>
1135 <entry>Role has superuser privileges
</entry>
1139 <entry><structfield>rolinherit
</structfield></entry>
1140 <entry><type>bool
</type></entry>
1141 <entry>Role automatically inherits privileges of roles it is a
1146 <entry><structfield>rolcreaterole
</structfield></entry>
1147 <entry><type>bool
</type></entry>
1148 <entry>Role can create more roles
</entry>
1152 <entry><structfield>rolcreatedb
</structfield></entry>
1153 <entry><type>bool
</type></entry>
1154 <entry>Role can create databases
</entry>
1158 <entry><structfield>rolcatupdate
</structfield></entry>
1159 <entry><type>bool
</type></entry>
1161 Role can update system catalogs directly. (Even a superuser cannot do
1162 this unless this column is true)
1167 <entry><structfield>rolcanlogin
</structfield></entry>
1168 <entry><type>bool
</type></entry>
1170 Role can log in. That is, this role can be given as the initial
1171 session authorization identifier.
1176 <entry><structfield>rolconnlimit
</structfield></entry>
1177 <entry><type>int4
</type></entry>
1179 For roles that can log in, this sets maximum number of concurrent
1180 connections this role can make. -
1 means no limit.
1185 <entry><structfield>rolpassword
</structfield></entry>
1186 <entry><type>text
</type></entry>
1188 Password (possibly encrypted); null if none. If the password is
1189 encrypted, this column will contain the string md5 followed by a
1190 32-character hexadecimal MD5 hash. The MD5 hash will be of the
1191 user's password concatenated to their username (for example, if
1192 user joe has password xyzzy,
<productname>PostgreSQL<
/> will store
1193 the md5 hash of xyzzyjoe).
1198 <entry><structfield>rolvaliduntil
</structfield></entry>
1199 <entry><type>timestamptz
</type></entry>
1200 <entry>Password expiry time (only used for password authentication);
1201 null if no expiration
</entry>
1210 <sect1 id=
"catalog-pg-auth-members">
1211 <title><structname>pg_auth_members
</structname></title>
1213 <indexterm zone=
"catalog-pg-auth-members">
1214 <primary>pg_auth_members
</primary>
1218 The catalog
<structname>pg_auth_members
</structname> shows the membership
1219 relations between roles. Any non-circular set of relationships is allowed.
1223 Because user identities are cluster-wide,
1224 <structname>pg_auth_members
</structname>
1225 is shared across all databases of a cluster: there is only one
1226 copy of
<structname>pg_auth_members
</structname> per cluster, not
1231 <title><structname>pg_auth_members<
/> Columns
</title>
1238 <entry>References
</entry>
1239 <entry>Description
</entry>
1245 <entry><structfield>roleid
</structfield></entry>
1246 <entry><type>oid
</type></entry>
1247 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
1248 <entry>ID of a role that has a member
</entry>
1252 <entry><structfield>member
</structfield></entry>
1253 <entry><type>oid
</type></entry>
1254 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
1255 <entry>ID of a role that is a member of
<structfield>roleid<
/></entry>
1259 <entry><structfield>grantor
</structfield></entry>
1260 <entry><type>oid
</type></entry>
1261 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
1262 <entry>ID of the role that granted this membership
</entry>
1266 <entry><structfield>admin_option
</structfield></entry>
1267 <entry><type>bool
</type></entry>
1269 <entry>True if
<structfield>member<
/> can grant membership in
1270 <structfield>roleid<
/> to others
</entry>
1279 <sect1 id=
"catalog-pg-cast">
1280 <title><structname>pg_cast
</structname></title>
1282 <indexterm zone=
"catalog-pg-cast">
1283 <primary>pg_cast
</primary>
1287 The catalog
<structname>pg_cast
</structname> stores data type conversion
1288 paths, both built-in paths and those defined with
1289 <xref linkend=
"sql-createcast">.
1293 It should be noted that
<structname>pg_cast
</structname> does not represent
1294 every type conversion that the system knows how to perform; only those that
1295 cannot be deduced from some generic rule. For example, casting between a
1296 domain and its base type is not explicitly represented in
1297 <structname>pg_cast
</structname>. Another important exception is that
1298 <quote>automatic I/O conversion casts<
/>, those performed using a data
1299 type's own I/O functions to convert to or from
<type>text<
/> or other
1300 string types, are not explicitly represented in
1301 <structname>pg_cast
</structname>.
1305 <title><structname>pg_cast<
/> Columns
</title>
1312 <entry>References
</entry>
1313 <entry>Description
</entry>
1319 <entry><structfield>castsource
</structfield></entry>
1320 <entry><type>oid
</type></entry>
1321 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
1322 <entry>OID of the source data type
</entry>
1326 <entry><structfield>casttarget
</structfield></entry>
1327 <entry><type>oid
</type></entry>
1328 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
1329 <entry>OID of the target data type
</entry>
1333 <entry><structfield>castfunc
</structfield></entry>
1334 <entry><type>oid
</type></entry>
1335 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
1337 The OID of the function to use to perform this cast. Zero is
1338 stored if the cast method doesn't require a function.
1343 <entry><structfield>castcontext
</structfield></entry>
1344 <entry><type>char
</type></entry>
1347 Indicates what contexts the cast can be invoked in.
1348 <literal>e<
/> means only as an explicit cast (using
1349 <literal>CAST<
/> or
<literal>::<
/> syntax).
1350 <literal>a<
/> means implicitly in assignment
1351 to a target column, as well as explicitly.
1352 <literal>i<
/> means implicitly in expressions, as well as the
1357 <entry><structfield>castmethod
</structfield></entry>
1358 <entry><type>char
</type></entry>
1361 Indicates how the cast is performed.
1362 <literal>f<
/> means that the function specified in the
<structfield>castfunc<
/> field is used.
1363 <literal>i<
/> means that the input/output functions are used.
1364 <literal>b<
/> means that the types are binary-coercible, thus no conversion is required.
1372 The cast functions listed in
<structname>pg_cast
</structname> must
1373 always take the cast source type as their first argument type, and
1374 return the cast destination type as their result type. A cast
1375 function can have up to three arguments. The second argument,
1376 if present, must be type
<type>integer<
/>; it receives the type
1377 modifier associated with the destination type, or
<literal>-
1<
/>
1378 if there is none. The third argument,
1379 if present, must be type
<type>boolean<
/>; it receives
<literal>true<
/>
1380 if the cast is an explicit cast,
<literal>false<
/> otherwise.
1384 It is legitimate to create a
<structname>pg_cast
</structname> entry
1385 in which the source and target types are the same, if the associated
1386 function takes more than one argument. Such entries represent
1387 <quote>length coercion functions<
/> that coerce values of the type
1388 to be legal for a particular type modifier value.
1392 When a
<structname>pg_cast
</structname> entry has different source and
1393 target types and a function that takes more than one argument, it
1394 represents converting from one type to another and applying a length
1395 coercion in a single step. When no such entry is available, coercion
1396 to a type that uses a type modifier involves two steps, one to
1397 convert between data types and a second to apply the modifier.
1401 <sect1 id=
"catalog-pg-class">
1402 <title><structname>pg_class
</structname></title>
1404 <indexterm zone=
"catalog-pg-class">
1405 <primary>pg_class
</primary>
1409 The catalog
<structname>pg_class
</structname> catalogs tables and most
1410 everything else that has columns or is otherwise similar to a
1411 table. This includes indexes (but see also
1412 <structname>pg_index
</structname>), sequences, views, composite types,
1413 and TOAST tables; see
<structfield>relkind<
/>.
1414 Below, when we mean all of these
1415 kinds of objects we speak of
<quote>relations
</quote>. Not all
1416 columns are meaningful for all relation types.
1420 <title><structname>pg_class<
/> Columns
</title>
1427 <entry>References
</entry>
1428 <entry>Description
</entry>
1434 <entry><structfield>relname
</structfield></entry>
1435 <entry><type>name
</type></entry>
1437 <entry>Name of the table, index, view, etc.
</entry>
1441 <entry><structfield>relnamespace
</structfield></entry>
1442 <entry><type>oid
</type></entry>
1443 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
1445 The OID of the namespace that contains this relation
1450 <entry><structfield>reltype
</structfield></entry>
1451 <entry><type>oid
</type></entry>
1452 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
1454 The OID of the data type that corresponds to this table's row type,
1455 if any (zero for indexes, which have no
<structname>pg_type<
/> entry)
1460 <entry><structfield>reloftype
</structfield></entry>
1461 <entry><type>oid
</type></entry>
1462 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
1464 For typed tables, the OID of the underlying composite type,
1465 zero for all other relations
1470 <entry><structfield>relowner
</structfield></entry>
1471 <entry><type>oid
</type></entry>
1472 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
1473 <entry>Owner of the relation
</entry>
1477 <entry><structfield>relam
</structfield></entry>
1478 <entry><type>oid
</type></entry>
1479 <entry><literal><link linkend=
"catalog-pg-am"><structname>pg_am
</structname></link>.oid
</literal></entry>
1480 <entry>If this is an index, the access method used (B-tree, hash, etc.)
</entry>
1484 <entry><structfield>relfilenode
</structfield></entry>
1485 <entry><type>oid
</type></entry>
1487 <entry>Name of the on-disk file of this relation; zero means this
1488 is a
<quote>mapped<
/> relation whose disk file name is determined
1489 by low-level state
</entry>
1493 <entry><structfield>reltablespace
</structfield></entry>
1494 <entry><type>oid
</type></entry>
1495 <entry><literal><link linkend=
"catalog-pg-tablespace"><structname>pg_tablespace
</structname></link>.oid
</literal></entry>
1497 The tablespace in which this relation is stored. If zero,
1498 the database's default tablespace is implied. (Not meaningful
1499 if the relation has no on-disk file.)
1504 <entry><structfield>relpages
</structfield></entry>
1505 <entry><type>int4
</type></entry>
1508 Size of the on-disk representation of this table in pages (of size
1509 <symbol>BLCKSZ
</symbol>). This is only an estimate used by the
1510 planner. It is updated by
<command>VACUUM
</command>,
1511 <command>ANALYZE
</command>, and a few DDL commands such as
1512 <command>CREATE INDEX
</command>.
1517 <entry><structfield>reltuples
</structfield></entry>
1518 <entry><type>float4
</type></entry>
1521 Number of rows in the table. This is only an estimate used by the
1522 planner. It is updated by
<command>VACUUM
</command>,
1523 <command>ANALYZE
</command>, and a few DDL commands such as
1524 <command>CREATE INDEX
</command>.
1529 <entry><structfield>reltoastrelid
</structfield></entry>
1530 <entry><type>oid
</type></entry>
1531 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
1533 OID of the TOAST table associated with this table,
0 if none. The
1534 TOAST table stores large attributes
<quote>out of line
</quote> in a
1540 <entry><structfield>reltoastidxid
</structfield></entry>
1541 <entry><type>oid
</type></entry>
1542 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
1544 For a TOAST table, the OID of its index.
0 if not a TOAST table.
1549 <entry><structfield>relhasindex
</structfield></entry>
1550 <entry><type>bool
</type></entry>
1553 True if this is a table and it has (or recently had) any indexes
1558 <entry><structfield>relisshared
</structfield></entry>
1559 <entry><type>bool
</type></entry>
1562 True if this table is shared across all databases in the cluster. Only
1563 certain system catalogs (such as
<structname>pg_database
</structname>)
1569 <entry><structfield>relistemp
</structfield></entry>
1570 <entry><type>bool
</type></entry>
1573 True if this table is a temporary relation. If so, only the creating
1574 session can safely access its contents.
1579 <entry><structfield>relkind
</structfield></entry>
1580 <entry><type>char
</type></entry>
1583 <literal>r<
/> = ordinary table,
<literal>i<
/> = index,
1584 <literal>S<
/> = sequence,
<literal>v<
/> = view,
<literal>c<
/> =
1585 composite type,
<literal>t<
/> = TOAST table,
1586 <literal>f<
/> = foiregn table
1591 <entry><structfield>relnatts
</structfield></entry>
1592 <entry><type>int2
</type></entry>
1595 Number of user columns in the relation (system columns not
1596 counted). There must be this many corresponding entries in
1597 <structname>pg_attribute
</structname>. See also
1598 <literal>pg_attribute.attnum
</literal>.
1603 <entry><structfield>relchecks
</structfield></entry>
1604 <entry><type>int2
</type></entry>
1607 Number of
<literal>CHECK<
/> constraints on the table; see
1608 <link linkend=
"catalog-pg-constraint"><structname>pg_constraint
</structname></link> catalog
1613 <entry><structfield>relhasoids
</structfield></entry>
1614 <entry><type>bool
</type></entry>
1617 True if we generate an OID for each row of the relation
1622 <entry><structfield>relhaspkey
</structfield></entry>
1623 <entry><type>bool
</type></entry>
1626 True if the table has (or once had) a primary key
1631 <entry><structfield>relhasexclusion
</structfield></entry>
1632 <entry><type>bool
</type></entry>
1635 For a table, true if the table has (or once had) any exclusion
1636 constraints; for an index, true if the index supports an exclusion
1642 <entry><structfield>relhasrules
</structfield></entry>
1643 <entry><type>bool
</type></entry>
1646 True if table has (or once had) rules; see
1647 <link linkend=
"catalog-pg-rewrite"><structname>pg_rewrite
</structname></link> catalog
1652 <entry><structfield>relhastriggers
</structfield></entry>
1653 <entry><type>bool
</type></entry>
1656 True if table has (or once had) triggers; see
1657 <link linkend=
"catalog-pg-trigger"><structname>pg_trigger
</structname></link> catalog
1662 <entry><structfield>relhassubclass
</structfield></entry>
1663 <entry><type>bool
</type></entry>
1665 <entry>True if table has (or once had) any inheritance children
</entry>
1669 <entry><structfield>relfrozenxid
</structfield></entry>
1670 <entry><type>xid
</type></entry>
1673 All transaction IDs before this one have been replaced with a permanent
1674 (
<quote>frozen<
/>) transaction ID in this table. This is used to track
1675 whether the table needs to be vacuumed in order to prevent transaction
1676 ID wraparound or to allow
<literal>pg_clog<
/> to be shrunk. Zero
1677 (
<symbol>InvalidTransactionId
</symbol>) if the relation is not a table.
1682 <entry><structfield>relacl
</structfield></entry>
1683 <entry><type>aclitem[]
</type></entry>
1686 Access privileges; see
1687 <xref linkend=
"sql-grant"> and
1688 <xref linkend=
"sql-revoke">
1694 <entry><structfield>reloptions
</structfield></entry>
1695 <entry><type>text[]
</type></entry>
1698 Access-method-specific options, as
<quote>keyword=value<
/> strings
1706 Several of the Boolean flags in
<structname>pg_class<
/> are maintained
1707 lazily: they are guaranteed to be true if that's the correct state, but
1708 may not be reset to false immediately when the condition is no longer
1709 true. For example,
<structfield>relhasindex<
/> is set by
1710 <command>CREATE INDEX
</command>, but it is never cleared by
1711 <command>DROP INDEX
</command>. Instead,
<command>VACUUM
</command> clears
1712 <structfield>relhasindex<
/> if it finds the table has no indexes. This
1713 arrangement avoids race conditions and improves concurrency.
1717 <sect1 id=
"catalog-pg-constraint">
1718 <title><structname>pg_constraint
</structname></title>
1720 <indexterm zone=
"catalog-pg-constraint">
1721 <primary>pg_constraint
</primary>
1725 The catalog
<structname>pg_constraint
</structname> stores check, primary
1726 key, unique, foreign key, and exclusion constraints on tables.
1727 (Column constraints are not treated specially. Every column constraint is
1728 equivalent to some table constraint.)
1729 Not-null constraints are represented in the
<structname>pg_attribute<
/>
1734 User-defined constraint triggers (created with
<command>CREATE CONSTRAINT
1735 TRIGGER<
/>) also give rise to an entry in this table.
1739 Check constraints on domains are stored here, too.
1743 <title><structname>pg_constraint<
/> Columns
</title>
1750 <entry>References
</entry>
1751 <entry>Description
</entry>
1757 <entry><structfield>conname
</structfield></entry>
1758 <entry><type>name
</type></entry>
1760 <entry>Constraint name (not necessarily unique!)
</entry>
1764 <entry><structfield>connamespace
</structfield></entry>
1765 <entry><type>oid
</type></entry>
1766 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
1768 The OID of the namespace that contains this constraint
1773 <entry><structfield>contype
</structfield></entry>
1774 <entry><type>char
</type></entry>
1777 <literal>c<
/> = check constraint,
1778 <literal>f<
/> = foreign key constraint,
1779 <literal>p<
/> = primary key constraint,
1780 <literal>u<
/> = unique constraint,
1781 <literal>t<
/> = constraint trigger,
1782 <literal>x<
/> = exclusion constraint
1787 <entry><structfield>condeferrable
</structfield></entry>
1788 <entry><type>bool
</type></entry>
1790 <entry>Is the constraint deferrable?
</entry>
1794 <entry><structfield>condeferred
</structfield></entry>
1795 <entry><type>bool
</type></entry>
1797 <entry>Is the constraint deferred by default?
</entry>
1801 <entry><structfield>conrelid
</structfield></entry>
1802 <entry><type>oid
</type></entry>
1803 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
1804 <entry>The table this constraint is on;
0 if not a table constraint
</entry>
1808 <entry><structfield>contypid
</structfield></entry>
1809 <entry><type>oid
</type></entry>
1810 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
1811 <entry>The domain this constraint is on;
0 if not a domain constraint
</entry>
1815 <entry><structfield>conindid
</structfield></entry>
1816 <entry><type>oid
</type></entry>
1817 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
1818 <entry>The index supporting this constraint, if it's a unique, primary
1819 key, foreign key, or exclusion constraint; else
0</entry>
1823 <entry><structfield>confrelid
</structfield></entry>
1824 <entry><type>oid
</type></entry>
1825 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
1826 <entry>If a foreign key, the referenced table; else
0</entry>
1830 <entry><structfield>confupdtype
</structfield></entry>
1831 <entry><type>char
</type></entry>
1833 <entry>Foreign key update action code:
1834 <literal>a<
/> = no action,
1835 <literal>r<
/> = restrict,
1836 <literal>c<
/> = cascade,
1837 <literal>n<
/> = set null,
1838 <literal>d<
/> = set default
1843 <entry><structfield>confdeltype
</structfield></entry>
1844 <entry><type>char
</type></entry>
1846 <entry>Foreign key deletion action code:
1847 <literal>a<
/> = no action,
1848 <literal>r<
/> = restrict,
1849 <literal>c<
/> = cascade,
1850 <literal>n<
/> = set null,
1851 <literal>d<
/> = set default
1856 <entry><structfield>confmatchtype
</structfield></entry>
1857 <entry><type>char
</type></entry>
1859 <entry>Foreign key match type:
1860 <literal>f<
/> = full,
1861 <literal>p<
/> = partial,
1862 <literal>u<
/> = simple (unspecified)
1867 <entry><structfield>conislocal
</structfield></entry>
1868 <entry><type>bool
</type></entry>
1871 This constraint is defined locally for the relation. Note that a
1872 constraint can be locally defined and inherited simultaneously.
1877 <entry><structfield>coninhcount
</structfield></entry>
1878 <entry><type>int4
</type></entry>
1881 The number of direct inheritance ancestors this constraint has.
1883 a nonzero number of ancestors cannot be dropped nor renamed.
1888 <entry><structfield>conkey
</structfield></entry>
1889 <entry><type>int2[]
</type></entry>
1890 <entry><literal><link linkend=
"catalog-pg-attribute"><structname>pg_attribute
</structname></link>.attnum<
/></entry>
1891 <entry>If a table constraint (including foreign keys, but not constraint
1892 triggers), list of the constrained columns
</entry>
1896 <entry><structfield>confkey
</structfield></entry>
1897 <entry><type>int2[]
</type></entry>
1898 <entry><literal><link linkend=
"catalog-pg-attribute"><structname>pg_attribute
</structname></link>.attnum<
/></entry>
1899 <entry>If a foreign key, list of the referenced columns
</entry>
1903 <entry><structfield>conpfeqop
</structfield></entry>
1904 <entry><type>oid[]
</type></entry>
1905 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid<
/></entry>
1906 <entry>If a foreign key, list of the equality operators for PK = FK comparisons
</entry>
1910 <entry><structfield>conppeqop
</structfield></entry>
1911 <entry><type>oid[]
</type></entry>
1912 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid<
/></entry>
1913 <entry>If a foreign key, list of the equality operators for PK = PK comparisons
</entry>
1917 <entry><structfield>conffeqop
</structfield></entry>
1918 <entry><type>oid[]
</type></entry>
1919 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid<
/></entry>
1920 <entry>If a foreign key, list of the equality operators for FK = FK comparisons
</entry>
1924 <entry><structfield>conexclop
</structfield></entry>
1925 <entry><type>oid[]
</type></entry>
1926 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid<
/></entry>
1927 <entry>If an exclusion constraint, list of the per-column exclusion operators
</entry>
1931 <entry><structfield>conbin
</structfield></entry>
1932 <entry><type>pg_node_tree
</type></entry>
1934 <entry>If a check constraint, an internal representation of the expression
</entry>
1938 <entry><structfield>consrc
</structfield></entry>
1939 <entry><type>text
</type></entry>
1941 <entry>If a check constraint, a human-readable representation of the expression
</entry>
1948 In the case of an exclusion constraint,
<structfield>conkey
</structfield>
1949 is only useful for constraint elements that are simple column references.
1950 For other cases, a zero appears in
<structfield>conkey
</structfield>
1951 and the associated index must be consulted to discover the expression
1952 that is constrained. (
<structfield>conkey
</structfield> thus has the
1953 same contents as
<structname>pg_index<
/>.
<structfield>indkey<
/> for the
1959 <structfield>consrc
</structfield> is not updated when referenced objects
1960 change; for example, it won't track renaming of columns. Rather than
1961 relying on this field, it's best to use
<function>pg_get_constraintdef()<
/>
1962 to extract the definition of a check constraint.
1968 <literal>pg_class.relchecks
</literal> needs to agree with the
1969 number of check-constraint entries found in this table for each
1970 relation. Also,
<literal>pg_class.relhasexclusion
</literal> must
1971 be true if there are any exclusion-constraint entries for the relation.
1977 <sect1 id=
"catalog-pg-conversion">
1978 <title><structname>pg_conversion
</structname></title>
1980 <indexterm zone=
"catalog-pg-conversion">
1981 <primary>pg_conversion
</primary>
1985 The catalog
<structname>pg_conversion
</structname> describes the
1986 available encoding conversion procedures. See
1987 <xref linkend=
"sql-createconversion">
1988 for more information.
1992 <title><structname>pg_conversion<
/> Columns
</title>
1999 <entry>References
</entry>
2000 <entry>Description
</entry>
2006 <entry><structfield>conname
</structfield></entry>
2007 <entry><type>name
</type></entry>
2009 <entry>Conversion name (unique within a namespace)
</entry>
2013 <entry><structfield>connamespace
</structfield></entry>
2014 <entry><type>oid
</type></entry>
2015 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
2017 The OID of the namespace that contains this conversion
2022 <entry><structfield>conowner
</structfield></entry>
2023 <entry><type>oid
</type></entry>
2024 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
2025 <entry>Owner of the conversion
</entry>
2029 <entry><structfield>conforencoding
</structfield></entry>
2030 <entry><type>int4
</type></entry>
2032 <entry>Source encoding ID
</entry>
2036 <entry><structfield>contoencoding
</structfield></entry>
2037 <entry><type>int4
</type></entry>
2039 <entry>Destination encoding ID
</entry>
2043 <entry><structfield>conproc
</structfield></entry>
2044 <entry><type>regproc
</type></entry>
2045 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
2046 <entry>Conversion procedure
</entry>
2050 <entry><structfield>condefault
</structfield></entry>
2051 <entry><type>bool
</type></entry>
2053 <entry>True if this is the default conversion
</entry>
2062 <sect1 id=
"catalog-pg-database">
2063 <title><structname>pg_database
</structname></title>
2065 <indexterm zone=
"catalog-pg-database">
2066 <primary>pg_database
</primary>
2070 The catalog
<structname>pg_database
</structname> stores information about
2071 the available databases. Databases are created with the
<xref
2072 linkend=
"sql-createdatabase"> command.
2073 Consult
<xref linkend=
"managing-databases"> for details about the meaning
2074 of some of the parameters.
2078 Unlike most system catalogs,
<structname>pg_database
</structname>
2079 is shared across all databases of a cluster: there is only one
2080 copy of
<structname>pg_database
</structname> per cluster, not
2085 <title><structname>pg_database<
/> Columns
</title>
2092 <entry>References
</entry>
2093 <entry>Description
</entry>
2099 <entry><structfield>datname
</structfield></entry>
2100 <entry><type>name
</type></entry>
2102 <entry>Database name
</entry>
2106 <entry><structfield>datdba
</structfield></entry>
2107 <entry><type>oid
</type></entry>
2108 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
2109 <entry>Owner of the database, usually the user who created it
</entry>
2113 <entry><structfield>encoding
</structfield></entry>
2114 <entry><type>int4
</type></entry>
2116 <entry>Character encoding for this database
2117 (
<function>pg_encoding_to_char()
</function> can translate
2118 this number to the encoding name)
</entry>
2122 <entry><structfield>datcollate
</structfield></entry>
2123 <entry><type>name
</type></entry>
2125 <entry>LC_COLLATE for this database
</entry>
2129 <entry><structfield>datctype
</structfield></entry>
2130 <entry><type>name
</type></entry>
2132 <entry>LC_CTYPE for this database
</entry>
2136 <entry><structfield>datistemplate
</structfield></entry>
2137 <entry><type>bool
</type></entry>
2140 If true then this database can be used in the
2141 <literal>TEMPLATE
</literal> clause of
<command>CREATE
2142 DATABASE
</command> to create a new database as a clone of
2148 <entry><structfield>datallowconn
</structfield></entry>
2149 <entry><type>bool
</type></entry>
2152 If false then no one can connect to this database. This is
2153 used to protect the
<literal>template0<
/> database from being altered.
2158 <entry><structfield>datconnlimit
</structfield></entry>
2159 <entry><type>int4
</type></entry>
2162 Sets maximum number of concurrent connections that can be made
2163 to this database. -
1 means no limit.
2168 <entry><structfield>datlastsysoid
</structfield></entry>
2169 <entry><type>oid
</type></entry>
2172 Last system OID in the database; useful
2173 particularly to
<application>pg_dump
</application>
2178 <entry><structfield>datfrozenxid
</structfield></entry>
2179 <entry><type>xid
</type></entry>
2182 All transaction IDs before this one have been replaced with a permanent
2183 (
<quote>frozen<
/>) transaction ID in this database. This is used to
2184 track whether the database needs to be vacuumed in order to prevent
2185 transaction ID wraparound or to allow
<literal>pg_clog<
/> to be shrunk.
2186 It is the minimum of the per-table
2187 <structname>pg_class<
/>.
<structfield>relfrozenxid<
/> values.
2192 <entry><structfield>dattablespace
</structfield></entry>
2193 <entry><type>oid
</type></entry>
2194 <entry><literal><link linkend=
"catalog-pg-tablespace"><structname>pg_tablespace
</structname></link>.oid
</literal></entry>
2196 The default tablespace for the database.
2197 Within this database, all tables for which
2198 <structname>pg_class<
/>.
<structfield>reltablespace<
/> is zero
2199 will be stored in this tablespace; in particular, all the non-shared
2200 system catalogs will be there.
2205 <entry><structfield>datacl
</structfield></entry>
2206 <entry><type>aclitem[]
</type></entry>
2209 Access privileges; see
2210 <xref linkend=
"sql-grant"> and
2211 <xref linkend=
"sql-revoke">
2221 <sect1 id=
"catalog-pg-default-acl">
2222 <title><structname>pg_default_acl
</structname></title>
2224 <indexterm zone=
"catalog-pg-default-acl">
2225 <primary>pg_default_acl
</primary>
2229 The catalog
<structname>pg_default_acl<
/> stores initial
2230 privileges to be assigned to newly created objects.
2234 <title><structname>pg_default_acl<
/> Columns
</title>
2241 <entry>References
</entry>
2242 <entry>Description
</entry>
2248 <entry><structfield>defaclrole
</structfield></entry>
2249 <entry><type>oid
</type></entry>
2250 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
2251 <entry>The OID of the role associated with this entry
</entry>
2255 <entry><structfield>defaclnamespace
</structfield></entry>
2256 <entry><type>oid
</type></entry>
2257 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
2258 <entry>The OID of the namespace associated with this entry,
2259 or
0 if none
</entry>
2263 <entry><structfield>defaclobjtype
</structfield></entry>
2264 <entry><type>char
</type></entry>
2267 Type of object this entry is for:
2268 <literal>r<
/> = relation (table, view),
2269 <literal>S<
/> = sequence,
2270 <literal>f<
/> = function
2275 <entry><structfield>defaclacl
</structfield></entry>
2276 <entry><type>aclitem[]
</type></entry>
2279 Access privileges that this type of object should have on creation
2287 A
<structname>pg_default_acl<
/> entry shows the initial privileges to
2288 be assigned to an object belonging to the indicated user. There are
2289 currently two types of entry:
<quote>global<
/> entries with
2290 <structfield>defaclnamespace<
/> =
0, and
<quote>per-schema<
/> entries
2291 that reference a particular schema. If a global entry is present then
2292 it
<emphasis>overrides<
/> the normal hard-wired default privileges
2293 for the object type. A per-schema entry, if present, represents privileges
2294 to be
<emphasis>added to<
/> the global or hard-wired default privileges.
2298 Note that when an ACL entry in another catalog is null, it is taken
2299 to represent the hard-wired default privileges for its object,
2300 <emphasis>not<
/> whatever might be in
<structname>pg_default_acl<
/>
2301 at the moment.
<structname>pg_default_acl<
/> is only consulted during
2308 <sect1 id=
"catalog-pg-depend">
2309 <title><structname>pg_depend
</structname></title>
2311 <indexterm zone=
"catalog-pg-depend">
2312 <primary>pg_depend
</primary>
2316 The catalog
<structname>pg_depend
</structname> records the dependency
2317 relationships between database objects. This information allows
2318 <command>DROP<
/> commands to find which other objects must be dropped
2319 by
<command>DROP CASCADE<
/> or prevent dropping in the
<command>DROP
2324 See also
<link linkend=
"catalog-pg-shdepend"><structname>pg_shdepend
</structname></link>,
2325 which performs a similar function for dependencies involving objects
2326 that are shared across a database cluster.
2330 <title><structname>pg_depend<
/> Columns
</title>
2337 <entry>References
</entry>
2338 <entry>Description
</entry>
2344 <entry><structfield>classid
</structfield></entry>
2345 <entry><type>oid
</type></entry>
2346 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
2347 <entry>The OID of the system catalog the dependent object is in
</entry>
2351 <entry><structfield>objid
</structfield></entry>
2352 <entry><type>oid
</type></entry>
2353 <entry>any OID column
</entry>
2354 <entry>The OID of the specific dependent object
</entry>
2358 <entry><structfield>objsubid
</structfield></entry>
2359 <entry><type>int4
</type></entry>
2362 For a table column, this is the column number (the
2363 <structfield>objid<
/> and
<structfield>classid<
/> refer to the
2364 table itself). For all other object types, this column is
2370 <entry><structfield>refclassid
</structfield></entry>
2371 <entry><type>oid
</type></entry>
2372 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
2373 <entry>The OID of the system catalog the referenced object is in
</entry>
2377 <entry><structfield>refobjid
</structfield></entry>
2378 <entry><type>oid
</type></entry>
2379 <entry>any OID column
</entry>
2380 <entry>The OID of the specific referenced object
</entry>
2384 <entry><structfield>refobjsubid
</structfield></entry>
2385 <entry><type>int4
</type></entry>
2388 For a table column, this is the column number (the
2389 <structfield>refobjid<
/> and
<structfield>refclassid<
/> refer
2390 to the table itself). For all other object types, this column
2396 <entry><structfield>deptype
</structfield></entry>
2397 <entry><type>char
</type></entry>
2400 A code defining the specific semantics of this dependency relationship; see text
2409 In all cases, a
<structname>pg_depend
</structname> entry indicates that the
2410 referenced object cannot be dropped without also dropping the dependent
2411 object. However, there are several subflavors identified by
2412 <structfield>deptype<
/>:
2416 <term><symbol>DEPENDENCY_NORMAL<
/> (
<literal>n<
/>)
</term>
2419 A normal relationship between separately-created objects. The
2420 dependent object can be dropped without affecting the
2421 referenced object. The referenced object can only be dropped
2422 by specifying
<literal>CASCADE<
/>, in which case the dependent
2423 object is dropped, too. Example: a table column has a normal
2424 dependency on its data type.
2430 <term><symbol>DEPENDENCY_AUTO<
/> (
<literal>a<
/>)
</term>
2433 The dependent object can be dropped separately from the
2434 referenced object, and should be automatically dropped
2435 (regardless of
<literal>RESTRICT<
/> or
<literal>CASCADE<
/>
2436 mode) if the referenced object is dropped. Example: a named
2437 constraint on a table is made autodependent on the table, so
2438 that it will go away if the table is dropped.
2444 <term><symbol>DEPENDENCY_INTERNAL<
/> (
<literal>i<
/>)
</term>
2447 The dependent object was created as part of creation of the
2448 referenced object, and is really just a part of its internal
2449 implementation. A
<command>DROP<
/> of the dependent object
2450 will be disallowed outright (we'll tell the user to issue a
2451 <command>DROP<
/> against the referenced object, instead). A
2452 <command>DROP<
/> of the referenced object will be propagated
2453 through to drop the dependent object whether
2454 <command>CASCADE<
/> is specified or not. Example: a trigger
2455 that's created to enforce a foreign-key constraint is made
2456 internally dependent on the constraint's
2457 <structname>pg_constraint<
/> entry.
2463 <term><symbol>DEPENDENCY_PIN<
/> (
<literal>p<
/>)
</term>
2466 There is no dependent object; this type of entry is a signal
2467 that the system itself depends on the referenced object, and so
2468 that object must never be deleted. Entries of this type are
2469 created only by
<command>initdb
</command>. The columns for the
2470 dependent object contain zeroes.
2476 Other dependency flavors might be needed in future.
2482 <sect1 id=
"catalog-pg-description">
2483 <title><structname>pg_description
</structname></title>
2485 <indexterm zone=
"catalog-pg-description">
2486 <primary>pg_description
</primary>
2490 The catalog
<structname>pg_description<
/> stores optional descriptions
2491 (comments) for each database object. Descriptions can be manipulated
2492 with the
<xref linkend=
"sql-comment"> command and viewed with
2493 <application>psql
</application>'s
<literal>\d
</literal> commands.
2494 Descriptions of many built-in system objects are provided in the initial
2495 contents of
<structname>pg_description
</structname>.
2499 See also
<link linkend=
"catalog-pg-shdescription"><structname>pg_shdescription
</structname></link>,
2500 which performs a similar function for descriptions involving objects that
2501 are shared across a database cluster.
2505 <title><structname>pg_description<
/> Columns
</title>
2512 <entry>References
</entry>
2513 <entry>Description
</entry>
2519 <entry><structfield>objoid
</structfield></entry>
2520 <entry><type>oid
</type></entry>
2521 <entry>any OID column
</entry>
2522 <entry>The OID of the object this description pertains to
</entry>
2526 <entry><structfield>classoid
</structfield></entry>
2527 <entry><type>oid
</type></entry>
2528 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
2529 <entry>The OID of the system catalog this object appears in
</entry>
2533 <entry><structfield>objsubid
</structfield></entry>
2534 <entry><type>int4
</type></entry>
2537 For a comment on a table column, this is the column number (the
2538 <structfield>objoid<
/> and
<structfield>classoid<
/> refer to
2539 the table itself). For all other object types, this column is
2545 <entry><structfield>description
</structfield></entry>
2546 <entry><type>text
</type></entry>
2548 <entry>Arbitrary text that serves as the description of this object
</entry>
2557 <sect1 id=
"catalog-pg-enum">
2558 <title><structname>pg_enum
</structname></title>
2560 <indexterm zone=
"catalog-pg-enum">
2561 <primary>pg_enum
</primary>
2565 The
<structname>pg_enum
</structname> catalog contains entries
2566 matching enum types to their associated values and labels. The
2567 internal representation of a given enum value is actually the OID
2568 of its associated row in
<structname>pg_enum
</structname>. The
2569 OIDs for a particular enum type are guaranteed to be ordered in
2570 the way the type should sort, but there is no guarantee about the
2571 ordering of OIDs of unrelated enum types.
2575 <title><structname>pg_enum<
/> Columns
</title>
2582 <entry>References
</entry>
2583 <entry>Description
</entry>
2589 <entry><structfield>enumtypid
</structfield></entry>
2590 <entry><type>oid
</type></entry>
2591 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
2592 <entry>The OID of the
<structname>pg_type<
/> entry owning this enum value
</entry>
2596 <entry><structfield>enumlabel
</structfield></entry>
2597 <entry><type>name
</type></entry>
2599 <entry>The textual label for this enum value
</entry>
2607 <sect1 id=
"catalog-pg-foreign-data-wrapper">
2608 <title><structname>pg_foreign_data_wrapper
</structname></title>
2610 <indexterm zone=
"catalog-pg-foreign-data-wrapper">
2611 <primary>pg_foreign_data_wrapper
</primary>
2615 The catalog
<structname>pg_foreign_data_wrapper
</structname> stores
2616 foreign-data wrapper definitions. A foreign-data wrapper is the
2617 mechanism by which external data, residing on foreign servers, is
2622 <title><structname>pg_foreign_data_wrapper<
/> Columns
</title>
2629 <entry>References
</entry>
2630 <entry>Description
</entry>
2636 <entry><structfield>fdwname
</structfield></entry>
2637 <entry><type>name
</type></entry>
2639 <entry>Name of the foreign-data wrapper
</entry>
2643 <entry><structfield>fdwowner
</structfield></entry>
2644 <entry><type>oid
</type></entry>
2645 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
2646 <entry>Owner of the foreign-data wrapper
</entry>
2650 <entry><structfield>fdwvalidator
</structfield></entry>
2651 <entry><type>oid
</type></entry>
2652 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
2654 References a validator function that is responsible for
2655 checking the validity of the generic options given to the
2656 foreign-data wrapper, as well as to foreign servers and user
2657 mappings using the foreign-data wrapper. Zero if no validator
2663 <entry><structfield>fdwhandler
</structfield></entry>
2664 <entry><type>oid
</type></entry>
2665 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
2667 References a handler function that is responsible for
2668 supplying foreign-data wrapper routines.
2669 Zero if no handler is provided.
2674 <entry><structfield>fdwacl
</structfield></entry>
2675 <entry><type>aclitem[]
</type></entry>
2678 Access privileges; see
2679 <xref linkend=
"sql-grant"> and
2680 <xref linkend=
"sql-revoke">
2686 <entry><structfield>fdwoptions
</structfield></entry>
2687 <entry><type>text[]
</type></entry>
2690 Foreign-data wrapper specific options, as
<quote>keyword=value<
/> strings
2699 <sect1 id=
"catalog-pg-foreign-server">
2700 <title><structname>pg_foreign_server
</structname></title>
2702 <indexterm zone=
"catalog-pg-foreign-server">
2703 <primary>pg_foreign_server
</primary>
2707 The catalog
<structname>pg_foreign_server
</structname> stores
2708 foreign server definitions. A foreign server describes the
2709 connection to a remote server, managing external data. Foreign
2710 servers are accessed via foreign-data wrappers.
2714 <title><structname>pg_foreign_server<
/> Columns
</title>
2721 <entry>References
</entry>
2722 <entry>Description
</entry>
2728 <entry><structfield>srvname
</structfield></entry>
2729 <entry><type>name
</type></entry>
2731 <entry>Name of the foreign server
</entry>
2735 <entry><structfield>srvowner
</structfield></entry>
2736 <entry><type>oid
</type></entry>
2737 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
2738 <entry>Owner of the foreign server
</entry>
2742 <entry><structfield>srvfdw
</structfield></entry>
2743 <entry><type>oid
</type></entry>
2744 <entry><literal><link linkend=
"catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper
</structname></link>.oid
</literal></entry>
2745 <entry>The OID of the foreign-data wrapper of this foreign server
</entry>
2749 <entry><structfield>srvtype
</structfield></entry>
2750 <entry><type>text
</type></entry>
2752 <entry>Type of the server (optional)
</entry>
2756 <entry><structfield>srvversion
</structfield></entry>
2757 <entry><type>text
</type></entry>
2759 <entry>Version of the server (optional)
</entry>
2763 <entry><structfield>srvacl
</structfield></entry>
2764 <entry><type>aclitem[]
</type></entry>
2767 Access privileges; see
2768 <xref linkend=
"sql-grant"> and
2769 <xref linkend=
"sql-revoke">
2775 <entry><structfield>srvoptions
</structfield></entry>
2776 <entry><type>text[]
</type></entry>
2779 Foreign server specific options, as
<quote>keyword=value<
/> strings
2788 <sect1 id=
"catalog-pg-foreign-table">
2789 <title><structname>pg_foreign_table
</structname></title>
2791 <indexterm zone=
"catalog-pg-foreign-table">
2792 <primary>pg_foreign_table
</primary>
2796 The catalog
<structname>pg_foreign_table
</structname> contains part
2797 of the information about foreign tables.
2798 The rest is mostly in
<structname>pg_class
</structname>.
2802 <title><structname>pg_foreign_table<
/> Columns
</title>
2809 <entry>References
</entry>
2810 <entry>Description
</entry>
2816 <entry><structfield>ftrelid
</structfield></entry>
2817 <entry><type>oid
</type></entry>
2818 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
2819 <entry>The OID of the
<structname>pg_class<
/> entry for this foreign table
</entry>
2823 <entry><structfield>ftserver
</structfield></entry>
2824 <entry><type>oid
</type></entry>
2825 <entry><literal><link linkend=
"catalog-pg-foreign-server"><structname>pg_foreign_server
</structname></link>.oid
</literal></entry>
2826 <entry>The OID of the foreign server for this foreign table
</entry>
2830 <entry><structfield>srvoptions
</structfield></entry>
2831 <entry><type>text[]
</type></entry>
2834 Foreign table specific options, as
<quote>keyword=value<
/> strings.
2843 <sect1 id=
"catalog-pg-index">
2844 <title><structname>pg_index
</structname></title>
2846 <indexterm zone=
"catalog-pg-index">
2847 <primary>pg_index
</primary>
2851 The catalog
<structname>pg_index
</structname> contains part of the information
2852 about indexes. The rest is mostly in
2853 <structname>pg_class
</structname>.
2857 <title><structname>pg_index<
/> Columns
</title>
2864 <entry>References
</entry>
2865 <entry>Description
</entry>
2871 <entry><structfield>indexrelid
</structfield></entry>
2872 <entry><type>oid
</type></entry>
2873 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
2874 <entry>The OID of the
<structname>pg_class<
/> entry for this index
</entry>
2878 <entry><structfield>indrelid
</structfield></entry>
2879 <entry><type>oid
</type></entry>
2880 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
2881 <entry>The OID of the
<structname>pg_class<
/> entry for the table this index is for
</entry>
2885 <entry><structfield>indnatts
</structfield></entry>
2886 <entry><type>int2
</type></entry>
2888 <entry>The number of columns in the index (duplicates
2889 <literal>pg_class.relnatts
</literal>)
</entry>
2893 <entry><structfield>indisunique
</structfield></entry>
2894 <entry><type>bool
</type></entry>
2896 <entry>If true, this is a unique index
</entry>
2900 <entry><structfield>indisprimary
</structfield></entry>
2901 <entry><type>bool
</type></entry>
2903 <entry>If true, this index represents the primary key of the table
2904 (
<structfield>indisunique<
/> should always be true when this is true)
</entry>
2908 <entry><structfield>indimmediate
</structfield></entry>
2909 <entry><type>bool
</type></entry>
2911 <entry>If true, the uniqueness check is enforced immediately on insertion
2912 (
<structfield>indisunique<
/> should always be true when this is true)
</entry>
2916 <entry><structfield>indisclustered
</structfield></entry>
2917 <entry><type>bool
</type></entry>
2919 <entry>If true, the table was last clustered on this index
</entry>
2923 <entry><structfield>indisvalid
</structfield></entry>
2924 <entry><type>bool
</type></entry>
2927 If true, the index is currently valid for queries. False means the
2928 index is possibly incomplete: it must still be modified by
2929 <command>INSERT<
/>/
<command>UPDATE<
/> operations, but it cannot safely
2930 be used for queries. If it is unique, the uniqueness property is not
2936 <entry><structfield>indcheckxmin
</structfield></entry>
2937 <entry><type>bool
</type></entry>
2940 If true, queries must not use the index until the
<structfield>xmin<
/>
2941 of this
<structname>pg_index<
/> row is below their
<symbol>TransactionXmin
</symbol>
2942 event horizon, because the table may contain broken HOT chains with
2943 incompatible rows that they can see
2948 <entry><structfield>indisready
</structfield></entry>
2949 <entry><type>bool
</type></entry>
2952 If true, the index is currently ready for inserts. False means the
2953 index must be ignored by
<command>INSERT<
/>/
<command>UPDATE<
/>
2959 <entry><structfield>indkey
</structfield></entry>
2960 <entry><type>int2vector
</type></entry>
2961 <entry><literal><link linkend=
"catalog-pg-attribute"><structname>pg_attribute
</structname></link>.attnum
</literal></entry>
2963 This is an array of
<structfield>indnatts
</structfield> values that
2964 indicate which table columns this index indexes. For example a value
2965 of
<literal>1 3</literal> would mean that the first and the third table
2966 columns make up the index key. A zero in this array indicates that the
2967 corresponding index attribute is an expression over the table columns,
2968 rather than a simple column reference.
2973 <entry><structfield>indclass
</structfield></entry>
2974 <entry><type>oidvector
</type></entry>
2975 <entry><literal><link linkend=
"catalog-pg-opclass"><structname>pg_opclass
</structname></link>.oid
</literal></entry>
2977 For each column in the index key, this contains the OID of
2978 the operator class to use. See
2979 <link linkend=
"catalog-pg-opclass"><structname>pg_opclass
</structname></link> for details.
2984 <entry><structfield>indoption
</structfield></entry>
2985 <entry><type>int2vector
</type></entry>
2988 This is an array of
<structfield>indnatts
</structfield> values that
2989 store per-column flag bits. The meaning of the bits is defined by
2990 the index's access method.
2995 <entry><structfield>indexprs
</structfield></entry>
2996 <entry><type>pg_node_tree
</type></entry>
2999 Expression trees (in
<function>nodeToString()
</function>
3000 representation) for index attributes that are not simple column
3001 references. This is a list with one element for each zero
3002 entry in
<structfield>indkey<
/>. Null if all index attributes
3003 are simple references.
3008 <entry><structfield>indpred
</structfield></entry>
3009 <entry><type>pg_node_tree
</type></entry>
3012 Expression tree (in
<function>nodeToString()
</function>
3013 representation) for partial index predicate. Null if not a
3024 <sect1 id=
"catalog-pg-inherits">
3025 <title><structname>pg_inherits
</structname></title>
3027 <indexterm zone=
"catalog-pg-inherits">
3028 <primary>pg_inherits
</primary>
3032 The catalog
<structname>pg_inherits<
/> records information about
3033 table inheritance hierarchies. There is one entry for each direct
3034 child table in the database. (Indirect inheritance can be determined
3035 by following chains of entries.)
3039 <title><structname>pg_inherits<
/> Columns
</title>
3046 <entry>References
</entry>
3047 <entry>Description
</entry>
3053 <entry><structfield>inhrelid
</structfield></entry>
3054 <entry><type>oid
</type></entry>
3055 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
3057 The OID of the child table
3062 <entry><structfield>inhparent
</structfield></entry>
3063 <entry><type>oid
</type></entry>
3064 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
3066 The OID of the parent table
3071 <entry><structfield>inhseqno
</structfield></entry>
3072 <entry><type>int4
</type></entry>
3075 If there is more than one direct parent for a child table (multiple
3076 inheritance), this number tells the order in which the
3077 inherited columns are to be arranged. The count starts at
1.
3087 <sect1 id=
"catalog-pg-language">
3088 <title><structname>pg_language
</structname></title>
3090 <indexterm zone=
"catalog-pg-language">
3091 <primary>pg_language
</primary>
3095 The catalog
<structname>pg_language
</structname> registers
3096 languages in which you can write functions or stored procedures.
3097 See
<xref linkend=
"sql-createlanguage">
3098 and
<xref linkend=
"xplang"> for more information about language handlers.
3102 <title><structname>pg_language<
/> Columns
</title>
3109 <entry>References
</entry>
3110 <entry>Description
</entry>
3116 <entry><structfield>lanname
</structfield></entry>
3117 <entry><type>name
</type></entry>
3119 <entry>Name of the language
</entry>
3123 <entry><structfield>lanowner
</structfield></entry>
3124 <entry><type>oid
</type></entry>
3125 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
3126 <entry>Owner of the language
</entry>
3130 <entry><structfield>lanispl
</structfield></entry>
3131 <entry><type>bool
</type></entry>
3134 This is false for internal languages (such as
3135 <acronym>SQL
</acronym>) and true for user-defined languages.
3136 Currently,
<application>pg_dump
</application> still uses this
3137 to determine which languages need to be dumped, but this might be
3138 replaced by a different mechanism in the future.
3143 <entry><structfield>lanpltrusted
</structfield></entry>
3144 <entry><type>bool
</type></entry>
3147 True if this is a trusted language, which means that it is believed
3148 not to grant access to anything outside the normal SQL execution
3149 environment. Only superusers can create functions in untrusted
3155 <entry><structfield>lanplcallfoid
</structfield></entry>
3156 <entry><type>oid
</type></entry>
3157 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
3159 For noninternal languages this references the language
3160 handler, which is a special function that is responsible for
3161 executing all functions that are written in the particular
3167 <entry><structfield>laninline
</structfield></entry>
3168 <entry><type>oid
</type></entry>
3169 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
3171 This references a function that is responsible for executing
3172 <quote>inline<
/> anonymous code blocks
3173 (
<xref linkend=
"sql-do"> blocks).
3174 Zero if inline blocks are not supported.
3179 <entry><structfield>lanvalidator
</structfield></entry>
3180 <entry><type>oid
</type></entry>
3181 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
3183 This references a language validator function that is responsible
3184 for checking the syntax and validity of new functions when they
3185 are created. Zero if no validator is provided.
3190 <entry><structfield>lanacl
</structfield></entry>
3191 <entry><type>aclitem[]
</type></entry>
3194 Access privileges; see
3195 <xref linkend=
"sql-grant"> and
3196 <xref linkend=
"sql-revoke">
3207 <sect1 id=
"catalog-pg-largeobject">
3208 <title><structname>pg_largeobject
</structname></title>
3210 <indexterm zone=
"catalog-pg-largeobject">
3211 <primary>pg_largeobject
</primary>
3215 The catalog
<structname>pg_largeobject
</structname> holds the data making up
3216 <quote>large objects
</quote>. A large object is identified by an OID
3217 assigned when it is created. Each large object is broken into
3218 segments or
<quote>pages<
/> small enough to be conveniently stored as rows
3219 in
<structname>pg_largeobject
</structname>.
3220 The amount of data per page is defined to be
<symbol>LOBLKSIZE<
/> (which is currently
3221 <literal>BLCKSZ/
4<
/>, or typically
2 kB).
3225 Prior to
<productname>PostgreSQL<
/> 9.0, there was no permission structure
3226 associated with large objects. As a result,
3227 <structname>pg_largeobject
</structname> was publicly readable and could be
3228 used to obtain the OIDs (and contents) of all large objects in the system.
3229 This is no longer the case; use
3230 <link linkend=
"catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata<
/></link>
3231 to obtain a list of large object OIDs.
3235 <title><structname>pg_largeobject<
/> Columns
</title>
3242 <entry>References
</entry>
3243 <entry>Description
</entry>
3249 <entry><structfield>loid
</structfield></entry>
3250 <entry><type>oid
</type></entry>
3251 <entry><literal><link linkend=
"catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata
</structname></link>.oid
</literal></entry>
3252 <entry>Identifier of the large object that includes this page
</entry>
3256 <entry><structfield>pageno
</structfield></entry>
3257 <entry><type>int4
</type></entry>
3259 <entry>Page number of this page within its large object
3260 (counting from zero)
</entry>
3264 <entry><structfield>data
</structfield></entry>
3265 <entry><type>bytea
</type></entry>
3268 Actual data stored in the large object.
3269 This will never be more than
<symbol>LOBLKSIZE<
/> bytes and might be less.
3277 Each row of
<structname>pg_largeobject
</structname> holds data
3278 for one page of a large object, beginning at
3279 byte offset (
<literal>pageno * LOBLKSIZE<
/>) within the object. The implementation
3280 allows sparse storage: pages might be missing, and might be shorter than
3281 <literal>LOBLKSIZE<
/> bytes even if they are not the last page of the object.
3282 Missing regions within a large object read as zeroes.
3287 <sect1 id=
"catalog-pg-largeobject-metadata">
3288 <title><structname>pg_largeobject_metadata
</structname></title>
3290 <indexterm zone=
"catalog-pg-largeobject-metadata">
3291 <primary>pg_largeobject_metadata
</primary>
3295 The catalog
<structname>pg_largeobject_metadata
</structname>
3296 holds metadata associated with large objects. The actual large object
3298 <link linkend=
"catalog-pg-largeobject"><structname>pg_largeobject<
/></link>.
3302 <title><structname>pg_largeobject_metadata<
/> Columns
</title>
3309 <entry>References
</entry>
3310 <entry>Description
</entry>
3316 <entry><structfield>lomowner
</structfield></entry>
3317 <entry><type>oid
</type></entry>
3318 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
3319 <entry>Owner of the large object
</entry>
3323 <entry><structfield>lomacl
</structfield></entry>
3324 <entry><type>aclitem[]
</type></entry>
3327 Access privileges; see
3328 <xref linkend=
"sql-grant"> and
3329 <xref linkend=
"sql-revoke">
3339 <sect1 id=
"catalog-pg-namespace">
3340 <title><structname>pg_namespace
</structname></title>
3342 <indexterm zone=
"catalog-pg-namespace">
3343 <primary>pg_namespace
</primary>
3347 The catalog
<structname>pg_namespace<
/> stores namespaces.
3348 A namespace is the structure underlying SQL schemas: each namespace
3349 can have a separate collection of relations, types, etc. without name
3354 <title><structname>pg_namespace<
/> Columns
</title>
3361 <entry>References
</entry>
3362 <entry>Description
</entry>
3368 <entry><structfield>nspname
</structfield></entry>
3369 <entry><type>name
</type></entry>
3371 <entry>Name of the namespace
</entry>
3375 <entry><structfield>nspowner
</structfield></entry>
3376 <entry><type>oid
</type></entry>
3377 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
3378 <entry>Owner of the namespace
</entry>
3382 <entry><structfield>nspacl
</structfield></entry>
3383 <entry><type>aclitem[]
</type></entry>
3386 Access privileges; see
3387 <xref linkend=
"sql-grant"> and
3388 <xref linkend=
"sql-revoke">
3399 <sect1 id=
"catalog-pg-opclass">
3400 <title><structname>pg_opclass
</structname></title>
3402 <indexterm zone=
"catalog-pg-opclass">
3403 <primary>pg_opclass
</primary>
3407 The catalog
<structname>pg_opclass
</structname> defines
3408 index access method operator classes. Each operator class defines
3409 semantics for index columns of a particular data type and a particular
3410 index access method. An operator class essentially specifies that a
3411 particular operator family is applicable to a particular indexable column
3412 data type. The set of operators from the family that are actually usable
3413 with the indexed column are whichever ones accept the column's data type
3414 as their lefthand input.
3418 Operator classes are described at length in
<xref linkend=
"xindex">.
3422 <title><structname>pg_opclass<
/> Columns
</title>
3429 <entry>References
</entry>
3430 <entry>Description
</entry>
3436 <entry><structfield>opcmethod
</structfield></entry>
3437 <entry><type>oid
</type></entry>
3438 <entry><literal><link linkend=
"catalog-pg-am"><structname>pg_am
</structname></link>.oid
</literal></entry>
3439 <entry>Index access method operator class is for
</entry>
3443 <entry><structfield>opcname
</structfield></entry>
3444 <entry><type>name
</type></entry>
3446 <entry>Name of this operator class
</entry>
3450 <entry><structfield>opcnamespace
</structfield></entry>
3451 <entry><type>oid
</type></entry>
3452 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
3453 <entry>Namespace of this operator class
</entry>
3457 <entry><structfield>opcowner
</structfield></entry>
3458 <entry><type>oid
</type></entry>
3459 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
3460 <entry>Owner of the operator class
</entry>
3464 <entry><structfield>opcfamily
</structfield></entry>
3465 <entry><type>oid
</type></entry>
3466 <entry><literal><link linkend=
"catalog-pg-opfamily"><structname>pg_opfamily
</structname></link>.oid
</literal></entry>
3467 <entry>Operator family containing the operator class
</entry>
3471 <entry><structfield>opcintype
</structfield></entry>
3472 <entry><type>oid
</type></entry>
3473 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
3474 <entry>Data type that the operator class indexes
</entry>
3478 <entry><structfield>opcdefault
</structfield></entry>
3479 <entry><type>bool
</type></entry>
3481 <entry>True if this operator class is the default for
<structfield>opcintype<
/></entry>
3485 <entry><structfield>opckeytype
</structfield></entry>
3486 <entry><type>oid
</type></entry>
3487 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
3488 <entry>Type of data stored in index, or zero if same as
<structfield>opcintype<
/></entry>
3496 An operator class's
<structfield>opcmethod<
/> must match the
3497 <structname>opfmethod<
/> of its containing operator family.
3498 Also, there must be no more than one
<structname>pg_opclass
</structname>
3499 row having
<structname>opcdefault<
/> true for any given combination of
3500 <structname>opcmethod<
/> and
<structname>opcintype<
/>.
3506 <sect1 id=
"catalog-pg-operator">
3507 <title><structname>pg_operator
</structname></title>
3509 <indexterm zone=
"catalog-pg-operator">
3510 <primary>pg_operator
</primary>
3514 The catalog
<structname>pg_operator<
/> stores information about operators.
3515 See
<xref linkend=
"sql-createoperator">
3516 and
<xref linkend=
"xoper"> for more information.
3520 <title><structname>pg_operator<
/> Columns
</title>
3527 <entry>References
</entry>
3528 <entry>Description
</entry>
3534 <entry><structfield>oprname
</structfield></entry>
3535 <entry><type>name
</type></entry>
3537 <entry>Name of the operator
</entry>
3541 <entry><structfield>oprnamespace
</structfield></entry>
3542 <entry><type>oid
</type></entry>
3543 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
3545 The OID of the namespace that contains this operator
3550 <entry><structfield>oprowner
</structfield></entry>
3551 <entry><type>oid
</type></entry>
3552 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
3553 <entry>Owner of the operator
</entry>
3557 <entry><structfield>oprkind
</structfield></entry>
3558 <entry><type>char
</type></entry>
3561 <literal>b<
/> = infix (
<quote>both
</quote>),
<literal>l<
/> = prefix
3562 (
<quote>left
</quote>),
<literal>r<
/> = postfix (
<quote>right
</quote>)
3567 <entry><structfield>oprcanmerge
</structfield></entry>
3568 <entry><type>bool
</type></entry>
3570 <entry>This operator supports merge joins
</entry>
3574 <entry><structfield>oprcanhash
</structfield></entry>
3575 <entry><type>bool
</type></entry>
3577 <entry>This operator supports hash joins
</entry>
3581 <entry><structfield>oprleft
</structfield></entry>
3582 <entry><type>oid
</type></entry>
3583 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
3584 <entry>Type of the left operand
</entry>
3588 <entry><structfield>oprright
</structfield></entry>
3589 <entry><type>oid
</type></entry>
3590 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
3591 <entry>Type of the right operand
</entry>
3595 <entry><structfield>oprresult
</structfield></entry>
3596 <entry><type>oid
</type></entry>
3597 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
3598 <entry>Type of the result
</entry>
3602 <entry><structfield>oprcom
</structfield></entry>
3603 <entry><type>oid
</type></entry>
3604 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid
</literal></entry>
3605 <entry>Commutator of this operator, if any
</entry>
3609 <entry><structfield>oprnegate
</structfield></entry>
3610 <entry><type>oid
</type></entry>
3611 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid
</literal></entry>
3612 <entry>Negator of this operator, if any
</entry>
3616 <entry><structfield>oprcode
</structfield></entry>
3617 <entry><type>regproc
</type></entry>
3618 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
3619 <entry>Function that implements this operator
</entry>
3623 <entry><structfield>oprrest
</structfield></entry>
3624 <entry><type>regproc
</type></entry>
3625 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
3626 <entry>Restriction selectivity estimation function for this operator
</entry>
3630 <entry><structfield>oprjoin
</structfield></entry>
3631 <entry><type>regproc
</type></entry>
3632 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
3633 <entry>Join selectivity estimation function for this operator
</entry>
3640 Unused column contain zeroes. For example,
<structfield>oprleft
</structfield>
3641 is zero for a prefix operator.
3647 <sect1 id=
"catalog-pg-opfamily">
3648 <title><structname>pg_opfamily
</structname></title>
3650 <indexterm zone=
"catalog-pg-opfamily">
3651 <primary>pg_opfamily
</primary>
3655 The catalog
<structname>pg_opfamily
</structname> defines operator families.
3656 Each operator family is a collection of operators and associated
3657 support routines that implement the semantics specified for a particular
3658 index access method. Furthermore, the operators in a family are all
3659 <quote>compatible<
/>, in a way that is specified by the access method.
3660 The operator family concept allows cross-data-type operators to be used
3661 with indexes and to be reasoned about using knowledge of access method
3666 Operator families are described at length in
<xref linkend=
"xindex">.
3670 <title><structname>pg_opfamily<
/> Columns
</title>
3677 <entry>References
</entry>
3678 <entry>Description
</entry>
3684 <entry><structfield>opfmethod
</structfield></entry>
3685 <entry><type>oid
</type></entry>
3686 <entry><literal><link linkend=
"catalog-pg-am"><structname>pg_am
</structname></link>.oid
</literal></entry>
3687 <entry>Index access method operator family is for
</entry>
3691 <entry><structfield>opfname
</structfield></entry>
3692 <entry><type>name
</type></entry>
3694 <entry>Name of this operator family
</entry>
3698 <entry><structfield>opfnamespace
</structfield></entry>
3699 <entry><type>oid
</type></entry>
3700 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
3701 <entry>Namespace of this operator family
</entry>
3705 <entry><structfield>opfowner
</structfield></entry>
3706 <entry><type>oid
</type></entry>
3707 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
3708 <entry>Owner of the operator family
</entry>
3716 The majority of the information defining an operator family is not in its
3717 <structname>pg_opfamily
</structname> row, but in the associated rows in
3718 <link linkend=
"catalog-pg-amop"><structname>pg_amop
</structname></link>,
3719 <link linkend=
"catalog-pg-amproc"><structname>pg_amproc
</structname></link>,
3721 <link linkend=
"catalog-pg-opclass"><structname>pg_opclass
</structname></link>.
3727 <sect1 id=
"catalog-pg-pltemplate">
3728 <title><structname>pg_pltemplate
</structname></title>
3730 <indexterm zone=
"catalog-pg-pltemplate">
3731 <primary>pg_pltemplate
</primary>
3735 The catalog
<structname>pg_pltemplate
</structname> stores
3736 <quote>template<
/> information for procedural languages.
3737 A template for a language allows the language to be created in a
3738 particular database by a simple
<command>CREATE LANGUAGE<
/> command,
3739 with no need to specify implementation details.
3743 Unlike most system catalogs,
<structname>pg_pltemplate
</structname>
3744 is shared across all databases of a cluster: there is only one
3745 copy of
<structname>pg_pltemplate
</structname> per cluster, not
3746 one per database. This allows the information to be accessible in
3747 each database as it is needed.
3751 <title><structname>pg_pltemplate<
/> Columns
</title>
3758 <entry>Description
</entry>
3764 <entry><structfield>tmplname
</structfield></entry>
3765 <entry><type>name
</type></entry>
3766 <entry>Name of the language this template is for
</entry>
3770 <entry><structfield>tmpltrusted
</structfield></entry>
3771 <entry><type>boolean
</type></entry>
3772 <entry>True if language is considered trusted
</entry>
3776 <entry><structfield>tmpldbacreate
</structfield></entry>
3777 <entry><type>boolean
</type></entry>
3778 <entry>True if language may be created by a database owner
</entry>
3782 <entry><structfield>tmplhandler
</structfield></entry>
3783 <entry><type>text
</type></entry>
3784 <entry>Name of call handler function
</entry>
3788 <entry><structfield>tmplinline
</structfield></entry>
3789 <entry><type>text
</type></entry>
3790 <entry>Name of anonymous-block handler function, or null if none
</entry>
3794 <entry><structfield>tmplvalidator
</structfield></entry>
3795 <entry><type>text
</type></entry>
3796 <entry>Name of validator function, or null if none
</entry>
3800 <entry><structfield>tmpllibrary
</structfield></entry>
3801 <entry><type>text
</type></entry>
3802 <entry>Path of shared library that implements language
</entry>
3806 <entry><structfield>tmplacl
</structfield></entry>
3807 <entry><type>aclitem[]
</type></entry>
3808 <entry>Access privileges for template (not yet used)
</entry>
3816 There are not currently any commands that manipulate procedural language
3817 templates; to change the built-in information, a superuser must modify
3818 the table using ordinary
<command>INSERT
</command>,
<command>DELETE
</command>,
3819 or
<command>UPDATE
</command> commands. It is likely that a future
3820 release of
<productname>PostgreSQL
</productname> will offer
3821 commands to change the entries in a cleaner fashion.
3825 When implemented, the
<structfield>tmplacl
</structfield> field will provide
3826 access control for the template itself (i.e., the right to create a
3827 language using it), not for the languages created from the template.
3833 <sect1 id=
"catalog-pg-proc">
3834 <title><structname>pg_proc
</structname></title>
3836 <indexterm zone=
"catalog-pg-proc">
3837 <primary>pg_proc
</primary>
3841 The catalog
<structname>pg_proc<
/> stores information about functions (or procedures).
3842 See
<xref linkend=
"sql-createfunction">
3843 and
<xref linkend=
"xfunc"> for more information.
3847 The table contains data for aggregate functions as well as plain functions.
3848 If
<structfield>proisagg
</structfield> is true, there should be a matching
3849 row in
<structfield>pg_aggregate
</structfield>.
3853 <title><structname>pg_proc<
/> Columns
</title>
3860 <entry>References
</entry>
3861 <entry>Description
</entry>
3867 <entry><structfield>proname
</structfield></entry>
3868 <entry><type>name
</type></entry>
3870 <entry>Name of the function
</entry>
3874 <entry><structfield>pronamespace
</structfield></entry>
3875 <entry><type>oid
</type></entry>
3876 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
3878 The OID of the namespace that contains this function
3883 <entry><structfield>proowner
</structfield></entry>
3884 <entry><type>oid
</type></entry>
3885 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
3886 <entry>Owner of the function
</entry>
3890 <entry><structfield>prolang
</structfield></entry>
3891 <entry><type>oid
</type></entry>
3892 <entry><literal><link linkend=
"catalog-pg-language"><structname>pg_language
</structname></link>.oid
</literal></entry>
3893 <entry>Implementation language or call interface of this function
</entry>
3897 <entry><structfield>procost
</structfield></entry>
3898 <entry><type>float4
</type></entry>
3900 <entry>Estimated execution cost (in units of
3901 <xref linkend=
"guc-cpu-operator-cost">); if
<structfield>proretset<
/>,
3902 this is cost per row returned
</entry>
3906 <entry><structfield>prorows
</structfield></entry>
3907 <entry><type>float4
</type></entry>
3909 <entry>Estimated number of result rows (zero if not
<structfield>proretset<
/>)
</entry>
3913 <entry><structfield>provariadic
</structfield></entry>
3914 <entry><type>oid
</type></entry>
3915 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
3916 <entry>Data type of the variadic array parameter's elements,
3917 or zero if the function does not have a variadic parameter
</entry>
3921 <entry><structfield>proisagg
</structfield></entry>
3922 <entry><type>bool
</type></entry>
3924 <entry>Function is an aggregate function
</entry>
3928 <entry><structfield>proiswindow
</structfield></entry>
3929 <entry><type>bool
</type></entry>
3931 <entry>Function is a window function
</entry>
3935 <entry><structfield>prosecdef
</structfield></entry>
3936 <entry><type>bool
</type></entry>
3938 <entry>Function is a security definer (i.e., a
<quote>setuid<
/>
3943 <entry><structfield>proisstrict
</structfield></entry>
3944 <entry><type>bool
</type></entry>
3947 Function returns null if any call argument is null. In that
3948 case the function won't actually be called at all. Functions
3949 that are not
<quote>strict
</quote> must be prepared to handle
3955 <entry><structfield>proretset
</structfield></entry>
3956 <entry><type>bool
</type></entry>
3958 <entry>Function returns a set (i.e., multiple values of the specified
3963 <entry><structfield>provolatile
</structfield></entry>
3964 <entry><type>char
</type></entry>
3967 <structfield>provolatile
</structfield> tells whether the function's
3968 result depends only on its input arguments, or is affected by outside
3970 It is
<literal>i
</literal> for
<quote>immutable<
/> functions,
3971 which always deliver the same result for the same inputs.
3972 It is
<literal>s
</literal> for
<quote>stable<
/> functions,
3973 whose results (for fixed inputs) do not change within a scan.
3974 It is
<literal>v
</literal> for
<quote>volatile<
/> functions,
3975 whose results might change at any time. (Use
<literal>v
</literal> also
3976 for functions with side-effects, so that calls to them cannot get
3982 <entry><structfield>pronargs
</structfield></entry>
3983 <entry><type>int2
</type></entry>
3985 <entry>Number of input arguments
</entry>
3989 <entry><structfield>pronargdefaults
</structfield></entry>
3990 <entry><type>int2
</type></entry>
3992 <entry>Number of arguments that have defaults
</entry>
3996 <entry><structfield>prorettype
</structfield></entry>
3997 <entry><type>oid
</type></entry>
3998 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
3999 <entry>Data type of the return value
</entry>
4003 <entry><structfield>proargtypes
</structfield></entry>
4004 <entry><type>oidvector
</type></entry>
4005 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
4007 An array with the data types of the function arguments. This includes
4008 only input arguments (including
<literal>INOUT
</literal> and
4009 <literal>VARIADIC<
/> arguments), and thus represents
4010 the call signature of the function.
4015 <entry><structfield>proallargtypes
</structfield></entry>
4016 <entry><type>oid[]
</type></entry>
4017 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
4019 An array with the data types of the function arguments. This includes
4020 all arguments (including
<literal>OUT
</literal> and
4021 <literal>INOUT
</literal> arguments); however, if all the
4022 arguments are
<literal>IN
</literal> arguments, this field will be null.
4023 Note that subscripting is
1-based, whereas for historical reasons
4024 <structfield>proargtypes<
/> is subscripted from
0.
4029 <entry><structfield>proargmodes
</structfield></entry>
4030 <entry><type>char[]
</type></entry>
4033 An array with the modes of the function arguments, encoded as
4034 <literal>i
</literal> for
<literal>IN<
/> arguments,
4035 <literal>o
</literal> for
<literal>OUT<
/> arguments,
4036 <literal>b
</literal> for
<literal>INOUT<
/> arguments,
4037 <literal>v
</literal> for
<literal>VARIADIC<
/> arguments,
4038 <literal>t
</literal> for
<literal>TABLE<
/> arguments.
4039 If all the arguments are
<literal>IN
</literal> arguments,
4040 this field will be null.
4041 Note that subscripts correspond to positions of
4042 <structfield>proallargtypes<
/> not
<structfield>proargtypes<
/>.
4047 <entry><structfield>proargnames
</structfield></entry>
4048 <entry><type>text[]
</type></entry>
4051 An array with the names of the function arguments.
4052 Arguments without a name are set to empty strings in the array.
4053 If none of the arguments have a name, this field will be null.
4054 Note that subscripts correspond to positions of
4055 <structfield>proallargtypes<
/> not
<structfield>proargtypes<
/>.
4060 <entry><structfield>proargdefaults
</structfield></entry>
4061 <entry><type>pg_node_tree
</type></entry>
4064 Expression trees (in
<function>nodeToString()
</function> representation)
4065 for default values. This is a list with
4066 <structfield>pronargdefaults<
/> elements, corresponding to the last
4067 <replaceable>N<
/> <emphasis>input<
/> arguments (i.e., the last
4068 <replaceable>N<
/> <structfield>proargtypes<
/> positions).
4069 If none of the arguments have defaults, this field will be null.
4074 <entry><structfield>prosrc
</structfield></entry>
4075 <entry><type>text
</type></entry>
4078 This tells the function handler how to invoke the function. It
4079 might be the actual source code of the function for interpreted
4080 languages, a link symbol, a file name, or just about anything
4081 else, depending on the implementation language/call convention.
4086 <entry><structfield>probin
</structfield></entry>
4087 <entry><type>text
</type></entry>
4090 Additional information about how to invoke the function.
4091 Again, the interpretation is language-specific.
4096 <entry><structfield>proconfig
</structfield></entry>
4097 <entry><type>text[]
</type></entry>
4099 <entry>Function's local settings for run-time configuration variables
</entry>
4103 <entry><structfield>proacl
</structfield></entry>
4104 <entry><type>aclitem[]
</type></entry>
4107 Access privileges; see
4108 <xref linkend=
"sql-grant"> and
4109 <xref linkend=
"sql-revoke">
4118 For compiled functions, both built-in and dynamically loaded,
4119 <structfield>prosrc
</structfield> contains the function's C-language
4120 name (link symbol). For all other currently-known language types,
4121 <structfield>prosrc
</structfield> contains the function's source
4122 text.
<structfield>probin
</structfield> is unused except for
4123 dynamically-loaded C functions, for which it gives the name of the
4124 shared library file containing the function.
4129 <sect1 id=
"catalog-pg-rewrite">
4130 <title><structname>pg_rewrite
</structname></title>
4132 <indexterm zone=
"catalog-pg-rewrite">
4133 <primary>pg_rewrite
</primary>
4137 The catalog
<structname>pg_rewrite
</structname> stores rewrite rules for tables and views.
4141 <title><structname>pg_rewrite<
/> Columns
</title>
4148 <entry>References
</entry>
4149 <entry>Description
</entry>
4155 <entry><structfield>rulename
</structfield></entry>
4156 <entry><type>name
</type></entry>
4158 <entry>Rule name
</entry>
4162 <entry><structfield>ev_class
</structfield></entry>
4163 <entry><type>oid
</type></entry>
4164 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
4165 <entry>The table this rule is for
</entry>
4169 <entry><structfield>ev_attr
</structfield></entry>
4170 <entry><type>int2
</type></entry>
4172 <entry>The column this rule is for (currently, always zero to
4173 indicate the whole table)
</entry>
4177 <entry><structfield>ev_type
</structfield></entry>
4178 <entry><type>char
</type></entry>
4181 Event type that the rule is for:
1 =
<command>SELECT<
/>,
2 =
4182 <command>UPDATE<
/>,
3 =
<command>INSERT<
/>,
4 =
4188 <entry><structfield>ev_enabled
</structfield></entry>
4189 <entry><type>char
</type></entry>
4192 Controls in which
<xref linkend=
"guc-session-replication-role"> modes
4194 <literal>O<
/> = rule fires in
<quote>origin<
/> and
<quote>local<
/> modes,
4195 <literal>D<
/> = rule is disabled,
4196 <literal>R<
/> = rule fires in
<quote>replica<
/> mode,
4197 <literal>A<
/> = rule fires always.
4202 <entry><structfield>is_instead
</structfield></entry>
4203 <entry><type>bool
</type></entry>
4205 <entry>True if the rule is an
<literal>INSTEAD
</literal> rule
</entry>
4209 <entry><structfield>ev_qual
</structfield></entry>
4210 <entry><type>pg_node_tree
</type></entry>
4213 Expression tree (in the form of a
4214 <function>nodeToString()
</function> representation) for the
4215 rule's qualifying condition
4220 <entry><structfield>ev_action
</structfield></entry>
4221 <entry><type>pg_node_tree
</type></entry>
4224 Query tree (in the form of a
4225 <function>nodeToString()
</function> representation) for the
4235 <literal>pg_class.relhasrules
</literal>
4236 must be true if a table has any rules in this catalog.
4242 <sect1 id=
"catalog-pg-db-role-setting">
4243 <title><structname>pg_db_role_setting
</structname></title>
4245 <indexterm zone=
"catalog-pg-db-role-setting">
4246 <primary>pg_db_role_setting
</primary>
4250 The catalog
<structname>pg_db_role_setting
</structname> records the default
4251 values that have been set for run-time configuration variables,
4252 for each role and database combination.
4256 Unlike most system catalogs,
<structname>pg_db_role_setting
</structname>
4257 is shared across all databases of a cluster: there is only one
4258 copy of
<structname>pg_db_role_setting
</structname> per cluster, not
4263 <title><structname>pg_db_role_setting<
/> Columns
</title>
4270 <entry>References
</entry>
4271 <entry>Description
</entry>
4277 <entry><structfield>setdatabase
</structfield></entry>
4278 <entry><type>oid
</type></entry>
4279 <entry><literal><link linkend=
"catalog-pg-database"><structname>pg_database
</structname></link>.oid
</literal></entry>
4280 <entry>The OID of the database the setting is applicable to, or zero if not database-specific
</entry>
4284 <entry><structfield>setrole
</structfield></entry>
4285 <entry><type>oid
</type></entry>
4286 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
4287 <entry>The OID of the role the setting is applicable to, or zero if not role-specific
</entry>
4291 <entry><structfield>setconfig
</structfield></entry>
4292 <entry><type>text[]
</type></entry>
4294 <entry>Defaults for run-time configuration variables
</entry>
4302 <sect1 id=
"catalog-pg-shdepend">
4303 <title><structname>pg_shdepend
</structname></title>
4305 <indexterm zone=
"catalog-pg-shdepend">
4306 <primary>pg_shdepend
</primary>
4310 The catalog
<structname>pg_shdepend
</structname> records the
4311 dependency relationships between database objects and shared objects,
4312 such as roles. This information allows
4313 <productname>PostgreSQL
</productname> to ensure that those objects are
4314 unreferenced before attempting to delete them.
4318 See also
<link linkend=
"catalog-pg-depend"><structname>pg_depend
</structname></link>,
4319 which performs a similar function for dependencies involving objects
4320 within a single database.
4324 Unlike most system catalogs,
<structname>pg_shdepend
</structname>
4325 is shared across all databases of a cluster: there is only one
4326 copy of
<structname>pg_shdepend
</structname> per cluster, not
4331 <title><structname>pg_shdepend<
/> Columns
</title>
4338 <entry>References
</entry>
4339 <entry>Description
</entry>
4345 <entry><structfield>dbid
</structfield></entry>
4346 <entry><type>oid
</type></entry>
4347 <entry><literal><link linkend=
"catalog-pg-database"><structname>pg_database
</structname></link>.oid
</literal></entry>
4348 <entry>The OID of the database the dependent object is in,
4349 or zero for a shared object
</entry>
4353 <entry><structfield>classid
</structfield></entry>
4354 <entry><type>oid
</type></entry>
4355 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
4356 <entry>The OID of the system catalog the dependent object is in
</entry>
4360 <entry><structfield>objid
</structfield></entry>
4361 <entry><type>oid
</type></entry>
4362 <entry>any OID column
</entry>
4363 <entry>The OID of the specific dependent object
</entry>
4367 <entry><structfield>objsubid
</structfield></entry>
4368 <entry><type>int4
</type></entry>
4371 For a table column, this is the column number (the
4372 <structfield>objid<
/> and
<structfield>classid<
/> refer to the
4373 table itself). For all other object types, this column is zero.
4378 <entry><structfield>refclassid
</structfield></entry>
4379 <entry><type>oid
</type></entry>
4380 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
4381 <entry>The OID of the system catalog the referenced object is in
4382 (must be a shared catalog)
</entry>
4386 <entry><structfield>refobjid
</structfield></entry>
4387 <entry><type>oid
</type></entry>
4388 <entry>any OID column
</entry>
4389 <entry>The OID of the specific referenced object
</entry>
4393 <entry><structfield>deptype
</structfield></entry>
4394 <entry><type>char
</type></entry>
4397 A code defining the specific semantics of this dependency relationship; see text
4406 In all cases, a
<structname>pg_shdepend
</structname> entry indicates that
4407 the referenced object cannot be dropped without also dropping the dependent
4408 object. However, there are several subflavors identified by
4409 <structfield>deptype<
/>:
4413 <term><symbol>SHARED_DEPENDENCY_OWNER<
/> (
<literal>o<
/>)
</term>
4416 The referenced object (which must be a role) is the owner of the
4423 <term><symbol>SHARED_DEPENDENCY_ACL<
/> (
<literal>a<
/>)
</term>
4426 The referenced object (which must be a role) is mentioned in the
4427 ACL (access control list, i.e., privileges list) of the
4428 dependent object. (A
<symbol>SHARED_DEPENDENCY_ACL<
/> entry is
4429 not made for the owner of the object, since the owner will have
4430 a
<symbol>SHARED_DEPENDENCY_OWNER<
/> entry anyway.)
4436 <term><symbol>SHARED_DEPENDENCY_PIN<
/> (
<literal>p<
/>)
</term>
4439 There is no dependent object; this type of entry is a signal
4440 that the system itself depends on the referenced object, and so
4441 that object must never be deleted. Entries of this type are
4442 created only by
<command>initdb
</command>. The columns for the
4443 dependent object contain zeroes.
4449 Other dependency flavors might be needed in future. Note in particular
4450 that the current definition only supports roles as referenced objects.
4455 <sect1 id=
"catalog-pg-shdescription">
4456 <title><structname>pg_shdescription
</structname></title>
4458 <indexterm zone=
"catalog-pg-shdescription">
4459 <primary>pg_shdescription
</primary>
4463 The catalog
<structname>pg_shdescription
</structname> stores optional
4464 descriptions (comments) for shared database objects. Descriptions can be
4465 manipulated with the
<xref linkend=
"sql-comment"> command and viewed with
4466 <application>psql
</application>'s
<literal>\d
</literal> commands.
4470 See also
<link linkend=
"catalog-pg-description"><structname>pg_description
</structname></link>,
4471 which performs a similar function for descriptions involving objects
4472 within a single database.
4476 Unlike most system catalogs,
<structname>pg_shdescription
</structname>
4477 is shared across all databases of a cluster: there is only one
4478 copy of
<structname>pg_shdescription
</structname> per cluster, not
4483 <title><structname>pg_shdescription<
/> Columns
</title>
4490 <entry>References
</entry>
4491 <entry>Description
</entry>
4497 <entry><structfield>objoid
</structfield></entry>
4498 <entry><type>oid
</type></entry>
4499 <entry>any OID column
</entry>
4500 <entry>The OID of the object this description pertains to
</entry>
4504 <entry><structfield>classoid
</structfield></entry>
4505 <entry><type>oid
</type></entry>
4506 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
4507 <entry>The OID of the system catalog this object appears in
</entry>
4511 <entry><structfield>description
</structfield></entry>
4512 <entry><type>text
</type></entry>
4514 <entry>Arbitrary text that serves as the description of this object
</entry>
4523 <sect1 id=
"catalog-pg-statistic">
4524 <title><structname>pg_statistic
</structname></title>
4526 <indexterm zone=
"catalog-pg-statistic">
4527 <primary>pg_statistic
</primary>
4531 The catalog
<structname>pg_statistic
</structname> stores
4532 statistical data about the contents of the database. Entries are
4533 created by
<xref linkend=
"sql-analyze">
4534 and subsequently used by the query planner. Note that all the
4535 statistical data is inherently approximate, even assuming that it
4540 Normally there is one entry, with
<structfield>stainherit<
/> =
4541 <literal>false<
/>, for each table column that has been analyzed.
4542 If the table has inheritance children, a second entry with
4543 <structfield>stainherit<
/> =
<literal>true<
/> is also created. This row
4544 represents the column's statistics over the inheritance tree, i.e.,
4545 statistics for the data you'd see with
4546 <literal>SELECT
<replaceable>column<
/> FROM
<replaceable>table<
/>*
</literal>,
4547 whereas the
<structfield>stainherit<
/> =
<literal>false<
/> row represents
4549 <literal>SELECT
<replaceable>column<
/> FROM ONLY
<replaceable>table<
/></literal>.
4553 <structname>pg_statistic
</structname> also stores statistical data about
4554 the values of index expressions. These are described as if they were
4555 actual data columns; in particular,
<structfield>starelid
</structfield>
4556 references the index. No entry is made for an ordinary non-expression
4557 index column, however, since it would be redundant with the entry
4558 for the underlying table column. Currently, entries for index expressions
4559 always have
<structfield>stainherit<
/> =
<literal>false<
/>.
4563 Since different kinds of statistics might be appropriate for different
4564 kinds of data,
<structname>pg_statistic
</structname> is designed not
4565 to assume very much about what sort of statistics it stores. Only
4566 extremely general statistics (such as nullness) are given dedicated
4567 columns in
<structname>pg_statistic
</structname>. Everything else
4568 is stored in
<quote>slots
</quote>, which are groups of associated columns
4569 whose content is identified by a code number in one of the slot's columns.
4570 For more information see
4571 <filename>src/include/catalog/pg_statistic.h
</filename>.
4575 <structname>pg_statistic
</structname> should not be readable by the
4576 public, since even statistical information about a table's contents
4577 might be considered sensitive. (Example: minimum and maximum values
4578 of a salary column might be quite interesting.)
4579 <link linkend=
"view-pg-stats"><structname>pg_stats
</structname></link>
4580 is a publicly readable view on
4581 <structname>pg_statistic
</structname> that only exposes information
4582 about those tables that are readable by the current user.
4586 <title><structname>pg_statistic<
/> Columns
</title>
4593 <entry>References
</entry>
4594 <entry>Description
</entry>
4600 <entry><structfield>starelid
</structfield></entry>
4601 <entry><type>oid
</type></entry>
4602 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
4603 <entry>The table or index that the described column belongs to
</entry>
4607 <entry><structfield>staattnum
</structfield></entry>
4608 <entry><type>int2
</type></entry>
4609 <entry><literal><link linkend=
"catalog-pg-attribute"><structname>pg_attribute
</structname></link>.attnum
</literal></entry>
4610 <entry>The number of the described column
</entry>
4614 <entry><structfield>stainherit
</structfield></entry>
4615 <entry><type>bool
</type></entry>
4617 <entry>If true, the stats include inheritance child columns, not just the
4618 values in the specified relation
</entry>
4622 <entry><structfield>stanullfrac
</structfield></entry>
4623 <entry><type>float4
</type></entry>
4625 <entry>The fraction of the column's entries that are null
</entry>
4629 <entry><structfield>stawidth
</structfield></entry>
4630 <entry><type>int4
</type></entry>
4632 <entry>The average stored width, in bytes, of nonnull entries
</entry>
4636 <entry><structfield>stadistinct
</structfield></entry>
4637 <entry><type>float4
</type></entry>
4639 <entry>The number of distinct nonnull data values in the column.
4640 A value greater than zero is the actual number of distinct values.
4641 A value less than zero is the negative of a multiplier for the number
4642 of rows in the table; for example, a column in which values appear about
4643 twice on the average could be represented by
4644 <structfield>stadistinct<
/> = -
0.5.
4645 A zero value means the number of distinct values is unknown.
4650 <entry><structfield>stakind
<replaceable>N<
/></structfield></entry>
4651 <entry><type>int2
</type></entry>
4654 A code number indicating the kind of statistics stored in the
4655 <replaceable>N<
/>th
<quote>slot
</quote> of the
4656 <structname>pg_statistic
</structname> row.
4661 <entry><structfield>staop
<replaceable>N<
/></structfield></entry>
4662 <entry><type>oid
</type></entry>
4663 <entry><literal><link linkend=
"catalog-pg-operator"><structname>pg_operator
</structname></link>.oid
</literal></entry>
4665 An operator used to derive the statistics stored in the
4666 <replaceable>N<
/>th
<quote>slot
</quote>. For example, a
4667 histogram slot would show the
<literal><</literal> operator
4668 that defines the sort order of the data.
4673 <entry><structfield>stanumbers
<replaceable>N<
/></structfield></entry>
4674 <entry><type>float4[]
</type></entry>
4677 Numerical statistics of the appropriate kind for the
4678 <replaceable>N<
/>th
<quote>slot
</quote>, or null if the slot
4679 kind does not involve numerical values
4684 <entry><structfield>stavalues
<replaceable>N<
/></structfield></entry>
4685 <entry><type>anyarray
</type></entry>
4688 Column data values of the appropriate kind for the
4689 <replaceable>N<
/>th
<quote>slot
</quote>, or null if the slot
4690 kind does not store any data values. Each array's element
4691 values are actually of the specific column's data type, so there
4692 is no way to define these columns' type more specifically than
4703 <sect1 id=
"catalog-pg-tablespace">
4704 <title><structname>pg_tablespace
</structname></title>
4706 <indexterm zone=
"catalog-pg-tablespace">
4707 <primary>pg_tablespace
</primary>
4711 The catalog
<structname>pg_tablespace
</structname> stores information
4712 about the available tablespaces. Tables can be placed in particular
4713 tablespaces to aid administration of disk layout.
4717 Unlike most system catalogs,
<structname>pg_tablespace
</structname>
4718 is shared across all databases of a cluster: there is only one
4719 copy of
<structname>pg_tablespace
</structname> per cluster, not
4724 <title><structname>pg_tablespace<
/> Columns
</title>
4731 <entry>References
</entry>
4732 <entry>Description
</entry>
4738 <entry><structfield>spcname
</structfield></entry>
4739 <entry><type>name
</type></entry>
4741 <entry>Tablespace name
</entry>
4745 <entry><structfield>spcowner
</structfield></entry>
4746 <entry><type>oid
</type></entry>
4747 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
4748 <entry>Owner of the tablespace, usually the user who created it
</entry>
4752 <entry><structfield>spclocation
</structfield></entry>
4753 <entry><type>text
</type></entry>
4755 <entry>Location (directory path) of the tablespace
</entry>
4759 <entry><structfield>spcacl
</structfield></entry>
4760 <entry><type>aclitem[]
</type></entry>
4763 Access privileges; see
4764 <xref linkend=
"sql-grant"> and
4765 <xref linkend=
"sql-revoke">
4771 <entry><structfield>spcoptions
</structfield></entry>
4772 <entry><type>text[]
</type></entry>
4775 Tablespace-level options, as
<quote>keyword=value<
/> strings
4784 <sect1 id=
"catalog-pg-trigger">
4785 <title><structname>pg_trigger
</structname></title>
4787 <indexterm zone=
"catalog-pg-trigger">
4788 <primary>pg_trigger
</primary>
4792 The catalog
<structname>pg_trigger
</structname> stores triggers on tables.
4793 See
<xref linkend=
"sql-createtrigger">
4794 for more information.
4798 <title><structname>pg_trigger<
/> Columns
</title>
4805 <entry>References
</entry>
4806 <entry>Description
</entry>
4812 <entry><structfield>tgrelid
</structfield></entry>
4813 <entry><type>oid
</type></entry>
4814 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
4815 <entry>The table this trigger is on
</entry>
4819 <entry><structfield>tgname
</structfield></entry>
4820 <entry><type>name
</type></entry>
4822 <entry>Trigger name (must be unique among triggers of same table)
</entry>
4826 <entry><structfield>tgfoid
</structfield></entry>
4827 <entry><type>oid
</type></entry>
4828 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
4829 <entry>The function to be called
</entry>
4833 <entry><structfield>tgtype
</structfield></entry>
4834 <entry><type>int2
</type></entry>
4836 <entry>Bit mask identifying trigger conditions
</entry>
4840 <entry><structfield>tgenabled
</structfield></entry>
4841 <entry><type>char
</type></entry>
4844 Controls in which
<xref linkend=
"guc-session-replication-role"> modes
4846 <literal>O<
/> = trigger fires in
<quote>origin<
/> and
<quote>local<
/> modes,
4847 <literal>D<
/> = trigger is disabled,
4848 <literal>R<
/> = trigger fires in
<quote>replica<
/> mode,
4849 <literal>A<
/> = trigger fires always.
4854 <entry><structfield>tgisinternal
</structfield></entry>
4855 <entry><type>bool
</type></entry>
4857 <entry>True if trigger is internally generated (usually, to enforce
4858 the constraint identified by
<structfield>tgconstraint<
/>)
</entry>
4862 <entry><structfield>tgconstrrelid
</structfield></entry>
4863 <entry><type>oid
</type></entry>
4864 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
4865 <entry>The table referenced by a referential integrity constraint
</entry>
4869 <entry><structfield>tgconstrindid
</structfield></entry>
4870 <entry><type>oid
</type></entry>
4871 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
4872 <entry>The index supporting a unique, primary key, or referential integrity constraint
</entry>
4876 <entry><structfield>tgconstraint
</structfield></entry>
4877 <entry><type>oid
</type></entry>
4878 <entry><literal><link linkend=
"catalog-pg-constraint"><structname>pg_constraint
</structname></link>.oid
</literal></entry>
4879 <entry>The
<structname>pg_constraint<
/> entry associated with the trigger, if any
</entry>
4883 <entry><structfield>tgdeferrable
</structfield></entry>
4884 <entry><type>bool
</type></entry>
4886 <entry>True if constraint trigger is deferrable
</entry>
4890 <entry><structfield>tginitdeferred
</structfield></entry>
4891 <entry><type>bool
</type></entry>
4893 <entry>True if constraint trigger is initially deferred
</entry>
4897 <entry><structfield>tgnargs
</structfield></entry>
4898 <entry><type>int2
</type></entry>
4900 <entry>Number of argument strings passed to trigger function
</entry>
4904 <entry><structfield>tgattr
</structfield></entry>
4905 <entry><type>int2vector
</type></entry>
4906 <entry><literal><link linkend=
"catalog-pg-attribute"><structname>pg_attribute
</structname></link>.attnum
</literal></entry>
4907 <entry>Column numbers, if trigger is column-specific; otherwise an
4912 <entry><structfield>tgargs
</structfield></entry>
4913 <entry><type>bytea
</type></entry>
4915 <entry>Argument strings to pass to trigger, each NULL-terminated
</entry>
4919 <entry><structfield>tgqual
</structfield></entry>
4920 <entry><type>pg_node_tree
</type></entry>
4922 <entry>Expression tree (in
<function>nodeToString()
</function>
4923 representation) for the trigger's
<literal>WHEN<
/> condition, or null
4931 Currently, column-specific triggering is supported only for
4932 <literal>UPDATE<
/> events, and so
<structfield>tgattr<
/> is relevant
4933 only for that event type.
<structfield>tgtype
</structfield> might
4934 contain bits for other event types as well, but those are presumed
4935 to be table-wide regardless of what is in
<structfield>tgattr<
/>.
4940 When
<structfield>tgconstraint<
/> is nonzero,
4941 <structfield>tgconstrrelid<
/>,
<structfield>tgconstrindid<
/>,
4942 <structfield>tgdeferrable<
/>, and
<structfield>tginitdeferred<
/> are
4943 largely redundant with the referenced
<structname>pg_constraint<
/> entry.
4944 However, it is possible for a non-deferrable trigger to be associated
4945 with a deferrable constraint: foreign key constraints can have some
4946 deferrable and some non-deferrable triggers.
4952 <literal>pg_class.relhastriggers
</literal>
4953 must be true if a table has any triggers in this catalog.
4960 <sect1 id=
"catalog-pg-ts-config">
4961 <title><structname>pg_ts_config
</structname></title>
4963 <indexterm zone=
"catalog-pg-ts-config">
4964 <primary>pg_ts_config
</primary>
4968 The
<structname>pg_ts_config
</structname> catalog contains entries
4969 representing text search configurations. A configuration specifies
4970 a particular text search parser and a list of dictionaries to use
4971 for each of the parser's output token types. The parser is shown
4972 in the
<structname>pg_ts_config
</structname> entry, but the
4973 token-to-dictionary mapping is defined by subsidiary entries in
<link
4974 linkend=
"catalog-pg-ts-config-map"><structname>pg_ts_config_map
</structname></link>.
4978 <productname>PostgreSQL
</productname>'s text search features are
4979 described at length in
<xref linkend=
"textsearch">.
4983 <title><structname>pg_ts_config<
/> Columns
</title>
4990 <entry>References
</entry>
4991 <entry>Description
</entry>
4997 <entry><structfield>cfgname
</structfield></entry>
4998 <entry><type>name
</type></entry>
5000 <entry>Text search configuration name
</entry>
5004 <entry><structfield>cfgnamespace
</structfield></entry>
5005 <entry><type>oid
</type></entry>
5006 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
5008 The OID of the namespace that contains this configuration
5013 <entry><structfield>cfgowner
</structfield></entry>
5014 <entry><type>oid
</type></entry>
5015 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
5016 <entry>Owner of the configuration
</entry>
5020 <entry><structfield>cfgparser
</structfield></entry>
5021 <entry><type>oid
</type></entry>
5022 <entry><literal><link linkend=
"catalog-pg-ts-parser"><structname>pg_ts_parser
</structname></link>.oid
</literal></entry>
5023 <entry>The OID of the text search parser for this configuration
</entry>
5031 <sect1 id=
"catalog-pg-ts-config-map">
5032 <title><structname>pg_ts_config_map
</structname></title>
5034 <indexterm zone=
"catalog-pg-ts-config-map">
5035 <primary>pg_ts_config_map
</primary>
5039 The
<structname>pg_ts_config_map
</structname> catalog contains entries
5040 showing which text search dictionaries should be consulted, and in
5041 what order, for each output token type of each text search configuration's
5046 <productname>PostgreSQL
</productname>'s text search features are
5047 described at length in
<xref linkend=
"textsearch">.
5051 <title><structname>pg_ts_config_map<
/> Columns
</title>
5058 <entry>References
</entry>
5059 <entry>Description
</entry>
5065 <entry><structfield>mapcfg
</structfield></entry>
5066 <entry><type>oid
</type></entry>
5067 <entry><literal><link linkend=
"catalog-pg-ts-config"><structname>pg_ts_config
</structname></link>.oid
</literal></entry>
5068 <entry>The OID of the
<structname>pg_ts_config<
/> entry owning this map entry
</entry>
5072 <entry><structfield>maptokentype
</structfield></entry>
5073 <entry><type>integer
</type></entry>
5075 <entry>A token type emitted by the configuration's parser
</entry>
5079 <entry><structfield>mapseqno
</structfield></entry>
5080 <entry><type>integer
</type></entry>
5082 <entry>Order in which to consult this entry (lower
5083 <structfield>mapseqno<
/>s first)
</entry>
5087 <entry><structfield>mapdict
</structfield></entry>
5088 <entry><type>oid
</type></entry>
5089 <entry><literal><link linkend=
"catalog-pg-ts-dict"><structname>pg_ts_dict
</structname></link>.oid
</literal></entry>
5090 <entry>The OID of the text search dictionary to consult
</entry>
5098 <sect1 id=
"catalog-pg-ts-dict">
5099 <title><structname>pg_ts_dict
</structname></title>
5101 <indexterm zone=
"catalog-pg-ts-dict">
5102 <primary>pg_ts_dict
</primary>
5106 The
<structname>pg_ts_dict
</structname> catalog contains entries
5107 defining text search dictionaries. A dictionary depends on a text
5108 search template, which specifies all the implementation functions
5109 needed; the dictionary itself provides values for the user-settable
5110 parameters supported by the template. This division of labor allows
5111 dictionaries to be created by unprivileged users. The parameters
5112 are specified by a text string
<structfield>dictinitoption<
/>,
5113 whose format and meaning vary depending on the template.
5117 <productname>PostgreSQL
</productname>'s text search features are
5118 described at length in
<xref linkend=
"textsearch">.
5122 <title><structname>pg_ts_dict<
/> Columns
</title>
5129 <entry>References
</entry>
5130 <entry>Description
</entry>
5136 <entry><structfield>dictname
</structfield></entry>
5137 <entry><type>name
</type></entry>
5139 <entry>Text search dictionary name
</entry>
5143 <entry><structfield>dictnamespace
</structfield></entry>
5144 <entry><type>oid
</type></entry>
5145 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
5147 The OID of the namespace that contains this dictionary
5152 <entry><structfield>dictowner
</structfield></entry>
5153 <entry><type>oid
</type></entry>
5154 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
5155 <entry>Owner of the dictionary
</entry>
5159 <entry><structfield>dicttemplate
</structfield></entry>
5160 <entry><type>oid
</type></entry>
5161 <entry><literal><link linkend=
"catalog-pg-ts-template"><structname>pg_ts_template
</structname></link>.oid
</literal></entry>
5162 <entry>The OID of the text search template for this dictionary
</entry>
5166 <entry><structfield>dictinitoption
</structfield></entry>
5167 <entry><type>text
</type></entry>
5169 <entry>Initialization option string for the template
</entry>
5177 <sect1 id=
"catalog-pg-ts-parser">
5178 <title><structname>pg_ts_parser
</structname></title>
5180 <indexterm zone=
"catalog-pg-ts-parser">
5181 <primary>pg_ts_parser
</primary>
5185 The
<structname>pg_ts_parser
</structname> catalog contains entries
5186 defining text search parsers. A parser is responsible for splitting
5187 input text into lexemes and assigning a token type to each lexeme.
5188 Since a parser must be implemented by C-language-level functions,
5189 creation of new parsers is restricted to database superusers.
5193 <productname>PostgreSQL
</productname>'s text search features are
5194 described at length in
<xref linkend=
"textsearch">.
5198 <title><structname>pg_ts_parser<
/> Columns
</title>
5205 <entry>References
</entry>
5206 <entry>Description
</entry>
5212 <entry><structfield>prsname
</structfield></entry>
5213 <entry><type>name
</type></entry>
5215 <entry>Text search parser name
</entry>
5219 <entry><structfield>prsnamespace
</structfield></entry>
5220 <entry><type>oid
</type></entry>
5221 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
5223 The OID of the namespace that contains this parser
5228 <entry><structfield>prsstart
</structfield></entry>
5229 <entry><type>regproc
</type></entry>
5230 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5231 <entry>OID of the parser's startup function
</entry>
5235 <entry><structfield>prstoken
</structfield></entry>
5236 <entry><type>regproc
</type></entry>
5237 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5238 <entry>OID of the parser's next-token function
</entry>
5242 <entry><structfield>prsend
</structfield></entry>
5243 <entry><type>regproc
</type></entry>
5244 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5245 <entry>OID of the parser's shutdown function
</entry>
5249 <entry><structfield>prsheadline
</structfield></entry>
5250 <entry><type>regproc
</type></entry>
5251 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5252 <entry>OID of the parser's headline function
</entry>
5256 <entry><structfield>prslextype
</structfield></entry>
5257 <entry><type>regproc
</type></entry>
5258 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5259 <entry>OID of the parser's lextype function
</entry>
5267 <sect1 id=
"catalog-pg-ts-template">
5268 <title><structname>pg_ts_template
</structname></title>
5270 <indexterm zone=
"catalog-pg-ts-template">
5271 <primary>pg_ts_template
</primary>
5275 The
<structname>pg_ts_template
</structname> catalog contains entries
5276 defining text search templates. A template is the implementation
5277 skeleton for a class of text search dictionaries.
5278 Since a template must be implemented by C-language-level functions,
5279 creation of new templates is restricted to database superusers.
5283 <productname>PostgreSQL
</productname>'s text search features are
5284 described at length in
<xref linkend=
"textsearch">.
5288 <title><structname>pg_ts_template<
/> Columns
</title>
5295 <entry>References
</entry>
5296 <entry>Description
</entry>
5302 <entry><structfield>tmplname
</structfield></entry>
5303 <entry><type>name
</type></entry>
5305 <entry>Text search template name
</entry>
5309 <entry><structfield>tmplnamespace
</structfield></entry>
5310 <entry><type>oid
</type></entry>
5311 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
5313 The OID of the namespace that contains this template
5318 <entry><structfield>tmplinit
</structfield></entry>
5319 <entry><type>regproc
</type></entry>
5320 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5321 <entry>OID of the template's initialization function
</entry>
5325 <entry><structfield>tmpllexize
</structfield></entry>
5326 <entry><type>regproc
</type></entry>
5327 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5328 <entry>OID of the template's lexize function
</entry>
5336 <sect1 id=
"catalog-pg-type">
5337 <title><structname>pg_type
</structname></title>
5339 <indexterm zone=
"catalog-pg-type">
5340 <primary>pg_type
</primary>
5344 The catalog
<structname>pg_type
</structname> stores information about data
5345 types. Base types and enum types (scalar types) are created with
5346 <xref linkend=
"sql-createtype">, and
5348 <xref linkend=
"sql-createdomain">.
5349 A composite type is automatically created for each table in the database, to
5350 represent the row structure of the table. It is also possible to create
5351 composite types with
<command>CREATE TYPE AS
</command>.
5355 <title><structname>pg_type<
/> Columns
</title>
5362 <entry>References
</entry>
5363 <entry>Description
</entry>
5369 <entry><structfield>typname
</structfield></entry>
5370 <entry><type>name
</type></entry>
5372 <entry>Data type name
</entry>
5376 <entry><structfield>typnamespace
</structfield></entry>
5377 <entry><type>oid
</type></entry>
5378 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.oid
</literal></entry>
5380 The OID of the namespace that contains this type
5385 <entry><structfield>typowner
</structfield></entry>
5386 <entry><type>oid
</type></entry>
5387 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
5388 <entry>Owner of the type
</entry>
5392 <entry><structfield>typlen
</structfield></entry>
5393 <entry><type>int2
</type></entry>
5396 For a fixed-size type,
<structfield>typlen
</structfield> is the number
5397 of bytes in the internal representation of the type. But for a
5398 variable-length type,
<structfield>typlen
</structfield> is negative.
5399 -
1 indicates a
<quote>varlena<
/> type (one that has a length word),
5400 -
2 indicates a null-terminated C string.
5405 <entry><structfield>typbyval
</structfield></entry>
5406 <entry><type>bool
</type></entry>
5409 <structfield>typbyval
</structfield> determines whether internal
5410 routines pass a value of this type by value or by reference.
5411 <structfield>typbyval
</structfield> had better be false if
5412 <structfield>typlen
</structfield> is not
1,
2, or
4 (or
8 on machines
5413 where Datum is
8 bytes).
5414 Variable-length types are always passed by reference. Note that
5415 <structfield>typbyval
</structfield> can be false even if the
5416 length would allow pass-by-value.
5421 <entry><structfield>typtype
</structfield></entry>
5422 <entry><type>char
</type></entry>
5425 <structfield>typtype
</structfield> is
5426 <literal>b
</literal> for a base type,
5427 <literal>c
</literal> for a composite type (e.g., a table's row type),
5428 <literal>d
</literal> for a domain,
5429 <literal>e
</literal> for an enum type,
5430 or
<literal>p
</literal> for a pseudo-type.
5431 See also
<structfield>typrelid
</structfield> and
5432 <structfield>typbasetype
</structfield>.
5437 <entry><structfield>typcategory
</structfield></entry>
5438 <entry><type>char
</type></entry>
5441 <structfield>typcategory
</structfield> is an arbitrary classification
5442 of data types that is used by the parser to determine which implicit
5443 casts should be
<quote>preferred<
/>.
5444 See
<xref linkend=
"catalog-typcategory-table">.
5449 <entry><structfield>typispreferred
</structfield></entry>
5450 <entry><type>bool
</type></entry>
5453 True if the type is a preferred cast target within its
5454 <structfield>typcategory
</structfield>
5459 <entry><structfield>typisdefined
</structfield></entry>
5460 <entry><type>bool
</type></entry>
5463 True if the type is defined, false if this is a placeholder
5464 entry for a not-yet-defined type. When
5465 <structfield>typisdefined
</structfield> is false, nothing
5466 except the type name, namespace, and OID can be relied on.
5471 <entry><structfield>typdelim
</structfield></entry>
5472 <entry><type>char
</type></entry>
5475 Character that separates two values of this type when parsing
5476 array input. Note that the delimiter is associated with the array
5477 element data type, not the array data type.
5482 <entry><structfield>typrelid
</structfield></entry>
5483 <entry><type>oid
</type></entry>
5484 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
5486 If this is a composite type (see
5487 <structfield>typtype
</structfield>), then this column points to
5488 the
<structname>pg_class
</structname> entry that defines the
5489 corresponding table. (For a free-standing composite type, the
5490 <structname>pg_class
</structname> entry doesn't really represent
5491 a table, but it is needed anyway for the type's
5492 <structname>pg_attribute
</structname> entries to link to.)
5493 Zero for non-composite types.
5498 <entry><structfield>typelem
</structfield></entry>
5499 <entry><type>oid
</type></entry>
5500 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
5502 If
<structfield>typelem
</structfield> is not
0 then it
5503 identifies another row in
<structname>pg_type
</structname>.
5504 The current type can then be subscripted like an array yielding
5505 values of type
<structfield>typelem
</structfield>. A
5506 <quote>true
</quote> array type is variable length
5507 (
<structfield>typlen
</structfield> = -
1),
5508 but some fixed-length (
<structfield>typlen
</structfield> > 0) types
5509 also have nonzero
<structfield>typelem
</structfield>, for example
5510 <type>name
</type> and
<type>point
</type>.
5511 If a fixed-length type has a
<structfield>typelem
</structfield> then
5512 its internal representation must be some number of values of the
5513 <structfield>typelem
</structfield> data type with no other data.
5514 Variable-length array types have a header defined by the array
5520 <entry><structfield>typarray
</structfield></entry>
5521 <entry><type>oid
</type></entry>
5522 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
5524 If
<structfield>typarray
</structfield> is not
0 then it
5525 identifies another row in
<structname>pg_type
</structname>, which
5526 is the
<quote>true
</quote> array type having this type as element
5531 <entry><structfield>typinput
</structfield></entry>
5532 <entry><type>regproc
</type></entry>
5533 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5534 <entry>Input conversion function (text format)
</entry>
5538 <entry><structfield>typoutput
</structfield></entry>
5539 <entry><type>regproc
</type></entry>
5540 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5541 <entry>Output conversion function (text format)
</entry>
5545 <entry><structfield>typreceive
</structfield></entry>
5546 <entry><type>regproc
</type></entry>
5547 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5548 <entry>Input conversion function (binary format), or
0 if none
</entry>
5552 <entry><structfield>typsend
</structfield></entry>
5553 <entry><type>regproc
</type></entry>
5554 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5555 <entry>Output conversion function (binary format), or
0 if none
</entry>
5559 <entry><structfield>typmodin
</structfield></entry>
5560 <entry><type>regproc
</type></entry>
5561 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5562 <entry>Type modifier input function, or
0 if type does not support modifiers
</entry>
5566 <entry><structfield>typmodout
</structfield></entry>
5567 <entry><type>regproc
</type></entry>
5568 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5569 <entry>Type modifier output function, or
0 to use the standard format
</entry>
5573 <entry><structfield>typanalyze
</structfield></entry>
5574 <entry><type>regproc
</type></entry>
5575 <entry><literal><link linkend=
"catalog-pg-proc"><structname>pg_proc
</structname></link>.oid
</literal></entry>
5576 <entry>Custom
<command>ANALYZE
</command> function, or
0 to use the standard function
</entry>
5580 <entry><structfield>typalign
</structfield></entry>
5581 <entry><type>char
</type></entry>
5585 <structfield>typalign
</structfield> is the alignment required
5586 when storing a value of this type. It applies to storage on
5587 disk as well as most representations of the value inside
5588 <productname>PostgreSQL<
/>.
5589 When multiple values are stored consecutively, such
5590 as in the representation of a complete row on disk, padding is
5591 inserted before a datum of this type so that it begins on the
5592 specified boundary. The alignment reference is the beginning
5593 of the first datum in the sequence.
5597 Possible values are:
5600 <para><literal>c<
/> =
<type>char
</type> alignment, i.e., no alignment needed.
</para>
5603 <para><literal>s<
/> =
<type>short
</type> alignment (
2 bytes on most machines).
</para>
5606 <para><literal>i<
/> =
<type>int
</type> alignment (
4 bytes on most machines).
</para>
5609 <para><literal>d<
/> =
<type>double
</type> alignment (
8 bytes on many machines, but by no means all).
</para>
5614 For types used in system tables, it is critical that the size
5615 and alignment defined in
<structname>pg_type
</structname>
5616 agree with the way that the compiler will lay out the column in
5617 a structure representing a table row.
5623 <entry><structfield>typstorage
</structfield></entry>
5624 <entry><type>char
</type></entry>
5627 <structfield>typstorage
</structfield> tells for varlena
5628 types (those with
<structfield>typlen
</structfield> = -
1) if
5629 the type is prepared for toasting and what the default strategy
5630 for attributes of this type should be.
5634 <para><literal>p<
/>: Value must always be stored plain.
</para>
5638 <literal>e<
/>: Value can be stored in a
<quote>secondary
</quote>
5639 relation (if relation has one, see
5640 <literal>pg_class.reltoastrelid
</literal>).
5644 <para><literal>m<
/>: Value can be stored compressed inline.
</para>
5647 <para><literal>x<
/>: Value can be stored compressed inline or stored in
<quote>secondary
</quote> storage.
</para>
5650 Note that
<literal>m<
/> columns can also be moved out to secondary
5651 storage, but only as a last resort (
<literal>e<
/> and
<literal>x<
/> columns are
5657 <entry><structfield>typnotnull
</structfield></entry>
5658 <entry><type>bool
</type></entry>
5661 <structfield>typnotnull
</structfield> represents a not-null
5662 constraint on a type. Used for domains only.
5667 <entry><structfield>typbasetype
</structfield></entry>
5668 <entry><type>oid
</type></entry>
5669 <entry><literal><link linkend=
"catalog-pg-type"><structname>pg_type
</structname></link>.oid
</literal></entry>
5671 If this is a domain (see
<structfield>typtype
</structfield>), then
5672 <structfield>typbasetype
</structfield> identifies the type that this
5673 one is based on. Zero if this type is not a domain.
5678 <entry><structfield>typtypmod
</structfield></entry>
5679 <entry><type>int4
</type></entry>
5682 Domains use
<structfield>typtypmod
</structfield> to record the
<literal>typmod<
/>
5683 to be applied to their base type (-
1 if base type does not use a
5684 <literal>typmod<
/>). -
1 if this type is not a domain.
5689 <entry><structfield>typndims
</structfield></entry>
5690 <entry><type>int4
</type></entry>
5693 <structfield>typndims
</structfield> is the number of array dimensions
5694 for a domain that is an array (that is,
<structfield>typbasetype<
/> is
5695 an array type; the domain's
<structfield>typelem<
/> will match the base
5696 type's
<structfield>typelem
</structfield>).
5697 Zero for types other than domains over array types.
5702 <entry><structfield>typdefaultbin
</structfield></entry>
5703 <entry><type>pg_node_tree
</type></entry>
5706 If
<structfield>typdefaultbin<
/> is not null, it is the
5707 <function>nodeToString()
</function>
5708 representation of a default expression for the type. This is
5709 only used for domains.
5714 <entry><structfield>typdefault
</structfield></entry>
5715 <entry><type>text
</type></entry>
5718 <structfield>typdefault<
/> is null if the type has no associated
5719 default value. If
<structfield>typdefaultbin<
/> is not null,
5720 <structfield>typdefault<
/> must contain a human-readable version of the
5721 default expression represented by
<structfield>typdefaultbin<
/>. If
5722 <structfield>typdefaultbin<
/> is null and
<structfield>typdefault<
/> is
5723 not, then
<structfield>typdefault<
/> is the external representation of
5724 the type's default value, which can be fed to the type's input
5725 converter to produce a constant.
5733 <xref linkend=
"catalog-typcategory-table"> lists the system-defined values
5734 of
<structfield>typcategory<
/>. Any future additions to this list will
5735 also be upper-case ASCII letters. All other ASCII characters are reserved
5736 for user-defined categories.
5739 <table id=
"catalog-typcategory-table">
5740 <title><structfield>typcategory<
/> Codes
</title>
5746 <entry>Category
</entry>
5752 <entry><literal>A
</literal></entry>
5753 <entry>Array types
</entry>
5756 <entry><literal>B
</literal></entry>
5757 <entry>Boolean types
</entry>
5760 <entry><literal>C
</literal></entry>
5761 <entry>Composite types
</entry>
5764 <entry><literal>D
</literal></entry>
5765 <entry>Date/time types
</entry>
5768 <entry><literal>E
</literal></entry>
5769 <entry>Enum types
</entry>
5772 <entry><literal>G
</literal></entry>
5773 <entry>Geometric types
</entry>
5776 <entry><literal>I
</literal></entry>
5777 <entry>Network address types
</entry>
5780 <entry><literal>N
</literal></entry>
5781 <entry>Numeric types
</entry>
5784 <entry><literal>P
</literal></entry>
5785 <entry>Pseudo-types
</entry>
5788 <entry><literal>S
</literal></entry>
5789 <entry>String types
</entry>
5792 <entry><literal>T
</literal></entry>
5793 <entry>Timespan types
</entry>
5796 <entry><literal>U
</literal></entry>
5797 <entry>User-defined types
</entry>
5800 <entry><literal>V
</literal></entry>
5801 <entry>Bit-string types
</entry>
5804 <entry><literal>X
</literal></entry>
5805 <entry><type>unknown<
/> type
</entry>
5814 <sect1 id=
"catalog-pg-user-mapping">
5815 <title><structname>pg_user_mapping
</structname></title>
5817 <indexterm zone=
"catalog-pg-user-mapping">
5818 <primary>pg_user_mapping
</primary>
5822 The catalog
<structname>pg_user_mapping
</structname> stores
5823 the mappings from local user to remote. Access to this catalog is
5824 restricted from normal users, use the view
5825 <link linkend=
"view-pg-user-mappings"><structname>pg_user_mappings
</structname></link>
5830 <title><structname>pg_user_mapping<
/> Columns
</title>
5837 <entry>References
</entry>
5838 <entry>Description
</entry>
5844 <entry><structfield>umuser
</structfield></entry>
5845 <entry><type>oid
</type></entry>
5846 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
5847 <entry>OID of the local role being mapped,
0 if the user mapping is public
</entry>
5851 <entry><structfield>umserver
</structfield></entry>
5852 <entry><type>oid
</type></entry>
5853 <entry><literal><link linkend=
"catalog-pg-foreign-server"><structname>pg_foreign_server
</structname></link>.oid
</literal></entry>
5855 The OID of the foreign server that contains this mapping
5860 <entry><structfield>umoptions
</structfield></entry>
5861 <entry><type>text[]
</type></entry>
5864 User mapping specific options, as
<quote>keyword=value<
/> strings
5873 <sect1 id=
"views-overview">
5874 <title>System Views
</title>
5877 In addition to the system catalogs,
<productname>PostgreSQL
</productname>
5878 provides a number of built-in views. Some system views provide convenient
5879 access to some commonly used queries on the system catalogs. Other views
5880 provide access to internal server state.
5884 The information schema (
<xref linkend=
"information-schema">) provides
5885 an alternative set of views which overlap the functionality of the system
5886 views. Since the information schema is SQL-standard whereas the views
5887 described here are
<productname>PostgreSQL
</productname>-specific,
5888 it's usually better to use the information schema if it provides all
5889 the information you need.
5893 <xref linkend=
"view-table"> lists the system views described here.
5894 More detailed documentation of each view follows below.
5895 There are some additional views that provide access to the results of
5896 the statistics collector; they are described in
<xref
5897 linkend=
"monitoring-stats-views-table">.
5901 Except where noted, all the views described here are read-only.
5904 <table id=
"view-table">
5905 <title>System Views
</title>
5910 <entry>View Name
</entry>
5911 <entry>Purpose
</entry>
5917 <entry><link linkend=
"view-pg-cursors"><structname>pg_cursors
</structname></link></entry>
5918 <entry>open cursors
</entry>
5922 <entry><link linkend=
"view-pg-foreign-connections"><structname>pg_foreign_connections
</structname></link></entry>
5923 <entry>established foreign connections
</entry>
5927 <entry><link linkend=
"view-pg-group"><structname>pg_group
</structname></link></entry>
5928 <entry>groups of database users
</entry>
5932 <entry><link linkend=
"view-pg-indexes"><structname>pg_indexes
</structname></link></entry>
5933 <entry>indexes
</entry>
5937 <entry><link linkend=
"view-pg-locks"><structname>pg_locks
</structname></link></entry>
5938 <entry>currently held locks
</entry>
5942 <entry><link linkend=
"view-pg-prepared-statements"><structname>pg_prepared_statements
</structname></link></entry>
5943 <entry>prepared statements
</entry>
5947 <entry><link linkend=
"view-pg-prepared-xacts"><structname>pg_prepared_xacts
</structname></link></entry>
5948 <entry>prepared transactions
</entry>
5952 <entry><link linkend=
"view-pg-roles"><structname>pg_roles
</structname></link></entry>
5953 <entry>database roles
</entry>
5957 <entry><link linkend=
"view-pg-rules"><structname>pg_rules
</structname></link></entry>
5958 <entry>rules
</entry>
5962 <entry><link linkend=
"view-pg-settings"><structname>pg_settings
</structname></link></entry>
5963 <entry>parameter settings
</entry>
5967 <entry><link linkend=
"view-pg-shadow"><structname>pg_shadow
</structname></link></entry>
5968 <entry>database users
</entry>
5972 <entry><link linkend=
"view-pg-stats"><structname>pg_stats
</structname></link></entry>
5973 <entry>planner statistics
</entry>
5977 <entry><link linkend=
"view-pg-tables"><structname>pg_tables
</structname></link></entry>
5978 <entry>tables
</entry>
5982 <entry><link linkend=
"view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs
</structname></link></entry>
5983 <entry>time zone abbreviations
</entry>
5987 <entry><link linkend=
"view-pg-timezone-names"><structname>pg_timezone_names
</structname></link></entry>
5988 <entry>time zone names
</entry>
5992 <entry><link linkend=
"view-pg-user"><structname>pg_user
</structname></link></entry>
5993 <entry>database users
</entry>
5997 <entry><link linkend=
"view-pg-views"><structname>pg_views
</structname></link></entry>
5998 <entry>views
</entry>
6006 <sect1 id=
"view-pg-cursors">
6007 <title><structname>pg_cursors
</structname></title>
6009 <indexterm zone=
"view-pg-cursors">
6010 <primary>pg_cursors
</primary>
6014 The
<structname>pg_cursors
</structname> view lists the cursors that
6015 are currently available. Cursors can be defined in several ways:
6019 via the
<xref linkend=
"sql-declare">
6026 via the Bind message in the frontend/backend protocol, as
6027 described in
<xref linkend=
"protocol-flow-ext-query">
6033 via the Server Programming Interface (SPI), as described in
6034 <xref linkend=
"spi-interface">
6039 The
<structname>pg_cursors
</structname> view displays cursors
6040 created by any of these means. Cursors only exist for the duration
6041 of the transaction that defines them, unless they have been
6042 declared
<literal>WITH HOLD
</literal>. Therefore non-holdable
6043 cursors are only present in the view until the end of their
6044 creating transaction.
6048 Cursors are used internally to implement some of the components
6049 of
<productname>PostgreSQL<
/>, such as procedural languages.
6050 Therefore, the
<structname>pg_cursors<
/> view might include cursors
6051 that have not been explicitly created by the user.
6057 <title><structname>pg_cursors<
/> Columns
</title>
6064 <entry>Description
</entry>
6070 <entry><structfield>name
</structfield></entry>
6071 <entry><type>text
</type></entry>
6072 <entry>The name of the cursor
</entry>
6076 <entry><structfield>statement
</structfield></entry>
6077 <entry><type>text
</type></entry>
6078 <entry>The verbatim query string submitted to declare this cursor
</entry>
6082 <entry><structfield>is_holdable
</structfield></entry>
6083 <entry><type>boolean
</type></entry>
6085 <literal>true
</literal> if the cursor is holdable (that is, it
6086 can be accessed after the transaction that declared the cursor
6087 has committed);
<literal>false
</literal> otherwise
6092 <entry><structfield>is_binary
</structfield></entry>
6093 <entry><type>boolean
</type></entry>
6095 <literal>true
</literal> if the cursor was declared
6096 <literal>BINARY
</literal>;
<literal>false
</literal>
6102 <entry><structfield>is_scrollable
</structfield></entry>
6103 <entry><type>boolean
</type></entry>
6105 <literal>true<
/> if the cursor is scrollable (that is, it
6106 allows rows to be retrieved in a nonsequential manner);
6107 <literal>false
</literal> otherwise
6112 <entry><structfield>creation_time
</structfield></entry>
6113 <entry><type>timestamptz
</type></entry>
6114 <entry>The time at which the cursor was declared
</entry>
6121 The
<structname>pg_cursors
</structname> view is read only.
6126 <sect1 id=
"view-pg-foreign-connections">
6127 <title><structname>pg_foreign_connections
</structname></title>
6129 <indexterm zone=
"view-pg-foreign-connections">
6130 <primary>pg_foreign_connections
</primary>
6134 The
<structname>pg_foreign_connections
</structname> view lists
6135 the foreign connections that are currently available.
6136 Foreign connections are established in several ways:
6140 via the query for a foreign table
6146 via the use of dblink functions, see
<xref linkend=
"dblink">
6151 The
<structname>pg_foreign_connections
</structname> view displays
6152 foreign connections created by any of these means.
6153 Foreign connections only exist for the duration
6154 of the backend lifetime which established the connection,
6155 and cannot be used from other backends.
6156 Use
<command>DISCARD ALL
</command> command to close all foreign
6161 <title><structname>pg_foreign_connections<
/> Columns
</title>
6168 <entry>Description
</entry>
6174 <entry><structfield>conname
</structfield></entry>
6175 <entry><type>text
</type></entry>
6176 <entry>The name of the connection
</entry>
6180 <entry><structfield>srvname
</structfield></entry>
6181 <entry><type>name
</type></entry>
6182 <entry>The name of the foreign server which was used to
6183 establish the connection
</entry>
6187 <entry><structfield>usename
</structfield></entry>
6188 <entry><type>name
</type></entry>
6189 <entry>The name of the local user which was used to
6190 establish the connection
</entry>
6194 <entry><structfield>fdwname
</structfield></entry>
6195 <entry><type>name
</type></entry>
6196 <entry>The name of the foreign-data wrapper which was
6197 used to establish the connection
</entry>
6204 The
<structname>pg_cursors
</structname> view is read only.
6209 <sect1 id=
"view-pg-group">
6210 <title><structname>pg_group
</structname></title>
6212 <indexterm zone=
"view-pg-group">
6213 <primary>pg_group
</primary>
6217 The view
<structname>pg_group
</structname> exists for backwards
6218 compatibility: it emulates a catalog that existed in
6219 <productname>PostgreSQL
</productname> before version
8.1.
6220 It shows the names and members of all roles that are marked as not
6221 <structfield>rolcanlogin<
/>, which is an approximation to the set
6222 of roles that are being used as groups.
6226 <title><structname>pg_group<
/> Columns
</title>
6233 <entry>References
</entry>
6234 <entry>Description
</entry>
6240 <entry><structfield>groname
</structfield></entry>
6241 <entry><type>name
</type></entry>
6242 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.rolname
</literal></entry>
6243 <entry>Name of the group
</entry>
6247 <entry><structfield>grosysid
</structfield></entry>
6248 <entry><type>oid
</type></entry>
6249 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
6250 <entry>ID of this group
</entry>
6254 <entry><structfield>grolist
</structfield></entry>
6255 <entry><type>oid[]
</type></entry>
6256 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
6257 <entry>An array containing the IDs of the roles in this group
</entry>
6265 <sect1 id=
"view-pg-indexes">
6266 <title><structname>pg_indexes
</structname></title>
6268 <indexterm zone=
"view-pg-indexes">
6269 <primary>pg_indexes
</primary>
6273 The view
<structname>pg_indexes
</structname> provides access to
6274 useful information about each index in the database.
6278 <title><structname>pg_indexes<
/> Columns
</title>
6285 <entry>References
</entry>
6286 <entry>Description
</entry>
6291 <entry><structfield>schemaname
</structfield></entry>
6292 <entry><type>name
</type></entry>
6293 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.nspname
</literal></entry>
6294 <entry>Name of schema containing table and index
</entry>
6297 <entry><structfield>tablename
</structfield></entry>
6298 <entry><type>name
</type></entry>
6299 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relname
</literal></entry>
6300 <entry>Name of table the index is for
</entry>
6303 <entry><structfield>indexname
</structfield></entry>
6304 <entry><type>name
</type></entry>
6305 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relname
</literal></entry>
6306 <entry>Name of index
</entry>
6309 <entry><structfield>tablespace
</structfield></entry>
6310 <entry><type>name
</type></entry>
6311 <entry><literal><link linkend=
"catalog-pg-tablespace"><structname>pg_tablespace
</structname></link>.spcname
</literal></entry>
6312 <entry>Name of tablespace containing index (null if default for database)
</entry>
6315 <entry><structfield>indexdef
</structfield></entry>
6316 <entry><type>text
</type></entry>
6318 <entry>Index definition (a reconstructed
<command>CREATE INDEX
</command>
6327 <sect1 id=
"view-pg-locks">
6328 <title><structname>pg_locks
</structname></title>
6330 <indexterm zone=
"view-pg-locks">
6331 <primary>pg_locks
</primary>
6335 The view
<structname>pg_locks
</structname> provides access to
6336 information about the locks held by open transactions within the
6337 database server. See
<xref linkend=
"mvcc"> for more discussion
6342 <structname>pg_locks
</structname> contains one row per active lockable
6343 object, requested lock mode, and relevant transaction. Thus, the same
6344 lockable object might
6345 appear many times, if multiple transactions are holding or waiting
6346 for locks on it. However, an object that currently has no locks on it
6347 will not appear at all.
6351 There are several distinct types of lockable objects:
6352 whole relations (e.g., tables), individual pages of relations,
6353 individual tuples of relations,
6354 transaction IDs (both virtual and permanent IDs),
6355 and general database objects (identified by class OID and object OID,
6356 in the same way as in
<structname>pg_description
</structname> or
6357 <structname>pg_depend
</structname>). Also, the right to extend a
6358 relation is represented as a separate lockable object.
6362 <title><structname>pg_locks<
/> Columns
</title>
6369 <entry>References
</entry>
6370 <entry>Description
</entry>
6375 <entry><structfield>locktype
</structfield></entry>
6376 <entry><type>text
</type></entry>
6379 Type of the lockable object:
6380 <literal>relation<
/>,
6384 <literal>transactionid<
/>,
6385 <literal>virtualxid<
/>,
6387 <literal>userlock<
/>, or
6388 <literal>advisory<
/>
6392 <entry><structfield>database
</structfield></entry>
6393 <entry><type>oid
</type></entry>
6394 <entry><literal><link linkend=
"catalog-pg-database"><structname>pg_database
</structname></link>.oid
</literal></entry>
6396 OID of the database in which the object exists, or
6397 zero if the object is a shared object, or
6398 null if the object is a transaction ID
6402 <entry><structfield>relation
</structfield></entry>
6403 <entry><type>oid
</type></entry>
6404 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
6406 OID of the relation, or null if the object is not
6407 a relation or part of a relation
6411 <entry><structfield>page
</structfield></entry>
6412 <entry><type>integer
</type></entry>
6415 Page number within the relation, or null if the object
6416 is not a tuple or relation page
6420 <entry><structfield>tuple
</structfield></entry>
6421 <entry><type>smallint
</type></entry>
6424 Tuple number within the page, or null if the object is not a tuple
6428 <entry><structfield>virtualxid
</structfield></entry>
6429 <entry><type>text
</type></entry>
6432 Virtual ID of a transaction, or null if the object is not a
6433 virtual transaction ID
6437 <entry><structfield>transactionid
</structfield></entry>
6438 <entry><type>xid
</type></entry>
6441 ID of a transaction, or null if the object is not a transaction ID
6445 <entry><structfield>classid
</structfield></entry>
6446 <entry><type>oid
</type></entry>
6447 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.oid
</literal></entry>
6449 OID of the system catalog containing the object, or null if the
6450 object is not a general database object
6454 <entry><structfield>objid
</structfield></entry>
6455 <entry><type>oid
</type></entry>
6456 <entry>any OID column
</entry>
6458 OID of the object within its system catalog, or null if the
6459 object is not a general database object.
6460 For advisory locks it is used to distinguish the two key
6461 spaces (
<literal>1<
/> for an int8 key,
<literal>2<
/> for two
6466 <entry><structfield>objsubid
</structfield></entry>
6467 <entry><type>smallint
</type></entry>
6470 For a table column, this is the column number (the
6471 <structfield>classid<
/> and
<structfield>objid<
/> refer to the
6472 table itself). For all other object types, this column is
6473 zero. Null if the object is not a general database object
6477 <entry><structfield>virtualtransaction
</structfield></entry>
6478 <entry><type>text
</type></entry>
6481 Virtual ID of the transaction that is holding or awaiting this lock
6485 <entry><structfield>pid
</structfield></entry>
6486 <entry><type>integer
</type></entry>
6489 Process ID of the server process holding or awaiting this
6490 lock. Null if the lock is held by a prepared transaction.
6494 <entry><structfield>mode
</structfield></entry>
6495 <entry><type>text
</type></entry>
6497 <entry>Name of the lock mode held or desired by this process (see
<xref
6498 linkend=
"locking-tables">)
</entry>
6501 <entry><structfield>granted
</structfield></entry>
6502 <entry><type>boolean
</type></entry>
6504 <entry>True if lock is held, false if lock is awaited
</entry>
6511 <structfield>granted
</structfield> is true in a row representing a lock
6512 held by the indicated transaction. False indicates that this transaction is
6513 currently waiting to acquire this lock, which implies that some other
6514 transaction is holding a conflicting lock mode on the same lockable object.
6515 The waiting transaction will sleep until the other lock is released (or a
6516 deadlock situation is detected). A single transaction can be waiting to
6517 acquire at most one lock at a time.
6521 Every transaction holds an exclusive lock on its virtual transaction ID for
6522 its entire duration. If a permanent ID is assigned to the transaction
6523 (which normally happens only if the transaction changes the state of the
6524 database), it also holds an exclusive lock on its permanent transaction ID
6525 until it ends. When one transaction finds it necessary to wait specifically
6526 for another transaction, it does so by attempting to acquire share lock on
6527 the other transaction ID (either virtual or permanent ID depending on the
6528 situation). That will succeed only when the other transaction
6529 terminates and releases its locks.
6533 Although tuples are a lockable type of object,
6534 information about row-level locks is stored on disk, not in memory,
6535 and therefore row-level locks normally do not appear in this view.
6536 If a transaction is waiting for a
6537 row-level lock, it will usually appear in the view as waiting for the
6538 permanent transaction ID of the current holder of that row lock.
6542 Advisory locks can be acquired on keys consisting of either a single
6543 <type>bigint
</type> value or two integer values. A
<type>bigint
</type> key is displayed with its
6544 high-order half in the
<structfield>classid<
/> column, its low-order half
6545 in the
<structfield>objid<
/> column, and
<structfield>objsubid<
/> equal
6546 to
1. Integer keys are displayed with the first key in the
6547 <structfield>classid<
/> column, the second key in the
<structfield>objid<
/>
6548 column, and
<structfield>objsubid<
/> equal to
2. The actual meaning of
6549 the keys is up to the user. Advisory locks are local to each database,
6550 so the
<structfield>database<
/> column is meaningful for an advisory lock.
6554 When the
<structname>pg_locks
</structname> view is accessed, the
6555 internal lock manager data structures are momentarily locked, and
6556 a copy is made for the view to display. This ensures that the
6557 view produces a consistent set of results, while not blocking
6558 normal lock manager operations longer than necessary. Nonetheless
6559 there could be some impact on database performance if this view is
6560 frequently accessed.
6564 <structname>pg_locks
</structname> provides a global view of all locks
6565 in the database cluster, not only those relevant to the current database.
6566 Although its
<structfield>relation
</structfield> column can be joined
6567 against
<structname>pg_class<
/>.
<structfield>oid<
/> to identify locked
6568 relations, this will only work correctly for relations in the current
6569 database (those for which the
<structfield>database
</structfield> column
6570 is either the current database's OID or zero).
6574 The
<structfield>pid
</structfield> column can be joined to the
6575 <structfield>procpid
</structfield> column of the
6576 <structname>pg_stat_activity
</structname> view to get more
6577 information on the session holding or waiting to hold each lock.
6578 Also, if you are using prepared transactions, the
6579 <structfield>transaction<
/> column can be joined to the
6580 <structfield>transaction
</structfield> column of the
6581 <structname>pg_prepared_xacts
</structname> view to get more
6582 information on prepared transactions that hold locks.
6583 (A prepared transaction can never be waiting for a lock,
6584 but it continues to hold the locks it acquired while running.)
6589 <sect1 id=
"view-pg-prepared-statements">
6590 <title><structname>pg_prepared_statements
</structname></title>
6592 <indexterm zone=
"view-pg-prepared-statements">
6593 <primary>pg_prepared_statements
</primary>
6597 The
<structname>pg_prepared_statements
</structname> view displays
6598 all the prepared statements that are available in the current
6599 session. See
<xref linkend=
"sql-prepare"> for more information about prepared
6604 <structname>pg_prepared_statements
</structname> contains one row
6605 for each prepared statement. Rows are added to the view when a new
6606 prepared statement is created and removed when a prepared statement
6607 is released (for example, via the
<xref linkend=
"sql-deallocate"> command).
6611 <title><structname>pg_prepared_statements<
/> Columns
</title>
6618 <entry>Description
</entry>
6623 <entry><structfield>name
</structfield></entry>
6624 <entry><type>text
</type></entry>
6626 The identifier of the prepared statement
6630 <entry><structfield>statement
</structfield></entry>
6631 <entry><type>text
</type></entry>
6633 The query string submitted by the client to create this
6634 prepared statement. For prepared statements created via SQL,
6635 this is the
<command>PREPARE
</command> statement submitted by
6636 the client. For prepared statements created via the
6637 frontend/backend protocol, this is the text of the prepared
6642 <entry><structfield>prepare_time
</structfield></entry>
6643 <entry><type>timestamptz
</type></entry>
6645 The time at which the prepared statement was created
6649 <entry><structfield>parameter_types
</structfield></entry>
6650 <entry><type>regtype[]
</type></entry>
6652 The expected parameter types for the prepared statement in the
6653 form of an array of
<type>regtype
</type>. The OID corresponding
6654 to an element of this array can be obtained by casting the
6655 <type>regtype
</type> value to
<type>oid
</type>.
6659 <entry><structfield>from_sql
</structfield></entry>
6660 <entry><type>boolean
</type></entry>
6662 <literal>true
</literal> if the prepared statement was created
6663 via the
<command>PREPARE
</command> SQL statement;
6664 <literal>false
</literal> if the statement was prepared via the
6665 frontend/backend protocol
6673 The
<structname>pg_prepared_statements
</structname> view is read only.
6677 <sect1 id=
"view-pg-prepared-xacts">
6678 <title><structname>pg_prepared_xacts
</structname></title>
6680 <indexterm zone=
"view-pg-prepared-xacts">
6681 <primary>pg_prepared_xacts
</primary>
6685 The view
<structname>pg_prepared_xacts
</structname> displays
6686 information about transactions that are currently prepared for two-phase
6687 commit (see
<xref linkend=
"sql-prepare-transaction"> for details).
6691 <structname>pg_prepared_xacts
</structname> contains one row per prepared
6692 transaction. An entry is removed when the transaction is committed or
6697 <title><structname>pg_prepared_xacts<
/> Columns
</title>
6704 <entry>References
</entry>
6705 <entry>Description
</entry>
6710 <entry><structfield>transaction
</structfield></entry>
6711 <entry><type>xid
</type></entry>
6714 Numeric transaction identifier of the prepared transaction
6718 <entry><structfield>gid
</structfield></entry>
6719 <entry><type>text
</type></entry>
6722 Global transaction identifier that was assigned to the transaction
6726 <entry><structfield>prepared
</structfield></entry>
6727 <entry><type>timestamp with time zone
</type></entry>
6730 Time at which the transaction was prepared for commit
6734 <entry><structfield>owner
</structfield></entry>
6735 <entry><type>name
</type></entry>
6736 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.rolname
</literal></entry>
6738 Name of the user that executed the transaction
6742 <entry><structfield>database
</structfield></entry>
6743 <entry><type>name
</type></entry>
6744 <entry><literal><link linkend=
"catalog-pg-database"><structname>pg_database
</structname></link>.datname
</literal></entry>
6746 Name of the database in which the transaction was executed
6754 When the
<structname>pg_prepared_xacts
</structname> view is accessed, the
6755 internal transaction manager data structures are momentarily locked, and
6756 a copy is made for the view to display. This ensures that the
6757 view produces a consistent set of results, while not blocking
6758 normal operations longer than necessary. Nonetheless
6759 there could be some impact on database performance if this view is
6760 frequently accessed.
6765 <sect1 id=
"view-pg-roles">
6766 <title><structname>pg_roles
</structname></title>
6768 <indexterm zone=
"view-pg-roles">
6769 <primary>pg_roles
</primary>
6773 The view
<structname>pg_roles
</structname> provides access to
6774 information about database roles. This is simply a publicly
6776 <link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>
6777 that blanks out the password field.
6781 This view explicitly exposes the OID column of the underlying table,
6782 since that is needed to do joins to other catalogs.
6786 <title><structname>pg_roles<
/> Columns
</title>
6793 <entry>References
</entry>
6794 <entry>Description
</entry>
6800 <entry><structfield>rolname
</structfield></entry>
6801 <entry><type>name
</type></entry>
6803 <entry>Role name
</entry>
6807 <entry><structfield>rolsuper
</structfield></entry>
6808 <entry><type>bool
</type></entry>
6810 <entry>Role has superuser privileges
</entry>
6814 <entry><structfield>rolinherit
</structfield></entry>
6815 <entry><type>bool
</type></entry>
6817 <entry>Role automatically inherits privileges of roles it is a
6822 <entry><structfield>rolcreaterole
</structfield></entry>
6823 <entry><type>bool
</type></entry>
6825 <entry>Role can create more roles
</entry>
6829 <entry><structfield>rolcreatedb
</structfield></entry>
6830 <entry><type>bool
</type></entry>
6832 <entry>Role can create databases
</entry>
6836 <entry><structfield>rolcatupdate
</structfield></entry>
6837 <entry><type>bool
</type></entry>
6840 Role can update system catalogs directly. (Even a superuser cannot do
6841 this unless this column is true.)
6846 <entry><structfield>rolcanlogin
</structfield></entry>
6847 <entry><type>bool
</type></entry>
6850 Role can log in. That is, this role can be given as the initial
6851 session authorization identifier
6856 <entry><structfield>rolconnlimit
</structfield></entry>
6857 <entry><type>int4
</type></entry>
6860 For roles that can log in, this sets maximum number of concurrent
6861 connections this role can make. -
1 means no limit.
6866 <entry><structfield>rolpassword
</structfield></entry>
6867 <entry><type>text
</type></entry>
6869 <entry>Not the password (always reads as
<literal>********<
/>)
</entry>
6873 <entry><structfield>rolvaliduntil
</structfield></entry>
6874 <entry><type>timestamptz
</type></entry>
6876 <entry>Password expiry time (only used for password authentication);
6877 null if no expiration
</entry>
6881 <entry><structfield>oid
</structfield></entry>
6882 <entry><type>oid
</type></entry>
6883 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
6884 <entry>ID of role
</entry>
6892 <sect1 id=
"view-pg-rules">
6893 <title><structname>pg_rules
</structname></title>
6895 <indexterm zone=
"view-pg-rules">
6896 <primary>pg_rules
</primary>
6900 The view
<structname>pg_rules
</structname> provides access to
6901 useful information about query rewrite rules.
6905 <title><structname>pg_rules<
/> Columns
</title>
6912 <entry>References
</entry>
6913 <entry>Description
</entry>
6918 <entry><structfield>schemaname
</structfield></entry>
6919 <entry><type>name
</type></entry>
6920 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.nspname
</literal></entry>
6921 <entry>Name of schema containing table
</entry>
6924 <entry><structfield>tablename
</structfield></entry>
6925 <entry><type>name
</type></entry>
6926 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relname
</literal></entry>
6927 <entry>Name of table the rule is for
</entry>
6930 <entry><structfield>rulename
</structfield></entry>
6931 <entry><type>name
</type></entry>
6932 <entry><literal><link linkend=
"catalog-pg-rewrite"><structname>pg_rewrite
</structname></link>.rulename
</literal></entry>
6933 <entry>Name of rule
</entry>
6936 <entry><structfield>definition
</structfield></entry>
6937 <entry><type>text
</type></entry>
6939 <entry>Rule definition (a reconstructed creation command)
</entry>
6946 The
<structname>pg_rules<
/> view excludes the
<literal>ON SELECT<
/> rules
6947 of views; those can be seen in
<structname>pg_views<
/>.
6952 <sect1 id=
"view-pg-settings">
6953 <title><structname>pg_settings
</structname></title>
6955 <indexterm zone=
"view-pg-settings">
6956 <primary>pg_settings
</primary>
6960 The view
<structname>pg_settings
</structname> provides access to
6961 run-time parameters of the server. It is essentially an alternative
6962 interface to the
<xref linkend=
"sql-show">
6963 and
<xref linkend=
"sql-set"> commands.
6964 It also provides access to some facts about each parameter that are
6965 not directly available from
<command>SHOW<
/>, such as minimum and
6970 <title><structname>pg_settings<
/> Columns
</title>
6977 <entry>Description
</entry>
6982 <entry><structfield>name
</structfield></entry>
6983 <entry><type>text
</type></entry>
6984 <entry>Run-time configuration parameter name
</entry>
6987 <entry><structfield>setting
</structfield></entry>
6988 <entry><type>text
</type></entry>
6989 <entry>Current value of the parameter
</entry>
6992 <entry><structfield>unit
</structfield></entry>
6993 <entry><type>text
</type></entry>
6994 <entry>Implicit unit of the parameter
</entry>
6997 <entry><structfield>category
</structfield></entry>
6998 <entry><type>text
</type></entry>
6999 <entry>Logical group of the parameter
</entry>
7002 <entry><structfield>short_desc
</structfield></entry>
7003 <entry><type>text
</type></entry>
7004 <entry>A brief description of the parameter
</entry>
7007 <entry><structfield>extra_desc
</structfield></entry>
7008 <entry><type>text
</type></entry>
7009 <entry>Additional, more detailed, description of the parameter
</entry>
7012 <entry><structfield>context
</structfield></entry>
7013 <entry><type>text
</type></entry>
7014 <entry>Context required to set the parameter's value
</entry>
7017 <entry><structfield>vartype
</structfield></entry>
7018 <entry><type>text
</type></entry>
7019 <entry>Parameter type (
<literal>bool<
/>,
<literal>enum<
/>,
7020 <literal>integer<
/>,
<literal>real<
/>, or
<literal>string<
/>)
7024 <entry><structfield>source
</structfield></entry>
7025 <entry><type>text
</type></entry>
7026 <entry>Source of the current parameter value
</entry>
7029 <entry><structfield>min_val
</structfield></entry>
7030 <entry><type>text
</type></entry>
7031 <entry>Minimum allowed value of the parameter (null for non-numeric
7035 <entry><structfield>max_val
</structfield></entry>
7036 <entry><type>text
</type></entry>
7037 <entry>Maximum allowed value of the parameter (null for non-numeric
7041 <entry><structfield>enumvals
</structfield></entry>
7042 <entry><type>text[]
</type></entry>
7043 <entry>Allowed values of an enum parameter (null for non-enum
7047 <entry><structfield>boot_val
</structfield></entry>
7048 <entry><type>text
</type></entry>
7049 <entry>Parameter value assumed at server startup if the parameter is
7050 not otherwise set
</entry>
7053 <entry><structfield>reset_val
</structfield></entry>
7054 <entry><type>text
</type></entry>
7055 <entry>Value that
<command>RESET
</command> would reset the parameter to
7056 in the current session
</entry>
7059 <entry><structfield>sourcefile
</structfield></entry>
7060 <entry><type>text
</type></entry>
7061 <entry>Configuration file the current value was set in (null for
7062 values set from sources other than configuration files, or when
7063 examined by a non-superuser);
7064 helpful when using
<literal>include<
/> directives in configuration files
</entry>
7067 <entry><structfield>sourceline
</structfield></entry>
7068 <entry><type>integer
</type></entry>
7069 <entry>Line number within the configuration file the current value was
7070 set at (null for values set from sources other than configuration files,
7071 or when examined by a non-superuser)
7079 The
<structname>pg_settings
</structname> view cannot be inserted into or
7080 deleted from, but it can be updated. An
<command>UPDATE
</command> applied
7081 to a row of
<structname>pg_settings
</structname> is equivalent to executing
7082 the
<xref linkend=
"sql-set"> command on that named
7083 parameter. The change only affects the value used by the current
7084 session. If an
<command>UPDATE
</command> is issued within a transaction
7085 that is later aborted, the effects of the
<command>UPDATE
</command> command
7086 disappear when the transaction is rolled back. Once the surrounding
7087 transaction is committed, the effects will persist until the end of the
7088 session, unless overridden by another
<command>UPDATE
</command> or
7089 <command>SET
</command>.
7094 <sect1 id=
"view-pg-shadow">
7095 <title><structname>pg_shadow
</structname></title>
7097 <indexterm zone=
"view-pg-shadow">
7098 <primary>pg_shadow
</primary>
7102 The view
<structname>pg_shadow
</structname> exists for backwards
7103 compatibility: it emulates a catalog that existed in
7104 <productname>PostgreSQL
</productname> before version
8.1.
7105 It shows properties of all roles that are marked as
7106 <structfield>rolcanlogin<
/> in
7107 <link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.
7111 The name stems from the fact that this table
7112 should not be readable by the public since it contains passwords.
7113 <link linkend=
"view-pg-user"><structname>pg_user
</structname></link>
7114 is a publicly readable view on
7115 <structname>pg_shadow
</structname> that blanks out the password field.
7119 <title><structname>pg_shadow<
/> Columns
</title>
7126 <entry>References
</entry>
7127 <entry>Description
</entry>
7133 <entry><structfield>usename
</structfield></entry>
7134 <entry><type>name
</type></entry>
7135 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.rolname
</literal></entry>
7136 <entry>User name
</entry>
7140 <entry><structfield>usesysid
</structfield></entry>
7141 <entry><type>oid
</type></entry>
7142 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
7143 <entry>ID of this user
</entry>
7147 <entry><structfield>usecreatedb
</structfield></entry>
7148 <entry><type>bool
</type></entry>
7150 <entry>User can create databases
</entry>
7154 <entry><structfield>usesuper
</structfield></entry>
7155 <entry><type>bool
</type></entry>
7157 <entry>User is a superuser
</entry>
7161 <entry><structfield>usecatupd
</structfield></entry>
7162 <entry><type>bool
</type></entry>
7165 User can update system catalogs. (Even a superuser cannot do
7166 this unless this column is true.)
7171 <entry><structfield>passwd
</structfield></entry>
7172 <entry><type>text
</type></entry>
7174 <entry>Password (possibly encrypted); null if none. See
7175 <link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>
7176 for details of how encrypted passwords are stored.
</entry>
7180 <entry><structfield>valuntil
</structfield></entry>
7181 <entry><type>abstime
</type></entry>
7183 <entry>Password expiry time (only used for password authentication)
</entry>
7187 <entry><structfield>useconfig
</structfield></entry>
7188 <entry><type>text[]
</type></entry>
7190 <entry>Session defaults for run-time configuration variables
</entry>
7198 <sect1 id=
"view-pg-stats">
7199 <title><structname>pg_stats
</structname></title>
7201 <indexterm zone=
"view-pg-stats">
7202 <primary>pg_stats
</primary>
7206 The view
<structname>pg_stats
</structname> provides access to
7207 the information stored in the
<link
7208 linkend=
"catalog-pg-statistic"><structname>pg_statistic
</structname></link>
7209 catalog. This view allows access only to rows of
7210 <structname>pg_statistic
</structname> that correspond to tables the
7211 user has permission to read, and therefore it is safe to allow public
7212 read access to this view.
7216 <structname>pg_stats
</structname> is also designed to present the
7217 information in a more readable format than the underlying catalog
7218 — at the cost that its schema must be extended whenever new slot types
7219 are defined for
<structname>pg_statistic
</structname>.
7223 <title><structname>pg_stats<
/> Columns
</title>
7230 <entry>References
</entry>
7231 <entry>Description
</entry>
7236 <entry><structfield>schemaname
</structfield></entry>
7237 <entry><type>name
</type></entry>
7238 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.nspname
</literal></entry>
7239 <entry>Name of schema containing table
</entry>
7243 <entry><structfield>tablename
</structfield></entry>
7244 <entry><type>name
</type></entry>
7245 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relname
</literal></entry>
7246 <entry>Name of table
</entry>
7250 <entry><structfield>attname
</structfield></entry>
7251 <entry><type>name
</type></entry>
7252 <entry><literal><link linkend=
"catalog-pg-attribute"><structname>pg_attribute
</structname></link>.attname
</literal></entry>
7253 <entry>Name of the column described by this row
</entry>
7257 <entry><structfield>inherited
</structfield></entry>
7258 <entry><type>bool
</type></entry>
7260 <entry>If true, this row includes inheritance child columns, not just the
7261 values in the specified table
</entry>
7265 <entry><structfield>null_frac
</structfield></entry>
7266 <entry><type>real
</type></entry>
7268 <entry>Fraction of column entries that are null
</entry>
7272 <entry><structfield>avg_width
</structfield></entry>
7273 <entry><type>integer
</type></entry>
7275 <entry>Average width in bytes of column's entries
</entry>
7279 <entry><structfield>n_distinct
</structfield></entry>
7280 <entry><type>real
</type></entry>
7283 If greater than zero, the estimated number of distinct values in the
7284 column. If less than zero, the negative of the number of distinct
7285 values divided by the number of rows. (The negated form is used when
7286 <command>ANALYZE<
/> believes that the number of distinct values is
7287 likely to increase as the table grows; the positive form is used when
7288 the column seems to have a fixed number of possible values.) For
7289 example, -
1 indicates a unique column in which the number of distinct
7290 values is the same as the number of rows.
7295 <entry><structfield>most_common_vals
</structfield></entry>
7296 <entry><type>anyarray
</type></entry>
7299 A list of the most common values in the column. (Null if
7300 no values seem to be more common than any others.)
7301 For some data types such as
<type>tsvector<
/>, this is a list of
7302 the most common element values rather than values of the type itself.
7307 <entry><structfield>most_common_freqs
</structfield></entry>
7308 <entry><type>real[]
</type></entry>
7311 A list of the frequencies of the most common values or elements,
7312 i.e., number of occurrences of each divided by total number of rows.
7313 (Null when
<structfield>most_common_vals
</structfield> is.)
7314 For some data types such as
<type>tsvector<
/>, it can also store some
7315 additional information, making it longer than the
7316 <structfield>most_common_vals<
/> array.
7321 <entry><structfield>histogram_bounds
</structfield></entry>
7322 <entry><type>anyarray
</type></entry>
7325 A list of values that divide the column's values into groups of
7326 approximately equal population. The values in
7327 <structfield>most_common_vals<
/>, if present, are omitted from this
7328 histogram calculation. (This column is null if the column data type
7329 does not have a
<literal><<
/> operator or if the
7330 <structfield>most_common_vals<
/> list accounts for the entire
7336 <entry><structfield>correlation
</structfield></entry>
7337 <entry><type>real
</type></entry>
7340 Statistical correlation between physical row ordering and
7341 logical ordering of the column values. This ranges from -
1 to +
1.
7342 When the value is near -
1 or +
1, an index scan on the column will
7343 be estimated to be cheaper than when it is near zero, due to reduction
7344 of random access to the disk. (This column is null if the column data
7345 type does not have a
<literal><<
/> operator.)
7353 The maximum number of entries in the
<structfield>most_common_vals<
/>
7354 and
<structfield>histogram_bounds<
/> arrays can be set on a
7355 column-by-column basis using the
<command>ALTER TABLE SET STATISTICS<
/>
7356 command, or globally by setting the
7357 <xref linkend=
"guc-default-statistics-target"> run-time parameter.
7362 <sect1 id=
"view-pg-tables">
7363 <title><structname>pg_tables
</structname></title>
7365 <indexterm zone=
"view-pg-tables">
7366 <primary>pg_tables
</primary>
7370 The view
<structname>pg_tables
</structname> provides access to
7371 useful information about each table in the database.
7375 <title><structname>pg_tables<
/> Columns
</title>
7382 <entry>References
</entry>
7383 <entry>Description
</entry>
7388 <entry><structfield>schemaname
</structfield></entry>
7389 <entry><type>name
</type></entry>
7390 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.nspname
</literal></entry>
7391 <entry>Name of schema containing table
</entry>
7394 <entry><structfield>tablename
</structfield></entry>
7395 <entry><type>name
</type></entry>
7396 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relname
</literal></entry>
7397 <entry>Name of table
</entry>
7400 <entry><structfield>tableowner
</structfield></entry>
7401 <entry><type>name
</type></entry>
7402 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.rolname
</literal></entry>
7403 <entry>Name of table's owner
</entry>
7406 <entry><structfield>tablespace
</structfield></entry>
7407 <entry><type>name
</type></entry>
7408 <entry><literal><link linkend=
"catalog-pg-tablespace"><structname>pg_tablespace
</structname></link>.spcname
</literal></entry>
7409 <entry>Name of tablespace containing table (null if default for database)
</entry>
7412 <entry><structfield>hasindexes
</structfield></entry>
7413 <entry><type>boolean
</type></entry>
7414 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relhasindex
</literal></entry>
7415 <entry>True if table has (or recently had) any indexes
</entry>
7418 <entry><structfield>hasrules
</structfield></entry>
7419 <entry><type>boolean
</type></entry>
7420 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relhasrules
</literal></entry>
7421 <entry>True if table has (or once had) rules
</entry>
7424 <entry><structfield>hastriggers
</structfield></entry>
7425 <entry><type>boolean
</type></entry>
7426 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relhastriggers
</literal></entry>
7427 <entry>True if table has (or once had) triggers
</entry>
7435 <sect1 id=
"view-pg-timezone-abbrevs">
7436 <title><structname>pg_timezone_abbrevs
</structname></title>
7438 <indexterm zone=
"view-pg-timezone-abbrevs">
7439 <primary>pg_timezone_abbrevs
</primary>
7443 The view
<structname>pg_timezone_abbrevs
</structname> provides a list
7444 of time zone abbreviations that are currently recognized by the datetime
7445 input routines. The contents of this view change when the
7446 <xref linkend=
"guc-timezone-abbreviations"> run-time parameter is modified.
7450 <title><structname>pg_timezone_abbrevs<
/> Columns
</title>
7457 <entry>Description
</entry>
7462 <entry><structfield>abbrev
</structfield></entry>
7463 <entry><type>text
</type></entry>
7464 <entry>Time zone abbreviation
</entry>
7467 <entry><structfield>utc_offset
</structfield></entry>
7468 <entry><type>interval
</type></entry>
7469 <entry>Offset from UTC (positive means east of Greenwich)
</entry>
7472 <entry><structfield>is_dst
</structfield></entry>
7473 <entry><type>boolean
</type></entry>
7474 <entry>True if this is a daylight-savings abbreviation
</entry>
7482 <sect1 id=
"view-pg-timezone-names">
7483 <title><structname>pg_timezone_names
</structname></title>
7485 <indexterm zone=
"view-pg-timezone-names">
7486 <primary>pg_timezone_names
</primary>
7490 The view
<structname>pg_timezone_names
</structname> provides a list
7491 of time zone names that are recognized by
<command>SET TIMEZONE<
/>,
7492 along with their associated abbreviations, UTC offsets,
7493 and daylight-savings status.
7494 Unlike the abbreviations shown in
<link
7495 linkend=
"view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs
</structname></link>, many of these names imply a set of daylight-savings transition
7496 date rules. Therefore, the associated information changes across local DST
7497 boundaries. The displayed information is computed based on the current
7498 value of
<function>CURRENT_TIMESTAMP<
/>.
7502 <title><structname>pg_timezone_names<
/> Columns
</title>
7509 <entry>Description
</entry>
7514 <entry><structfield>name
</structfield></entry>
7515 <entry><type>text
</type></entry>
7516 <entry>Time zone name
</entry>
7519 <entry><structfield>abbrev
</structfield></entry>
7520 <entry><type>text
</type></entry>
7521 <entry>Time zone abbreviation
</entry>
7524 <entry><structfield>utc_offset
</structfield></entry>
7525 <entry><type>interval
</type></entry>
7526 <entry>Offset from UTC (positive means east of Greenwich)
</entry>
7529 <entry><structfield>is_dst
</structfield></entry>
7530 <entry><type>boolean
</type></entry>
7531 <entry>True if currently observing daylight savings
</entry>
7539 <sect1 id=
"view-pg-user">
7540 <title><structname>pg_user
</structname></title>
7542 <indexterm zone=
"view-pg-user">
7543 <primary>pg_user
</primary>
7547 The view
<structname>pg_user
</structname> provides access to
7548 information about database users. This is simply a publicly
7550 <link linkend=
"view-pg-shadow"><structname>pg_shadow
</structname></link>
7551 that blanks out the password field.
7555 <title><structname>pg_user<
/> Columns
</title>
7562 <entry>Description
</entry>
7567 <entry><structfield>usename
</structfield></entry>
7568 <entry><type>name
</type></entry>
7569 <entry>User name
</entry>
7573 <entry><structfield>usesysid
</structfield></entry>
7574 <entry><type>int4
</type></entry>
7575 <entry>User ID (arbitrary number used to reference this user)
</entry>
7579 <entry><structfield>usecreatedb
</structfield></entry>
7580 <entry><type>bool
</type></entry>
7581 <entry>User can create databases
</entry>
7585 <entry><structfield>usesuper
</structfield></entry>
7586 <entry><type>bool
</type></entry>
7587 <entry>User is a superuser
</entry>
7591 <entry><structfield>usecatupd
</structfield></entry>
7592 <entry><type>bool
</type></entry>
7594 User can update system catalogs. (Even a superuser cannot do
7595 this unless this column is true.)
7600 <entry><structfield>passwd
</structfield></entry>
7601 <entry><type>text
</type></entry>
7602 <entry>Not the password (always reads as
<literal>********<
/>)
</entry>
7606 <entry><structfield>valuntil
</structfield></entry>
7607 <entry><type>abstime
</type></entry>
7608 <entry>Password expiry time (only used for password authentication)
</entry>
7612 <entry><structfield>useconfig
</structfield></entry>
7613 <entry><type>text[]
</type></entry>
7614 <entry>Session defaults for run-time configuration variables
</entry>
7622 <sect1 id=
"view-pg-user-mappings">
7623 <title><structname>pg_user_mappings
</structname></title>
7625 <indexterm zone=
"view-pg-user-mappings">
7626 <primary>pg_user_mappings
</primary>
7630 The view
<structname>pg_user_mappings
</structname> provides access
7631 to information about user mappings. This is essentially a publicly
7633 <link linkend=
"catalog-pg-user-mapping"><structname>pg_user_mapping
</structname></link>
7634 that leaves out the options field if the user has no rights to use
7639 <title><structname>pg_user_mappings<
/> Columns
</title>
7646 <entry>References
</entry>
7647 <entry>Description
</entry>
7653 <entry><structfield>umid
</structfield></entry>
7654 <entry><type>oid
</type></entry>
7655 <entry><literal><link linkend=
"catalog-pg-user-mapping"><structname>pg_user_mapping
</structname></link>.oid
</literal></entry>
7656 <entry>OID of the user mapping
</entry>
7660 <entry><structfield>srvid
</structfield></entry>
7661 <entry><type>oid
</type></entry>
7662 <entry><literal><link linkend=
"catalog-pg-foreign-server"><structname>pg_foreign_server
</structname></link>.oid
</literal></entry>
7664 The OID of the foreign server that contains this mapping
7669 <entry><structfield>srvname
</structfield></entry>
7670 <entry><type>text
</type></entry>
7673 Name of the foreign server
7678 <entry><structfield>umuser
</structfield></entry>
7679 <entry><type>oid
</type></entry>
7680 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.oid
</literal></entry>
7681 <entry>OID of the local role being mapped,
0 if the user mapping is public
</entry>
7685 <entry><structfield>usename
</structfield></entry>
7686 <entry><type>name
</type></entry>
7688 <entry>Name of the local user to be mapped
</entry>
7692 <entry><structfield>umoptions
</structfield></entry>
7693 <entry><type>text[]
</type></entry>
7696 User mapping specific options, as
<quote>keyword=value<
/>
7697 strings, if the current user is the owner of the foreign
7707 <sect1 id=
"view-pg-views">
7708 <title><structname>pg_views
</structname></title>
7710 <indexterm zone=
"view-pg-views">
7711 <primary>pg_views
</primary>
7715 The view
<structname>pg_views
</structname> provides access to
7716 useful information about each view in the database.
7720 <title><structname>pg_views<
/> Columns
</title>
7727 <entry>References
</entry>
7728 <entry>Description
</entry>
7733 <entry><structfield>schemaname
</structfield></entry>
7734 <entry><type>name
</type></entry>
7735 <entry><literal><link linkend=
"catalog-pg-namespace"><structname>pg_namespace
</structname></link>.nspname
</literal></entry>
7736 <entry>Name of schema containing view
</entry>
7739 <entry><structfield>viewname
</structfield></entry>
7740 <entry><type>name
</type></entry>
7741 <entry><literal><link linkend=
"catalog-pg-class"><structname>pg_class
</structname></link>.relname
</literal></entry>
7742 <entry>Name of view
</entry>
7745 <entry><structfield>viewowner
</structfield></entry>
7746 <entry><type>name
</type></entry>
7747 <entry><literal><link linkend=
"catalog-pg-authid"><structname>pg_authid
</structname></link>.rolname
</literal></entry>
7748 <entry>Name of view's owner
</entry>
7751 <entry><structfield>definition
</structfield></entry>
7752 <entry><type>text
</type></entry>
7754 <entry>View definition (a reconstructed
<command>SELECT
</command> query)
</entry>