]> granicus.if.org Git - postgresql/blob - doc/src/sgml/catalogs.sgml
Address points made in post-commit review of replication origins.
[postgresql] / doc / src / sgml / catalogs.sgml
1 <!-- doc/src/sgml/catalogs.sgml -->
2 <!--
3  Documentation of the system catalogs, directed toward PostgreSQL developers
4  -->
5
6 <chapter id="catalogs">
7  <title>System Catalogs</title>
8
9   <para>
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 &mdash; and actually
20    creates the database on disk.)  There are some exceptions for
21    particularly esoteric operations, such as adding index access methods.
22   </para>
23
24  <sect1 id="catalogs-overview">
25   <title>Overview</title>
26
27   <para>
28    <xref linkend="catalog-table"> lists the system catalogs.
29    More detailed documentation of each catalog follows below.
30   </para>
31
32   <para>
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.
37   </para>
38
39   <table id="catalog-table">
40    <title>System Catalogs</title>
41
42    <tgroup cols="2">
43     <thead>
44      <row>
45       <entry>Catalog Name</entry>
46       <entry>Purpose</entry>
47      </row>
48     </thead>
49
50     <tbody>
51      <row>
52       <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
53       <entry>aggregate functions</entry>
54      </row>
55
56      <row>
57       <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
58       <entry>index access methods</entry>
59      </row>
60
61      <row>
62       <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
63       <entry>access method operators</entry>
64      </row>
65
66      <row>
67       <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
68       <entry>access method support procedures</entry>
69      </row>
70
71      <row>
72       <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
73       <entry>column default values</entry>
74      </row>
75
76      <row>
77       <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
78       <entry>table columns (<quote>attributes</quote>)</entry>
79      </row>
80
81      <row>
82       <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
83       <entry>authorization identifiers (roles)</entry>
84      </row>
85
86      <row>
87       <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
88       <entry>authorization identifier membership relationships</entry>
89      </row>
90
91      <row>
92       <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
93       <entry>casts (data type conversions)</entry>
94      </row>
95
96      <row>
97       <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
98       <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
99      </row>
100
101      <row>
102       <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
103       <entry>collations (locale information)</entry>
104      </row>
105
106      <row>
107       <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
108       <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
109      </row>
110
111      <row>
112       <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
113       <entry>encoding conversion information</entry>
114      </row>
115
116      <row>
117       <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
118       <entry>databases within this database cluster</entry>
119      </row>
120
121      <row>
122       <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
123       <entry>per-role and per-database settings</entry>
124      </row>
125
126      <row>
127       <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
128       <entry>default privileges for object types</entry>
129      </row>
130
131      <row>
132       <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
133       <entry>dependencies between database objects</entry>
134      </row>
135
136      <row>
137       <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
138       <entry>descriptions or comments on database objects</entry>
139      </row>
140
141      <row>
142       <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
143       <entry>enum label and value definitions</entry>
144      </row>
145
146      <row>
147       <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
148       <entry>event triggers</entry>
149      </row>
150
151      <row>
152       <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
153       <entry>installed extensions</entry>
154      </row>
155
156      <row>
157       <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
158       <entry>foreign-data wrapper definitions</entry>
159      </row>
160
161      <row>
162       <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
163       <entry>foreign server definitions</entry>
164      </row>
165
166      <row>
167       <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
168       <entry>additional foreign table information</entry>
169      </row>
170
171      <row>
172       <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
173       <entry>additional index information</entry>
174      </row>
175
176      <row>
177       <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
178       <entry>table inheritance hierarchy</entry>
179      </row>
180
181      <row>
182       <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
183       <entry>languages for writing functions</entry>
184      </row>
185
186      <row>
187       <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
188       <entry>data pages for large objects</entry>
189      </row>
190
191      <row>
192       <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
193       <entry>metadata for large objects</entry>
194      </row>
195
196      <row>
197       <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
198       <entry>schemas</entry>
199      </row>
200
201      <row>
202       <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
203       <entry>access method operator classes</entry>
204      </row>
205
206      <row>
207       <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
208       <entry>operators</entry>
209      </row>
210
211      <row>
212       <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
213       <entry>access method operator families</entry>
214      </row>
215
216      <row>
217       <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
218       <entry>template data for procedural languages</entry>
219      </row>
220
221      <row>
222       <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
223       <entry>row-security policies</entry>
224      </row>
225
226      <row>
227       <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
228       <entry>functions and procedures</entry>
229      </row>
230
231      <row>
232       <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
233       <entry>information about range types</entry>
234      </row>
235
236      <row>
237       <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
238       <entry>query rewrite rules</entry>
239      </row>
240
241      <row>
242       <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
243       <entry>registered replication origins</entry>
244      </row>
245
246      <row>
247       <entry><link linkend="catalog-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
248       <entry>information about replication origins, including replication progress</entry>
249      </row>
250
251      <row>
252       <entry><link linkend="catalog-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
253       <entry>replication slot information</entry>
254      </row>
255
256      <row>
257       <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
258       <entry>security labels on database objects</entry>
259      </row>
260
261      <row>
262       <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
263       <entry>dependencies on shared objects</entry>
264      </row>
265
266      <row>
267       <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
268       <entry>comments on shared objects</entry>
269      </row>
270
271      <row>
272       <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
273       <entry>security labels on shared database objects</entry>
274      </row>
275
276      <row>
277       <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
278       <entry>planner statistics</entry>
279      </row>
280
281      <row>
282       <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
283       <entry>tablespaces within this database cluster</entry>
284      </row>
285
286      <row>
287       <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
288       <entry>transforms (data type to procedural language conversions)</entry>
289      </row>
290
291      <row>
292       <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
293       <entry>triggers</entry>
294      </row>
295
296      <row>
297       <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
298       <entry>text search configurations</entry>
299      </row>
300
301      <row>
302       <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
303       <entry>text search configurations' token mappings</entry>
304      </row>
305
306      <row>
307       <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
308       <entry>text search dictionaries</entry>
309      </row>
310
311      <row>
312       <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
313       <entry>text search parsers</entry>
314      </row>
315
316      <row>
317       <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
318       <entry>text search templates</entry>
319      </row>
320
321      <row>
322       <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
323       <entry>data types</entry>
324      </row>
325
326      <row>
327       <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
328       <entry>mappings of users to foreign servers</entry>
329      </row>
330     </tbody>
331    </tgroup>
332   </table>
333  </sect1>
334
335
336  <sect1 id="catalog-pg-aggregate">
337   <title><structname>pg_aggregate</structname></title>
338
339   <indexterm zone="catalog-pg-aggregate">
340    <primary>pg_aggregate</primary>
341   </indexterm>
342
343   <para>
344    The catalog <structname>pg_aggregate</structname> stores information about
345    aggregate functions.  An aggregate function is a function that
346    operates on a set of values (typically one column from each row
347    that matches a query condition) and returns a single value computed
348    from all these values.  Typical aggregate functions are
349    <function>sum</function>, <function>count</function>, and
350    <function>max</function>.  Each entry in
351    <structname>pg_aggregate</structname> is an extension of an entry
352    in <structname>pg_proc</structname>.  The <structname>pg_proc</structname>
353    entry carries the aggregate's name, input and output data types, and
354    other information that is similar to ordinary functions.
355   </para>
356
357   <table>
358    <title><structname>pg_aggregate</> Columns</title>
359
360    <tgroup cols="4">
361     <thead>
362      <row>
363       <entry>Name</entry>
364       <entry>Type</entry>
365       <entry>References</entry>
366       <entry>Description</entry>
367      </row>
368     </thead>
369     <tbody>
370      <row>
371       <entry><structfield>aggfnoid</structfield></entry>
372       <entry><type>regproc</type></entry>
373       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
374       <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
375      </row>
376      <row>
377       <entry><structfield>aggkind</structfield></entry>
378       <entry><type>char</type></entry>
379       <entry></entry>
380       <entry>Aggregate kind:
381        <literal>n</literal> for <quote>normal</> aggregates,
382        <literal>o</literal> for <quote>ordered-set</> aggregates, or
383        <literal>h</literal> for <quote>hypothetical-set</> aggregates
384       </entry>
385      </row>
386      <row>
387       <entry><structfield>aggnumdirectargs</structfield></entry>
388       <entry><type>int2</type></entry>
389       <entry></entry>
390       <entry>Number of direct (non-aggregated) arguments of an ordered-set or
391        hypothetical-set aggregate, counting a variadic array as one argument.
392        If equal to <structfield>pronargs</>, the aggregate must be variadic
393        and the variadic array describes the aggregated arguments as well as
394        the final direct arguments.
395        Always zero for normal aggregates.</entry>
396      </row>
397      <row>
398       <entry><structfield>aggtransfn</structfield></entry>
399       <entry><type>regproc</type></entry>
400       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
401       <entry>Transition function</entry>
402      </row>
403      <row>
404       <entry><structfield>aggfinalfn</structfield></entry>
405       <entry><type>regproc</type></entry>
406       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
407       <entry>Final function (zero if none)</entry>
408      </row>
409      <row>
410       <entry><structfield>aggmtransfn</structfield></entry>
411       <entry><type>regproc</type></entry>
412       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
413       <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
414      </row>
415      <row>
416       <entry><structfield>aggminvtransfn</structfield></entry>
417       <entry><type>regproc</type></entry>
418       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
419       <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
420      </row>
421      <row>
422       <entry><structfield>aggmfinalfn</structfield></entry>
423       <entry><type>regproc</type></entry>
424       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
425       <entry>Final function for moving-aggregate mode (zero if none)</entry>
426      </row>
427      <row>
428       <entry><structfield>aggfinalextra</structfield></entry>
429       <entry><type>bool</type></entry>
430       <entry></entry>
431       <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
432      </row>
433      <row>
434       <entry><structfield>aggmfinalextra</structfield></entry>
435       <entry><type>bool</type></entry>
436       <entry></entry>
437       <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
438      </row>
439      <row>
440       <entry><structfield>aggsortop</structfield></entry>
441       <entry><type>oid</type></entry>
442       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
443       <entry>Associated sort operator (zero if none)</entry>
444      </row>
445      <row>
446       <entry><structfield>aggtranstype</structfield></entry>
447       <entry><type>oid</type></entry>
448       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
449       <entry>Data type of the aggregate function's internal transition (state) data</entry>
450      </row>
451      <row>
452       <entry><structfield>aggtransspace</structfield></entry>
453       <entry><type>int4</type></entry>
454       <entry></entry>
455       <entry>Approximate average size (in bytes) of the transition state
456        data, or zero to use a default estimate</entry>
457      </row>
458      <row>
459       <entry><structfield>aggmtranstype</structfield></entry>
460       <entry><type>oid</type></entry>
461       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
462       <entry>Data type of the aggregate function's internal transition (state)
463        data for moving-aggregate mode (zero if none)</entry>
464      </row>
465      <row>
466       <entry><structfield>aggmtransspace</structfield></entry>
467       <entry><type>int4</type></entry>
468       <entry></entry>
469       <entry>Approximate average size (in bytes) of the transition state data
470        for moving-aggregate mode, or zero to use a default estimate</entry>
471      </row>
472      <row>
473       <entry><structfield>agginitval</structfield></entry>
474       <entry><type>text</type></entry>
475       <entry></entry>
476       <entry>
477        The initial value of the transition state.  This is a text
478        field containing the initial value in its external string
479        representation.  If this field is null, the transition state
480        value starts out null.
481       </entry>
482      </row>
483      <row>
484       <entry><structfield>aggminitval</structfield></entry>
485       <entry><type>text</type></entry>
486       <entry></entry>
487       <entry>
488        The initial value of the transition state for moving-aggregate mode.
489        This is a text field containing the initial value in its external
490        string representation.  If this field is null, the transition state
491        value starts out null.
492       </entry>
493      </row>
494     </tbody>
495    </tgroup>
496   </table>
497
498   <para>
499    New aggregate functions are registered with the <xref
500    linkend="sql-createaggregate">
501    command.  See <xref linkend="xaggr"> for more information about
502    writing aggregate functions and the meaning of the transition
503    functions, etc.
504   </para>
505
506  </sect1>
507
508
509  <sect1 id="catalog-pg-am">
510   <title><structname>pg_am</structname></title>
511
512   <indexterm zone="catalog-pg-am">
513    <primary>pg_am</primary>
514   </indexterm>
515
516   <para>
517    The catalog <structname>pg_am</structname> stores information about index
518    access methods.  There is one row for each index access method supported by
519    the system.  The contents of this catalog are discussed in detail in
520    <xref linkend="indexam">.
521   </para>
522
523   <table>
524    <title><structname>pg_am</> Columns</title>
525
526    <tgroup cols="4">
527     <thead>
528      <row>
529       <entry>Name</entry>
530       <entry>Type</entry>
531       <entry>References</entry>
532       <entry>Description</entry>
533      </row>
534     </thead>
535     <tbody>
536
537      <row>
538       <entry><structfield>oid</structfield></entry>
539       <entry><type>oid</type></entry>
540       <entry></entry>
541       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
542      </row>
543
544      <row>
545       <entry><structfield>amname</structfield></entry>
546       <entry><type>name</type></entry>
547       <entry></entry>
548       <entry>Name of the access method</entry>
549      </row>
550
551      <row>
552       <entry><structfield>amstrategies</structfield></entry>
553       <entry><type>int2</type></entry>
554       <entry></entry>
555       <entry>Number of operator strategies for this access method,
556        or zero if access method does not have a fixed set of operator
557        strategies</entry>
558      </row>
559
560      <row>
561       <entry><structfield>amsupport</structfield></entry>
562       <entry><type>int2</type></entry>
563       <entry></entry>
564       <entry>Number of support routines for this access method</entry>
565      </row>
566
567      <row>
568       <entry><structfield>amcanorder</structfield></entry>
569       <entry><type>bool</type></entry>
570       <entry></entry>
571       <entry>Does the access method support ordered scans sorted by the
572        indexed column's value?</entry>
573      </row>
574
575      <row>
576       <entry><structfield>amcanorderbyop</structfield></entry>
577       <entry><type>bool</type></entry>
578       <entry></entry>
579       <entry>Does the access method support ordered scans sorted by the result
580        of an operator on the indexed column?</entry>
581      </row>
582
583      <row>
584       <entry><structfield>amcanbackward</structfield></entry>
585       <entry><type>bool</type></entry>
586       <entry></entry>
587       <entry>Does the access method support backward scanning?</entry>
588      </row>
589
590      <row>
591       <entry><structfield>amcanunique</structfield></entry>
592       <entry><type>bool</type></entry>
593       <entry></entry>
594       <entry>Does the access method support unique indexes?</entry>
595      </row>
596
597      <row>
598       <entry><structfield>amcanmulticol</structfield></entry>
599       <entry><type>bool</type></entry>
600       <entry></entry>
601       <entry>Does the access method support multicolumn indexes?</entry>
602      </row>
603
604      <row>
605       <entry><structfield>amoptionalkey</structfield></entry>
606       <entry><type>bool</type></entry>
607       <entry></entry>
608       <entry>Does the access method support a scan without any constraint
609        for the first index column?</entry>
610      </row>
611
612      <row>
613       <entry><structfield>amsearcharray</structfield></entry>
614       <entry><type>bool</type></entry>
615       <entry></entry>
616       <entry>Does the access method support <literal>ScalarArrayOpExpr</> searches?</entry>
617      </row>
618
619      <row>
620       <entry><structfield>amsearchnulls</structfield></entry>
621       <entry><type>bool</type></entry>
622       <entry></entry>
623       <entry>Does the access method support <literal>IS NULL</>/<literal>NOT NULL</> searches?</entry>
624      </row>
625
626      <row>
627       <entry><structfield>amstorage</structfield></entry>
628       <entry><type>bool</type></entry>
629       <entry></entry>
630       <entry>Can index storage data type differ from column data type?</entry>
631      </row>
632
633      <row>
634       <entry><structfield>amclusterable</structfield></entry>
635       <entry><type>bool</type></entry>
636       <entry></entry>
637       <entry>Can an index of this type be clustered on?</entry>
638      </row>
639
640      <row>
641       <entry><structfield>ampredlocks</structfield></entry>
642       <entry><type>bool</type></entry>
643       <entry></entry>
644       <entry>Does an index of this type manage fine-grained predicate locks?</entry>
645      </row>
646
647      <row>
648       <entry><structfield>amkeytype</structfield></entry>
649       <entry><type>oid</type></entry>
650       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
651       <entry>Type of data stored in index, or zero if not a fixed type</entry>
652      </row>
653
654      <row>
655       <entry><structfield>aminsert</structfield></entry>
656       <entry><type>regproc</type></entry>
657       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
658       <entry><quote>Insert this tuple</quote> function</entry>
659      </row>
660
661      <row>
662       <entry><structfield>ambeginscan</structfield></entry>
663       <entry><type>regproc</type></entry>
664       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
665       <entry><quote>Prepare for index scan</quote> function</entry>
666      </row>
667
668      <row>
669       <entry><structfield>amgettuple</structfield></entry>
670       <entry><type>regproc</type></entry>
671       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
672       <entry><quote>Next valid tuple</quote> function, or zero if none</entry>
673      </row>
674
675      <row>
676       <entry><structfield>amgetbitmap</structfield></entry>
677       <entry><type>regproc</type></entry>
678       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
679       <entry><quote>Fetch all valid tuples</quote> function, or zero if none</entry>
680      </row>
681
682      <row>
683       <entry><structfield>amrescan</structfield></entry>
684       <entry><type>regproc</type></entry>
685       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
686       <entry><quote>(Re)start index scan</quote> function</entry>
687      </row>
688
689      <row>
690       <entry><structfield>amendscan</structfield></entry>
691       <entry><type>regproc</type></entry>
692       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
693       <entry><quote>Clean up after index scan</quote> function</entry>
694      </row>
695
696      <row>
697       <entry><structfield>ammarkpos</structfield></entry>
698       <entry><type>regproc</type></entry>
699       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
700       <entry><quote>Mark current scan position</quote> function</entry>
701      </row>
702
703      <row>
704       <entry><structfield>amrestrpos</structfield></entry>
705       <entry><type>regproc</type></entry>
706       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
707       <entry><quote>Restore marked scan position</quote> function</entry>
708      </row>
709
710      <row>
711       <entry><structfield>ambuild</structfield></entry>
712       <entry><type>regproc</type></entry>
713       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
714       <entry><quote>Build new index</quote> function</entry>
715      </row>
716
717      <row>
718       <entry><structfield>ambuildempty</structfield></entry>
719       <entry><type>regproc</type></entry>
720       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
721       <entry><quote>Build empty index</quote> function</entry>
722      </row>
723
724      <row>
725       <entry><structfield>ambulkdelete</structfield></entry>
726       <entry><type>regproc</type></entry>
727       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
728       <entry>Bulk-delete function</entry>
729      </row>
730
731      <row>
732       <entry><structfield>amvacuumcleanup</structfield></entry>
733       <entry><type>regproc</type></entry>
734       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
735       <entry>Post-<command>VACUUM</command> cleanup function</entry>
736      </row>
737
738      <row>
739       <entry><structfield>amcanreturn</structfield></entry>
740       <entry><type>regproc</type></entry>
741       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
742       <entry>Function to check whether an index column supports index-only
743        scans. Can be zero if index-only scans are never supported.</entry>
744      </row>
745
746      <row>
747       <entry><structfield>amcostestimate</structfield></entry>
748       <entry><type>regproc</type></entry>
749       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
750       <entry>Function to estimate cost of an index scan</entry>
751      </row>
752
753      <row>
754       <entry><structfield>amoptions</structfield></entry>
755       <entry><type>regproc</type></entry>
756       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
757       <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
758      </row>
759
760     </tbody>
761    </tgroup>
762   </table>
763
764  </sect1>
765
766
767  <sect1 id="catalog-pg-amop">
768   <title><structname>pg_amop</structname></title>
769
770   <indexterm zone="catalog-pg-amop">
771    <primary>pg_amop</primary>
772   </indexterm>
773
774   <para>
775    The catalog <structname>pg_amop</structname> stores information about
776    operators associated with access method operator families.  There is one
777    row for each operator that is a member of an operator family.  A family
778    member can be either a <firstterm>search</> operator or an
779    <firstterm>ordering</> operator.  An operator
780    can appear in more than one family, but cannot appear in more than one
781    search position nor more than one ordering position within a family.
782    (It is allowed, though unlikely, for an operator to be used for both
783    search and ordering purposes.)
784   </para>
785
786   <table>
787    <title><structname>pg_amop</> Columns</title>
788
789    <tgroup cols="4">
790     <thead>
791      <row>
792       <entry>Name</entry>
793       <entry>Type</entry>
794       <entry>References</entry>
795       <entry>Description</entry>
796      </row>
797     </thead>
798     <tbody>
799
800      <row>
801       <entry><structfield>oid</structfield></entry>
802       <entry><type>oid</type></entry>
803       <entry></entry>
804       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
805      </row>
806
807      <row>
808       <entry><structfield>amopfamily</structfield></entry>
809       <entry><type>oid</type></entry>
810       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
811       <entry>The operator family this entry is for</entry>
812      </row>
813
814      <row>
815       <entry><structfield>amoplefttype</structfield></entry>
816       <entry><type>oid</type></entry>
817       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
818       <entry>Left-hand input data type of operator</entry>
819      </row>
820
821      <row>
822       <entry><structfield>amoprighttype</structfield></entry>
823       <entry><type>oid</type></entry>
824       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
825       <entry>Right-hand input data type of operator</entry>
826      </row>
827
828      <row>
829       <entry><structfield>amopstrategy</structfield></entry>
830       <entry><type>int2</type></entry>
831       <entry></entry>
832       <entry>Operator strategy number</entry>
833      </row>
834
835      <row>
836       <entry><structfield>amoppurpose</structfield></entry>
837       <entry><type>char</type></entry>
838       <entry></entry>
839       <entry>Operator purpose, either <literal>s</> for search or
840        <literal>o</> for ordering</entry>
841      </row>
842
843      <row>
844       <entry><structfield>amopopr</structfield></entry>
845       <entry><type>oid</type></entry>
846       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
847       <entry>OID of the operator</entry>
848      </row>
849
850      <row>
851       <entry><structfield>amopmethod</structfield></entry>
852       <entry><type>oid</type></entry>
853       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
854       <entry>Index access method operator family is for</entry>
855      </row>
856
857      <row>
858       <entry><structfield>amopsortfamily</structfield></entry>
859       <entry><type>oid</type></entry>
860       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
861       <entry>The B-tree operator family this entry sorts according to, if an
862        ordering operator; zero if a search operator</entry>
863      </row>
864
865     </tbody>
866    </tgroup>
867   </table>
868
869   <para>
870    A <quote>search</> operator entry indicates that an index of this operator
871    family can be searched to find all rows satisfying
872    <literal>WHERE</>
873    <replaceable>indexed_column</>
874    <replaceable>operator</>
875    <replaceable>constant</>.
876    Obviously, such an operator must return <type>boolean</type>, and its left-hand input
877    type must match the index's column data type.
878   </para>
879
880   <para>
881    An <quote>ordering</> operator entry indicates that an index of this
882    operator family can be scanned to return rows in the order represented by
883    <literal>ORDER BY</>
884    <replaceable>indexed_column</>
885    <replaceable>operator</>
886    <replaceable>constant</>.
887    Such an operator could return any sortable data type, though again
888    its left-hand input type must match the index's column data type.
889    The exact semantics of the <literal>ORDER BY</> are specified by the
890    <structfield>amopsortfamily</structfield> column, which must reference
891    a B-tree operator family for the operator's result type.
892   </para>
893
894   <note>
895    <para>
896     At present, it's assumed that the sort order for an ordering operator
897     is the default for the referenced operator family, i.e., <literal>ASC NULLS
898     LAST</>.  This might someday be relaxed by adding additional columns
899     to specify sort options explicitly.
900    </para>
901   </note>
902
903   <para>
904    An entry's <structfield>amopmethod</> must match the
905    <structname>opfmethod</> of its containing operator family (including
906    <structfield>amopmethod</> here is an intentional denormalization of the
907    catalog structure for performance reasons).  Also,
908    <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
909    the <structfield>oprleft</> and <structfield>oprright</> fields of the
910    referenced <structname>pg_operator</> entry.
911   </para>
912
913  </sect1>
914
915
916  <sect1 id="catalog-pg-amproc">
917   <title><structname>pg_amproc</structname></title>
918
919   <indexterm zone="catalog-pg-amproc">
920    <primary>pg_amproc</primary>
921   </indexterm>
922
923   <para>
924    The catalog <structname>pg_amproc</structname> stores information about
925    support procedures associated with access method operator families.  There
926    is one row for each support procedure belonging to an operator family.
927   </para>
928
929   <table>
930    <title><structname>pg_amproc</structname> Columns</title>
931
932    <tgroup cols="4">
933     <thead>
934      <row>
935       <entry>Name</entry>
936       <entry>Type</entry>
937       <entry>References</entry>
938       <entry>Description</entry>
939      </row>
940     </thead>
941     <tbody>
942
943      <row>
944       <entry><structfield>oid</structfield></entry>
945       <entry><type>oid</type></entry>
946       <entry></entry>
947       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
948      </row>
949
950      <row>
951       <entry><structfield>amprocfamily</structfield></entry>
952       <entry><type>oid</type></entry>
953       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
954       <entry>The operator family this entry is for</entry>
955      </row>
956
957      <row>
958       <entry><structfield>amproclefttype</structfield></entry>
959       <entry><type>oid</type></entry>
960       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
961       <entry>Left-hand input data type of associated operator</entry>
962      </row>
963
964      <row>
965       <entry><structfield>amprocrighttype</structfield></entry>
966       <entry><type>oid</type></entry>
967       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
968       <entry>Right-hand input data type of associated operator</entry>
969      </row>
970
971      <row>
972       <entry><structfield>amprocnum</structfield></entry>
973       <entry><type>int2</type></entry>
974       <entry></entry>
975       <entry>Support procedure number</entry>
976      </row>
977
978      <row>
979       <entry><structfield>amproc</structfield></entry>
980       <entry><type>regproc</type></entry>
981       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
982       <entry>OID of the procedure</entry>
983      </row>
984
985     </tbody>
986    </tgroup>
987   </table>
988
989   <para>
990    The usual interpretation of the
991    <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
992    is that they identify the left and right input types of the operator(s)
993    that a particular support procedure supports.  For some access methods
994    these match the input data type(s) of the support procedure itself, for
995    others not.  There is a notion of <quote>default</> support procedures for
996    an index, which are those with <structfield>amproclefttype</> and
997    <structfield>amprocrighttype</> both equal to the index operator class's
998    <structfield>opcintype</>.
999   </para>
1000
1001  </sect1>
1002
1003
1004  <sect1 id="catalog-pg-attrdef">
1005   <title><structname>pg_attrdef</structname></title>
1006
1007   <indexterm zone="catalog-pg-attrdef">
1008    <primary>pg_attrdef</primary>
1009   </indexterm>
1010
1011   <para>
1012    The catalog <structname>pg_attrdef</structname> stores column default values.  The main information
1013    about columns is stored in <structname>pg_attribute</structname>
1014    (see below).  Only columns that explicitly specify a default value
1015    (when the table is created or the column is added) will have an
1016    entry here.
1017   </para>
1018
1019   <table>
1020    <title><structname>pg_attrdef</> Columns</title>
1021
1022    <tgroup cols="4">
1023     <thead>
1024      <row>
1025       <entry>Name</entry>
1026       <entry>Type</entry>
1027       <entry>References</entry>
1028       <entry>Description</entry>
1029      </row>
1030     </thead>
1031
1032     <tbody>
1033      <row>
1034       <entry><structfield>oid</structfield></entry>
1035       <entry><type>oid</type></entry>
1036       <entry></entry>
1037       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1038      </row>
1039
1040      <row>
1041       <entry><structfield>adrelid</structfield></entry>
1042       <entry><type>oid</type></entry>
1043       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1044       <entry>The table this column belongs to</entry>
1045      </row>
1046
1047      <row>
1048       <entry><structfield>adnum</structfield></entry>
1049       <entry><type>int2</type></entry>
1050       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
1051       <entry>The number of the column</entry>
1052      </row>
1053
1054      <row>
1055       <entry><structfield>adbin</structfield></entry>
1056       <entry><type>pg_node_tree</type></entry>
1057       <entry></entry>
1058       <entry>The internal representation of the column default value</entry>
1059      </row>
1060
1061      <row>
1062       <entry><structfield>adsrc</structfield></entry>
1063       <entry><type>text</type></entry>
1064       <entry></entry>
1065       <entry>A human-readable representation of the default value</entry>
1066      </row>
1067     </tbody>
1068    </tgroup>
1069   </table>
1070
1071    <para>
1072     The <structfield>adsrc</structfield> field is historical, and is best
1073     not used, because it does not track outside changes that might affect
1074     the representation of the default value.  Reverse-compiling the
1075     <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
1076     example) is a better way to display the default value.
1077    </para>
1078
1079  </sect1>
1080
1081
1082  <sect1 id="catalog-pg-attribute">
1083   <title><structname>pg_attribute</structname></title>
1084
1085   <indexterm zone="catalog-pg-attribute">
1086    <primary>pg_attribute</primary>
1087   </indexterm>
1088
1089   <para>
1090    The catalog <structname>pg_attribute</structname> stores information about
1091    table columns.  There will be exactly one
1092    <structname>pg_attribute</structname> row for every column in every
1093    table in the database.  (There will also be attribute entries for
1094    indexes, and indeed all objects that have <structname>pg_class</structname>
1095    entries.)
1096   </para>
1097
1098   <para>
1099    The term attribute is equivalent to column and is used for
1100    historical reasons.
1101   </para>
1102
1103   <table>
1104    <title><structname>pg_attribute</> Columns</title>
1105
1106    <tgroup cols="4">
1107     <thead>
1108      <row>
1109       <entry>Name</entry>
1110       <entry>Type</entry>
1111       <entry>References</entry>
1112       <entry>Description</entry>
1113      </row>
1114     </thead>
1115
1116     <tbody>
1117      <row>
1118       <entry><structfield>attrelid</structfield></entry>
1119       <entry><type>oid</type></entry>
1120       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1121       <entry>The table this column belongs to</entry>
1122      </row>
1123
1124      <row>
1125       <entry><structfield>attname</structfield></entry>
1126       <entry><type>name</type></entry>
1127       <entry></entry>
1128       <entry>The column name</entry>
1129      </row>
1130
1131      <row>
1132       <entry><structfield>atttypid</structfield></entry>
1133       <entry><type>oid</type></entry>
1134       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1135       <entry>The data type of this column</entry>
1136      </row>
1137
1138      <row>
1139       <entry><structfield>attstattarget</structfield></entry>
1140       <entry><type>int4</type></entry>
1141       <entry></entry>
1142       <entry>
1143        <structfield>attstattarget</structfield> controls the level of detail
1144        of statistics accumulated for this column by
1145        <xref linkend="sql-analyze">.
1146        A zero value indicates that no statistics should be collected.
1147        A negative value says to use the system default statistics target.
1148        The exact meaning of positive values is data type-dependent.
1149        For scalar data types, <structfield>attstattarget</structfield>
1150        is both the target number of <quote>most common values</quote>
1151        to collect, and the target number of histogram bins to create.
1152       </entry>
1153      </row>
1154
1155      <row>
1156       <entry><structfield>attlen</structfield></entry>
1157       <entry><type>int2</type></entry>
1158       <entry></entry>
1159       <entry>
1160        A copy of <literal>pg_type.typlen</literal> of this column's
1161        type
1162       </entry>
1163      </row>
1164
1165      <row>
1166       <entry><structfield>attnum</structfield></entry>
1167       <entry><type>int2</type></entry>
1168       <entry></entry>
1169       <entry>
1170        The number of the column.  Ordinary columns are numbered from 1
1171        up.  System columns, such as <structfield>oid</structfield>,
1172        have (arbitrary) negative numbers.
1173       </entry>
1174      </row>
1175
1176      <row>
1177       <entry><structfield>attndims</structfield></entry>
1178       <entry><type>int4</type></entry>
1179       <entry></entry>
1180       <entry>
1181        Number of dimensions, if the column is an array type; otherwise 0.
1182        (Presently, the number of dimensions of an array is not enforced,
1183        so any nonzero value effectively means <quote>it's an array</>.)
1184       </entry>
1185      </row>
1186
1187      <row>
1188       <entry><structfield>attcacheoff</structfield></entry>
1189       <entry><type>int4</type></entry>
1190       <entry></entry>
1191       <entry>
1192        Always -1 in storage, but when loaded into a row descriptor
1193        in memory this might be updated to cache the offset of the attribute
1194        within the row
1195       </entry>
1196      </row>
1197
1198      <row>
1199       <entry><structfield>atttypmod</structfield></entry>
1200       <entry><type>int4</type></entry>
1201       <entry></entry>
1202       <entry>
1203        <structfield>atttypmod</structfield> records type-specific data
1204        supplied at table creation time (for example, the maximum
1205        length of a <type>varchar</type> column).  It is passed to
1206        type-specific input functions and length coercion functions.
1207        The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1208       </entry>
1209      </row>
1210
1211      <row>
1212       <entry><structfield>attbyval</structfield></entry>
1213       <entry><type>bool</type></entry>
1214       <entry></entry>
1215       <entry>
1216        A copy of <literal>pg_type.typbyval</> of this column's type
1217       </entry>
1218      </row>
1219
1220      <row>
1221       <entry><structfield>attstorage</structfield></entry>
1222       <entry><type>char</type></entry>
1223       <entry></entry>
1224       <entry>
1225        Normally a copy of <literal>pg_type.typstorage</> of this
1226        column's type.  For TOAST-able data types, this can be altered
1227        after column creation to control storage policy.
1228       </entry>
1229      </row>
1230
1231      <row>
1232       <entry><structfield>attalign</structfield></entry>
1233       <entry><type>char</type></entry>
1234       <entry></entry>
1235       <entry>
1236        A copy of <literal>pg_type.typalign</> of this column's type
1237       </entry>
1238      </row>
1239
1240      <row>
1241       <entry><structfield>attnotnull</structfield></entry>
1242       <entry><type>bool</type></entry>
1243       <entry></entry>
1244       <entry>
1245        This represents a not-null constraint.
1246       </entry>
1247      </row>
1248
1249      <row>
1250       <entry><structfield>atthasdef</structfield></entry>
1251       <entry><type>bool</type></entry>
1252       <entry></entry>
1253       <entry>
1254        This column has a default value, in which case there will be a
1255        corresponding entry in the <structname>pg_attrdef</structname>
1256        catalog that actually defines the value.
1257       </entry>
1258      </row>
1259
1260      <row>
1261       <entry><structfield>attisdropped</structfield></entry>
1262       <entry><type>bool</type></entry>
1263       <entry></entry>
1264       <entry>
1265        This column has been dropped and is no longer valid.  A dropped
1266        column is still physically present in the table, but is
1267        ignored by the parser and so cannot be accessed via SQL.
1268       </entry>
1269      </row>
1270
1271      <row>
1272       <entry><structfield>attislocal</structfield></entry>
1273       <entry><type>bool</type></entry>
1274       <entry></entry>
1275       <entry>
1276        This column is defined locally in the relation.  Note that a column can
1277        be locally defined and inherited simultaneously.
1278       </entry>
1279      </row>
1280
1281      <row>
1282       <entry><structfield>attinhcount</structfield></entry>
1283       <entry><type>int4</type></entry>
1284       <entry></entry>
1285       <entry>
1286        The number of direct ancestors this column has.  A column with a
1287        nonzero number of ancestors cannot be dropped nor renamed.
1288       </entry>
1289      </row>
1290
1291      <row>
1292       <entry><structfield>attcollation</structfield></entry>
1293       <entry><type>oid</type></entry>
1294       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1295       <entry>
1296        The defined collation of the column, or zero if the column is
1297        not of a collatable data type.
1298       </entry>
1299      </row>
1300
1301      <row>
1302       <entry><structfield>attacl</structfield></entry>
1303       <entry><type>aclitem[]</type></entry>
1304       <entry></entry>
1305       <entry>
1306        Column-level access privileges, if any have been granted specifically
1307        on this column
1308       </entry>
1309      </row>
1310
1311      <row>
1312       <entry><structfield>attoptions</structfield></entry>
1313       <entry><type>text[]</type></entry>
1314       <entry></entry>
1315       <entry>
1316        Attribute-level options, as <quote>keyword=value</> strings
1317       </entry>
1318      </row>
1319
1320      <row>
1321       <entry><structfield>attfdwoptions</structfield></entry>
1322       <entry><type>text[]</type></entry>
1323       <entry></entry>
1324       <entry>
1325        Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1326       </entry>
1327      </row>
1328
1329     </tbody>
1330    </tgroup>
1331   </table>
1332
1333   <para>
1334    In a dropped column's <structname>pg_attribute</structname> entry,
1335    <structfield>atttypid</structfield> is reset to zero, but
1336    <structfield>attlen</structfield> and the other fields copied from
1337    <structname>pg_type</> are still valid.  This arrangement is needed
1338    to cope with the situation where the dropped column's data type was
1339    later dropped, and so there is no <structname>pg_type</> row anymore.
1340    <structfield>attlen</structfield> and the other fields can be used
1341    to interpret the contents of a row of the table.
1342   </para>
1343  </sect1>
1344
1345
1346  <sect1 id="catalog-pg-authid">
1347   <title><structname>pg_authid</structname></title>
1348
1349   <indexterm zone="catalog-pg-authid">
1350    <primary>pg_authid</primary>
1351   </indexterm>
1352
1353   <para>
1354    The catalog <structname>pg_authid</structname> contains information about
1355    database authorization identifiers (roles).  A role subsumes the concepts
1356    of <quote>users</> and <quote>groups</>.  A user is essentially just a
1357    role with the <structfield>rolcanlogin</> flag set.  Any role (with or
1358    without <structfield>rolcanlogin</>) can have other roles as members; see
1359    <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1360   </para>
1361
1362   <para>
1363    Since this catalog contains passwords, it must not be publicly readable.
1364    <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1365    is a publicly readable view on
1366    <structname>pg_authid</structname> that blanks out the password field.
1367   </para>
1368
1369   <para>
1370    <xref linkend="user-manag"> contains detailed information about user and
1371    privilege management.
1372   </para>
1373
1374   <para>
1375    Because user identities are cluster-wide,
1376    <structname>pg_authid</structname>
1377    is shared across all databases of a cluster: there is only one
1378    copy of <structname>pg_authid</structname> per cluster, not
1379    one per database.
1380   </para>
1381
1382   <table>
1383    <title><structname>pg_authid</> Columns</title>
1384
1385    <tgroup cols="3">
1386     <thead>
1387      <row>
1388       <entry>Name</entry>
1389       <entry>Type</entry>
1390       <entry>Description</entry>
1391      </row>
1392     </thead>
1393
1394     <tbody>
1395
1396      <row>
1397       <entry><structfield>oid</structfield></entry>
1398       <entry><type>oid</type></entry>
1399       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1400      </row>
1401
1402      <row>
1403       <entry><structfield>rolname</structfield></entry>
1404       <entry><type>name</type></entry>
1405       <entry>Role name</entry>
1406      </row>
1407
1408      <row>
1409       <entry><structfield>rolsuper</structfield></entry>
1410       <entry><type>bool</type></entry>
1411       <entry>Role has superuser privileges</entry>
1412      </row>
1413
1414      <row>
1415       <entry><structfield>rolinherit</structfield></entry>
1416       <entry><type>bool</type></entry>
1417       <entry>Role automatically inherits privileges of roles it is a
1418        member of</entry>
1419      </row>
1420
1421      <row>
1422       <entry><structfield>rolcreaterole</structfield></entry>
1423       <entry><type>bool</type></entry>
1424       <entry>Role can create more roles</entry>
1425      </row>
1426
1427      <row>
1428       <entry><structfield>rolcreatedb</structfield></entry>
1429       <entry><type>bool</type></entry>
1430       <entry>Role can create databases</entry>
1431      </row>
1432
1433      <row>
1434       <entry><structfield>rolcanlogin</structfield></entry>
1435       <entry><type>bool</type></entry>
1436       <entry>
1437        Role can log in. That is, this role can be given as the initial
1438        session authorization identifier
1439       </entry>
1440      </row>
1441
1442      <row>
1443       <entry><structfield>rolreplication</structfield></entry>
1444       <entry><type>bool</type></entry>
1445       <entry>
1446        Role is a replication role. That is, this role can initiate streaming
1447        replication (see <xref linkend="streaming-replication">) and set/unset
1448        the system backup mode using <function>pg_start_backup</> and
1449        <function>pg_stop_backup</>
1450       </entry>
1451      </row>
1452
1453      <row>
1454       <entry><structfield>rolbypassrls</structfield></entry>
1455       <entry><type>bool</type></entry>
1456       <entry>
1457        Role can bypass row level security policies, see
1458        <xref linkend="ddl-rowsecurity"> for more information.
1459       </entry>
1460      </row>
1461
1462      <row>
1463       <entry><structfield>rolconnlimit</structfield></entry>
1464       <entry><type>int4</type></entry>
1465       <entry>
1466        For roles that can log in, this sets maximum number of concurrent
1467        connections this role can make.  -1 means no limit.
1468       </entry>
1469      </row>
1470
1471      <row>
1472       <entry><structfield>rolpassword</structfield></entry>
1473       <entry><type>text</type></entry>
1474       <entry>
1475        Password (possibly encrypted); null if none.  If the password
1476        is encrypted, this column will begin with the string <literal>md5</>
1477        followed by a 32-character hexadecimal MD5 hash.  The MD5 hash
1478        will be of the user's password concatenated to their user name.
1479        For example, if user <literal>joe</> has password <literal>xyzzy</>,
1480        <productname>PostgreSQL</> will store the md5 hash of
1481        <literal>xyzzyjoe</>.  A password that does not follow that
1482        format is assumed to be unencrypted.
1483       </entry>
1484      </row>
1485
1486      <row>
1487       <entry><structfield>rolvaliduntil</structfield></entry>
1488       <entry><type>timestamptz</type></entry>
1489       <entry>Password expiry time (only used for password authentication);
1490        null if no expiration</entry>
1491      </row>
1492     </tbody>
1493    </tgroup>
1494   </table>
1495
1496  </sect1>
1497
1498
1499  <sect1 id="catalog-pg-auth-members">
1500   <title><structname>pg_auth_members</structname></title>
1501
1502   <indexterm zone="catalog-pg-auth-members">
1503    <primary>pg_auth_members</primary>
1504   </indexterm>
1505
1506   <para>
1507    The catalog <structname>pg_auth_members</structname> shows the membership
1508    relations between roles.  Any non-circular set of relationships is allowed.
1509   </para>
1510
1511   <para>
1512    Because user identities are cluster-wide,
1513    <structname>pg_auth_members</structname>
1514    is shared across all databases of a cluster: there is only one
1515    copy of <structname>pg_auth_members</structname> per cluster, not
1516    one per database.
1517   </para>
1518
1519   <table>
1520    <title><structname>pg_auth_members</> Columns</title>
1521
1522    <tgroup cols="4">
1523     <thead>
1524      <row>
1525       <entry>Name</entry>
1526       <entry>Type</entry>
1527       <entry>References</entry>
1528       <entry>Description</entry>
1529      </row>
1530     </thead>
1531
1532     <tbody>
1533      <row>
1534       <entry><structfield>roleid</structfield></entry>
1535       <entry><type>oid</type></entry>
1536       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1537       <entry>ID of a role that has a member</entry>
1538      </row>
1539
1540      <row>
1541       <entry><structfield>member</structfield></entry>
1542       <entry><type>oid</type></entry>
1543       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1544       <entry>ID of a role that is a member of <structfield>roleid</></entry>
1545      </row>
1546
1547      <row>
1548       <entry><structfield>grantor</structfield></entry>
1549       <entry><type>oid</type></entry>
1550       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1551       <entry>ID of the role that granted this membership</entry>
1552      </row>
1553
1554      <row>
1555       <entry><structfield>admin_option</structfield></entry>
1556       <entry><type>bool</type></entry>
1557       <entry></entry>
1558       <entry>True if <structfield>member</> can grant membership in
1559        <structfield>roleid</> to others</entry>
1560      </row>
1561     </tbody>
1562    </tgroup>
1563   </table>
1564
1565  </sect1>
1566
1567
1568  <sect1 id="catalog-pg-cast">
1569   <title><structname>pg_cast</structname></title>
1570
1571   <indexterm zone="catalog-pg-cast">
1572    <primary>pg_cast</primary>
1573   </indexterm>
1574
1575   <para>
1576    The catalog <structname>pg_cast</structname> stores data type conversion
1577    paths, both built-in and user-defined.
1578   </para>
1579
1580   <para>
1581    It should be noted that <structname>pg_cast</structname> does not represent
1582    every type conversion that the system knows how to perform; only those that
1583    cannot be deduced from some generic rule.  For example, casting between a
1584    domain and its base type is not explicitly represented in
1585    <structname>pg_cast</structname>.  Another important exception is that
1586    <quote>automatic I/O conversion casts</>, those performed using a data
1587    type's own I/O functions to convert to or from <type>text</> or other
1588    string types, are not explicitly represented in
1589    <structname>pg_cast</structname>.
1590   </para>
1591
1592   <table>
1593    <title><structname>pg_cast</> Columns</title>
1594
1595    <tgroup cols="4">
1596     <thead>
1597      <row>
1598       <entry>Name</entry>
1599       <entry>Type</entry>
1600       <entry>References</entry>
1601       <entry>Description</entry>
1602      </row>
1603     </thead>
1604
1605     <tbody>
1606      <row>
1607       <entry><structfield>oid</structfield></entry>
1608       <entry><type>oid</type></entry>
1609       <entry></entry>
1610       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1611      </row>
1612
1613      <row>
1614       <entry><structfield>castsource</structfield></entry>
1615       <entry><type>oid</type></entry>
1616       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1617       <entry>OID of the source data type</entry>
1618      </row>
1619
1620      <row>
1621       <entry><structfield>casttarget</structfield></entry>
1622       <entry><type>oid</type></entry>
1623       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1624       <entry>OID of the target data type</entry>
1625      </row>
1626
1627      <row>
1628       <entry><structfield>castfunc</structfield></entry>
1629       <entry><type>oid</type></entry>
1630       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1631       <entry>
1632        The OID of the function to use to perform this cast.  Zero is
1633        stored if the cast method doesn't require a function.
1634       </entry>
1635      </row>
1636
1637      <row>
1638       <entry><structfield>castcontext</structfield></entry>
1639       <entry><type>char</type></entry>
1640       <entry></entry>
1641       <entry>
1642        Indicates what contexts the cast can be invoked in.
1643        <literal>e</> means only as an explicit cast (using
1644        <literal>CAST</> or <literal>::</> syntax).
1645        <literal>a</> means implicitly in assignment
1646        to a target column, as well as explicitly.
1647        <literal>i</> means implicitly in expressions, as well as the
1648        other cases.
1649       </entry>
1650      </row>
1651      <row>
1652       <entry><structfield>castmethod</structfield></entry>
1653       <entry><type>char</type></entry>
1654       <entry></entry>
1655       <entry>
1656        Indicates how the cast is performed.
1657        <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1658        <literal>i</> means that the input/output functions are used.
1659        <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1660       </entry>
1661      </row>
1662     </tbody>
1663    </tgroup>
1664   </table>
1665
1666   <para>
1667    The cast functions listed in <structname>pg_cast</structname> must
1668    always take the cast source type as their first argument type, and
1669    return the cast destination type as their result type.  A cast
1670    function can have up to three arguments.  The second argument,
1671    if present, must be type <type>integer</>; it receives the type
1672    modifier associated with the destination type, or -1
1673    if there is none.  The third argument,
1674    if present, must be type <type>boolean</>; it receives <literal>true</>
1675    if the cast is an explicit cast, <literal>false</> otherwise.
1676   </para>
1677
1678   <para>
1679    It is legitimate to create a <structname>pg_cast</structname> entry
1680    in which the source and target types are the same, if the associated
1681    function takes more than one argument.  Such entries represent
1682    <quote>length coercion functions</> that coerce values of the type
1683    to be legal for a particular type modifier value.
1684   </para>
1685
1686   <para>
1687    When a <structname>pg_cast</structname> entry has different source and
1688    target types and a function that takes more than one argument, it
1689    represents converting from one type to another and applying a length
1690    coercion in a single step.  When no such entry is available, coercion
1691    to a type that uses a type modifier involves two steps, one to
1692    convert between data types and a second to apply the modifier.
1693   </para>
1694  </sect1>
1695
1696  <sect1 id="catalog-pg-class">
1697   <title><structname>pg_class</structname></title>
1698
1699   <indexterm zone="catalog-pg-class">
1700    <primary>pg_class</primary>
1701   </indexterm>
1702
1703   <para>
1704    The catalog <structname>pg_class</structname> catalogs tables and most
1705    everything else that has columns or is otherwise similar to a
1706    table.  This includes indexes (but see also
1707    <structname>pg_index</structname>), sequences, views, materialized
1708    views, composite types, and TOAST tables; see <structfield>relkind</>.
1709    Below, when we mean all of these
1710    kinds of objects we speak of <quote>relations</quote>.  Not all
1711    columns are meaningful for all relation types.
1712   </para>
1713
1714   <table>
1715    <title><structname>pg_class</> Columns</title>
1716
1717    <tgroup cols="4">
1718     <thead>
1719      <row>
1720       <entry>Name</entry>
1721       <entry>Type</entry>
1722       <entry>References</entry>
1723       <entry>Description</entry>
1724      </row>
1725     </thead>
1726
1727     <tbody>
1728      <row>
1729       <entry><structfield>oid</structfield></entry>
1730       <entry><type>oid</type></entry>
1731       <entry></entry>
1732       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1733      </row>
1734
1735      <row>
1736       <entry><structfield>relname</structfield></entry>
1737       <entry><type>name</type></entry>
1738       <entry></entry>
1739       <entry>Name of the table, index, view, etc.</entry>
1740      </row>
1741
1742      <row>
1743       <entry><structfield>relnamespace</structfield></entry>
1744       <entry><type>oid</type></entry>
1745       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1746       <entry>
1747        The OID of the namespace that contains this relation
1748       </entry>
1749      </row>
1750
1751      <row>
1752       <entry><structfield>reltype</structfield></entry>
1753       <entry><type>oid</type></entry>
1754       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1755       <entry>
1756        The OID of the data type that corresponds to this table's row type,
1757        if any (zero for indexes, which have no <structname>pg_type</> entry)
1758       </entry>
1759      </row>
1760
1761      <row>
1762       <entry><structfield>reloftype</structfield></entry>
1763       <entry><type>oid</type></entry>
1764       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1765       <entry>
1766        For typed tables, the OID of the underlying composite type,
1767        zero for all other relations
1768       </entry>
1769      </row>
1770
1771      <row>
1772       <entry><structfield>relowner</structfield></entry>
1773       <entry><type>oid</type></entry>
1774       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1775       <entry>Owner of the relation</entry>
1776      </row>
1777
1778      <row>
1779       <entry><structfield>relam</structfield></entry>
1780       <entry><type>oid</type></entry>
1781       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1782       <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1783      </row>
1784
1785      <row>
1786       <entry><structfield>relfilenode</structfield></entry>
1787       <entry><type>oid</type></entry>
1788       <entry></entry>
1789       <entry>Name of the on-disk file of this relation; zero means this
1790        is a <quote>mapped</> relation whose disk file name is determined
1791        by low-level state</entry>
1792      </row>
1793
1794      <row>
1795       <entry><structfield>reltablespace</structfield></entry>
1796       <entry><type>oid</type></entry>
1797       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1798       <entry>
1799        The tablespace in which this relation is stored.  If zero,
1800        the database's default tablespace is implied.  (Not meaningful
1801        if the relation has no on-disk file.)
1802       </entry>
1803      </row>
1804
1805      <row>
1806       <entry><structfield>relpages</structfield></entry>
1807       <entry><type>int4</type></entry>
1808       <entry></entry>
1809       <entry>
1810        Size of the on-disk representation of this table in pages (of size
1811        <symbol>BLCKSZ</symbol>).  This is only an estimate used by the
1812        planner.  It is updated by <command>VACUUM</command>,
1813        <command>ANALYZE</command>, and a few DDL commands such as
1814        <command>CREATE INDEX</command>.
1815       </entry>
1816      </row>
1817
1818      <row>
1819       <entry><structfield>reltuples</structfield></entry>
1820       <entry><type>float4</type></entry>
1821       <entry></entry>
1822       <entry>
1823        Number of rows in the table.  This is only an estimate used by the
1824        planner.  It is updated by <command>VACUUM</command>,
1825        <command>ANALYZE</command>, and a few DDL commands such as
1826        <command>CREATE INDEX</command>.
1827       </entry>
1828      </row>
1829
1830      <row>
1831       <entry><structfield>relallvisible</structfield></entry>
1832       <entry><type>int4</type></entry>
1833       <entry></entry>
1834       <entry>
1835        Number of pages that are marked all-visible in the table's
1836        visibility map.  This is only an estimate used by the
1837        planner.  It is updated by <command>VACUUM</command>,
1838        <command>ANALYZE</command>, and a few DDL commands such as
1839        <command>CREATE INDEX</command>.
1840       </entry>
1841      </row>
1842
1843      <row>
1844       <entry><structfield>reltoastrelid</structfield></entry>
1845       <entry><type>oid</type></entry>
1846       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1847       <entry>
1848        OID of the TOAST table associated with this table, 0 if none.  The
1849        TOAST table stores large attributes <quote>out of line</quote> in a
1850        secondary table.
1851       </entry>
1852      </row>
1853
1854      <row>
1855       <entry><structfield>relhasindex</structfield></entry>
1856       <entry><type>bool</type></entry>
1857       <entry></entry>
1858       <entry>
1859        True if this is a table and it has (or recently had) any indexes
1860       </entry>
1861      </row>
1862
1863      <row>
1864       <entry><structfield>relisshared</structfield></entry>
1865       <entry><type>bool</type></entry>
1866       <entry></entry>
1867       <entry>
1868        True if this table is shared across all databases in the cluster.  Only
1869        certain system catalogs (such as <structname>pg_database</structname>)
1870        are shared.
1871       </entry>
1872      </row>
1873
1874      <row>
1875       <entry><structfield>relpersistence</structfield></entry>
1876       <entry><type>char</type></entry>
1877       <entry></entry>
1878       <entry>
1879        <literal>p</> = permanent table, <literal>u</> = unlogged table,
1880        <literal>t</> = temporary table
1881       </entry>
1882      </row>
1883
1884      <row>
1885       <entry><structfield>relkind</structfield></entry>
1886       <entry><type>char</type></entry>
1887       <entry></entry>
1888       <entry>
1889        <literal>r</> = ordinary table, <literal>i</> = index,
1890        <literal>S</> = sequence, <literal>v</> = view,
1891        <literal>m</> = materialized view,
1892        <literal>c</> = composite type, <literal>t</> = TOAST table,
1893        <literal>f</> = foreign table
1894       </entry>
1895      </row>
1896
1897      <row>
1898       <entry><structfield>relnatts</structfield></entry>
1899       <entry><type>int2</type></entry>
1900       <entry></entry>
1901       <entry>
1902        Number of user columns in the relation (system columns not
1903        counted).  There must be this many corresponding entries in
1904        <structname>pg_attribute</structname>.  See also
1905        <literal>pg_attribute.attnum</literal>.
1906       </entry>
1907      </row>
1908
1909      <row>
1910       <entry><structfield>relchecks</structfield></entry>
1911       <entry><type>int2</type></entry>
1912       <entry></entry>
1913       <entry>
1914        Number of <literal>CHECK</> constraints on the table; see
1915        <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1916       </entry>
1917      </row>
1918
1919      <row>
1920       <entry><structfield>relhasoids</structfield></entry>
1921       <entry><type>bool</type></entry>
1922       <entry></entry>
1923       <entry>
1924        True if we generate an OID for each row of the relation
1925       </entry>
1926      </row>
1927
1928      <row>
1929       <entry><structfield>relhaspkey</structfield></entry>
1930       <entry><type>bool</type></entry>
1931       <entry></entry>
1932       <entry>
1933        True if the table has (or once had) a primary key
1934       </entry>
1935      </row>
1936
1937      <row>
1938       <entry><structfield>relhasrules</structfield></entry>
1939       <entry><type>bool</type></entry>
1940       <entry></entry>
1941       <entry>
1942        True if table has (or once had) rules; see
1943        <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1944       </entry>
1945      </row>
1946
1947      <row>
1948       <entry><structfield>relhastriggers</structfield></entry>
1949       <entry><type>bool</type></entry>
1950       <entry></entry>
1951       <entry>
1952        True if table has (or once had) triggers; see
1953        <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1954       </entry>
1955      </row>
1956
1957      <row>
1958       <entry><structfield>relhassubclass</structfield></entry>
1959       <entry><type>bool</type></entry>
1960       <entry></entry>
1961       <entry>True if table has (or once had) any inheritance children</entry>
1962      </row>
1963
1964      <row>
1965       <entry><structfield>relrowsecurity</structfield></entry>
1966       <entry><type>bool</type></entry>
1967       <entry></entry>
1968       <entry>
1969        True if table has row level security enabled; see
1970        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1971       </entry>
1972      </row>
1973
1974      <row>
1975       <entry><structfield>relispopulated</structfield></entry>
1976       <entry><type>bool</type></entry>
1977       <entry></entry>
1978       <entry>True if relation is populated (this is true for all
1979        relations other than some materialized views)</entry>
1980      </row>
1981
1982      <row>
1983       <entry><structfield>relreplident</structfield></entry>
1984       <entry><type>char</type></entry>
1985       <entry></entry>
1986       <entry>
1987        Columns used to form <quote>replica identity</> for rows:
1988        <literal>d</> = default (primary key, if any),
1989        <literal>n</> = nothing,
1990        <literal>f</> = all columns
1991        <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1992       </entry>
1993      </row>
1994
1995      <row>
1996       <entry><structfield>relfrozenxid</structfield></entry>
1997       <entry><type>xid</type></entry>
1998       <entry></entry>
1999       <entry>
2000        All transaction IDs before this one have been replaced with a permanent
2001        (<quote>frozen</>) transaction ID in this table.  This is used to track
2002        whether the table needs to be vacuumed in order to prevent transaction
2003        ID wraparound or to allow <literal>pg_clog</> to be shrunk.  Zero
2004        (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2005       </entry>
2006      </row>
2007
2008      <row>
2009       <entry><structfield>relminmxid</structfield></entry>
2010       <entry><type>xid</type></entry>
2011       <entry></entry>
2012       <entry>
2013        All multixact IDs before this one have been replaced by a
2014        transaction ID in this table.  This is used to track
2015        whether the table needs to be vacuumed in order to prevent multixact ID
2016        wraparound or to allow <literal>pg_multixact</> to be shrunk.  Zero
2017        (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
2018       </entry>
2019      </row>
2020
2021      <row>
2022       <entry><structfield>relacl</structfield></entry>
2023       <entry><type>aclitem[]</type></entry>
2024       <entry></entry>
2025       <entry>
2026        Access privileges; see
2027        <xref linkend="sql-grant"> and
2028        <xref linkend="sql-revoke">
2029        for details
2030       </entry>
2031      </row>
2032
2033      <row>
2034       <entry><structfield>reloptions</structfield></entry>
2035       <entry><type>text[]</type></entry>
2036       <entry></entry>
2037       <entry>
2038        Access-method-specific options, as <quote>keyword=value</> strings
2039       </entry>
2040      </row>
2041     </tbody>
2042    </tgroup>
2043   </table>
2044
2045   <para>
2046    Several of the Boolean flags in <structname>pg_class</> are maintained
2047    lazily: they are guaranteed to be true if that's the correct state, but
2048    may not be reset to false immediately when the condition is no longer
2049    true.  For example, <structfield>relhasindex</> is set by
2050    <command>CREATE INDEX</command>, but it is never cleared by
2051    <command>DROP INDEX</command>.  Instead, <command>VACUUM</command> clears
2052    <structfield>relhasindex</> if it finds the table has no indexes.  This
2053    arrangement avoids race conditions and improves concurrency.
2054   </para>
2055  </sect1>
2056
2057  <sect1 id="catalog-pg-collation">
2058   <title><structname>pg_collation</structname></title>
2059
2060   <indexterm zone="catalog-pg-collation">
2061    <primary>pg_collation</primary>
2062   </indexterm>
2063
2064   <para>
2065    The catalog <structname>pg_collation</structname> describes the
2066    available collations, which are essentially mappings from an SQL
2067    name to operating system locale categories.
2068    See <xref linkend="collation"> for more information.
2069   </para>
2070
2071   <table>
2072    <title><structname>pg_collation</> Columns</title>
2073
2074    <tgroup cols="4">
2075     <thead>
2076      <row>
2077       <entry>Name</entry>
2078       <entry>Type</entry>
2079       <entry>References</entry>
2080       <entry>Description</entry>
2081      </row>
2082     </thead>
2083
2084     <tbody>
2085      <row>
2086       <entry><structfield>oid</structfield></entry>
2087       <entry><type>oid</type></entry>
2088       <entry></entry>
2089       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2090      </row>
2091
2092      <row>
2093       <entry><structfield>collname</structfield></entry>
2094       <entry><type>name</type></entry>
2095       <entry></entry>
2096       <entry>Collation name (unique per namespace and encoding)</entry>
2097      </row>
2098
2099      <row>
2100       <entry><structfield>collnamespace</structfield></entry>
2101       <entry><type>oid</type></entry>
2102       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2103       <entry>
2104        The OID of the namespace that contains this collation
2105       </entry>
2106      </row>
2107
2108      <row>
2109       <entry><structfield>collowner</structfield></entry>
2110       <entry><type>oid</type></entry>
2111       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2112       <entry>Owner of the collation</entry>
2113      </row>
2114
2115      <row>
2116       <entry><structfield>collencoding</structfield></entry>
2117       <entry><type>int4</type></entry>
2118       <entry></entry>
2119       <entry>Encoding in which the collation is applicable, or -1 if it
2120        works for any encoding</entry>
2121      </row>
2122
2123      <row>
2124       <entry><structfield>collcollate</structfield></entry>
2125       <entry><type>name</type></entry>
2126       <entry></entry>
2127       <entry><symbol>LC_COLLATE</> for this collation object</entry>
2128      </row>
2129
2130      <row>
2131       <entry><structfield>collctype</structfield></entry>
2132       <entry><type>name</type></entry>
2133       <entry></entry>
2134       <entry><symbol>LC_CTYPE</> for this collation object</entry>
2135      </row>
2136     </tbody>
2137    </tgroup>
2138   </table>
2139
2140   <para>
2141    Note that the unique key on this catalog is (<structfield>collname</>,
2142    <structfield>collencoding</>, <structfield>collnamespace</>) not just
2143    (<structfield>collname</>, <structfield>collnamespace</>).
2144    <productname>PostgreSQL</productname> generally ignores all
2145    collations that do not have <structfield>collencoding</> equal to
2146    either the current database's encoding or -1, and creation of new entries
2147    with the same name as an entry with <structfield>collencoding</> = -1
2148    is forbidden.  Therefore it is sufficient to use a qualified SQL name
2149    (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2150    even though this is not unique according to the catalog definition.
2151    The reason for defining the catalog this way is that
2152    <application>initdb</> fills it in at cluster initialization time with
2153    entries for all locales available on the system, so it must be able to
2154    hold entries for all encodings that might ever be used in the cluster.
2155   </para>
2156
2157   <para>
2158    In the <literal>template0</> database, it could be useful to create
2159    collations whose encoding does not match the database encoding,
2160    since they could match the encodings of databases later cloned from
2161    <literal>template0</>.  This would currently have to be done manually.
2162   </para>
2163  </sect1>
2164
2165  <sect1 id="catalog-pg-constraint">
2166   <title><structname>pg_constraint</structname></title>
2167
2168   <indexterm zone="catalog-pg-constraint">
2169    <primary>pg_constraint</primary>
2170   </indexterm>
2171
2172   <para>
2173    The catalog <structname>pg_constraint</structname> stores check, primary
2174    key, unique, foreign key, and exclusion constraints on tables.
2175    (Column constraints are not treated specially.  Every column constraint is
2176    equivalent to some table constraint.)
2177    Not-null constraints are represented in the <structname>pg_attribute</>
2178    catalog, not here.
2179   </para>
2180
2181   <para>
2182    User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2183    TRIGGER</>) also give rise to an entry in this table.
2184   </para>
2185
2186   <para>
2187    Check constraints on domains are stored here, too.
2188   </para>
2189
2190   <table>
2191    <title><structname>pg_constraint</> Columns</title>
2192
2193    <tgroup cols="4">
2194     <thead>
2195      <row>
2196       <entry>Name</entry>
2197       <entry>Type</entry>
2198       <entry>References</entry>
2199       <entry>Description</entry>
2200      </row>
2201     </thead>
2202
2203     <tbody>
2204      <row>
2205       <entry><structfield>oid</structfield></entry>
2206       <entry><type>oid</type></entry>
2207       <entry></entry>
2208       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2209      </row>
2210
2211      <row>
2212       <entry><structfield>conname</structfield></entry>
2213       <entry><type>name</type></entry>
2214       <entry></entry>
2215       <entry>Constraint name (not necessarily unique!)</entry>
2216      </row>
2217
2218      <row>
2219       <entry><structfield>connamespace</structfield></entry>
2220       <entry><type>oid</type></entry>
2221       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2222       <entry>
2223        The OID of the namespace that contains this constraint
2224       </entry>
2225      </row>
2226
2227      <row>
2228       <entry><structfield>contype</structfield></entry>
2229       <entry><type>char</type></entry>
2230       <entry></entry>
2231       <entry>
2232         <literal>c</> = check constraint,
2233         <literal>f</> = foreign key constraint,
2234         <literal>p</> = primary key constraint,
2235         <literal>u</> = unique constraint,
2236         <literal>t</> = constraint trigger,
2237         <literal>x</> = exclusion constraint
2238       </entry>
2239      </row>
2240
2241      <row>
2242       <entry><structfield>condeferrable</structfield></entry>
2243       <entry><type>bool</type></entry>
2244       <entry></entry>
2245       <entry>Is the constraint deferrable?</entry>
2246      </row>
2247
2248      <row>
2249       <entry><structfield>condeferred</structfield></entry>
2250       <entry><type>bool</type></entry>
2251       <entry></entry>
2252       <entry>Is the constraint deferred by default?</entry>
2253      </row>
2254
2255      <row>
2256       <entry><structfield>convalidated</structfield></entry>
2257       <entry><type>bool</type></entry>
2258       <entry></entry>
2259       <entry>Has the constraint been validated?
2260        Currently, can only be false for foreign keys and CHECK constraints</entry>
2261      </row>
2262
2263      <row>
2264       <entry><structfield>conrelid</structfield></entry>
2265       <entry><type>oid</type></entry>
2266       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2267       <entry>The table this constraint is on; 0 if not a table constraint</entry>
2268      </row>
2269
2270      <row>
2271       <entry><structfield>contypid</structfield></entry>
2272       <entry><type>oid</type></entry>
2273       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2274       <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2275      </row>
2276
2277      <row>
2278       <entry><structfield>conindid</structfield></entry>
2279       <entry><type>oid</type></entry>
2280       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2281       <entry>The index supporting this constraint, if it's a unique, primary
2282        key, foreign key, or exclusion constraint; else 0</entry>
2283      </row>
2284
2285      <row>
2286       <entry><structfield>confrelid</structfield></entry>
2287       <entry><type>oid</type></entry>
2288       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2289       <entry>If a foreign key, the referenced table; else 0</entry>
2290      </row>
2291
2292      <row>
2293       <entry><structfield>confupdtype</structfield></entry>
2294       <entry><type>char</type></entry>
2295       <entry></entry>
2296       <entry>Foreign key update action code:
2297             <literal>a</> = no action,
2298             <literal>r</> = restrict,
2299             <literal>c</> = cascade,
2300             <literal>n</> = set null,
2301             <literal>d</> = set default
2302           </entry>
2303      </row>
2304
2305      <row>
2306       <entry><structfield>confdeltype</structfield></entry>
2307       <entry><type>char</type></entry>
2308       <entry></entry>
2309       <entry>Foreign key deletion action code:
2310             <literal>a</> = no action,
2311             <literal>r</> = restrict,
2312             <literal>c</> = cascade,
2313             <literal>n</> = set null,
2314             <literal>d</> = set default
2315           </entry>
2316      </row>
2317
2318      <row>
2319       <entry><structfield>confmatchtype</structfield></entry>
2320       <entry><type>char</type></entry>
2321       <entry></entry>
2322       <entry>Foreign key match type:
2323             <literal>f</> = full,
2324             <literal>p</> = partial,
2325             <literal>s</> = simple
2326           </entry>
2327      </row>
2328
2329      <row>
2330       <entry><structfield>conislocal</structfield></entry>
2331       <entry><type>bool</type></entry>
2332       <entry></entry>
2333       <entry>
2334        This constraint is defined locally for the relation.  Note that a
2335        constraint can be locally defined and inherited simultaneously.
2336       </entry>
2337      </row>
2338
2339      <row>
2340       <entry><structfield>coninhcount</structfield></entry>
2341       <entry><type>int4</type></entry>
2342       <entry></entry>
2343       <entry>
2344        The number of direct inheritance ancestors this constraint has.
2345        A constraint with
2346        a nonzero number of ancestors cannot be dropped nor renamed.
2347       </entry>
2348      </row>
2349
2350      <row>
2351       <entry><structfield>connoinherit</structfield></entry>
2352       <entry><type>bool</type></entry>
2353       <entry></entry>
2354       <entry>
2355        This constraint is defined locally for the relation.  It is a
2356        non-inheritable constraint.
2357       </entry>
2358      </row>
2359
2360      <row>
2361       <entry><structfield>conkey</structfield></entry>
2362       <entry><type>int2[]</type></entry>
2363       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2364       <entry>If a table constraint (including foreign keys, but not constraint
2365        triggers), list of the constrained columns</entry>
2366      </row>
2367
2368      <row>
2369       <entry><structfield>confkey</structfield></entry>
2370       <entry><type>int2[]</type></entry>
2371       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2372       <entry>If a foreign key, list of the referenced columns</entry>
2373      </row>
2374
2375      <row>
2376       <entry><structfield>conpfeqop</structfield></entry>
2377       <entry><type>oid[]</type></entry>
2378       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2379       <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2380      </row>
2381
2382      <row>
2383       <entry><structfield>conppeqop</structfield></entry>
2384       <entry><type>oid[]</type></entry>
2385       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2386       <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2387      </row>
2388
2389      <row>
2390       <entry><structfield>conffeqop</structfield></entry>
2391       <entry><type>oid[]</type></entry>
2392       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2393       <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2394      </row>
2395
2396      <row>
2397       <entry><structfield>conexclop</structfield></entry>
2398       <entry><type>oid[]</type></entry>
2399       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2400       <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2401      </row>
2402
2403      <row>
2404       <entry><structfield>conbin</structfield></entry>
2405       <entry><type>pg_node_tree</type></entry>
2406       <entry></entry>
2407       <entry>If a check constraint, an internal representation of the expression</entry>
2408      </row>
2409
2410      <row>
2411       <entry><structfield>consrc</structfield></entry>
2412       <entry><type>text</type></entry>
2413       <entry></entry>
2414       <entry>If a check constraint, a human-readable representation of the expression</entry>
2415      </row>
2416     </tbody>
2417    </tgroup>
2418   </table>
2419
2420   <para>
2421    In the case of an exclusion constraint, <structfield>conkey</structfield>
2422    is only useful for constraint elements that are simple column references.
2423    For other cases, a zero appears in <structfield>conkey</structfield>
2424    and the associated index must be consulted to discover the expression
2425    that is constrained.  (<structfield>conkey</structfield> thus has the
2426    same contents as <structname>pg_index</>.<structfield>indkey</> for the
2427    index.)
2428   </para>
2429
2430   <note>
2431    <para>
2432     <structfield>consrc</structfield> is not updated when referenced objects
2433     change; for example, it won't track renaming of columns.  Rather than
2434     relying on this field, it's best to use <function>pg_get_constraintdef()</>
2435     to extract the definition of a check constraint.
2436    </para>
2437   </note>
2438
2439   <note>
2440    <para>
2441     <literal>pg_class.relchecks</literal> needs to agree with the
2442     number of check-constraint entries found in this table for each
2443     relation.
2444    </para>
2445   </note>
2446  </sect1>
2447
2448
2449  <sect1 id="catalog-pg-conversion">
2450   <title><structname>pg_conversion</structname></title>
2451
2452   <indexterm zone="catalog-pg-conversion">
2453    <primary>pg_conversion</primary>
2454   </indexterm>
2455
2456   <para>
2457    The catalog <structname>pg_conversion</structname> describes
2458    encoding conversion procedures.  See <xref linkend="sql-createconversion">
2459    for more information.
2460   </para>
2461
2462   <table>
2463    <title><structname>pg_conversion</> Columns</title>
2464
2465    <tgroup cols="4">
2466     <thead>
2467      <row>
2468       <entry>Name</entry>
2469       <entry>Type</entry>
2470       <entry>References</entry>
2471       <entry>Description</entry>
2472      </row>
2473     </thead>
2474
2475     <tbody>
2476      <row>
2477       <entry><structfield>oid</structfield></entry>
2478       <entry><type>oid</type></entry>
2479       <entry></entry>
2480       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2481      </row>
2482
2483      <row>
2484       <entry><structfield>conname</structfield></entry>
2485       <entry><type>name</type></entry>
2486       <entry></entry>
2487       <entry>Conversion name (unique within a namespace)</entry>
2488      </row>
2489
2490      <row>
2491       <entry><structfield>connamespace</structfield></entry>
2492       <entry><type>oid</type></entry>
2493       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2494       <entry>
2495        The OID of the namespace that contains this conversion
2496       </entry>
2497      </row>
2498
2499      <row>
2500       <entry><structfield>conowner</structfield></entry>
2501       <entry><type>oid</type></entry>
2502       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2503       <entry>Owner of the conversion</entry>
2504      </row>
2505
2506      <row>
2507       <entry><structfield>conforencoding</structfield></entry>
2508       <entry><type>int4</type></entry>
2509       <entry></entry>
2510       <entry>Source encoding ID</entry>
2511      </row>
2512
2513      <row>
2514       <entry><structfield>contoencoding</structfield></entry>
2515       <entry><type>int4</type></entry>
2516       <entry></entry>
2517       <entry>Destination encoding ID</entry>
2518      </row>
2519
2520      <row>
2521       <entry><structfield>conproc</structfield></entry>
2522       <entry><type>regproc</type></entry>
2523       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2524       <entry>Conversion procedure</entry>
2525      </row>
2526
2527      <row>
2528       <entry><structfield>condefault</structfield></entry>
2529       <entry><type>bool</type></entry>
2530       <entry></entry>
2531       <entry>True if this is the default conversion</entry>
2532      </row>
2533
2534     </tbody>
2535    </tgroup>
2536   </table>
2537
2538  </sect1>
2539
2540  <sect1 id="catalog-pg-database">
2541   <title><structname>pg_database</structname></title>
2542
2543   <indexterm zone="catalog-pg-database">
2544    <primary>pg_database</primary>
2545   </indexterm>
2546
2547   <para>
2548    The catalog <structname>pg_database</structname> stores information about
2549    the available databases.  Databases are created with the <xref
2550    linkend="sql-createdatabase"> command.
2551    Consult <xref linkend="managing-databases"> for details about the meaning
2552    of some of the parameters.
2553   </para>
2554
2555   <para>
2556    Unlike most system catalogs, <structname>pg_database</structname>
2557    is shared across all databases of a cluster: there is only one
2558    copy of <structname>pg_database</structname> per cluster, not
2559    one per database.
2560   </para>
2561
2562   <table>
2563    <title><structname>pg_database</> Columns</title>
2564
2565    <tgroup cols="4">
2566     <thead>
2567      <row>
2568       <entry>Name</entry>
2569       <entry>Type</entry>
2570       <entry>References</entry>
2571       <entry>Description</entry>
2572      </row>
2573     </thead>
2574
2575     <tbody>
2576      <row>
2577       <entry><structfield>oid</structfield></entry>
2578       <entry><type>oid</type></entry>
2579       <entry></entry>
2580       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2581      </row>
2582
2583      <row>
2584       <entry><structfield>datname</structfield></entry>
2585       <entry><type>name</type></entry>
2586       <entry></entry>
2587       <entry>Database name</entry>
2588      </row>
2589
2590      <row>
2591       <entry><structfield>datdba</structfield></entry>
2592       <entry><type>oid</type></entry>
2593       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2594       <entry>Owner of the database, usually the user who created it</entry>
2595      </row>
2596
2597      <row>
2598       <entry><structfield>encoding</structfield></entry>
2599       <entry><type>int4</type></entry>
2600       <entry></entry>
2601       <entry>Character encoding for this database
2602           (<function>pg_encoding_to_char()</function> can translate
2603            this number to the encoding name)</entry>
2604      </row>
2605
2606      <row>
2607       <entry><structfield>datcollate</structfield></entry>
2608       <entry><type>name</type></entry>
2609       <entry></entry>
2610       <entry>LC_COLLATE for this database</entry>
2611      </row>
2612
2613      <row>
2614       <entry><structfield>datctype</structfield></entry>
2615       <entry><type>name</type></entry>
2616       <entry></entry>
2617       <entry>LC_CTYPE for this database</entry>
2618      </row>
2619
2620      <row>
2621       <entry><structfield>datistemplate</structfield></entry>
2622       <entry><type>bool</type></entry>
2623       <entry></entry>
2624       <entry>
2625        If true, then this database can be cloned by
2626        any user with <literal>CREATEDB</> privileges;
2627        if false, then only superusers or the owner of
2628        the database can clone it.
2629       </entry>
2630      </row>
2631
2632      <row>
2633       <entry><structfield>datallowconn</structfield></entry>
2634       <entry><type>bool</type></entry>
2635       <entry></entry>
2636       <entry>
2637        If false then no one can connect to this database.  This is
2638        used to protect the <literal>template0</> database from being altered.
2639       </entry>
2640      </row>
2641
2642      <row>
2643       <entry><structfield>datconnlimit</structfield></entry>
2644       <entry><type>int4</type></entry>
2645       <entry></entry>
2646       <entry>
2647        Sets maximum number of concurrent connections that can be made
2648        to this database.  -1 means no limit.
2649       </entry>
2650      </row>
2651
2652      <row>
2653       <entry><structfield>datlastsysoid</structfield></entry>
2654       <entry><type>oid</type></entry>
2655       <entry></entry>
2656       <entry>
2657        Last system OID in the database; useful
2658        particularly to <application>pg_dump</application>
2659       </entry>
2660      </row>
2661
2662      <row>
2663       <entry><structfield>datfrozenxid</structfield></entry>
2664       <entry><type>xid</type></entry>
2665       <entry></entry>
2666       <entry>
2667        All transaction IDs before this one have been replaced with a permanent
2668        (<quote>frozen</>) transaction ID in this database.  This is used to
2669        track whether the database needs to be vacuumed in order to prevent
2670        transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2671        It is the minimum of the per-table
2672        <structname>pg_class</>.<structfield>relfrozenxid</> values.
2673       </entry>
2674      </row>
2675
2676      <row>
2677       <entry><structfield>datminmxid</structfield></entry>
2678       <entry><type>xid</type></entry>
2679       <entry></entry>
2680       <entry>
2681        All multixact IDs before this one have been replaced with a
2682        transaction ID in this database.  This is used to
2683        track whether the database needs to be vacuumed in order to prevent
2684        multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2685        It is the minimum of the per-table
2686        <structname>pg_class</>.<structfield>relminmxid</> values.
2687       </entry>
2688      </row>
2689
2690      <row>
2691       <entry><structfield>dattablespace</structfield></entry>
2692       <entry><type>oid</type></entry>
2693       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2694       <entry>
2695        The default tablespace for the database.
2696        Within this database, all tables for which
2697        <structname>pg_class</>.<structfield>reltablespace</> is zero
2698        will be stored in this tablespace; in particular, all the non-shared
2699        system catalogs will be there.
2700       </entry>
2701      </row>
2702
2703      <row>
2704       <entry><structfield>datacl</structfield></entry>
2705       <entry><type>aclitem[]</type></entry>
2706       <entry></entry>
2707       <entry>
2708        Access privileges; see
2709        <xref linkend="sql-grant"> and
2710        <xref linkend="sql-revoke">
2711        for details
2712       </entry>
2713      </row>
2714     </tbody>
2715    </tgroup>
2716   </table>
2717  </sect1>
2718
2719
2720  <sect1 id="catalog-pg-db-role-setting">
2721   <title><structname>pg_db_role_setting</structname></title>
2722
2723   <indexterm zone="catalog-pg-db-role-setting">
2724    <primary>pg_db_role_setting</primary>
2725   </indexterm>
2726
2727   <para>
2728    The catalog <structname>pg_db_role_setting</structname> records the default
2729    values that have been set for run-time configuration variables,
2730    for each role and database combination.
2731   </para>
2732
2733   <para>
2734    Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2735    is shared across all databases of a cluster: there is only one
2736    copy of <structname>pg_db_role_setting</structname> per cluster, not
2737    one per database.
2738   </para>
2739
2740   <table>
2741    <title><structname>pg_db_role_setting</> Columns</title>
2742
2743    <tgroup cols="4">
2744     <thead>
2745      <row>
2746       <entry>Name</entry>
2747       <entry>Type</entry>
2748       <entry>References</entry>
2749       <entry>Description</entry>
2750      </row>
2751     </thead>
2752
2753     <tbody>
2754      <row>
2755       <entry><structfield>setdatabase</structfield></entry>
2756       <entry><type>oid</type></entry>
2757       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2758       <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2759      </row>
2760
2761      <row>
2762       <entry><structfield>setrole</structfield></entry>
2763       <entry><type>oid</type></entry>
2764       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2765       <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2766      </row>
2767
2768      <row>
2769       <entry><structfield>setconfig</structfield></entry>
2770       <entry><type>text[]</type></entry>
2771       <entry></entry>
2772       <entry>Defaults for run-time configuration variables</entry>
2773      </row>
2774     </tbody>
2775    </tgroup>
2776   </table>
2777  </sect1>
2778
2779
2780  <sect1 id="catalog-pg-default-acl">
2781   <title><structname>pg_default_acl</structname></title>
2782
2783   <indexterm zone="catalog-pg-default-acl">
2784    <primary>pg_default_acl</primary>
2785   </indexterm>
2786
2787   <para>
2788    The catalog <structname>pg_default_acl</> stores initial
2789    privileges to be assigned to newly created objects.
2790   </para>
2791
2792   <table>
2793    <title><structname>pg_default_acl</> Columns</title>
2794
2795    <tgroup cols="4">
2796     <thead>
2797      <row>
2798       <entry>Name</entry>
2799       <entry>Type</entry>
2800       <entry>References</entry>
2801       <entry>Description</entry>
2802      </row>
2803     </thead>
2804
2805     <tbody>
2806      <row>
2807       <entry><structfield>oid</structfield></entry>
2808       <entry><type>oid</type></entry>
2809       <entry></entry>
2810       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2811      </row>
2812
2813      <row>
2814       <entry><structfield>defaclrole</structfield></entry>
2815       <entry><type>oid</type></entry>
2816       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2817       <entry>The OID of the role associated with this entry</entry>
2818      </row>
2819
2820      <row>
2821       <entry><structfield>defaclnamespace</structfield></entry>
2822       <entry><type>oid</type></entry>
2823       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2824       <entry>The OID of the namespace associated with this entry,
2825        or 0 if none</entry>
2826      </row>
2827
2828      <row>
2829       <entry><structfield>defaclobjtype</structfield></entry>
2830       <entry><type>char</type></entry>
2831       <entry></entry>
2832       <entry>
2833        Type of object this entry is for:
2834        <literal>r</> = relation (table, view),
2835        <literal>S</> = sequence,
2836        <literal>f</> = function,
2837        <literal>T</> = type
2838       </entry>
2839      </row>
2840
2841      <row>
2842       <entry><structfield>defaclacl</structfield></entry>
2843       <entry><type>aclitem[]</type></entry>
2844       <entry></entry>
2845       <entry>
2846        Access privileges that this type of object should have on creation
2847       </entry>
2848      </row>
2849     </tbody>
2850    </tgroup>
2851   </table>
2852
2853   <para>
2854    A <structname>pg_default_acl</> entry shows the initial privileges to
2855    be assigned to an object belonging to the indicated user.  There are
2856    currently two types of entry: <quote>global</> entries with
2857    <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2858    that reference a particular schema.  If a global entry is present then
2859    it <emphasis>overrides</> the normal hard-wired default privileges
2860    for the object type.  A per-schema entry, if present, represents privileges
2861    to be <emphasis>added to</> the global or hard-wired default privileges.
2862   </para>
2863
2864   <para>
2865    Note that when an ACL entry in another catalog is null, it is taken
2866    to represent the hard-wired default privileges for its object,
2867    <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2868    at the moment.  <structname>pg_default_acl</> is only consulted during
2869    object creation.
2870   </para>
2871
2872  </sect1>
2873
2874
2875  <sect1 id="catalog-pg-depend">
2876   <title><structname>pg_depend</structname></title>
2877
2878   <indexterm zone="catalog-pg-depend">
2879    <primary>pg_depend</primary>
2880   </indexterm>
2881
2882   <para>
2883    The catalog <structname>pg_depend</structname> records the dependency
2884    relationships between database objects.  This information allows
2885    <command>DROP</> commands to find which other objects must be dropped
2886    by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2887    RESTRICT</> case.
2888   </para>
2889
2890   <para>
2891    See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2892    which performs a similar function for dependencies involving objects
2893    that are shared across a database cluster.
2894   </para>
2895
2896   <table>
2897    <title><structname>pg_depend</> Columns</title>
2898
2899    <tgroup cols="4">
2900     <thead>
2901      <row>
2902       <entry>Name</entry>
2903       <entry>Type</entry>
2904       <entry>References</entry>
2905       <entry>Description</entry>
2906      </row>
2907     </thead>
2908
2909     <tbody>
2910      <row>
2911       <entry><structfield>classid</structfield></entry>
2912       <entry><type>oid</type></entry>
2913       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2914       <entry>The OID of the system catalog the dependent object is in</entry>
2915      </row>
2916
2917      <row>
2918       <entry><structfield>objid</structfield></entry>
2919       <entry><type>oid</type></entry>
2920       <entry>any OID column</entry>
2921       <entry>The OID of the specific dependent object</entry>
2922      </row>
2923
2924      <row>
2925       <entry><structfield>objsubid</structfield></entry>
2926       <entry><type>int4</type></entry>
2927       <entry></entry>
2928       <entry>
2929        For a table column, this is the column number (the
2930        <structfield>objid</> and <structfield>classid</> refer to the
2931        table itself).  For all other object types, this column is
2932        zero.
2933       </entry>
2934      </row>
2935
2936      <row>
2937       <entry><structfield>refclassid</structfield></entry>
2938       <entry><type>oid</type></entry>
2939       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2940       <entry>The OID of the system catalog the referenced object is in</entry>
2941      </row>
2942
2943      <row>
2944       <entry><structfield>refobjid</structfield></entry>
2945       <entry><type>oid</type></entry>
2946       <entry>any OID column</entry>
2947       <entry>The OID of the specific referenced object</entry>
2948      </row>
2949
2950      <row>
2951       <entry><structfield>refobjsubid</structfield></entry>
2952       <entry><type>int4</type></entry>
2953       <entry></entry>
2954       <entry>
2955        For a table column, this is the column number (the
2956        <structfield>refobjid</> and <structfield>refclassid</> refer
2957        to the table itself).  For all other object types, this column
2958        is zero.
2959       </entry>
2960      </row>
2961
2962      <row>
2963       <entry><structfield>deptype</structfield></entry>
2964       <entry><type>char</type></entry>
2965       <entry></entry>
2966       <entry>
2967        A code defining the specific semantics of this dependency relationship; see text
2968       </entry>
2969      </row>
2970
2971     </tbody>
2972    </tgroup>
2973   </table>
2974
2975   <para>
2976    In all cases, a <structname>pg_depend</structname> entry indicates that the
2977    referenced object cannot be dropped without also dropping the dependent
2978    object.  However, there are several subflavors identified by
2979    <structfield>deptype</>:
2980
2981    <variablelist>
2982     <varlistentry>
2983      <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2984      <listitem>
2985       <para>
2986        A normal relationship between separately-created objects.  The
2987        dependent object can be dropped without affecting the
2988        referenced object.  The referenced object can only be dropped
2989        by specifying <literal>CASCADE</>, in which case the dependent
2990        object is dropped, too.  Example: a table column has a normal
2991        dependency on its data type.
2992       </para>
2993      </listitem>
2994     </varlistentry>
2995
2996     <varlistentry>
2997      <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2998      <listitem>
2999       <para>
3000        The dependent object can be dropped separately from the
3001        referenced object, and should be automatically dropped
3002        (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
3003        mode) if the referenced object is dropped.  Example: a named
3004        constraint on a table is made autodependent on the table, so
3005        that it will go away if the table is dropped.
3006       </para>
3007      </listitem>
3008     </varlistentry>
3009
3010     <varlistentry>
3011      <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
3012      <listitem>
3013       <para>
3014        The dependent object was created as part of creation of the
3015        referenced object, and is really just a part of its internal
3016        implementation.  A <command>DROP</> of the dependent object
3017        will be disallowed outright (we'll tell the user to issue a
3018        <command>DROP</> against the referenced object, instead).  A
3019        <command>DROP</> of the referenced object will be propagated
3020        through to drop the dependent object whether
3021        <command>CASCADE</> is specified or not.  Example: a trigger
3022        that's created to enforce a foreign-key constraint is made
3023        internally dependent on the constraint's
3024        <structname>pg_constraint</> entry.
3025       </para>
3026      </listitem>
3027     </varlistentry>
3028
3029     <varlistentry>
3030      <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
3031      <listitem>
3032       <para>
3033        The dependent object is a member of the <firstterm>extension</> that is
3034        the referenced object (see
3035        <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3036        The dependent object can be dropped only via
3037        <command>DROP EXTENSION</> on the referenced object.  Functionally
3038        this dependency type acts the same as an internal dependency, but
3039        it's kept separate for clarity and to simplify <application>pg_dump</>.
3040       </para>
3041      </listitem>
3042     </varlistentry>
3043
3044     <varlistentry>
3045      <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3046      <listitem>
3047       <para>
3048        There is no dependent object; this type of entry is a signal
3049        that the system itself depends on the referenced object, and so
3050        that object must never be deleted.  Entries of this type are
3051        created only by <command>initdb</command>.  The columns for the
3052        dependent object contain zeroes.
3053       </para>
3054      </listitem>
3055     </varlistentry>
3056    </variablelist>
3057
3058    Other dependency flavors might be needed in future.
3059   </para>
3060
3061  </sect1>
3062
3063
3064  <sect1 id="catalog-pg-description">
3065   <title><structname>pg_description</structname></title>
3066
3067   <indexterm zone="catalog-pg-description">
3068    <primary>pg_description</primary>
3069   </indexterm>
3070
3071   <para>
3072    The catalog <structname>pg_description</> stores optional descriptions
3073    (comments) for each database object.  Descriptions can be manipulated
3074    with the <xref linkend="sql-comment"> command and viewed with
3075    <application>psql</application>'s <literal>\d</literal> commands.
3076    Descriptions of many built-in system objects are provided in the initial
3077    contents of <structname>pg_description</structname>.
3078   </para>
3079
3080   <para>
3081    See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3082    which performs a similar function for descriptions involving objects that
3083    are shared across a database cluster.
3084   </para>
3085
3086   <table>
3087    <title><structname>pg_description</> Columns</title>
3088
3089    <tgroup cols="4">
3090     <thead>
3091      <row>
3092       <entry>Name</entry>
3093       <entry>Type</entry>
3094       <entry>References</entry>
3095       <entry>Description</entry>
3096      </row>
3097     </thead>
3098
3099     <tbody>
3100      <row>
3101       <entry><structfield>objoid</structfield></entry>
3102       <entry><type>oid</type></entry>
3103       <entry>any OID column</entry>
3104       <entry>The OID of the object this description pertains to</entry>
3105      </row>
3106
3107      <row>
3108       <entry><structfield>classoid</structfield></entry>
3109       <entry><type>oid</type></entry>
3110       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3111       <entry>The OID of the system catalog this object appears in</entry>
3112      </row>
3113
3114      <row>
3115       <entry><structfield>objsubid</structfield></entry>
3116       <entry><type>int4</type></entry>
3117       <entry></entry>
3118       <entry>
3119        For a comment on a table column, this is the column number (the
3120        <structfield>objoid</> and <structfield>classoid</> refer to
3121        the table itself).  For all other object types, this column is
3122        zero.
3123       </entry>
3124      </row>
3125
3126      <row>
3127       <entry><structfield>description</structfield></entry>
3128       <entry><type>text</type></entry>
3129       <entry></entry>
3130       <entry>Arbitrary text that serves as the description of this object</entry>
3131      </row>
3132     </tbody>
3133    </tgroup>
3134   </table>
3135
3136  </sect1>
3137
3138
3139  <sect1 id="catalog-pg-enum">
3140   <title><structname>pg_enum</structname></title>
3141
3142   <indexterm zone="catalog-pg-enum">
3143    <primary>pg_enum</primary>
3144   </indexterm>
3145
3146   <para>
3147    The <structname>pg_enum</structname> catalog contains entries
3148    showing the values and labels for each enum type. The
3149    internal representation of a given enum value is actually the OID
3150    of its associated row in <structname>pg_enum</structname>.
3151   </para>
3152
3153   <table>
3154    <title><structname>pg_enum</> Columns</title>
3155
3156    <tgroup cols="4">
3157     <thead>
3158      <row>
3159       <entry>Name</entry>
3160       <entry>Type</entry>
3161       <entry>References</entry>
3162       <entry>Description</entry>
3163      </row>
3164     </thead>
3165
3166     <tbody>
3167      <row>
3168       <entry><structfield>oid</structfield></entry>
3169       <entry><type>oid</type></entry>
3170       <entry></entry>
3171       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3172      </row>
3173
3174      <row>
3175       <entry><structfield>enumtypid</structfield></entry>
3176       <entry><type>oid</type></entry>
3177       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3178       <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3179      </row>
3180
3181      <row>
3182       <entry><structfield>enumsortorder</structfield></entry>
3183       <entry><type>float4</type></entry>
3184       <entry></entry>
3185       <entry>The sort position of this enum value within its enum type</entry>
3186      </row>
3187
3188      <row>
3189       <entry><structfield>enumlabel</structfield></entry>
3190       <entry><type>name</type></entry>
3191       <entry></entry>
3192       <entry>The textual label for this enum value</entry>
3193      </row>
3194     </tbody>
3195    </tgroup>
3196   </table>
3197
3198   <para>
3199    The OIDs for <structname>pg_enum</structname> rows follow a special
3200    rule: even-numbered OIDs are guaranteed to be ordered in the same way
3201    as the sort ordering of their enum type.  That is, if two even OIDs
3202    belong to the same enum type, the smaller OID must have the smaller
3203    <structfield>enumsortorder</structfield> value.  Odd-numbered OID values
3204    need bear no relationship to the sort order.  This rule allows the
3205    enum comparison routines to avoid catalog lookups in many common cases.
3206    The routines that create and alter enum types attempt to assign even
3207    OIDs to enum values whenever possible.
3208   </para>
3209
3210   <para>
3211    When an enum type is created, its members are assigned sort-order
3212    positions 1..<replaceable>n</>.  But members added later might be given
3213    negative or fractional values of <structfield>enumsortorder</structfield>.
3214    The only requirement on these values is that they be correctly
3215    ordered and unique within each enum type.
3216   </para>
3217  </sect1>
3218
3219
3220  <sect1 id="catalog-pg-event-trigger">
3221   <title><structname>pg_event_trigger</structname></title>
3222
3223   <indexterm zone="catalog-pg-event-trigger">
3224    <primary>pg_event_trigger</primary>
3225   </indexterm>
3226
3227   <para>
3228    The catalog <structname>pg_event_trigger</structname> stores event triggers.
3229    See <xref linkend="event-triggers"> for more information.
3230   </para>
3231
3232   <table>
3233    <title><structname>pg_event_trigger</> Columns</title>
3234
3235    <tgroup cols="4">
3236     <thead>
3237      <row>
3238       <entry>Name</entry>
3239       <entry>Type</entry>
3240       <entry>References</entry>
3241       <entry>Description</entry>
3242      </row>
3243     </thead>
3244
3245     <tbody>
3246      <row>
3247       <entry><structfield>evtname</structfield></entry>
3248       <entry><type>name</type></entry>
3249       <entry></entry>
3250       <entry>Trigger name (must be unique)</entry>
3251      </row>
3252
3253      <row>
3254       <entry><structfield>evtevent</structfield></entry>
3255       <entry><type>name</type></entry>
3256       <entry></entry>
3257       <entry>Identifies the event for which this trigger fires</entry>
3258      </row>
3259
3260      <row>
3261       <entry><structfield>evtowner</structfield></entry>
3262       <entry><type>oid</type></entry>
3263       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3264       <entry>Owner of the event trigger</entry>
3265      </row>
3266
3267      <row>
3268       <entry><structfield>evtfoid</structfield></entry>
3269       <entry><type>oid</type></entry>
3270       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3271       <entry>The function to be called</entry>
3272      </row>
3273
3274      <row>
3275       <entry><structfield>evtenabled</structfield></entry>
3276       <entry><type>char</type></entry>
3277       <entry></entry>
3278       <entry>
3279        Controls in which <xref linkend="guc-session-replication-role"> modes
3280        the event trigger fires.
3281        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3282        <literal>D</> = trigger is disabled,
3283        <literal>R</> = trigger fires in <quote>replica</> mode,
3284        <literal>A</> = trigger fires always.
3285       </entry>
3286      </row>
3287
3288      <row>
3289       <entry><structfield>evttags</structfield></entry>
3290       <entry><type>text[]</type></entry>
3291       <entry></entry>
3292       <entry>
3293         Command tags for which this trigger will fire.  If NULL, the firing
3294         of this trigger is not restricted on the basis of the command tag.
3295       </entry>
3296      </row>
3297     </tbody>
3298    </tgroup>
3299   </table>
3300  </sect1>
3301
3302
3303  <sect1 id="catalog-pg-extension">
3304   <title><structname>pg_extension</structname></title>
3305
3306   <indexterm zone="catalog-pg-extension">
3307    <primary>pg_extension</primary>
3308   </indexterm>
3309
3310   <para>
3311    The catalog <structname>pg_extension</structname> stores information
3312    about the installed extensions.  See <xref linkend="extend-extensions">
3313    for details about extensions.
3314   </para>
3315
3316   <table>
3317    <title><structname>pg_extension</> Columns</title>
3318
3319    <tgroup cols="4">
3320     <thead>
3321      <row>
3322       <entry>Name</entry>
3323       <entry>Type</entry>
3324       <entry>References</entry>
3325       <entry>Description</entry>
3326      </row>
3327     </thead>
3328
3329     <tbody>
3330      <row>
3331       <entry><structfield>oid</structfield></entry>
3332       <entry><type>oid</type></entry>
3333       <entry></entry>
3334       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3335      </row>
3336
3337      <row>
3338       <entry><structfield>extname</structfield></entry>
3339       <entry><type>name</type></entry>
3340       <entry></entry>
3341       <entry>Name of the extension</entry>
3342      </row>
3343
3344      <row>
3345       <entry><structfield>extowner</structfield></entry>
3346       <entry><type>oid</type></entry>
3347       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3348       <entry>Owner of the extension</entry>
3349      </row>
3350
3351      <row>
3352       <entry><structfield>extnamespace</structfield></entry>
3353       <entry><type>oid</type></entry>
3354       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3355       <entry>Schema containing the extension's exported objects</entry>
3356      </row>
3357
3358      <row>
3359       <entry><structfield>extrelocatable</structfield></entry>
3360       <entry><type>bool</type></entry>
3361       <entry></entry>
3362       <entry>True if extension can be relocated to another schema</entry>
3363      </row>
3364
3365      <row>
3366       <entry><structfield>extversion</structfield></entry>
3367       <entry><type>text</type></entry>
3368       <entry></entry>
3369       <entry>Version name for the extension</entry>
3370      </row>
3371
3372      <row>
3373       <entry><structfield>extconfig</structfield></entry>
3374       <entry><type>oid[]</type></entry>
3375       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3376       <entry>Array of <type>regclass</> OIDs for the extension's configuration
3377        table(s), or <literal>NULL</> if none</entry>
3378      </row>
3379
3380      <row>
3381       <entry><structfield>extcondition</structfield></entry>
3382       <entry><type>text[]</type></entry>
3383       <entry></entry>
3384       <entry>Array of <literal>WHERE</>-clause filter conditions for the
3385        extension's configuration table(s), or <literal>NULL</> if none</entry>
3386      </row>
3387
3388     </tbody>
3389    </tgroup>
3390   </table>
3391
3392   <para>
3393    Note that unlike most catalogs with a <quote>namespace</> column,
3394    <structfield>extnamespace</structfield> is not meant to imply
3395    that the extension belongs to that schema.  Extension names are never
3396    schema-qualified.  Rather, <structfield>extnamespace</structfield>
3397    indicates the schema that contains most or all of the extension's
3398    objects.  If <structfield>extrelocatable</structfield> is true, then
3399    this schema must in fact contain all schema-qualifiable objects
3400    belonging to the extension.
3401   </para>
3402  </sect1>
3403
3404
3405  <sect1 id="catalog-pg-foreign-data-wrapper">
3406   <title><structname>pg_foreign_data_wrapper</structname></title>
3407
3408   <indexterm zone="catalog-pg-foreign-data-wrapper">
3409    <primary>pg_foreign_data_wrapper</primary>
3410   </indexterm>
3411
3412   <para>
3413    The catalog <structname>pg_foreign_data_wrapper</structname> stores
3414    foreign-data wrapper definitions.  A foreign-data wrapper is the
3415    mechanism by which external data, residing on foreign servers, is
3416    accessed.
3417   </para>
3418
3419   <table>
3420    <title><structname>pg_foreign_data_wrapper</> Columns</title>
3421
3422    <tgroup cols="4">
3423     <thead>
3424      <row>
3425       <entry>Name</entry>
3426       <entry>Type</entry>
3427       <entry>References</entry>
3428       <entry>Description</entry>
3429      </row>
3430     </thead>
3431
3432     <tbody>
3433      <row>
3434       <entry><structfield>oid</structfield></entry>
3435       <entry><type>oid</type></entry>
3436       <entry></entry>
3437       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3438      </row>
3439
3440      <row>
3441       <entry><structfield>fdwname</structfield></entry>
3442       <entry><type>name</type></entry>
3443       <entry></entry>
3444       <entry>Name of the foreign-data wrapper</entry>
3445      </row>
3446
3447      <row>
3448       <entry><structfield>fdwowner</structfield></entry>
3449       <entry><type>oid</type></entry>
3450       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3451       <entry>Owner of the foreign-data wrapper</entry>
3452      </row>
3453
3454      <row>
3455       <entry><structfield>fdwhandler</structfield></entry>
3456       <entry><type>oid</type></entry>
3457       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3458       <entry>
3459        References a handler function that is responsible for
3460        supplying execution routines for the foreign-data wrapper.
3461        Zero if no handler is provided
3462       </entry>
3463      </row>
3464
3465      <row>
3466       <entry><structfield>fdwvalidator</structfield></entry>
3467       <entry><type>oid</type></entry>
3468       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3469       <entry>
3470        References a validator function that is responsible for
3471        checking the validity of the options given to the
3472        foreign-data wrapper, as well as options for foreign servers and user
3473        mappings using the foreign-data wrapper.  Zero if no validator
3474        is provided
3475       </entry>
3476      </row>
3477
3478      <row>
3479       <entry><structfield>fdwacl</structfield></entry>
3480       <entry><type>aclitem[]</type></entry>
3481       <entry></entry>
3482       <entry>
3483        Access privileges; see
3484        <xref linkend="sql-grant"> and
3485        <xref linkend="sql-revoke">
3486        for details
3487       </entry>
3488      </row>
3489
3490      <row>
3491       <entry><structfield>fdwoptions</structfield></entry>
3492       <entry><type>text[]</type></entry>
3493       <entry></entry>
3494       <entry>
3495        Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3496       </entry>
3497      </row>
3498     </tbody>
3499    </tgroup>
3500   </table>
3501  </sect1>
3502
3503
3504  <sect1 id="catalog-pg-foreign-server">
3505   <title><structname>pg_foreign_server</structname></title>
3506
3507   <indexterm zone="catalog-pg-foreign-server">
3508    <primary>pg_foreign_server</primary>
3509   </indexterm>
3510
3511   <para>
3512    The catalog <structname>pg_foreign_server</structname> stores
3513    foreign server definitions.  A foreign server describes a source
3514    of external data, such as a remote server.  Foreign
3515    servers are accessed via foreign-data wrappers.
3516   </para>
3517
3518   <table>
3519    <title><structname>pg_foreign_server</> Columns</title>
3520
3521    <tgroup cols="4">
3522     <thead>
3523      <row>
3524       <entry>Name</entry>
3525       <entry>Type</entry>
3526       <entry>References</entry>
3527       <entry>Description</entry>
3528      </row>
3529     </thead>
3530
3531     <tbody>
3532      <row>
3533       <entry><structfield>oid</structfield></entry>
3534       <entry><type>oid</type></entry>
3535       <entry></entry>
3536       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3537      </row>
3538
3539      <row>
3540       <entry><structfield>srvname</structfield></entry>
3541       <entry><type>name</type></entry>
3542       <entry></entry>
3543       <entry>Name of the foreign server</entry>
3544      </row>
3545
3546      <row>
3547       <entry><structfield>srvowner</structfield></entry>
3548       <entry><type>oid</type></entry>
3549       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3550       <entry>Owner of the foreign server</entry>
3551      </row>
3552
3553      <row>
3554       <entry><structfield>srvfdw</structfield></entry>
3555       <entry><type>oid</type></entry>
3556       <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3557       <entry>OID of the foreign-data wrapper of this foreign server</entry>
3558      </row>
3559
3560      <row>
3561       <entry><structfield>srvtype</structfield></entry>
3562       <entry><type>text</type></entry>
3563       <entry></entry>
3564       <entry>Type of the server (optional)</entry>
3565      </row>
3566
3567      <row>
3568       <entry><structfield>srvversion</structfield></entry>
3569       <entry><type>text</type></entry>
3570       <entry></entry>
3571       <entry>Version of the server (optional)</entry>
3572      </row>
3573
3574      <row>
3575       <entry><structfield>srvacl</structfield></entry>
3576       <entry><type>aclitem[]</type></entry>
3577       <entry></entry>
3578       <entry>
3579        Access privileges; see
3580        <xref linkend="sql-grant"> and
3581        <xref linkend="sql-revoke">
3582        for details
3583       </entry>
3584      </row>
3585
3586      <row>
3587       <entry><structfield>srvoptions</structfield></entry>
3588       <entry><type>text[]</type></entry>
3589       <entry></entry>
3590       <entry>
3591        Foreign server specific options, as <quote>keyword=value</> strings
3592       </entry>
3593      </row>
3594     </tbody>
3595    </tgroup>
3596   </table>
3597  </sect1>
3598
3599
3600  <sect1 id="catalog-pg-foreign-table">
3601   <title><structname>pg_foreign_table</structname></title>
3602
3603   <indexterm zone="catalog-pg-foreign-table">
3604    <primary>pg_foreign_table</primary>
3605   </indexterm>
3606
3607   <para>
3608    The catalog <structname>pg_foreign_table</structname> contains
3609    auxiliary information about foreign tables.  A foreign table is
3610    primarily represented by a <structname>pg_class</structname> entry,
3611    just like a regular table.  Its <structname>pg_foreign_table</structname>
3612    entry contains the information that is pertinent only to foreign tables
3613    and not any other kind of relation.
3614   </para>
3615
3616   <table>
3617    <title><structname>pg_foreign_table</> Columns</title>
3618
3619    <tgroup cols="4">
3620     <thead>
3621      <row>
3622       <entry>Name</entry>
3623       <entry>Type</entry>
3624       <entry>References</entry>
3625       <entry>Description</entry>
3626      </row>
3627     </thead>
3628
3629     <tbody>
3630      <row>
3631       <entry><structfield>ftrelid</structfield></entry>
3632       <entry><type>oid</type></entry>
3633       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3634       <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3635      </row>
3636
3637      <row>
3638       <entry><structfield>ftserver</structfield></entry>
3639       <entry><type>oid</type></entry>
3640       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3641       <entry>OID of the foreign server for this foreign table</entry>
3642      </row>
3643
3644      <row>
3645       <entry><structfield>ftoptions</structfield></entry>
3646       <entry><type>text[]</type></entry>
3647       <entry></entry>
3648       <entry>
3649        Foreign table options, as <quote>keyword=value</> strings
3650       </entry>
3651      </row>
3652     </tbody>
3653    </tgroup>
3654   </table>
3655  </sect1>
3656
3657
3658  <sect1 id="catalog-pg-index">
3659   <title><structname>pg_index</structname></title>
3660
3661   <indexterm zone="catalog-pg-index">
3662    <primary>pg_index</primary>
3663   </indexterm>
3664
3665   <para>
3666    The catalog <structname>pg_index</structname> contains part of the information
3667    about indexes.  The rest is mostly in
3668    <structname>pg_class</structname>.
3669   </para>
3670
3671   <table>
3672    <title><structname>pg_index</> Columns</title>
3673
3674    <tgroup cols="4">
3675     <thead>
3676      <row>
3677       <entry>Name</entry>
3678       <entry>Type</entry>
3679       <entry>References</entry>
3680       <entry>Description</entry>
3681      </row>
3682     </thead>
3683
3684     <tbody>
3685      <row>
3686       <entry><structfield>indexrelid</structfield></entry>
3687       <entry><type>oid</type></entry>
3688       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3689       <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3690      </row>
3691
3692      <row>
3693       <entry><structfield>indrelid</structfield></entry>
3694       <entry><type>oid</type></entry>
3695       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3696       <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3697      </row>
3698
3699      <row>
3700       <entry><structfield>indnatts</structfield></entry>
3701       <entry><type>int2</type></entry>
3702       <entry></entry>
3703       <entry>The number of columns in the index (duplicates
3704       <literal>pg_class.relnatts</literal>)</entry>
3705      </row>
3706
3707      <row>
3708       <entry><structfield>indisunique</structfield></entry>
3709       <entry><type>bool</type></entry>
3710       <entry></entry>
3711       <entry>If true, this is a unique index</entry>
3712      </row>
3713
3714      <row>
3715       <entry><structfield>indisprimary</structfield></entry>
3716       <entry><type>bool</type></entry>
3717       <entry></entry>
3718       <entry>If true, this index represents the primary key of the table
3719       (<structfield>indisunique</> should always be true when this is true)</entry>
3720      </row>
3721
3722      <row>
3723       <entry><structfield>indisexclusion</structfield></entry>
3724       <entry><type>bool</type></entry>
3725       <entry></entry>
3726       <entry>If true, this index supports an exclusion constraint</entry>
3727      </row>
3728
3729      <row>
3730       <entry><structfield>indimmediate</structfield></entry>
3731       <entry><type>bool</type></entry>
3732       <entry></entry>
3733       <entry>If true, the uniqueness check is enforced immediately on
3734        insertion
3735        (irrelevant if <structfield>indisunique</> is not true)</entry>
3736      </row>
3737
3738      <row>
3739       <entry><structfield>indisclustered</structfield></entry>
3740       <entry><type>bool</type></entry>
3741       <entry></entry>
3742       <entry>If true, the table was last clustered on this index</entry>
3743      </row>
3744
3745      <row>
3746       <entry><structfield>indisvalid</structfield></entry>
3747       <entry><type>bool</type></entry>
3748       <entry></entry>
3749       <entry>
3750        If true, the index is currently valid for queries.  False means the
3751        index is possibly incomplete: it must still be modified by
3752        <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3753        be used for queries. If it is unique, the uniqueness property is not
3754        guaranteed true either.
3755       </entry>
3756      </row>
3757
3758      <row>
3759       <entry><structfield>indcheckxmin</structfield></entry>
3760       <entry><type>bool</type></entry>
3761       <entry></entry>
3762       <entry>
3763        If true, queries must not use the index until the <structfield>xmin</>
3764        of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3765        event horizon, because the table may contain broken HOT chains with
3766        incompatible rows that they can see
3767       </entry>
3768      </row>
3769
3770      <row>
3771       <entry><structfield>indisready</structfield></entry>
3772       <entry><type>bool</type></entry>
3773       <entry></entry>
3774       <entry>
3775        If true, the index is currently ready for inserts.  False means the
3776        index must be ignored by <command>INSERT</>/<command>UPDATE</>
3777        operations.
3778       </entry>
3779      </row>
3780
3781      <row>
3782       <entry><structfield>indislive</structfield></entry>
3783       <entry><type>bool</type></entry>
3784       <entry></entry>
3785       <entry>
3786        If false, the index is in process of being dropped, and should be
3787        ignored for all purposes (including HOT-safety decisions)
3788       </entry>
3789      </row>
3790
3791      <row>
3792       <entry><structfield>indisreplident</structfield></entry>
3793       <entry><type>bool</type></entry>
3794       <entry></entry>
3795       <entry>
3796        If true this index has been chosen as <quote>replica identity</>
3797        using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3798        ...</>
3799       </entry>
3800      </row>
3801
3802      <row>
3803       <entry><structfield>indkey</structfield></entry>
3804       <entry><type>int2vector</type></entry>
3805       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3806       <entry>
3807        This is an array of <structfield>indnatts</structfield> values that
3808        indicate which table columns this index indexes.  For example a value
3809        of <literal>1 3</literal> would mean that the first and the third table
3810        columns make up the index key.  A zero in this array indicates that the
3811        corresponding index attribute is an expression over the table columns,
3812        rather than a simple column reference.
3813       </entry>
3814      </row>
3815
3816      <row>
3817       <entry><structfield>indcollation</structfield></entry>
3818       <entry><type>oidvector</type></entry>
3819       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3820       <entry>
3821        For each column in the index key, this contains the OID of the
3822        collation to use for the index.
3823       </entry>
3824      </row>
3825
3826      <row>
3827       <entry><structfield>indclass</structfield></entry>
3828       <entry><type>oidvector</type></entry>
3829       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3830       <entry>
3831        For each column in the index key, this contains the OID of
3832        the operator class to use.  See
3833        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3834       </entry>
3835      </row>
3836
3837      <row>
3838       <entry><structfield>indoption</structfield></entry>
3839       <entry><type>int2vector</type></entry>
3840       <entry></entry>
3841       <entry>
3842        This is an array of <structfield>indnatts</structfield> values that
3843        store per-column flag bits.  The meaning of the bits is defined by
3844        the index's access method.
3845       </entry>
3846      </row>
3847
3848      <row>
3849       <entry><structfield>indexprs</structfield></entry>
3850       <entry><type>pg_node_tree</type></entry>
3851       <entry></entry>
3852       <entry>
3853        Expression trees (in <function>nodeToString()</function>
3854        representation) for index attributes that are not simple column
3855        references.  This is a list with one element for each zero
3856        entry in <structfield>indkey</>.  Null if all index attributes
3857        are simple references.
3858       </entry>
3859      </row>
3860
3861      <row>
3862       <entry><structfield>indpred</structfield></entry>
3863       <entry><type>pg_node_tree</type></entry>
3864       <entry></entry>
3865       <entry>
3866        Expression tree (in <function>nodeToString()</function>
3867        representation) for partial index predicate.  Null if not a
3868        partial index.
3869       </entry>
3870      </row>
3871     </tbody>
3872    </tgroup>
3873   </table>
3874
3875  </sect1>
3876
3877
3878  <sect1 id="catalog-pg-inherits">
3879   <title><structname>pg_inherits</structname></title>
3880
3881   <indexterm zone="catalog-pg-inherits">
3882    <primary>pg_inherits</primary>
3883   </indexterm>
3884
3885   <para>
3886    The catalog <structname>pg_inherits</> records information about
3887    table inheritance hierarchies.  There is one entry for each direct
3888    child table in the database.  (Indirect inheritance can be determined
3889    by following chains of entries.)
3890   </para>
3891
3892   <table>
3893    <title><structname>pg_inherits</> Columns</title>
3894
3895    <tgroup cols="4">
3896     <thead>
3897      <row>
3898       <entry>Name</entry>
3899       <entry>Type</entry>
3900       <entry>References</entry>
3901       <entry>Description</entry>
3902      </row>
3903     </thead>
3904
3905     <tbody>
3906      <row>
3907       <entry><structfield>inhrelid</structfield></entry>
3908       <entry><type>oid</type></entry>
3909       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3910       <entry>
3911        The OID of the child table
3912       </entry>
3913      </row>
3914
3915      <row>
3916       <entry><structfield>inhparent</structfield></entry>
3917       <entry><type>oid</type></entry>
3918       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3919       <entry>
3920        The OID of the parent table
3921       </entry>
3922      </row>
3923
3924      <row>
3925       <entry><structfield>inhseqno</structfield></entry>
3926       <entry><type>int4</type></entry>
3927       <entry></entry>
3928       <entry>
3929        If there is more than one direct parent for a child table (multiple
3930        inheritance), this number tells the order in which the
3931        inherited columns are to be arranged.  The count starts at 1.
3932       </entry>
3933      </row>
3934     </tbody>
3935    </tgroup>
3936   </table>
3937
3938  </sect1>
3939
3940
3941  <sect1 id="catalog-pg-language">
3942   <title><structname>pg_language</structname></title>
3943
3944   <indexterm zone="catalog-pg-language">
3945    <primary>pg_language</primary>
3946   </indexterm>
3947
3948   <para>
3949    The catalog <structname>pg_language</structname> registers
3950    languages in which you can write functions or stored procedures.
3951    See <xref linkend="sql-createlanguage">
3952    and <xref linkend="xplang"> for more information about language handlers.
3953   </para>
3954
3955   <table>
3956    <title><structname>pg_language</> Columns</title>
3957
3958    <tgroup cols="4">
3959     <thead>
3960      <row>
3961       <entry>Name</entry>
3962       <entry>Type</entry>
3963       <entry>References</entry>
3964       <entry>Description</entry>
3965      </row>
3966     </thead>
3967
3968     <tbody>
3969      <row>
3970       <entry><structfield>oid</structfield></entry>
3971       <entry><type>oid</type></entry>
3972       <entry></entry>
3973       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3974      </row>
3975
3976      <row>
3977       <entry><structfield>lanname</structfield></entry>
3978       <entry><type>name</type></entry>
3979       <entry></entry>
3980       <entry>Name of the language</entry>
3981      </row>
3982
3983      <row>
3984       <entry><structfield>lanowner</structfield></entry>
3985       <entry><type>oid</type></entry>
3986       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3987       <entry>Owner of the language</entry>
3988      </row>
3989
3990      <row>
3991       <entry><structfield>lanispl</structfield></entry>
3992       <entry><type>bool</type></entry>
3993       <entry></entry>
3994       <entry>
3995        This is false for internal languages (such as
3996        <acronym>SQL</acronym>) and true for user-defined languages.
3997        Currently, <application>pg_dump</application> still uses this
3998        to determine which languages need to be dumped, but this might be
3999        replaced by a different mechanism in the future.
4000       </entry>
4001      </row>
4002
4003      <row>
4004       <entry><structfield>lanpltrusted</structfield></entry>
4005       <entry><type>bool</type></entry>
4006       <entry></entry>
4007       <entry>
4008        True if this is a trusted language, which means that it is believed
4009        not to grant access to anything outside the normal SQL execution
4010        environment.  Only superusers can create functions in untrusted
4011        languages.
4012       </entry>
4013      </row>
4014
4015      <row>
4016       <entry><structfield>lanplcallfoid</structfield></entry>
4017       <entry><type>oid</type></entry>
4018       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4019       <entry>
4020        For noninternal languages this references the language
4021        handler, which is a special function that is responsible for
4022        executing all functions that are written in the particular
4023        language
4024       </entry>
4025      </row>
4026
4027      <row>
4028       <entry><structfield>laninline</structfield></entry>
4029       <entry><type>oid</type></entry>
4030       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4031       <entry>
4032        This references a function that is responsible for executing
4033        <quote>inline</> anonymous code blocks
4034        (<xref linkend="sql-do"> blocks).
4035        Zero if inline blocks are not supported.
4036       </entry>
4037      </row>
4038
4039      <row>
4040       <entry><structfield>lanvalidator</structfield></entry>
4041       <entry><type>oid</type></entry>
4042       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4043       <entry>
4044        This references a language validator function that is responsible
4045        for checking the syntax and validity of new functions when they
4046        are created.  Zero if no validator is provided.
4047       </entry>
4048      </row>
4049
4050      <row>
4051       <entry><structfield>lanacl</structfield></entry>
4052       <entry><type>aclitem[]</type></entry>
4053       <entry></entry>
4054       <entry>
4055        Access privileges; see
4056        <xref linkend="sql-grant"> and
4057        <xref linkend="sql-revoke">
4058        for details
4059       </entry>
4060      </row>
4061     </tbody>
4062    </tgroup>
4063   </table>
4064
4065  </sect1>
4066
4067
4068  <sect1 id="catalog-pg-largeobject">
4069   <title><structname>pg_largeobject</structname></title>
4070
4071   <indexterm zone="catalog-pg-largeobject">
4072    <primary>pg_largeobject</primary>
4073   </indexterm>
4074
4075   <para>
4076    The catalog <structname>pg_largeobject</structname> holds the data making up
4077    <quote>large objects</quote>.  A large object is identified by an OID
4078    assigned when it is created.  Each large object is broken into
4079    segments or <quote>pages</> small enough to be conveniently stored as rows
4080    in <structname>pg_largeobject</structname>.
4081    The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4082    <literal>BLCKSZ/4</>, or typically 2 kB).
4083   </para>
4084
4085   <para>
4086    Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4087    associated with large objects.  As a result,
4088    <structname>pg_largeobject</structname> was publicly readable and could be
4089    used to obtain the OIDs (and contents) of all large objects in the system.
4090    This is no longer the case; use
4091    <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4092    to obtain a list of large object OIDs.
4093   </para>
4094
4095   <table>
4096    <title><structname>pg_largeobject</> Columns</title>
4097
4098    <tgroup cols="4">
4099     <thead>
4100      <row>
4101       <entry>Name</entry>
4102       <entry>Type</entry>
4103       <entry>References</entry>
4104       <entry>Description</entry>
4105      </row>
4106     </thead>
4107
4108     <tbody>
4109      <row>
4110       <entry><structfield>loid</structfield></entry>
4111       <entry><type>oid</type></entry>
4112       <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4113       <entry>Identifier of the large object that includes this page</entry>
4114      </row>
4115
4116      <row>
4117       <entry><structfield>pageno</structfield></entry>
4118       <entry><type>int4</type></entry>
4119       <entry></entry>
4120       <entry>Page number of this page within its large object
4121       (counting from zero)</entry>
4122      </row>
4123
4124      <row>
4125       <entry><structfield>data</structfield></entry>
4126       <entry><type>bytea</type></entry>
4127       <entry></entry>
4128       <entry>
4129        Actual data stored in the large object.
4130        This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4131       </entry>
4132      </row>
4133     </tbody>
4134    </tgroup>
4135   </table>
4136
4137   <para>
4138    Each row of <structname>pg_largeobject</structname> holds data
4139    for one page of a large object, beginning at
4140    byte offset (<literal>pageno * LOBLKSIZE</>) within the object.  The implementation
4141    allows sparse storage: pages might be missing, and might be shorter than
4142    <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4143    Missing regions within a large object read as zeroes.
4144   </para>
4145
4146  </sect1>
4147
4148  <sect1 id="catalog-pg-largeobject-metadata">
4149   <title><structname>pg_largeobject_metadata</structname></title>
4150
4151   <indexterm zone="catalog-pg-largeobject-metadata">
4152    <primary>pg_largeobject_metadata</primary>
4153   </indexterm>
4154
4155   <para>
4156    The catalog <structname>pg_largeobject_metadata</structname>
4157    holds metadata associated with large objects.  The actual large object
4158    data is stored in
4159    <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4160   </para>
4161
4162   <table>
4163    <title><structname>pg_largeobject_metadata</> Columns</title>
4164
4165    <tgroup cols="4">
4166     <thead>
4167      <row>
4168       <entry>Name</entry>
4169       <entry>Type</entry>
4170       <entry>References</entry>
4171       <entry>Description</entry>
4172      </row>
4173     </thead>
4174
4175     <tbody>
4176      <row>
4177       <entry><structfield>oid</structfield></entry>
4178       <entry><type>oid</type></entry>
4179       <entry></entry>
4180       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4181      </row>
4182
4183      <row>
4184       <entry><structfield>lomowner</structfield></entry>
4185       <entry><type>oid</type></entry>
4186       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4187       <entry>Owner of the large object</entry>
4188      </row>
4189
4190      <row>
4191       <entry><structfield>lomacl</structfield></entry>
4192       <entry><type>aclitem[]</type></entry>
4193       <entry></entry>
4194       <entry>
4195        Access privileges; see
4196        <xref linkend="sql-grant"> and
4197        <xref linkend="sql-revoke">
4198        for details
4199       </entry>
4200      </row>
4201
4202     </tbody>
4203    </tgroup>
4204   </table>
4205  </sect1>
4206
4207  <sect1 id="catalog-pg-namespace">
4208   <title><structname>pg_namespace</structname></title>
4209
4210   <indexterm zone="catalog-pg-namespace">
4211    <primary>pg_namespace</primary>
4212   </indexterm>
4213
4214   <para>
4215    The catalog <structname>pg_namespace</> stores namespaces.
4216    A namespace is the structure underlying SQL schemas: each namespace
4217    can have a separate collection of relations, types, etc. without name
4218    conflicts.
4219   </para>
4220
4221   <table>
4222    <title><structname>pg_namespace</> Columns</title>
4223
4224    <tgroup cols="4">
4225     <thead>
4226      <row>
4227       <entry>Name</entry>
4228       <entry>Type</entry>
4229       <entry>References</entry>
4230       <entry>Description</entry>
4231      </row>
4232     </thead>
4233
4234     <tbody>
4235      <row>
4236       <entry><structfield>oid</structfield></entry>
4237       <entry><type>oid</type></entry>
4238       <entry></entry>
4239       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4240      </row>
4241
4242      <row>
4243       <entry><structfield>nspname</structfield></entry>
4244       <entry><type>name</type></entry>
4245       <entry></entry>
4246       <entry>Name of the namespace</entry>
4247      </row>
4248
4249      <row>
4250       <entry><structfield>nspowner</structfield></entry>
4251       <entry><type>oid</type></entry>
4252       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4253       <entry>Owner of the namespace</entry>
4254      </row>
4255
4256      <row>
4257       <entry><structfield>nspacl</structfield></entry>
4258       <entry><type>aclitem[]</type></entry>
4259       <entry></entry>
4260       <entry>
4261        Access privileges; see
4262        <xref linkend="sql-grant"> and
4263        <xref linkend="sql-revoke">
4264        for details
4265       </entry>
4266      </row>
4267     </tbody>
4268    </tgroup>
4269   </table>
4270
4271  </sect1>
4272
4273
4274  <sect1 id="catalog-pg-opclass">
4275   <title><structname>pg_opclass</structname></title>
4276
4277   <indexterm zone="catalog-pg-opclass">
4278    <primary>pg_opclass</primary>
4279   </indexterm>
4280
4281   <para>
4282    The catalog <structname>pg_opclass</structname> defines
4283    index access method operator classes.  Each operator class defines
4284    semantics for index columns of a particular data type and a particular
4285    index access method.  An operator class essentially specifies that a
4286    particular operator family is applicable to a particular indexable column
4287    data type.  The set of operators from the family that are actually usable
4288    with the indexed column are whichever ones accept the column's data type
4289    as their left-hand input.
4290   </para>
4291
4292   <para>
4293    Operator classes are described at length in <xref linkend="xindex">.
4294   </para>
4295
4296   <table>
4297    <title><structname>pg_opclass</> Columns</title>
4298
4299    <tgroup cols="4">
4300     <thead>
4301      <row>
4302       <entry>Name</entry>
4303       <entry>Type</entry>
4304       <entry>References</entry>
4305       <entry>Description</entry>
4306      </row>
4307     </thead>
4308     <tbody>
4309
4310      <row>
4311       <entry><structfield>oid</structfield></entry>
4312       <entry><type>oid</type></entry>
4313       <entry></entry>
4314       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4315      </row>
4316
4317      <row>
4318       <entry><structfield>opcmethod</structfield></entry>
4319       <entry><type>oid</type></entry>
4320       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4321       <entry>Index access method operator class is for</entry>
4322      </row>
4323
4324      <row>
4325       <entry><structfield>opcname</structfield></entry>
4326       <entry><type>name</type></entry>
4327       <entry></entry>
4328       <entry>Name of this operator class</entry>
4329      </row>
4330
4331      <row>
4332       <entry><structfield>opcnamespace</structfield></entry>
4333       <entry><type>oid</type></entry>
4334       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4335       <entry>Namespace of this operator class</entry>
4336      </row>
4337
4338      <row>
4339       <entry><structfield>opcowner</structfield></entry>
4340       <entry><type>oid</type></entry>
4341       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4342       <entry>Owner of the operator class</entry>
4343      </row>
4344
4345      <row>
4346       <entry><structfield>opcfamily</structfield></entry>
4347       <entry><type>oid</type></entry>
4348       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4349       <entry>Operator family containing the operator class</entry>
4350      </row>
4351
4352      <row>
4353       <entry><structfield>opcintype</structfield></entry>
4354       <entry><type>oid</type></entry>
4355       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4356       <entry>Data type that the operator class indexes</entry>
4357      </row>
4358
4359      <row>
4360       <entry><structfield>opcdefault</structfield></entry>
4361       <entry><type>bool</type></entry>
4362       <entry></entry>
4363       <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4364      </row>
4365
4366      <row>
4367       <entry><structfield>opckeytype</structfield></entry>
4368       <entry><type>oid</type></entry>
4369       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4370       <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4371      </row>
4372
4373     </tbody>
4374    </tgroup>
4375   </table>
4376
4377   <para>
4378    An operator class's <structfield>opcmethod</> must match the
4379    <structname>opfmethod</> of its containing operator family.
4380    Also, there must be no more than one <structname>pg_opclass</structname>
4381    row having <structname>opcdefault</> true for any given combination of
4382    <structname>opcmethod</> and <structname>opcintype</>.
4383   </para>
4384
4385  </sect1>
4386
4387
4388  <sect1 id="catalog-pg-operator">
4389   <title><structname>pg_operator</structname></title>
4390
4391   <indexterm zone="catalog-pg-operator">
4392    <primary>pg_operator</primary>
4393   </indexterm>
4394
4395   <para>
4396    The catalog <structname>pg_operator</> stores information about operators.
4397    See <xref linkend="sql-createoperator">
4398    and <xref linkend="xoper"> for more information.
4399   </para>
4400
4401   <table>
4402    <title><structname>pg_operator</> Columns</title>
4403
4404    <tgroup cols="4">
4405     <thead>
4406      <row>
4407       <entry>Name</entry>
4408       <entry>Type</entry>
4409       <entry>References</entry>
4410       <entry>Description</entry>
4411      </row>
4412     </thead>
4413
4414     <tbody>
4415      <row>
4416       <entry><structfield>oid</structfield></entry>
4417       <entry><type>oid</type></entry>
4418       <entry></entry>
4419       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4420      </row>
4421
4422      <row>
4423       <entry><structfield>oprname</structfield></entry>
4424       <entry><type>name</type></entry>
4425       <entry></entry>
4426       <entry>Name of the operator</entry>
4427      </row>
4428
4429      <row>
4430       <entry><structfield>oprnamespace</structfield></entry>
4431       <entry><type>oid</type></entry>
4432       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4433       <entry>
4434        The OID of the namespace that contains this operator
4435       </entry>
4436      </row>
4437
4438      <row>
4439       <entry><structfield>oprowner</structfield></entry>
4440       <entry><type>oid</type></entry>
4441       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4442       <entry>Owner of the operator</entry>
4443      </row>
4444
4445      <row>
4446       <entry><structfield>oprkind</structfield></entry>
4447       <entry><type>char</type></entry>
4448       <entry></entry>
4449       <entry>
4450        <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4451        (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4452       </entry>
4453      </row>
4454
4455      <row>
4456       <entry><structfield>oprcanmerge</structfield></entry>
4457       <entry><type>bool</type></entry>
4458       <entry></entry>
4459       <entry>This operator supports merge joins</entry>
4460      </row>
4461
4462      <row>
4463       <entry><structfield>oprcanhash</structfield></entry>
4464       <entry><type>bool</type></entry>
4465       <entry></entry>
4466       <entry>This operator supports hash joins</entry>
4467      </row>
4468
4469      <row>
4470       <entry><structfield>oprleft</structfield></entry>
4471       <entry><type>oid</type></entry>
4472       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4473       <entry>Type of the left operand</entry>
4474      </row>
4475
4476      <row>
4477       <entry><structfield>oprright</structfield></entry>
4478       <entry><type>oid</type></entry>
4479       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4480       <entry>Type of the right operand</entry>
4481      </row>
4482
4483      <row>
4484       <entry><structfield>oprresult</structfield></entry>
4485       <entry><type>oid</type></entry>
4486       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4487       <entry>Type of the result</entry>
4488      </row>
4489
4490      <row>
4491       <entry><structfield>oprcom</structfield></entry>
4492       <entry><type>oid</type></entry>
4493       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4494       <entry>Commutator of this operator, if any</entry>
4495      </row>
4496
4497      <row>
4498       <entry><structfield>oprnegate</structfield></entry>
4499       <entry><type>oid</type></entry>
4500       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4501       <entry>Negator of this operator, if any</entry>
4502      </row>
4503
4504      <row>
4505       <entry><structfield>oprcode</structfield></entry>
4506       <entry><type>regproc</type></entry>
4507       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4508       <entry>Function that implements this operator</entry>
4509      </row>
4510
4511      <row>
4512       <entry><structfield>oprrest</structfield></entry>
4513       <entry><type>regproc</type></entry>
4514       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4515       <entry>Restriction selectivity estimation function for this operator</entry>
4516      </row>
4517
4518      <row>
4519       <entry><structfield>oprjoin</structfield></entry>
4520       <entry><type>regproc</type></entry>
4521       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4522       <entry>Join selectivity estimation function for this operator</entry>
4523      </row>
4524     </tbody>
4525    </tgroup>
4526   </table>
4527
4528   <para>
4529    Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4530    is zero for a prefix operator.
4531   </para>
4532
4533  </sect1>
4534
4535
4536  <sect1 id="catalog-pg-opfamily">
4537   <title><structname>pg_opfamily</structname></title>
4538
4539   <indexterm zone="catalog-pg-opfamily">
4540    <primary>pg_opfamily</primary>
4541   </indexterm>
4542
4543   <para>
4544    The catalog <structname>pg_opfamily</structname> defines operator families.
4545    Each operator family is a collection of operators and associated
4546    support routines that implement the semantics specified for a particular
4547    index access method.  Furthermore, the operators in a family are all
4548    <quote>compatible</>, in a way that is specified by the access method.
4549    The operator family concept allows cross-data-type operators to be used
4550    with indexes and to be reasoned about using knowledge of access method
4551    semantics.
4552   </para>
4553
4554   <para>
4555    Operator families are described at length in <xref linkend="xindex">.
4556   </para>
4557
4558   <table>
4559    <title><structname>pg_opfamily</> Columns</title>
4560
4561    <tgroup cols="4">
4562     <thead>
4563      <row>
4564       <entry>Name</entry>
4565       <entry>Type</entry>
4566       <entry>References</entry>
4567       <entry>Description</entry>
4568      </row>
4569     </thead>
4570     <tbody>
4571
4572      <row>
4573       <entry><structfield>oid</structfield></entry>
4574       <entry><type>oid</type></entry>
4575       <entry></entry>
4576       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4577      </row>
4578
4579      <row>
4580       <entry><structfield>opfmethod</structfield></entry>
4581       <entry><type>oid</type></entry>
4582       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4583       <entry>Index access method operator family is for</entry>
4584      </row>
4585
4586      <row>
4587       <entry><structfield>opfname</structfield></entry>
4588       <entry><type>name</type></entry>
4589       <entry></entry>
4590       <entry>Name of this operator family</entry>
4591      </row>
4592
4593      <row>
4594       <entry><structfield>opfnamespace</structfield></entry>
4595       <entry><type>oid</type></entry>
4596       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4597       <entry>Namespace of this operator family</entry>
4598      </row>
4599
4600      <row>
4601       <entry><structfield>opfowner</structfield></entry>
4602       <entry><type>oid</type></entry>
4603       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4604       <entry>Owner of the operator family</entry>
4605      </row>
4606
4607     </tbody>
4608    </tgroup>
4609   </table>
4610
4611   <para>
4612    The majority of the information defining an operator family is not in its
4613    <structname>pg_opfamily</structname> row, but in the associated rows in
4614    <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4615    <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4616    and
4617    <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4618   </para>
4619
4620  </sect1>
4621
4622
4623  <sect1 id="catalog-pg-pltemplate">
4624   <title><structname>pg_pltemplate</structname></title>
4625
4626   <indexterm zone="catalog-pg-pltemplate">
4627    <primary>pg_pltemplate</primary>
4628   </indexterm>
4629
4630   <para>
4631    The catalog <structname>pg_pltemplate</structname> stores
4632    <quote>template</> information for procedural languages.
4633    A template for a language allows the language to be created in a
4634    particular database by a simple <command>CREATE LANGUAGE</> command,
4635    with no need to specify implementation details.
4636   </para>
4637
4638   <para>
4639    Unlike most system catalogs, <structname>pg_pltemplate</structname>
4640    is shared across all databases of a cluster: there is only one
4641    copy of <structname>pg_pltemplate</structname> per cluster, not
4642    one per database.  This allows the information to be accessible in
4643    each database as it is needed.
4644   </para>
4645
4646   <table>
4647    <title><structname>pg_pltemplate</> Columns</title>
4648
4649    <tgroup cols="3">
4650     <thead>
4651      <row>
4652       <entry>Name</entry>
4653       <entry>Type</entry>
4654       <entry>Description</entry>
4655      </row>
4656     </thead>
4657
4658     <tbody>
4659      <row>
4660       <entry><structfield>tmplname</structfield></entry>
4661       <entry><type>name</type></entry>
4662       <entry>Name of the language this template is for</entry>
4663      </row>
4664
4665      <row>
4666       <entry><structfield>tmpltrusted</structfield></entry>
4667       <entry><type>boolean</type></entry>
4668       <entry>True if language is considered trusted</entry>
4669      </row>
4670
4671      <row>
4672       <entry><structfield>tmpldbacreate</structfield></entry>
4673       <entry><type>boolean</type></entry>
4674       <entry>True if language may be created by a database owner</entry>
4675      </row>
4676
4677      <row>
4678       <entry><structfield>tmplhandler</structfield></entry>
4679       <entry><type>text</type></entry>
4680       <entry>Name of call handler function</entry>
4681      </row>
4682
4683      <row>
4684       <entry><structfield>tmplinline</structfield></entry>
4685       <entry><type>text</type></entry>
4686       <entry>Name of anonymous-block handler function, or null if none</entry>
4687      </row>
4688
4689      <row>
4690       <entry><structfield>tmplvalidator</structfield></entry>
4691       <entry><type>text</type></entry>
4692       <entry>Name of validator function, or null if none</entry>
4693      </row>
4694
4695      <row>
4696       <entry><structfield>tmpllibrary</structfield></entry>
4697       <entry><type>text</type></entry>
4698       <entry>Path of shared library that implements language</entry>
4699      </row>
4700
4701      <row>
4702       <entry><structfield>tmplacl</structfield></entry>
4703       <entry><type>aclitem[]</type></entry>
4704       <entry>Access privileges for template (not actually used)</entry>
4705      </row>
4706
4707     </tbody>
4708    </tgroup>
4709   </table>
4710
4711   <para>
4712    There are not currently any commands that manipulate procedural language
4713    templates; to change the built-in information, a superuser must modify
4714    the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4715    or <command>UPDATE</command> commands.
4716   </para>
4717
4718   <note>
4719    <para>
4720     It is likely that <structname>pg_pltemplate</> will be removed in some
4721     future release of <productname>PostgreSQL</productname>, in favor of
4722     keeping this knowledge about procedural languages in their respective
4723     extension installation scripts.
4724    </para>
4725   </note>
4726
4727  </sect1>
4728
4729  <sect1 id="catalog-pg-policy">
4730   <title><structname>pg_policy</structname></title>
4731
4732   <indexterm zone="catalog-pg-policy">
4733    <primary>pg_policy</primary>
4734   </indexterm>
4735
4736   <para>
4737    The catalog <structname>pg_policy</structname> stores row level
4738    security policies for tables.  A policy includes the kind of
4739    command that it applies to (possibly all commands), the roles that it
4740    applies to, the expression to be added as a security-barrier
4741    qualification to queries that include the table, and the expression
4742    to be added as a <literal>WITH CHECK</> option for queries that attempt to
4743    add new records to the table.
4744   </para>
4745
4746   <table>
4747
4748    <title><structname>pg_policy</structname> Columns</title>
4749
4750    <tgroup cols="4">
4751     <thead>
4752      <row>
4753       <entry>Name</entry>
4754       <entry>Type</entry>
4755       <entry>References</entry>
4756       <entry>Description</entry>
4757      </row>
4758     </thead>
4759
4760     <tbody>
4761      <row>
4762       <entry><structfield>polname</structfield></entry>
4763       <entry><type>name</type></entry>
4764       <entry></entry>
4765       <entry>The name of the policy</entry>
4766      </row>
4767
4768      <row>
4769       <entry><structfield>polrelid</structfield></entry>
4770       <entry><type>oid</type></entry>
4771       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4772       <entry>The table to which the policy applies</entry>
4773      </row>
4774
4775      <row>
4776       <entry><structfield>polcmd</structfield></entry>
4777       <entry><type>char</type></entry>
4778       <entry></entry>
4779       <entry>The command type to which the policy is applied:
4780        <literal>r</> for <command>SELECT</>,
4781        <literal>a</> for <command>INSERT</>,
4782        <literal>w</> for <command>UPDATE</>,
4783        <literal>d</> for <command>DELETE</>,
4784        or <literal>*</> for all</entry>
4785      </row>
4786
4787      <row>
4788       <entry><structfield>polroles</structfield></entry>
4789       <entry><type>oid[]</type></entry>
4790       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4791       <entry>The roles to which the policy is applied</entry>
4792      </row>
4793
4794      <row>
4795       <entry><structfield>polqual</structfield></entry>
4796       <entry><type>pg_node_tree</type></entry>
4797       <entry></entry>
4798       <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4799      </row>
4800
4801      <row>
4802       <entry><structfield>polwithcheck</structfield></entry>
4803       <entry><type>pg_node_tree</type></entry>
4804       <entry></entry>
4805       <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4806      </row>
4807
4808     </tbody>
4809    </tgroup>
4810   </table>
4811
4812   <note>
4813    <para>
4814     Policies stored in <structname>pg_policy</> are applied only when
4815     <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4816     their table.
4817    </para>
4818   </note>
4819
4820  </sect1>
4821
4822  <sect1 id="catalog-pg-proc">
4823   <title><structname>pg_proc</structname></title>
4824
4825   <indexterm zone="catalog-pg-proc">
4826    <primary>pg_proc</primary>
4827   </indexterm>
4828
4829   <para>
4830    The catalog <structname>pg_proc</> stores information about functions (or procedures).
4831    See <xref linkend="sql-createfunction">
4832    and <xref linkend="xfunc"> for more information.
4833   </para>
4834
4835   <para>
4836    The table contains data for aggregate functions as well as plain functions.
4837    If <structfield>proisagg</structfield> is true, there should be a matching
4838    row in <structfield>pg_aggregate</structfield>.
4839   </para>
4840
4841   <table>
4842    <title><structname>pg_proc</> Columns</title>
4843
4844    <tgroup cols="4">
4845     <thead>
4846      <row>
4847       <entry>Name</entry>
4848       <entry>Type</entry>
4849       <entry>References</entry>
4850       <entry>Description</entry>
4851      </row>
4852     </thead>
4853
4854     <tbody>
4855      <row>
4856       <entry><structfield>oid</structfield></entry>
4857       <entry><type>oid</type></entry>
4858       <entry></entry>
4859       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4860      </row>
4861
4862      <row>
4863       <entry><structfield>proname</structfield></entry>
4864       <entry><type>name</type></entry>
4865       <entry></entry>
4866       <entry>Name of the function</entry>
4867      </row>
4868
4869      <row>
4870       <entry><structfield>pronamespace</structfield></entry>
4871       <entry><type>oid</type></entry>
4872       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4873       <entry>
4874        The OID of the namespace that contains this function
4875       </entry>
4876      </row>
4877
4878      <row>
4879       <entry><structfield>proowner</structfield></entry>
4880       <entry><type>oid</type></entry>
4881       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4882       <entry>Owner of the function</entry>
4883      </row>
4884
4885      <row>
4886       <entry><structfield>prolang</structfield></entry>
4887       <entry><type>oid</type></entry>
4888       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
4889       <entry>Implementation language or call interface of this function</entry>
4890      </row>
4891
4892      <row>
4893       <entry><structfield>procost</structfield></entry>
4894       <entry><type>float4</type></entry>
4895       <entry></entry>
4896       <entry>Estimated execution cost (in units of
4897        <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
4898        this is cost per row returned</entry>
4899      </row>
4900
4901      <row>
4902       <entry><structfield>prorows</structfield></entry>
4903       <entry><type>float4</type></entry>
4904       <entry></entry>
4905       <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
4906      </row>
4907
4908      <row>
4909       <entry><structfield>provariadic</structfield></entry>
4910       <entry><type>oid</type></entry>
4911       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4912       <entry>Data type of the variadic array parameter's elements,
4913        or zero if the function does not have a variadic parameter</entry>
4914      </row>
4915
4916      <row>
4917       <entry><structfield>protransform</structfield></entry>
4918       <entry><type>regproc</type></entry>
4919       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4920       <entry>Calls to this function can be simplified by this other function
4921        (see <xref linkend="xfunc-transform-functions">)</entry>
4922      </row>
4923
4924      <row>
4925       <entry><structfield>proisagg</structfield></entry>
4926       <entry><type>bool</type></entry>
4927       <entry></entry>
4928       <entry>Function is an aggregate function</entry>
4929      </row>
4930
4931      <row>
4932       <entry><structfield>proiswindow</structfield></entry>
4933       <entry><type>bool</type></entry>
4934       <entry></entry>
4935       <entry>Function is a window function</entry>
4936      </row>
4937
4938      <row>
4939       <entry><structfield>prosecdef</structfield></entry>
4940       <entry><type>bool</type></entry>
4941       <entry></entry>
4942       <entry>Function is a security definer (i.e., a <quote>setuid</>
4943       function)</entry>
4944      </row>
4945
4946      <row>
4947       <entry><structfield>proleakproof</structfield></entry>
4948       <entry><type>bool</type></entry>
4949       <entry></entry>
4950       <entry>
4951        The function has no side effects.  No information about the
4952        arguments is conveyed except via the return value.  Any function
4953        that might throw an error depending on the values of its arguments
4954        is not leak-proof.
4955       </entry>
4956      </row>
4957
4958      <row>
4959       <entry><structfield>proisstrict</structfield></entry>
4960       <entry><type>bool</type></entry>
4961       <entry></entry>
4962       <entry>
4963        Function returns null if any call argument is null.  In that
4964        case the function won't actually be called at all.  Functions
4965        that are not <quote>strict</quote> must be prepared to handle
4966        null inputs.
4967       </entry>
4968      </row>
4969
4970      <row>
4971       <entry><structfield>proretset</structfield></entry>
4972       <entry><type>bool</type></entry>
4973       <entry></entry>
4974       <entry>Function returns a set (i.e., multiple values of the specified
4975       data type)</entry>
4976      </row>
4977
4978      <row>
4979       <entry><structfield>provolatile</structfield></entry>
4980       <entry><type>char</type></entry>
4981       <entry></entry>
4982       <entry>
4983        <structfield>provolatile</structfield> tells whether the function's
4984        result depends only on its input arguments, or is affected by outside
4985        factors.
4986        It is <literal>i</literal> for <quote>immutable</> functions,
4987        which always deliver the same result for the same inputs.
4988        It is <literal>s</literal> for <quote>stable</> functions,
4989        whose results (for fixed inputs) do not change within a scan.
4990        It is <literal>v</literal> for <quote>volatile</> functions,
4991        whose results might change at any time.  (Use <literal>v</literal> also
4992        for functions with side-effects, so that calls to them cannot get
4993        optimized away.)
4994       </entry>
4995      </row>
4996
4997      <row>
4998       <entry><structfield>pronargs</structfield></entry>
4999       <entry><type>int2</type></entry>
5000       <entry></entry>
5001       <entry>Number of input arguments</entry>
5002      </row>
5003
5004      <row>
5005       <entry><structfield>pronargdefaults</structfield></entry>
5006       <entry><type>int2</type></entry>
5007       <entry></entry>
5008       <entry>Number of arguments that have defaults</entry>
5009      </row>
5010
5011      <row>
5012       <entry><structfield>prorettype</structfield></entry>
5013       <entry><type>oid</type></entry>
5014       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5015       <entry>Data type of the return value</entry>
5016      </row>
5017
5018      <row>
5019       <entry><structfield>proargtypes</structfield></entry>
5020       <entry><type>oidvector</type></entry>
5021       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5022       <entry>
5023        An array with the data types of the function arguments.  This includes
5024        only input arguments (including <literal>INOUT</literal> and
5025        <literal>VARIADIC</> arguments), and thus represents
5026        the call signature of the function.
5027       </entry>
5028      </row>
5029
5030      <row>
5031       <entry><structfield>proallargtypes</structfield></entry>
5032       <entry><type>oid[]</type></entry>
5033       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5034       <entry>
5035        An array with the data types of the function arguments.  This includes
5036        all arguments (including <literal>OUT</literal> and
5037        <literal>INOUT</literal> arguments); however, if all the
5038        arguments are <literal>IN</literal> arguments, this field will be null.
5039        Note that subscripting is 1-based, whereas for historical reasons
5040        <structfield>proargtypes</> is subscripted from 0.
5041       </entry>
5042      </row>
5043
5044      <row>
5045       <entry><structfield>proargmodes</structfield></entry>
5046       <entry><type>char[]</type></entry>
5047       <entry></entry>
5048       <entry>
5049         An array with the modes of the function arguments, encoded as
5050         <literal>i</literal> for <literal>IN</> arguments,
5051         <literal>o</literal> for <literal>OUT</> arguments,
5052         <literal>b</literal> for <literal>INOUT</> arguments,
5053         <literal>v</literal> for <literal>VARIADIC</> arguments,
5054         <literal>t</literal> for <literal>TABLE</> arguments.
5055         If all the arguments are <literal>IN</literal> arguments,
5056         this field will be null.
5057         Note that subscripts correspond to positions of
5058         <structfield>proallargtypes</> not <structfield>proargtypes</>.
5059       </entry>
5060      </row>
5061
5062      <row>
5063       <entry><structfield>proargnames</structfield></entry>
5064       <entry><type>text[]</type></entry>
5065       <entry></entry>
5066       <entry>
5067         An array with the names of the function arguments.
5068         Arguments without a name are set to empty strings in the array.
5069         If none of the arguments have a name, this field will be null.
5070         Note that subscripts correspond to positions of
5071         <structfield>proallargtypes</> not <structfield>proargtypes</>.
5072       </entry>
5073      </row>
5074
5075      <row>
5076       <entry><structfield>proargdefaults</structfield></entry>
5077       <entry><type>pg_node_tree</type></entry>
5078       <entry></entry>
5079       <entry>
5080        Expression trees (in <function>nodeToString()</function> representation)
5081        for default values.  This is a list with
5082        <structfield>pronargdefaults</> elements, corresponding to the last
5083        <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5084        <replaceable>N</> <structfield>proargtypes</> positions).
5085        If none of the arguments have defaults, this field will be null.
5086       </entry>
5087      </row>
5088
5089      <row>
5090       <entry><structfield>protrftypes</structfield></entry>
5091       <entry><type>oid[]</type></entry>
5092       <entry></entry>
5093       <entry>
5094        Data type OIDs for which to apply transforms.
5095       </entry>
5096      </row>
5097
5098      <row>
5099       <entry><structfield>prosrc</structfield></entry>
5100       <entry><type>text</type></entry>
5101       <entry></entry>
5102       <entry>
5103        This tells the function handler how to invoke the function.  It
5104        might be the actual source code of the function for interpreted
5105        languages, a link symbol, a file name, or just about anything
5106        else, depending on the implementation language/call convention.
5107       </entry>
5108      </row>
5109
5110      <row>
5111       <entry><structfield>probin</structfield></entry>
5112       <entry><type>text</type></entry>
5113       <entry></entry>
5114       <entry>
5115        Additional information about how to invoke the function.
5116        Again, the interpretation is language-specific.
5117       </entry>
5118      </row>
5119
5120      <row>
5121       <entry><structfield>proconfig</structfield></entry>
5122       <entry><type>text[]</type></entry>
5123       <entry></entry>
5124       <entry>Function's local settings for run-time configuration variables</entry>
5125      </row>
5126
5127      <row>
5128       <entry><structfield>proacl</structfield></entry>
5129       <entry><type>aclitem[]</type></entry>
5130       <entry></entry>
5131       <entry>
5132        Access privileges; see
5133        <xref linkend="sql-grant"> and
5134        <xref linkend="sql-revoke">
5135        for details
5136       </entry>
5137      </row>
5138     </tbody>
5139    </tgroup>
5140   </table>
5141
5142   <para>
5143    For compiled functions, both built-in and dynamically loaded,
5144    <structfield>prosrc</structfield> contains the function's C-language
5145    name (link symbol).  For all other currently-known language types,
5146    <structfield>prosrc</structfield> contains the function's source
5147    text.  <structfield>probin</structfield> is unused except for
5148    dynamically-loaded C functions, for which it gives the name of the
5149    shared library file containing the function.
5150   </para>
5151
5152  </sect1>
5153
5154  <sect1 id="catalog-pg-range">
5155   <title><structname>pg_range</structname></title>
5156
5157   <indexterm zone="catalog-pg-range">
5158    <primary>pg_range</primary>
5159   </indexterm>
5160
5161   <para>
5162    The catalog <structname>pg_range</structname> stores information about
5163    range types.  This is in addition to the types' entries in
5164    <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5165   </para>
5166
5167   <table>
5168    <title><structname>pg_range</> Columns</title>
5169
5170    <tgroup cols="4">
5171     <thead>
5172      <row>
5173       <entry>Name</entry>
5174       <entry>Type</entry>
5175       <entry>References</entry>
5176       <entry>Description</entry>
5177      </row>
5178     </thead>
5179
5180     <tbody>
5181      <row>
5182       <entry><structfield>rngtypid</structfield></entry>
5183       <entry><type>oid</type></entry>
5184       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5185       <entry>OID of the range type</entry>
5186      </row>
5187
5188      <row>
5189       <entry><structfield>rngsubtype</structfield></entry>
5190       <entry><type>oid</type></entry>
5191       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5192       <entry>OID of the element type (subtype) of this range type</entry>
5193      </row>
5194
5195      <row>
5196       <entry><structfield>rngcollation</structfield></entry>
5197       <entry><type>oid</type></entry>
5198       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5199       <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5200      </row>
5201
5202      <row>
5203       <entry><structfield>rngsubopc</structfield></entry>
5204       <entry><type>oid</type></entry>
5205       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5206       <entry>OID of the subtype's operator class used for range comparisons</entry>
5207      </row>
5208
5209      <row>
5210       <entry><structfield>rngcanonical</structfield></entry>
5211       <entry><type>regproc</type></entry>
5212       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5213       <entry>OID of the function to convert a range value into canonical form,
5214       or 0 if none</entry>
5215      </row>
5216
5217      <row>
5218       <entry><structfield>rngsubdiff</structfield></entry>
5219       <entry><type>regproc</type></entry>
5220       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5221       <entry>OID of the function to return the difference between two element
5222       values as <type>double precision</type>, or 0 if none</entry>
5223      </row>
5224     </tbody>
5225    </tgroup>
5226   </table>
5227
5228   <para>
5229    <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5230    element type is collatable) determines the sort ordering used by the range
5231    type.  <structfield>rngcanonical</> is used when the element type is
5232    discrete.  <structfield>rngsubdiff</> is optional but should be supplied to
5233    improve performance of GiST indexes on the range type.
5234   </para>
5235
5236  </sect1>
5237
5238  <sect1 id="catalog-pg-rewrite">
5239   <title><structname>pg_rewrite</structname></title>
5240
5241   <indexterm zone="catalog-pg-rewrite">
5242    <primary>pg_rewrite</primary>
5243   </indexterm>
5244
5245   <para>
5246    The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5247   </para>
5248
5249   <table>
5250    <title><structname>pg_rewrite</> Columns</title>
5251
5252    <tgroup cols="4">
5253     <thead>
5254      <row>
5255       <entry>Name</entry>
5256       <entry>Type</entry>
5257       <entry>References</entry>
5258       <entry>Description</entry>
5259      </row>
5260     </thead>
5261
5262     <tbody>
5263      <row>
5264       <entry><structfield>oid</structfield></entry>
5265       <entry><type>oid</type></entry>
5266       <entry></entry>
5267       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5268      </row>
5269
5270      <row>
5271       <entry><structfield>rulename</structfield></entry>
5272       <entry><type>name</type></entry>
5273       <entry></entry>
5274       <entry>Rule name</entry>
5275      </row>
5276
5277      <row>
5278       <entry><structfield>ev_class</structfield></entry>
5279       <entry><type>oid</type></entry>
5280       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5281       <entry>The table this rule is for</entry>
5282      </row>
5283
5284      <row>
5285       <entry><structfield>ev_type</structfield></entry>
5286       <entry><type>char</type></entry>
5287       <entry></entry>
5288       <entry>
5289        Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5290        <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5291        <command>DELETE</>
5292       </entry>
5293      </row>
5294
5295      <row>
5296       <entry><structfield>ev_enabled</structfield></entry>
5297       <entry><type>char</type></entry>
5298       <entry></entry>
5299       <entry>
5300        Controls in which <xref linkend="guc-session-replication-role"> modes
5301        the rule fires.
5302        <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5303        <literal>D</> = rule is disabled,
5304        <literal>R</> = rule fires in <quote>replica</> mode,
5305        <literal>A</> = rule fires always.
5306       </entry>
5307      </row>
5308
5309      <row>
5310       <entry><structfield>is_instead</structfield></entry>
5311       <entry><type>bool</type></entry>
5312       <entry></entry>
5313       <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5314      </row>
5315
5316      <row>
5317       <entry><structfield>ev_qual</structfield></entry>
5318       <entry><type>pg_node_tree</type></entry>
5319       <entry></entry>
5320       <entry>
5321        Expression tree (in the form of a
5322        <function>nodeToString()</function> representation) for the
5323        rule's qualifying condition
5324       </entry>
5325      </row>
5326
5327      <row>
5328       <entry><structfield>ev_action</structfield></entry>
5329       <entry><type>pg_node_tree</type></entry>
5330       <entry></entry>
5331       <entry>
5332        Query tree (in the form of a
5333        <function>nodeToString()</function> representation) for the
5334        rule's action
5335       </entry>
5336      </row>
5337     </tbody>
5338    </tgroup>
5339   </table>
5340
5341   <note>
5342    <para>
5343     <literal>pg_class.relhasrules</literal>
5344     must be true if a table has any rules in this catalog.
5345    </para>
5346   </note>
5347
5348  </sect1>
5349
5350  <sect1 id="catalog-pg-replication-origin">
5351   <title><structname>pg_replication_origin</structname></title>
5352
5353   <indexterm zone="catalog-pg-replication-origin">
5354    <primary>pg_replication_origin</primary>
5355   </indexterm>
5356
5357   <para>
5358    The <structname>pg_replication_origin</structname> catalog contains
5359    all replication origins created.  For more on replication origins
5360    see <xref linkend="replication-origins">.
5361   </para>
5362
5363   <table>
5364
5365    <title><structname>pg_replication_origin</structname> Columns</title>
5366
5367    <tgroup cols="4">
5368     <thead>
5369      <row>
5370       <entry>Name</entry>
5371       <entry>Type</entry>
5372       <entry>References</entry>
5373       <entry>Description</entry>
5374      </row>
5375     </thead>
5376
5377     <tbody>
5378      <row>
5379       <entry><structfield>roident</structfield></entry>
5380       <entry><type>Oid</type></entry>
5381       <entry></entry>
5382       <entry>A unique, cluster-wide identifier for the replication
5383       origin. Should never leave the system.</entry>
5384      </row>
5385
5386      <row>
5387       <entry><structfield>roname</structfield></entry>
5388       <entry><type>text</type></entry>
5389       <entry></entry>
5390       <entry>The external, user defined, name of a replication
5391       origin.</entry>
5392      </row>
5393     </tbody>
5394    </tgroup>
5395   </table>
5396  </sect1>
5397
5398   <sect1 id="catalog-pg-replication-origin-status">
5399   <title><structname>pg_replication_origin_status</structname></title>
5400
5401   <indexterm zone="catalog-pg-replication-origin-status">
5402    <primary>pg_replication_origin_status</primary>
5403   </indexterm>
5404
5405   <para>
5406    The <structname>pg_replication_origin_status</structname> view
5407    contains information about how far replay for a certain origin has
5408    progressed.  For more on replication origins
5409    see <xref linkend="replication-origins">.
5410   </para>
5411
5412   <table>
5413
5414    <title><structname>pg_replication_origin_status</structname> Columns</title>
5415
5416    <tgroup cols="4">
5417     <thead>
5418      <row>
5419       <entry>Name</entry>
5420       <entry>Type</entry>
5421       <entry>References</entry>
5422       <entry>Description</entry>
5423      </row>
5424     </thead>
5425
5426     <tbody>
5427      <row>
5428       <entry><structfield>local_id</structfield></entry>
5429       <entry><type>Oid</type></entry>
5430       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
5431       <entry>internal node identifier</entry>
5432      </row>
5433
5434      <row>
5435       <entry><structfield>external_id</structfield></entry>
5436       <entry><type>text</type></entry>
5437       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
5438       <entry>external node identifier</entry>
5439      </row>
5440
5441      <row>
5442       <entry><structfield>remote_lsn</structfield></entry>
5443       <entry><type>pg_lsn</type></entry>
5444       <entry></entry>
5445       <entry>The origin node's LSN up to which data has been replicated.</entry>
5446      </row>
5447
5448
5449      <row>
5450       <entry><structfield>local_lsn</structfield></entry>
5451       <entry><type>pg_lsn</type></entry>
5452       <entry></entry>
5453       <entry>
5454        This node's LSN at which <literal>remote_lsn</literal> has
5455        been replicated. Used to flush commit records before persisting
5456        data to disk when using asynchronous commits.
5457       </entry>
5458      </row>
5459     </tbody>
5460    </tgroup>
5461   </table>
5462  </sect1>
5463
5464  <sect1 id="catalog-pg-replication-slots">
5465   <title><structname>pg_replication_slots</structname></title>
5466
5467   <indexterm zone="catalog-pg-replication-slots">
5468    <primary>pg_replication_slots</primary>
5469   </indexterm>
5470
5471   <para>
5472    The <structname>pg_replication_slots</structname> view provides a listing
5473    of all replication slots that currently exist on the database cluster,
5474    along with their current state.
5475   </para>
5476
5477   <para>
5478    For more on replication slots,
5479    see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
5480   </para>
5481
5482   <table>
5483
5484    <title><structname>pg_replication_slots</structname> Columns</title>
5485
5486    <tgroup cols="4">
5487     <thead>
5488      <row>
5489       <entry>Name</entry>
5490       <entry>Type</entry>
5491       <entry>References</entry>
5492       <entry>Description</entry>
5493      </row>
5494     </thead>
5495
5496     <tbody>
5497      <row>
5498       <entry><structfield>slot_name</structfield></entry>
5499       <entry><type>name</type></entry>
5500       <entry></entry>
5501       <entry>A unique, cluster-wide identifier for the replication slot</entry>
5502      </row>
5503
5504      <row>
5505       <entry><structfield>plugin</structfield></entry>
5506       <entry><type>name</type></entry>
5507       <entry></entry>
5508       <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
5509      </row>
5510
5511      <row>
5512       <entry><structfield>slot_type</structfield></entry>
5513       <entry><type>text</type></entry>
5514       <entry></entry>
5515       <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
5516      </row>
5517
5518      <row>
5519       <entry><structfield>datoid</structfield></entry>
5520       <entry><type>oid</type></entry>
5521       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5522       <entry>The OID of the database this slot is associated with, or
5523       null. Only logical slots have an associated database.</entry>
5524      </row>
5525
5526      <row>
5527       <entry><structfield>database</structfield></entry>
5528       <entry><type>text</type></entry>
5529       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
5530       <entry>The name of the database this slot is associated with, or
5531       null. Only logical slots have an associated database.</entry>
5532      </row>
5533
5534      <row>
5535       <entry><structfield>active</structfield></entry>
5536       <entry><type>boolean</type></entry>
5537       <entry></entry>
5538       <entry>True if this slot is currently actively being used</entry>
5539      </row>
5540
5541      <row>
5542       <entry><structfield>active_pid</structfield></entry>
5543       <entry><type>integer</type></entry>
5544       <entry></entry>
5545       <entry>The process ID of the session using this slot if the slot
5546        is currently actively being used. <literal>NULL</literal> if
5547        inactive.
5548       </entry>
5549      </row>
5550
5551      <row>
5552       <entry><structfield>xmin</structfield></entry>
5553       <entry><type>xid</type></entry>
5554       <entry></entry>
5555       <entry>The oldest transaction that this slot needs the database to
5556       retain.  <literal>VACUUM</literal> cannot remove tuples deleted
5557       by any later transaction.
5558       </entry>
5559      </row>
5560
5561      <row>
5562       <entry><structfield>catalog_xmin</structfield></entry>
5563       <entry><type>xid</type></entry>
5564       <entry></entry>
5565       <entry>The oldest transaction affecting the system catalogs that this
5566       slot needs the database to retain.  <literal>VACUUM</literal> cannot
5567       remove catalog tuples deleted by any later transaction.
5568       </entry>
5569      </row>
5570
5571      <row>
5572       <entry><structfield>restart_lsn</structfield></entry>
5573       <entry><type>pg_lsn</type></entry>
5574       <entry></entry>
5575       <entry>The address (<literal>LSN</literal>) of oldest WAL which still
5576       might be required by the consumer of this slot and thus won't be
5577       automatically removed during checkpoints.
5578       </entry>
5579      </row>
5580     </tbody>
5581    </tgroup>
5582   </table>
5583  </sect1>
5584
5585  <sect1 id="catalog-pg-seclabel">
5586   <title><structname>pg_seclabel</structname></title>
5587
5588   <indexterm zone="catalog-pg-seclabel">
5589    <primary>pg_seclabel</primary>
5590   </indexterm>
5591
5592   <para>
5593    The catalog <structname>pg_seclabel</structname> stores security
5594    labels on database objects.  Security labels can be manipulated
5595    with the <xref linkend="sql-security-label"> command.  For an easier
5596    way to view security labels, see <xref linkend="view-pg-seclabels">.
5597   </para>
5598
5599   <para>
5600    See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5601    which performs a similar function for security labels of database objects
5602    that are shared across a database cluster.
5603   </para>
5604
5605   <table>
5606    <title><structname>pg_seclabel</structname> Columns</title>
5607
5608    <tgroup cols="4">
5609     <thead>
5610      <row>
5611       <entry>Name</entry>
5612       <entry>Type</entry>
5613       <entry>References</entry>
5614       <entry>Description</entry>
5615      </row>
5616     </thead>
5617
5618     <tbody>
5619      <row>
5620       <entry><structfield>objoid</structfield></entry>
5621       <entry><type>oid</type></entry>
5622       <entry>any OID column</entry>
5623       <entry>The OID of the object this security label pertains to</entry>
5624      </row>
5625
5626      <row>
5627       <entry><structfield>classoid</structfield></entry>
5628       <entry><type>oid</type></entry>
5629       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5630       <entry>The OID of the system catalog this object appears in</entry>
5631      </row>
5632
5633      <row>
5634       <entry><structfield>objsubid</structfield></entry>
5635       <entry><type>int4</type></entry>
5636       <entry></entry>
5637       <entry>
5638        For a security label on a table column, this is the column number (the
5639        <structfield>objoid</> and <structfield>classoid</> refer to
5640        the table itself).  For all other object types, this column is
5641        zero.
5642       </entry>
5643      </row>
5644
5645      <row>
5646       <entry><structfield>provider</structfield></entry>
5647       <entry><type>text</type></entry>
5648       <entry></entry>
5649       <entry>The label provider associated with this label.</entry>
5650      </row>
5651
5652      <row>
5653       <entry><structfield>label</structfield></entry>
5654       <entry><type>text</type></entry>
5655       <entry></entry>
5656       <entry>The security label applied to this object.</entry>
5657      </row>
5658     </tbody>
5659    </tgroup>
5660   </table>
5661  </sect1>
5662
5663  <sect1 id="catalog-pg-shdepend">
5664   <title><structname>pg_shdepend</structname></title>
5665
5666   <indexterm zone="catalog-pg-shdepend">
5667    <primary>pg_shdepend</primary>
5668   </indexterm>
5669
5670   <para>
5671    The catalog <structname>pg_shdepend</structname> records the
5672    dependency relationships between database objects and shared objects,
5673    such as roles.  This information allows
5674    <productname>PostgreSQL</productname> to ensure that those objects are
5675    unreferenced before attempting to delete them.
5676   </para>
5677
5678   <para>
5679    See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5680    which performs a similar function for dependencies involving objects
5681    within a single database.
5682   </para>
5683
5684   <para>
5685    Unlike most system catalogs, <structname>pg_shdepend</structname>
5686    is shared across all databases of a cluster: there is only one
5687    copy of <structname>pg_shdepend</structname> per cluster, not
5688    one per database.
5689   </para>
5690
5691   <table>
5692    <title><structname>pg_shdepend</> Columns</title>
5693
5694    <tgroup cols="4">
5695     <thead>
5696      <row>
5697       <entry>Name</entry>
5698       <entry>Type</entry>
5699       <entry>References</entry>
5700       <entry>Description</entry>
5701      </row>
5702     </thead>
5703
5704     <tbody>
5705      <row>
5706       <entry><structfield>dbid</structfield></entry>
5707       <entry><type>oid</type></entry>
5708       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5709       <entry>The OID of the database the dependent object is in,
5710        or zero for a shared object</entry>
5711      </row>
5712
5713      <row>
5714       <entry><structfield>classid</structfield></entry>
5715       <entry><type>oid</type></entry>
5716       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5717       <entry>The OID of the system catalog the dependent object is in</entry>
5718      </row>
5719
5720      <row>
5721       <entry><structfield>objid</structfield></entry>
5722       <entry><type>oid</type></entry>
5723       <entry>any OID column</entry>
5724       <entry>The OID of the specific dependent object</entry>
5725      </row>
5726
5727      <row>
5728       <entry><structfield>objsubid</structfield></entry>
5729       <entry><type>int4</type></entry>
5730       <entry></entry>
5731       <entry>
5732        For a table column, this is the column number (the
5733        <structfield>objid</> and <structfield>classid</> refer to the
5734        table itself).  For all other object types, this column is zero.
5735       </entry>
5736      </row>
5737
5738      <row>
5739       <entry><structfield>refclassid</structfield></entry>
5740       <entry><type>oid</type></entry>
5741       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5742       <entry>The OID of the system catalog the referenced object is in
5743        (must be a shared catalog)</entry>
5744      </row>
5745
5746      <row>
5747       <entry><structfield>refobjid</structfield></entry>
5748       <entry><type>oid</type></entry>
5749       <entry>any OID column</entry>
5750       <entry>The OID of the specific referenced object</entry>
5751      </row>
5752
5753      <row>
5754       <entry><structfield>deptype</structfield></entry>
5755       <entry><type>char</type></entry>
5756       <entry></entry>
5757       <entry>
5758        A code defining the specific semantics of this dependency relationship; see text
5759       </entry>
5760      </row>
5761
5762     </tbody>
5763    </tgroup>
5764   </table>
5765
5766   <para>
5767    In all cases, a <structname>pg_shdepend</structname> entry indicates that
5768    the referenced object cannot be dropped without also dropping the dependent
5769    object.  However, there are several subflavors identified by
5770    <structfield>deptype</>:
5771
5772    <variablelist>
5773     <varlistentry>
5774      <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5775      <listitem>
5776       <para>
5777        The referenced object (which must be a role) is the owner of the
5778        dependent object.
5779       </para>
5780      </listitem>
5781     </varlistentry>
5782
5783     <varlistentry>
5784      <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5785      <listitem>
5786       <para>
5787        The referenced object (which must be a role) is mentioned in the
5788        ACL (access control list, i.e., privileges list) of the
5789        dependent object.  (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5790        not made for the owner of the object, since the owner will have
5791        a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5792       </para>
5793      </listitem>
5794     </varlistentry>
5795
5796     <varlistentry>
5797      <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
5798      <listitem>
5799       <para>
5800        The referenced object (which must be a role) is mentioned as the
5801        target of a dependent policy object.
5802       </para>
5803      </listitem>
5804     </varlistentry>
5805
5806     <varlistentry>
5807      <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5808      <listitem>
5809       <para>
5810        There is no dependent object; this type of entry is a signal
5811        that the system itself depends on the referenced object, and so
5812        that object must never be deleted.  Entries of this type are
5813        created only by <command>initdb</command>.  The columns for the
5814        dependent object contain zeroes.
5815       </para>
5816      </listitem>
5817     </varlistentry>
5818    </variablelist>
5819
5820    Other dependency flavors might be needed in future.  Note in particular
5821    that the current definition only supports roles as referenced objects.
5822   </para>
5823
5824  </sect1>
5825
5826  <sect1 id="catalog-pg-shdescription">
5827   <title><structname>pg_shdescription</structname></title>
5828
5829   <indexterm zone="catalog-pg-shdescription">
5830    <primary>pg_shdescription</primary>
5831   </indexterm>
5832
5833   <para>
5834    The catalog <structname>pg_shdescription</structname> stores optional
5835    descriptions (comments) for shared database objects.  Descriptions can be
5836    manipulated with the <xref linkend="sql-comment"> command and viewed with
5837    <application>psql</application>'s <literal>\d</literal> commands.
5838   </para>
5839
5840   <para>
5841    See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
5842    which performs a similar function for descriptions involving objects
5843    within a single database.
5844   </para>
5845
5846   <para>
5847    Unlike most system catalogs, <structname>pg_shdescription</structname>
5848    is shared across all databases of a cluster: there is only one
5849    copy of <structname>pg_shdescription</structname> per cluster, not
5850    one per database.
5851   </para>
5852
5853   <table>
5854    <title><structname>pg_shdescription</> Columns</title>
5855
5856    <tgroup cols="4">
5857     <thead>
5858      <row>
5859       <entry>Name</entry>
5860       <entry>Type</entry>
5861       <entry>References</entry>
5862       <entry>Description</entry>
5863      </row>
5864     </thead>
5865
5866     <tbody>
5867      <row>
5868       <entry><structfield>objoid</structfield></entry>
5869       <entry><type>oid</type></entry>
5870       <entry>any OID column</entry>
5871       <entry>The OID of the object this description pertains to</entry>
5872      </row>
5873
5874      <row>
5875       <entry><structfield>classoid</structfield></entry>
5876       <entry><type>oid</type></entry>
5877       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5878       <entry>The OID of the system catalog this object appears in</entry>
5879      </row>
5880
5881      <row>
5882       <entry><structfield>description</structfield></entry>
5883       <entry><type>text</type></entry>
5884       <entry></entry>
5885       <entry>Arbitrary text that serves as the description of this object</entry>
5886      </row>
5887     </tbody>
5888    </tgroup>
5889   </table>
5890
5891  </sect1>
5892
5893  <sect1 id="catalog-pg-shseclabel">
5894   <title><structname>pg_shseclabel</structname></title>
5895
5896   <indexterm zone="catalog-pg-shseclabel">
5897    <primary>pg_shseclabel</primary>
5898   </indexterm>
5899
5900   <para>
5901    The catalog <structname>pg_shseclabel</structname> stores security
5902    labels on shared database objects.  Security labels can be manipulated
5903    with the <xref linkend="sql-security-label"> command.  For an easier
5904    way to view security labels, see <xref linkend="view-pg-seclabels">.
5905   </para>
5906
5907   <para>
5908    See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
5909    which performs a similar function for security labels involving objects
5910    within a single database.
5911   </para>
5912
5913   <para>
5914    Unlike most system catalogs, <structname>pg_shseclabel</structname>
5915    is shared across all databases of a cluster: there is only one
5916    copy of <structname>pg_shseclabel</structname> per cluster, not
5917    one per database.
5918   </para>
5919
5920   <table>
5921    <title><structname>pg_shseclabel</structname> Columns</title>
5922    <tgroup cols="4">
5923     <thead>
5924      <row>
5925       <entry>Name</entry>
5926       <entry>Type</entry>
5927       <entry>References</entry>
5928       <entry>Description</entry>
5929      </row>
5930     </thead>
5931     <tbody>
5932      <row>
5933       <entry><structfield>objoid</structfield></entry>
5934       <entry><type>oid</type></entry>
5935       <entry>any OID column</entry>
5936       <entry>The OID of the object this security label pertains to</entry>
5937      </row>
5938      <row>
5939       <entry><structfield>classoid</structfield></entry>
5940       <entry><type>oid</type></entry>
5941       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5942       <entry>The OID of the system catalog this object appears in</entry>
5943      </row>
5944      <row>
5945       <entry><structfield>provider</structfield></entry>
5946       <entry><type>text</type></entry>
5947       <entry></entry>
5948       <entry>The label provider associated with this label.</entry>
5949      </row>
5950      <row>
5951       <entry><structfield>label</structfield></entry>
5952       <entry><type>text</type></entry>
5953       <entry></entry>
5954       <entry>The security label applied to this object.</entry>
5955      </row>
5956     </tbody>
5957    </tgroup>
5958   </table>
5959  </sect1>
5960
5961  <sect1 id="catalog-pg-statistic">
5962   <title><structname>pg_statistic</structname></title>
5963
5964   <indexterm zone="catalog-pg-statistic">
5965    <primary>pg_statistic</primary>
5966   </indexterm>
5967
5968   <para>
5969    The catalog <structname>pg_statistic</structname> stores
5970    statistical data about the contents of the database.  Entries are
5971    created by <xref linkend="sql-analyze">
5972    and subsequently used by the query planner.  Note that all the
5973    statistical data is inherently approximate, even assuming that it
5974    is up-to-date.
5975   </para>
5976
5977   <para>
5978    Normally there is one entry, with <structfield>stainherit</> =
5979    <literal>false</>, for each table column that has been analyzed.
5980    If the table has inheritance children, a second entry with
5981    <structfield>stainherit</> = <literal>true</> is also created.  This row
5982    represents the column's statistics over the inheritance tree, i.e.,
5983    statistics for the data you'd see with
5984    <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
5985    whereas the <structfield>stainherit</> = <literal>false</> row represents
5986    the results of
5987    <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
5988   </para>
5989
5990   <para>
5991    <structname>pg_statistic</structname> also stores statistical data about
5992    the values of index expressions.  These are described as if they were
5993    actual data columns; in particular, <structfield>starelid</structfield>
5994    references the index.  No entry is made for an ordinary non-expression
5995    index column, however, since it would be redundant with the entry
5996    for the underlying table column.  Currently, entries for index expressions
5997    always have <structfield>stainherit</> = <literal>false</>.
5998   </para>
5999
6000   <para>
6001    Since different kinds of statistics might be appropriate for different
6002    kinds of data, <structname>pg_statistic</structname> is designed not
6003    to assume very much about what sort of statistics it stores.  Only
6004    extremely general statistics (such as nullness) are given dedicated
6005    columns in <structname>pg_statistic</structname>.  Everything else
6006    is stored in <quote>slots</quote>, which are groups of associated columns
6007    whose content is identified by a code number in one of the slot's columns.
6008    For more information see
6009    <filename>src/include/catalog/pg_statistic.h</filename>.
6010   </para>
6011
6012   <para>
6013    <structname>pg_statistic</structname> should not be readable by the
6014    public, since even statistical information about a table's contents
6015    might be considered sensitive.  (Example: minimum and maximum values
6016    of a salary column might be quite interesting.)
6017    <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6018    is a publicly readable view on
6019    <structname>pg_statistic</structname> that only exposes information
6020    about those tables that are readable by the current user.
6021   </para>
6022
6023   <table>
6024    <title><structname>pg_statistic</> Columns</title>
6025
6026    <tgroup cols="4">
6027     <thead>
6028      <row>
6029       <entry>Name</entry>
6030       <entry>Type</entry>
6031       <entry>References</entry>
6032       <entry>Description</entry>
6033      </row>
6034     </thead>
6035
6036     <tbody>
6037      <row>
6038       <entry><structfield>starelid</structfield></entry>
6039       <entry><type>oid</type></entry>
6040       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6041       <entry>The table or index that the described column belongs to</entry>
6042      </row>
6043
6044      <row>
6045       <entry><structfield>staattnum</structfield></entry>
6046       <entry><type>int2</type></entry>
6047       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6048       <entry>The number of the described column</entry>
6049      </row>
6050
6051      <row>
6052       <entry><structfield>stainherit</structfield></entry>
6053       <entry><type>bool</type></entry>
6054       <entry></entry>
6055       <entry>If true, the stats include inheritance child columns, not just the
6056        values in the specified relation</entry>
6057      </row>
6058
6059      <row>
6060       <entry><structfield>stanullfrac</structfield></entry>
6061       <entry><type>float4</type></entry>
6062       <entry></entry>
6063       <entry>The fraction of the column's entries that are null</entry>
6064      </row>
6065
6066      <row>
6067       <entry><structfield>stawidth</structfield></entry>
6068       <entry><type>int4</type></entry>
6069       <entry></entry>
6070       <entry>The average stored width, in bytes, of nonnull entries</entry>
6071      </row>
6072
6073      <row>
6074       <entry><structfield>stadistinct</structfield></entry>
6075       <entry><type>float4</type></entry>
6076       <entry></entry>
6077       <entry>The number of distinct nonnull data values in the column.
6078       A value greater than zero is the actual number of distinct values.
6079       A value less than zero is the negative of a multiplier for the number
6080       of rows in the table; for example, a column in which values appear about
6081       twice on the average could be represented by
6082       <structfield>stadistinct</> = -0.5.
6083       A zero value means the number of distinct values is unknown.
6084       </entry>
6085      </row>
6086
6087      <row>
6088       <entry><structfield>stakind<replaceable>N</></structfield></entry>
6089       <entry><type>int2</type></entry>
6090       <entry></entry>
6091       <entry>
6092        A code number indicating the kind of statistics stored in the
6093        <replaceable>N</>th <quote>slot</quote> of the
6094        <structname>pg_statistic</structname> row.
6095       </entry>
6096      </row>
6097
6098      <row>
6099       <entry><structfield>staop<replaceable>N</></structfield></entry>
6100       <entry><type>oid</type></entry>
6101       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6102       <entry>
6103        An operator used to derive the statistics stored in the
6104        <replaceable>N</>th <quote>slot</quote>.  For example, a
6105        histogram slot would show the <literal>&lt;</literal> operator
6106        that defines the sort order of the data.
6107       </entry>
6108      </row>
6109
6110      <row>
6111       <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6112       <entry><type>float4[]</type></entry>
6113       <entry></entry>
6114       <entry>
6115        Numerical statistics of the appropriate kind for the
6116        <replaceable>N</>th <quote>slot</quote>, or null if the slot
6117        kind does not involve numerical values
6118       </entry>
6119      </row>
6120
6121      <row>
6122       <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6123       <entry><type>anyarray</type></entry>
6124       <entry></entry>
6125       <entry>
6126        Column data values of the appropriate kind for the
6127        <replaceable>N</>th <quote>slot</quote>, or null if the slot
6128        kind does not store any data values.  Each array's element
6129        values are actually of the specific column's data type, or a related
6130        type such as an array's element type, so there is no way to define
6131        these columns' type more specifically than <type>anyarray</>.
6132       </entry>
6133      </row>
6134     </tbody>
6135    </tgroup>
6136   </table>
6137
6138  </sect1>
6139
6140
6141  <sect1 id="catalog-pg-tablespace">
6142   <title><structname>pg_tablespace</structname></title>
6143
6144   <indexterm zone="catalog-pg-tablespace">
6145    <primary>pg_tablespace</primary>
6146   </indexterm>
6147
6148   <para>
6149    The catalog <structname>pg_tablespace</structname> stores information
6150    about the available tablespaces.  Tables can be placed in particular
6151    tablespaces to aid administration of disk layout.
6152   </para>
6153
6154   <para>
6155    Unlike most system catalogs, <structname>pg_tablespace</structname>
6156    is shared across all databases of a cluster: there is only one
6157    copy of <structname>pg_tablespace</structname> per cluster, not
6158    one per database.
6159   </para>
6160
6161   <table>
6162    <title><structname>pg_tablespace</> Columns</title>
6163
6164    <tgroup cols="4">
6165     <thead>
6166      <row>
6167       <entry>Name</entry>
6168       <entry>Type</entry>
6169       <entry>References</entry>
6170       <entry>Description</entry>
6171      </row>
6172     </thead>
6173
6174     <tbody>
6175      <row>
6176       <entry><structfield>oid</structfield></entry>
6177       <entry><type>oid</type></entry>
6178       <entry></entry>
6179       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6180      </row>
6181
6182      <row>
6183       <entry><structfield>spcname</structfield></entry>
6184       <entry><type>name</type></entry>
6185       <entry></entry>
6186       <entry>Tablespace name</entry>
6187      </row>
6188
6189      <row>
6190       <entry><structfield>spcowner</structfield></entry>
6191       <entry><type>oid</type></entry>
6192       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6193       <entry>Owner of the tablespace, usually the user who created it</entry>
6194      </row>
6195
6196      <row>
6197       <entry><structfield>spcacl</structfield></entry>
6198       <entry><type>aclitem[]</type></entry>
6199       <entry></entry>
6200       <entry>
6201        Access privileges; see
6202        <xref linkend="sql-grant"> and
6203        <xref linkend="sql-revoke">
6204        for details
6205       </entry>
6206      </row>
6207
6208      <row>
6209       <entry><structfield>spcoptions</structfield></entry>
6210       <entry><type>text[]</type></entry>
6211       <entry></entry>
6212       <entry>
6213        Tablespace-level options, as <quote>keyword=value</> strings
6214       </entry>
6215      </row>
6216     </tbody>
6217    </tgroup>
6218   </table>
6219  </sect1>
6220
6221
6222  <sect1 id="catalog-pg-transform">
6223   <title><structname>pg_transform</structname></title>
6224
6225   <indexterm zone="catalog-pg-transform">
6226    <primary>pg_transform</primary>
6227   </indexterm>
6228
6229   <para>
6230    The catalog <structname>pg_transform</structname> stores information about
6231    transforms, which are a mechanism to adapt data types to procedural
6232    languages.  See <xref linkend="sql-createtransform"> for more information.
6233   </para>
6234
6235   <table>
6236    <title><structname>pg_transform</> Columns</title>
6237
6238    <tgroup cols="4">
6239     <thead>
6240      <row>
6241       <entry>Name</entry>
6242       <entry>Type</entry>
6243       <entry>References</entry>
6244       <entry>Description</entry>
6245      </row>
6246     </thead>
6247
6248     <tbody>
6249      <row>
6250       <entry><structfield>trftype</structfield></entry>
6251       <entry><type>oid</type></entry>
6252       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6253       <entry>OID of the data type this transform is for</entry>
6254      </row>
6255
6256      <row>
6257       <entry><structfield>trflang</structfield></entry>
6258       <entry><type>oid</type></entry>
6259       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6260       <entry>OID of the language this transform is for</entry>
6261      </row>
6262
6263      <row>
6264       <entry><structfield>trffromsql</structfield></entry>
6265       <entry><type>regproc</type></entry>
6266       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6267       <entry>
6268        The OID of the function to use when converting the data type for input
6269        to the procedural language (e.g., function parameters).  Zero is stored
6270        if this operation is not supported.
6271       </entry>
6272      </row>
6273
6274      <row>
6275       <entry><structfield>trftosql</structfield></entry>
6276       <entry><type>regproc</type></entry>
6277       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6278       <entry>
6279        The OID of the function to use when converting output from the
6280        procedural language (e.g., return values) to the data type.  Zero is
6281        stored if this operation is not supported.
6282       </entry>
6283      </row>
6284     </tbody>
6285    </tgroup>
6286   </table>
6287  </sect1>
6288
6289
6290  <sect1 id="catalog-pg-trigger">
6291   <title><structname>pg_trigger</structname></title>
6292
6293   <indexterm zone="catalog-pg-trigger">
6294    <primary>pg_trigger</primary>
6295   </indexterm>
6296
6297   <para>
6298    The catalog <structname>pg_trigger</structname> stores triggers on tables
6299    and views.
6300    See <xref linkend="sql-createtrigger">
6301    for more information.
6302   </para>
6303
6304   <table>
6305    <title><structname>pg_trigger</> Columns</title>
6306
6307    <tgroup cols="4">
6308     <thead>
6309      <row>
6310       <entry>Name</entry>
6311       <entry>Type</entry>
6312       <entry>References</entry>
6313       <entry>Description</entry>
6314      </row>
6315     </thead>
6316
6317     <tbody>
6318      <row>
6319       <entry><structfield>oid</structfield></entry>
6320       <entry><type>oid</type></entry>
6321       <entry></entry>
6322       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6323      </row>
6324
6325      <row>
6326       <entry><structfield>tgrelid</structfield></entry>
6327       <entry><type>oid</type></entry>
6328       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6329       <entry>The table this trigger is on</entry>
6330      </row>
6331
6332      <row>
6333       <entry><structfield>tgname</structfield></entry>
6334       <entry><type>name</type></entry>
6335       <entry></entry>
6336       <entry>Trigger name (must be unique among triggers of same table)</entry>
6337      </row>
6338
6339      <row>
6340       <entry><structfield>tgfoid</structfield></entry>
6341       <entry><type>oid</type></entry>
6342       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6343       <entry>The function to be called</entry>
6344      </row>
6345
6346      <row>
6347       <entry><structfield>tgtype</structfield></entry>
6348       <entry><type>int2</type></entry>
6349       <entry></entry>
6350       <entry>Bit mask identifying trigger firing conditions</entry>
6351      </row>
6352
6353      <row>
6354       <entry><structfield>tgenabled</structfield></entry>
6355       <entry><type>char</type></entry>
6356       <entry></entry>
6357       <entry>
6358        Controls in which <xref linkend="guc-session-replication-role"> modes
6359        the trigger fires.
6360        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6361        <literal>D</> = trigger is disabled,
6362        <literal>R</> = trigger fires in <quote>replica</> mode,
6363        <literal>A</> = trigger fires always.
6364       </entry>
6365      </row>
6366
6367      <row>
6368       <entry><structfield>tgisinternal</structfield></entry>
6369       <entry><type>bool</type></entry>
6370       <entry></entry>
6371       <entry>True if trigger is internally generated (usually, to enforce
6372        the constraint identified by <structfield>tgconstraint</>)</entry>
6373      </row>
6374
6375      <row>
6376       <entry><structfield>tgconstrrelid</structfield></entry>
6377       <entry><type>oid</type></entry>
6378       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6379       <entry>The table referenced by a referential integrity constraint</entry>
6380      </row>
6381
6382      <row>
6383       <entry><structfield>tgconstrindid</structfield></entry>
6384       <entry><type>oid</type></entry>
6385       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6386       <entry>The index supporting a unique, primary key, referential integrity,
6387        or exclusion constraint</entry>
6388      </row>
6389
6390      <row>
6391       <entry><structfield>tgconstraint</structfield></entry>
6392       <entry><type>oid</type></entry>
6393       <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6394       <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6395      </row>
6396
6397      <row>
6398       <entry><structfield>tgdeferrable</structfield></entry>
6399       <entry><type>bool</type></entry>
6400       <entry></entry>
6401       <entry>True if constraint trigger is deferrable</entry>
6402      </row>
6403
6404      <row>
6405       <entry><structfield>tginitdeferred</structfield></entry>
6406       <entry><type>bool</type></entry>
6407       <entry></entry>
6408       <entry>True if constraint trigger is initially deferred</entry>
6409      </row>
6410
6411      <row>
6412       <entry><structfield>tgnargs</structfield></entry>
6413       <entry><type>int2</type></entry>
6414       <entry></entry>
6415       <entry>Number of argument strings passed to trigger function</entry>
6416      </row>
6417
6418      <row>
6419       <entry><structfield>tgattr</structfield></entry>
6420       <entry><type>int2vector</type></entry>
6421       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6422       <entry>Column numbers, if trigger is column-specific; otherwise an
6423        empty array</entry>
6424      </row>
6425
6426      <row>
6427       <entry><structfield>tgargs</structfield></entry>
6428       <entry><type>bytea</type></entry>
6429       <entry></entry>
6430       <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6431      </row>
6432
6433      <row>
6434       <entry><structfield>tgqual</structfield></entry>
6435       <entry><type>pg_node_tree</type></entry>
6436       <entry></entry>
6437       <entry>Expression tree (in <function>nodeToString()</function>
6438        representation) for the trigger's <literal>WHEN</> condition, or null
6439        if none</entry>
6440      </row>
6441     </tbody>
6442    </tgroup>
6443   </table>
6444
6445   <para>
6446    Currently, column-specific triggering is supported only for
6447    <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6448    only for that event type.  <structfield>tgtype</structfield> might
6449    contain bits for other event types as well, but those are presumed
6450    to be table-wide regardless of what is in <structfield>tgattr</>.
6451   </para>
6452
6453   <note>
6454    <para>
6455     When <structfield>tgconstraint</> is nonzero,
6456     <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6457     <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6458     largely redundant with the referenced <structname>pg_constraint</> entry.
6459     However, it is possible for a non-deferrable trigger to be associated
6460     with a deferrable constraint: foreign key constraints can have some
6461     deferrable and some non-deferrable triggers.
6462    </para>
6463   </note>
6464
6465   <note>
6466    <para>
6467     <literal>pg_class.relhastriggers</literal>
6468     must be true if a relation has any triggers in this catalog.
6469    </para>
6470   </note>
6471
6472  </sect1>
6473
6474
6475  <sect1 id="catalog-pg-ts-config">
6476   <title><structname>pg_ts_config</structname></title>
6477
6478   <indexterm zone="catalog-pg-ts-config">
6479    <primary>pg_ts_config</primary>
6480   </indexterm>
6481
6482   <para>
6483    The <structname>pg_ts_config</structname> catalog contains entries
6484    representing text search configurations.  A configuration specifies
6485    a particular text search parser and a list of dictionaries to use
6486    for each of the parser's output token types.  The parser is shown
6487    in the <structname>pg_ts_config</structname> entry, but the
6488    token-to-dictionary mapping is defined by subsidiary entries in <link
6489    linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6490   </para>
6491
6492   <para>
6493    <productname>PostgreSQL</productname>'s text search features are
6494    described at length in <xref linkend="textsearch">.
6495   </para>
6496
6497   <table>
6498    <title><structname>pg_ts_config</> Columns</title>
6499
6500    <tgroup cols="4">
6501     <thead>
6502      <row>
6503       <entry>Name</entry>
6504       <entry>Type</entry>
6505       <entry>References</entry>
6506       <entry>Description</entry>
6507      </row>
6508     </thead>
6509
6510     <tbody>
6511      <row>
6512       <entry><structfield>oid</structfield></entry>
6513       <entry><type>oid</type></entry>
6514       <entry></entry>
6515       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6516      </row>
6517
6518      <row>
6519       <entry><structfield>cfgname</structfield></entry>
6520       <entry><type>name</type></entry>
6521       <entry></entry>
6522       <entry>Text search configuration name</entry>
6523      </row>
6524
6525      <row>
6526       <entry><structfield>cfgnamespace</structfield></entry>
6527       <entry><type>oid</type></entry>
6528       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6529       <entry>
6530        The OID of the namespace that contains this configuration
6531       </entry>
6532      </row>
6533
6534      <row>
6535       <entry><structfield>cfgowner</structfield></entry>
6536       <entry><type>oid</type></entry>
6537       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6538       <entry>Owner of the configuration</entry>
6539      </row>
6540
6541      <row>
6542       <entry><structfield>cfgparser</structfield></entry>
6543       <entry><type>oid</type></entry>
6544       <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6545       <entry>The OID of the text search parser for this configuration</entry>
6546      </row>
6547     </tbody>
6548    </tgroup>
6549   </table>
6550  </sect1>
6551
6552
6553  <sect1 id="catalog-pg-ts-config-map">
6554   <title><structname>pg_ts_config_map</structname></title>
6555
6556   <indexterm zone="catalog-pg-ts-config-map">
6557    <primary>pg_ts_config_map</primary>
6558   </indexterm>
6559
6560   <para>
6561    The <structname>pg_ts_config_map</structname> catalog contains entries
6562    showing which text search dictionaries should be consulted, and in
6563    what order, for each output token type of each text search configuration's
6564    parser.
6565   </para>
6566
6567   <para>
6568    <productname>PostgreSQL</productname>'s text search features are
6569    described at length in <xref linkend="textsearch">.
6570   </para>
6571
6572   <table>
6573    <title><structname>pg_ts_config_map</> Columns</title>
6574
6575    <tgroup cols="4">
6576     <thead>
6577      <row>
6578       <entry>Name</entry>
6579       <entry>Type</entry>
6580       <entry>References</entry>
6581       <entry>Description</entry>
6582      </row>
6583     </thead>
6584
6585     <tbody>
6586      <row>
6587       <entry><structfield>mapcfg</structfield></entry>
6588       <entry><type>oid</type></entry>
6589       <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6590       <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6591      </row>
6592
6593      <row>
6594       <entry><structfield>maptokentype</structfield></entry>
6595       <entry><type>integer</type></entry>
6596       <entry></entry>
6597       <entry>A token type emitted by the configuration's parser</entry>
6598      </row>
6599
6600      <row>
6601       <entry><structfield>mapseqno</structfield></entry>
6602       <entry><type>integer</type></entry>
6603       <entry></entry>
6604       <entry>Order in which to consult this entry (lower
6605        <structfield>mapseqno</>s first)</entry>
6606      </row>
6607
6608      <row>
6609       <entry><structfield>mapdict</structfield></entry>
6610       <entry><type>oid</type></entry>
6611       <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6612       <entry>The OID of the text search dictionary to consult</entry>
6613      </row>
6614     </tbody>
6615    </tgroup>
6616   </table>
6617  </sect1>
6618
6619
6620  <sect1 id="catalog-pg-ts-dict">
6621   <title><structname>pg_ts_dict</structname></title>
6622
6623   <indexterm zone="catalog-pg-ts-dict">
6624    <primary>pg_ts_dict</primary>
6625   </indexterm>
6626
6627   <para>
6628    The <structname>pg_ts_dict</structname> catalog contains entries
6629    defining text search dictionaries.  A dictionary depends on a text
6630    search template, which specifies all the implementation functions
6631    needed; the dictionary itself provides values for the user-settable
6632    parameters supported by the template.  This division of labor allows
6633    dictionaries to be created by unprivileged users.  The parameters
6634    are specified by a text string <structfield>dictinitoption</>,
6635    whose format and meaning vary depending on the template.
6636   </para>
6637
6638   <para>
6639    <productname>PostgreSQL</productname>'s text search features are
6640    described at length in <xref linkend="textsearch">.
6641   </para>
6642
6643   <table>
6644    <title><structname>pg_ts_dict</> Columns</title>
6645
6646    <tgroup cols="4">
6647     <thead>
6648      <row>
6649       <entry>Name</entry>
6650       <entry>Type</entry>
6651       <entry>References</entry>
6652       <entry>Description</entry>
6653      </row>
6654     </thead>
6655
6656     <tbody>
6657      <row>
6658       <entry><structfield>oid</structfield></entry>
6659       <entry><type>oid</type></entry>
6660       <entry></entry>
6661       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6662      </row>
6663
6664      <row>
6665       <entry><structfield>dictname</structfield></entry>
6666       <entry><type>name</type></entry>
6667       <entry></entry>
6668       <entry>Text search dictionary name</entry>
6669      </row>
6670
6671      <row>
6672       <entry><structfield>dictnamespace</structfield></entry>
6673       <entry><type>oid</type></entry>
6674       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6675       <entry>
6676        The OID of the namespace that contains this dictionary
6677       </entry>
6678      </row>
6679
6680      <row>
6681       <entry><structfield>dictowner</structfield></entry>
6682       <entry><type>oid</type></entry>
6683       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6684       <entry>Owner of the dictionary</entry>
6685      </row>
6686
6687      <row>
6688       <entry><structfield>dicttemplate</structfield></entry>
6689       <entry><type>oid</type></entry>
6690       <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6691       <entry>The OID of the text search template for this dictionary</entry>
6692      </row>
6693
6694      <row>
6695       <entry><structfield>dictinitoption</structfield></entry>
6696       <entry><type>text</type></entry>
6697       <entry></entry>
6698       <entry>Initialization option string for the template</entry>
6699      </row>
6700     </tbody>
6701    </tgroup>
6702   </table>
6703  </sect1>
6704
6705
6706  <sect1 id="catalog-pg-ts-parser">
6707   <title><structname>pg_ts_parser</structname></title>
6708
6709   <indexterm zone="catalog-pg-ts-parser">
6710    <primary>pg_ts_parser</primary>
6711   </indexterm>
6712
6713   <para>
6714    The <structname>pg_ts_parser</structname> catalog contains entries
6715    defining text search parsers.  A parser is responsible for splitting
6716    input text into lexemes and assigning a token type to each lexeme.
6717    Since a parser must be implemented by C-language-level functions,
6718    creation of new parsers is restricted to database superusers.
6719   </para>
6720
6721   <para>
6722    <productname>PostgreSQL</productname>'s text search features are
6723    described at length in <xref linkend="textsearch">.
6724   </para>
6725
6726   <table>
6727    <title><structname>pg_ts_parser</> Columns</title>
6728
6729    <tgroup cols="4">
6730     <thead>
6731      <row>
6732       <entry>Name</entry>
6733       <entry>Type</entry>
6734       <entry>References</entry>
6735       <entry>Description</entry>
6736      </row>
6737     </thead>
6738
6739     <tbody>
6740      <row>
6741       <entry><structfield>oid</structfield></entry>
6742       <entry><type>oid</type></entry>
6743       <entry></entry>
6744       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6745      </row>
6746
6747      <row>
6748       <entry><structfield>prsname</structfield></entry>
6749       <entry><type>name</type></entry>
6750       <entry></entry>
6751       <entry>Text search parser name</entry>
6752      </row>
6753
6754      <row>
6755       <entry><structfield>prsnamespace</structfield></entry>
6756       <entry><type>oid</type></entry>
6757       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6758       <entry>
6759        The OID of the namespace that contains this parser
6760       </entry>
6761      </row>
6762
6763      <row>
6764       <entry><structfield>prsstart</structfield></entry>
6765       <entry><type>regproc</type></entry>
6766       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6767       <entry>OID of the parser's startup function</entry>
6768      </row>
6769
6770      <row>
6771       <entry><structfield>prstoken</structfield></entry>
6772       <entry><type>regproc</type></entry>
6773       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6774       <entry>OID of the parser's next-token function</entry>
6775      </row>
6776
6777      <row>
6778       <entry><structfield>prsend</structfield></entry>
6779       <entry><type>regproc</type></entry>
6780       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6781       <entry>OID of the parser's shutdown function</entry>
6782      </row>
6783
6784      <row>
6785       <entry><structfield>prsheadline</structfield></entry>
6786       <entry><type>regproc</type></entry>
6787       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6788       <entry>OID of the parser's headline function</entry>
6789      </row>
6790
6791      <row>
6792       <entry><structfield>prslextype</structfield></entry>
6793       <entry><type>regproc</type></entry>
6794       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6795       <entry>OID of the parser's lextype function</entry>
6796      </row>
6797     </tbody>
6798    </tgroup>
6799   </table>
6800  </sect1>
6801
6802
6803  <sect1 id="catalog-pg-ts-template">
6804   <title><structname>pg_ts_template</structname></title>
6805
6806   <indexterm zone="catalog-pg-ts-template">
6807    <primary>pg_ts_template</primary>
6808   </indexterm>
6809
6810   <para>
6811    The <structname>pg_ts_template</structname> catalog contains entries
6812    defining text search templates.  A template is the implementation
6813    skeleton for a class of text search dictionaries.
6814    Since a template must be implemented by C-language-level functions,
6815    creation of new templates is restricted to database superusers.
6816   </para>
6817
6818   <para>
6819    <productname>PostgreSQL</productname>'s text search features are
6820    described at length in <xref linkend="textsearch">.
6821   </para>
6822
6823   <table>
6824    <title><structname>pg_ts_template</> Columns</title>
6825
6826    <tgroup cols="4">
6827     <thead>
6828      <row>
6829       <entry>Name</entry>
6830       <entry>Type</entry>
6831       <entry>References</entry>
6832       <entry>Description</entry>
6833      </row>
6834     </thead>
6835
6836     <tbody>
6837      <row>
6838       <entry><structfield>oid</structfield></entry>
6839       <entry><type>oid</type></entry>
6840       <entry></entry>
6841       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6842      </row>
6843
6844      <row>
6845       <entry><structfield>tmplname</structfield></entry>
6846       <entry><type>name</type></entry>
6847       <entry></entry>
6848       <entry>Text search template name</entry>
6849      </row>
6850
6851      <row>
6852       <entry><structfield>tmplnamespace</structfield></entry>
6853       <entry><type>oid</type></entry>
6854       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6855       <entry>
6856        The OID of the namespace that contains this template
6857       </entry>
6858      </row>
6859
6860      <row>
6861       <entry><structfield>tmplinit</structfield></entry>
6862       <entry><type>regproc</type></entry>
6863       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6864       <entry>OID of the template's initialization function</entry>
6865      </row>
6866
6867      <row>
6868       <entry><structfield>tmpllexize</structfield></entry>
6869       <entry><type>regproc</type></entry>
6870       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6871       <entry>OID of the template's lexize function</entry>
6872      </row>
6873     </tbody>
6874    </tgroup>
6875   </table>
6876  </sect1>
6877
6878
6879  <sect1 id="catalog-pg-type">
6880   <title><structname>pg_type</structname></title>
6881
6882   <indexterm zone="catalog-pg-type">
6883    <primary>pg_type</primary>
6884   </indexterm>
6885
6886   <para>
6887    The catalog <structname>pg_type</structname> stores information about data
6888    types.  Base types and enum types (scalar types) are created with
6889    <xref linkend="sql-createtype">, and
6890    domains with
6891    <xref linkend="sql-createdomain">.
6892    A composite type is automatically created for each table in the database, to
6893    represent the row structure of the table.  It is also possible to create
6894    composite types with <command>CREATE TYPE AS</command>.
6895   </para>
6896
6897   <table>
6898    <title><structname>pg_type</> Columns</title>
6899
6900    <tgroup cols="4">
6901     <thead>
6902      <row>
6903       <entry>Name</entry>
6904       <entry>Type</entry>
6905       <entry>References</entry>
6906       <entry>Description</entry>
6907      </row>
6908     </thead>
6909
6910     <tbody>
6911      <row>
6912       <entry><structfield>oid</structfield></entry>
6913       <entry><type>oid</type></entry>
6914       <entry></entry>
6915       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6916      </row>
6917
6918      <row>
6919       <entry><structfield>typname</structfield></entry>
6920       <entry><type>name</type></entry>
6921       <entry></entry>
6922       <entry>Data type name</entry>
6923      </row>
6924
6925      <row>
6926       <entry><structfield>typnamespace</structfield></entry>
6927       <entry><type>oid</type></entry>
6928       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6929       <entry>
6930        The OID of the namespace that contains this type
6931       </entry>
6932      </row>
6933
6934      <row>
6935       <entry><structfield>typowner</structfield></entry>
6936       <entry><type>oid</type></entry>
6937       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6938       <entry>Owner of the type</entry>
6939      </row>
6940
6941      <row>
6942       <entry><structfield>typlen</structfield></entry>
6943       <entry><type>int2</type></entry>
6944       <entry></entry>
6945       <entry>
6946        For a fixed-size type, <structfield>typlen</structfield> is the number
6947        of bytes in the internal representation of the type.  But for a
6948        variable-length type, <structfield>typlen</structfield> is negative.
6949        -1 indicates a <quote>varlena</> type (one that has a length word),
6950        -2 indicates a null-terminated C string.
6951       </entry>
6952      </row>
6953
6954      <row>
6955       <entry><structfield>typbyval</structfield></entry>
6956       <entry><type>bool</type></entry>
6957       <entry></entry>
6958       <entry>
6959        <structfield>typbyval</structfield> determines whether internal
6960        routines pass a value of this type by value or by reference.
6961        <structfield>typbyval</structfield> had better be false if
6962        <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
6963        where Datum is 8 bytes).
6964        Variable-length types are always passed by reference. Note that
6965        <structfield>typbyval</structfield> can be false even if the
6966        length would allow pass-by-value.
6967       </entry>
6968      </row>
6969
6970      <row>
6971       <entry><structfield>typtype</structfield></entry>
6972       <entry><type>char</type></entry>
6973       <entry></entry>
6974       <entry>
6975        <structfield>typtype</structfield> is
6976        <literal>b</literal> for a base type,
6977        <literal>c</literal> for a composite type (e.g., a table's row type),
6978        <literal>d</literal> for a domain,
6979        <literal>e</literal> for an enum type,
6980        <literal>p</literal> for a pseudo-type, or
6981        <literal>r</literal> for a range type.
6982        See also <structfield>typrelid</structfield> and
6983        <structfield>typbasetype</structfield>.
6984       </entry>
6985      </row>
6986
6987      <row>
6988       <entry><structfield>typcategory</structfield></entry>
6989       <entry><type>char</type></entry>
6990       <entry></entry>
6991       <entry>
6992        <structfield>typcategory</structfield> is an arbitrary classification
6993        of data types that is used by the parser to determine which implicit
6994        casts should be <quote>preferred</>.
6995        See <xref linkend="catalog-typcategory-table">.
6996       </entry>
6997      </row>
6998
6999      <row>
7000       <entry><structfield>typispreferred</structfield></entry>
7001       <entry><type>bool</type></entry>
7002       <entry></entry>
7003       <entry>
7004        True if the type is a preferred cast target within its
7005        <structfield>typcategory</structfield>
7006       </entry>
7007      </row>
7008
7009      <row>
7010       <entry><structfield>typisdefined</structfield></entry>
7011       <entry><type>bool</type></entry>
7012       <entry></entry>
7013       <entry>
7014        True if the type is defined, false if this is a placeholder
7015        entry for a not-yet-defined type.  When
7016        <structfield>typisdefined</structfield> is false, nothing
7017        except the type name, namespace, and OID can be relied on.
7018       </entry>
7019      </row>
7020
7021      <row>
7022       <entry><structfield>typdelim</structfield></entry>
7023       <entry><type>char</type></entry>
7024       <entry></entry>
7025       <entry>
7026        Character that separates two values of this type when parsing
7027        array input.  Note that the delimiter is associated with the array
7028        element data type, not the array data type.
7029       </entry>
7030      </row>
7031
7032      <row>
7033       <entry><structfield>typrelid</structfield></entry>
7034       <entry><type>oid</type></entry>
7035       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7036       <entry>
7037        If this is a composite type (see
7038        <structfield>typtype</structfield>), then this column points to
7039        the <structname>pg_class</structname> entry that defines the
7040        corresponding table.  (For a free-standing composite type, the
7041        <structname>pg_class</structname> entry doesn't really represent
7042        a table, but it is needed anyway for the type's
7043        <structname>pg_attribute</structname> entries to link to.)
7044        Zero for non-composite types.
7045       </entry>
7046      </row>
7047
7048      <row>
7049       <entry><structfield>typelem</structfield></entry>
7050       <entry><type>oid</type></entry>
7051       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7052       <entry>
7053        If <structfield>typelem</structfield> is not 0 then it
7054        identifies another row in <structname>pg_type</structname>.
7055        The current type can then be subscripted like an array yielding
7056        values of type <structfield>typelem</structfield>.  A
7057        <quote>true</quote> array type is variable length
7058        (<structfield>typlen</structfield> = -1),
7059        but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
7060        also have nonzero <structfield>typelem</structfield>, for example
7061        <type>name</type> and <type>point</type>.
7062        If a fixed-length type has a <structfield>typelem</structfield> then
7063        its internal representation must be some number of values of the
7064        <structfield>typelem</structfield> data type with no other data.
7065        Variable-length array types have a header defined by the array
7066        subroutines.
7067       </entry>
7068      </row>
7069
7070      <row>
7071       <entry><structfield>typarray</structfield></entry>
7072       <entry><type>oid</type></entry>
7073       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7074       <entry>
7075        If <structfield>typarray</structfield> is not 0 then it
7076        identifies another row in <structname>pg_type</structname>, which
7077        is the <quote>true</quote> array type having this type as element
7078       </entry>
7079      </row>
7080
7081      <row>
7082       <entry><structfield>typinput</structfield></entry>
7083       <entry><type>regproc</type></entry>
7084       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7085       <entry>Input conversion function (text format)</entry>
7086      </row>
7087
7088      <row>
7089       <entry><structfield>typoutput</structfield></entry>
7090       <entry><type>regproc</type></entry>
7091       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7092       <entry>Output conversion function (text format)</entry>
7093      </row>
7094
7095      <row>
7096       <entry><structfield>typreceive</structfield></entry>
7097       <entry><type>regproc</type></entry>
7098       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7099       <entry>Input conversion function (binary format), or 0 if none</entry>
7100      </row>
7101
7102      <row>
7103       <entry><structfield>typsend</structfield></entry>
7104       <entry><type>regproc</type></entry>
7105       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7106       <entry>Output conversion function (binary format), or 0 if none</entry>
7107      </row>
7108
7109      <row>
7110       <entry><structfield>typmodin</structfield></entry>
7111       <entry><type>regproc</type></entry>
7112       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7113       <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7114      </row>
7115
7116      <row>
7117       <entry><structfield>typmodout</structfield></entry>
7118       <entry><type>regproc</type></entry>
7119       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7120       <entry>Type modifier output function, or 0 to use the standard format</entry>
7121      </row>
7122
7123      <row>
7124       <entry><structfield>typanalyze</structfield></entry>
7125       <entry><type>regproc</type></entry>
7126       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7127       <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7128      </row>
7129
7130      <row>
7131       <entry><structfield>typalign</structfield></entry>
7132       <entry><type>char</type></entry>
7133       <entry></entry>
7134       <entry><para>
7135
7136        <structfield>typalign</structfield> is the alignment required
7137        when storing a value of this type.  It applies to storage on
7138        disk as well as most representations of the value inside
7139        <productname>PostgreSQL</>.
7140        When multiple values are stored consecutively, such
7141        as in the representation of a complete row on disk, padding is
7142        inserted before a datum of this type so that it begins on the
7143        specified boundary.  The alignment reference is the beginning
7144        of the first datum in the sequence.
7145       </para>
7146
7147       <para>
7148        Possible values are:
7149        <itemizedlist>
7150         <listitem>
7151          <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7152         </listitem>
7153         <listitem>
7154          <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7155         </listitem>
7156         <listitem>
7157          <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7158         </listitem>
7159         <listitem>
7160          <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7161         </listitem>
7162        </itemizedlist>
7163       </para><note>
7164        <para>
7165         For types used in system tables, it is critical that the size
7166         and alignment defined in <structname>pg_type</structname>
7167         agree with the way that the compiler will lay out the column in
7168         a structure representing a table row.
7169        </para>
7170       </note></entry>
7171      </row>
7172
7173      <row>
7174       <entry><structfield>typstorage</structfield></entry>
7175       <entry><type>char</type></entry>
7176       <entry></entry>
7177       <entry><para>
7178        <structfield>typstorage</structfield> tells for varlena
7179        types (those with <structfield>typlen</structfield> = -1) if
7180        the type is prepared for toasting and what the default strategy
7181        for attributes of this type should be.
7182        Possible values are
7183        <itemizedlist>
7184         <listitem>
7185          <para><literal>p</>: Value must always be stored plain.</para>
7186         </listitem>
7187         <listitem>
7188          <para>
7189           <literal>e</>: Value can be stored in a <quote>secondary</quote>
7190           relation (if relation has one, see
7191           <literal>pg_class.reltoastrelid</literal>).
7192          </para>
7193         </listitem>
7194         <listitem>
7195          <para><literal>m</>: Value can be stored compressed inline.</para>
7196         </listitem>
7197         <listitem>
7198          <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7199         </listitem>
7200        </itemizedlist>
7201        Note that <literal>m</> columns can also be moved out to secondary
7202        storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7203        moved first).
7204       </para></entry>
7205      </row>
7206
7207      <row>
7208       <entry><structfield>typnotnull</structfield></entry>
7209       <entry><type>bool</type></entry>
7210       <entry></entry>
7211       <entry><para>
7212        <structfield>typnotnull</structfield> represents a not-null
7213        constraint on a type.  Used for domains only.
7214       </para></entry>
7215      </row>
7216
7217      <row>
7218       <entry><structfield>typbasetype</structfield></entry>
7219       <entry><type>oid</type></entry>
7220       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7221       <entry><para>
7222        If this is a domain (see <structfield>typtype</structfield>), then
7223        <structfield>typbasetype</structfield> identifies the type that this
7224        one is based on.  Zero if this type is not a domain.
7225       </para></entry>
7226      </row>
7227
7228      <row>
7229       <entry><structfield>typtypmod</structfield></entry>
7230       <entry><type>int4</type></entry>
7231       <entry></entry>
7232       <entry><para>
7233        Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7234        to be applied to their base type (-1 if base type does not use a
7235        <literal>typmod</>).  -1 if this type is not a domain.
7236       </para></entry>
7237      </row>
7238
7239      <row>
7240       <entry><structfield>typndims</structfield></entry>
7241       <entry><type>int4</type></entry>
7242       <entry></entry>
7243       <entry><para>
7244        <structfield>typndims</structfield> is the number of array dimensions
7245        for a domain over an array (that is, <structfield>typbasetype</> is
7246        an array type).
7247        Zero for types other than domains over array types.
7248        </para></entry>
7249      </row>
7250
7251      <row>
7252       <entry><structfield>typcollation</structfield></entry>
7253       <entry><type>oid</type></entry>
7254       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7255       <entry><para>
7256        <structfield>typcollation</structfield> specifies the collation
7257        of the type.  If the type does not support collations, this will
7258        be zero.  A base type that supports collations will have
7259        <symbol>DEFAULT_COLLATION_OID</symbol> here.  A domain over a
7260        collatable type can have some other collation OID, if one was
7261        specified for the domain.
7262       </para></entry>
7263      </row>
7264
7265      <row>
7266       <entry><structfield>typdefaultbin</structfield></entry>
7267       <entry><type>pg_node_tree</type></entry>
7268       <entry></entry>
7269       <entry><para>
7270        If <structfield>typdefaultbin</> is not null, it is the
7271        <function>nodeToString()</function>
7272        representation of a default expression for the type.  This is
7273        only used for domains.
7274       </para></entry>
7275      </row>
7276
7277      <row>
7278       <entry><structfield>typdefault</structfield></entry>
7279       <entry><type>text</type></entry>
7280       <entry></entry>
7281       <entry><para>
7282        <structfield>typdefault</> is null if the type has no associated
7283        default value. If <structfield>typdefaultbin</> is not null,
7284        <structfield>typdefault</> must contain a human-readable version of the
7285        default expression represented by <structfield>typdefaultbin</>.  If
7286        <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7287        not, then <structfield>typdefault</> is the external representation of
7288        the type's default value, which can be fed to the type's input
7289        converter to produce a constant.
7290       </para></entry>
7291      </row>
7292
7293      <row>
7294       <entry><structfield>typacl</structfield></entry>
7295       <entry><type>aclitem[]</type></entry>
7296       <entry></entry>
7297       <entry>
7298        Access privileges; see
7299        <xref linkend="sql-grant"> and
7300        <xref linkend="sql-revoke">
7301        for details
7302       </entry>
7303      </row>
7304     </tbody>
7305    </tgroup>
7306   </table>
7307
7308   <para>
7309    <xref linkend="catalog-typcategory-table"> lists the system-defined values
7310    of <structfield>typcategory</>.  Any future additions to this list will
7311    also be upper-case ASCII letters.  All other ASCII characters are reserved
7312    for user-defined categories.
7313   </para>
7314
7315   <table id="catalog-typcategory-table">
7316    <title><structfield>typcategory</> Codes</title>
7317
7318    <tgroup cols="2">
7319     <thead>
7320      <row>
7321       <entry>Code</entry>
7322       <entry>Category</entry>
7323      </row>
7324     </thead>
7325
7326     <tbody>
7327      <row>
7328       <entry><literal>A</literal></entry>
7329       <entry>Array types</entry>
7330      </row>
7331      <row>
7332       <entry><literal>B</literal></entry>
7333       <entry>Boolean types</entry>
7334      </row>
7335      <row>
7336       <entry><literal>C</literal></entry>
7337       <entry>Composite types</entry>
7338      </row>
7339      <row>
7340       <entry><literal>D</literal></entry>
7341       <entry>Date/time types</entry>
7342      </row>
7343      <row>
7344       <entry><literal>E</literal></entry>
7345       <entry>Enum types</entry>
7346      </row>
7347      <row>
7348       <entry><literal>G</literal></entry>
7349       <entry>Geometric types</entry>
7350      </row>
7351      <row>
7352       <entry><literal>I</literal></entry>
7353       <entry>Network address types</entry>
7354      </row>
7355      <row>
7356       <entry><literal>N</literal></entry>
7357       <entry>Numeric types</entry>
7358      </row>
7359      <row>
7360       <entry><literal>P</literal></entry>
7361       <entry>Pseudo-types</entry>
7362      </row>
7363      <row>
7364       <entry><literal>R</literal></entry>
7365       <entry>Range types</entry>
7366      </row>
7367      <row>
7368       <entry><literal>S</literal></entry>
7369       <entry>String types</entry>
7370      </row>
7371      <row>
7372       <entry><literal>T</literal></entry>
7373       <entry>Timespan types</entry>
7374      </row>
7375      <row>
7376       <entry><literal>U</literal></entry>
7377       <entry>User-defined types</entry>
7378      </row>
7379      <row>
7380       <entry><literal>V</literal></entry>
7381       <entry>Bit-string types</entry>
7382      </row>
7383      <row>
7384       <entry><literal>X</literal></entry>
7385       <entry><type>unknown</> type</entry>
7386      </row>
7387     </tbody>
7388    </tgroup>
7389   </table>
7390
7391  </sect1>
7392
7393
7394  <sect1 id="catalog-pg-user-mapping">
7395   <title><structname>pg_user_mapping</structname></title>
7396
7397   <indexterm zone="catalog-pg-user-mapping">
7398    <primary>pg_user_mapping</primary>
7399   </indexterm>
7400
7401   <para>
7402    The catalog <structname>pg_user_mapping</structname> stores
7403    the mappings from local user to remote.  Access to this catalog is
7404    restricted from normal users, use the view
7405    <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7406    instead.
7407   </para>
7408
7409   <table>
7410    <title><structname>pg_user_mapping</> Columns</title>
7411
7412    <tgroup cols="4">
7413     <thead>
7414      <row>
7415       <entry>Name</entry>
7416       <entry>Type</entry>
7417       <entry>References</entry>
7418       <entry>Description</entry>
7419      </row>
7420     </thead>
7421
7422     <tbody>
7423      <row>
7424       <entry><structfield>oid</structfield></entry>
7425       <entry><type>oid</type></entry>
7426       <entry></entry>
7427       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7428      </row>
7429
7430      <row>
7431       <entry><structfield>umuser</structfield></entry>
7432       <entry><type>oid</type></entry>
7433       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7434       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7435      </row>
7436
7437      <row>
7438       <entry><structfield>umserver</structfield></entry>
7439       <entry><type>oid</type></entry>
7440       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7441       <entry>
7442        The OID of the foreign server that contains this mapping
7443       </entry>
7444      </row>
7445
7446      <row>
7447       <entry><structfield>umoptions</structfield></entry>
7448       <entry><type>text[]</type></entry>
7449       <entry></entry>
7450       <entry>
7451        User mapping specific options, as <quote>keyword=value</> strings
7452       </entry>
7453      </row>
7454     </tbody>
7455    </tgroup>
7456   </table>
7457  </sect1>
7458
7459
7460  <sect1 id="views-overview">
7461   <title>System Views</title>
7462
7463   <para>
7464    In addition to the system catalogs, <productname>PostgreSQL</productname>
7465    provides a number of built-in views.  Some system views provide convenient
7466    access to some commonly used queries on the system catalogs.  Other views
7467    provide access to internal server state.
7468   </para>
7469
7470   <para>
7471    The information schema (<xref linkend="information-schema">) provides
7472    an alternative set of views which overlap the functionality of the system
7473    views.  Since the information schema is SQL-standard whereas the views
7474    described here are <productname>PostgreSQL</productname>-specific,
7475    it's usually better to use the information schema if it provides all
7476    the information you need.
7477   </para>
7478
7479   <para>
7480    <xref linkend="view-table"> lists the system views described here.
7481    More detailed documentation of each view follows below.
7482    There are some additional views that provide access to the results of
7483    the statistics collector; they are described in <xref
7484    linkend="monitoring-stats-views-table">.
7485   </para>
7486
7487   <para>
7488    Except where noted, all the views described here are read-only.
7489   </para>
7490
7491   <table id="view-table">
7492    <title>System Views</title>
7493
7494    <tgroup cols="2">
7495     <thead>
7496      <row>
7497       <entry>View Name</entry>
7498       <entry>Purpose</entry>
7499      </row>
7500     </thead>
7501
7502     <tbody>
7503      <row>
7504       <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7505       <entry>available extensions</entry>
7506      </row>
7507
7508      <row>
7509       <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7510       <entry>available versions of extensions</entry>
7511      </row>
7512
7513      <row>
7514       <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7515       <entry>open cursors</entry>
7516      </row>
7517
7518      <row>
7519       <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
7520       <entry>summary of configuration file contents</entry>
7521      </row>
7522
7523      <row>
7524       <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7525       <entry>groups of database users</entry>
7526      </row>
7527
7528      <row>
7529       <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7530       <entry>indexes</entry>
7531      </row>
7532
7533      <row>
7534       <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7535       <entry>currently held locks</entry>
7536      </row>
7537
7538      <row>
7539       <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7540       <entry>materialized views</entry>
7541      </row>
7542
7543      <row>
7544       <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7545       <entry>policies</entry>
7546      </row>
7547
7548      <row>
7549       <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7550       <entry>prepared statements</entry>
7551      </row>
7552
7553      <row>
7554       <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7555       <entry>prepared transactions</entry>
7556      </row>
7557
7558      <row>
7559       <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7560       <entry>database roles</entry>
7561      </row>
7562
7563      <row>
7564       <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7565       <entry>rules</entry>
7566      </row>
7567
7568      <row>
7569       <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7570       <entry>security labels</entry>
7571      </row>
7572
7573      <row>
7574       <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7575       <entry>parameter settings</entry>
7576      </row>
7577
7578      <row>
7579       <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7580       <entry>database users</entry>
7581      </row>
7582
7583      <row>
7584       <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7585       <entry>planner statistics</entry>
7586      </row>
7587
7588      <row>
7589       <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7590       <entry>tables</entry>
7591      </row>
7592
7593      <row>
7594       <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7595       <entry>time zone abbreviations</entry>
7596      </row>
7597
7598      <row>
7599       <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7600       <entry>time zone names</entry>
7601      </row>
7602
7603      <row>
7604       <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7605       <entry>database users</entry>
7606      </row>
7607
7608      <row>
7609       <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7610       <entry>user mappings</entry>
7611      </row>
7612
7613      <row>
7614       <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7615       <entry>views</entry>
7616      </row>
7617
7618     </tbody>
7619    </tgroup>
7620   </table>
7621  </sect1>
7622
7623  <sect1 id="view-pg-available-extensions">
7624   <title><structname>pg_available_extensions</structname></title>
7625
7626   <indexterm zone="view-pg-available-extensions">
7627    <primary>pg_available_extensions</primary>
7628   </indexterm>
7629
7630   <para>
7631    The <structname>pg_available_extensions</structname> view lists the
7632    extensions that are available for installation.
7633    See also the
7634    <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7635    catalog, which shows the extensions currently installed.
7636   </para>
7637
7638   <table>
7639    <title><structname>pg_available_extensions</> Columns</title>
7640
7641    <tgroup cols="3">
7642     <thead>
7643      <row>
7644       <entry>Name</entry>
7645       <entry>Type</entry>
7646       <entry>Description</entry>
7647      </row>
7648     </thead>
7649
7650     <tbody>
7651      <row>
7652       <entry><structfield>name</structfield></entry>
7653       <entry><type>name</type></entry>
7654       <entry>Extension name</entry>
7655      </row>
7656
7657      <row>
7658       <entry><structfield>default_version</structfield></entry>
7659       <entry><type>text</type></entry>
7660       <entry>Name of default version, or <literal>NULL</literal> if none is
7661        specified</entry>
7662      </row>
7663
7664      <row>
7665       <entry><structfield>installed_version</structfield></entry>
7666       <entry><type>text</type></entry>
7667       <entry>Currently installed version of the extension,
7668        or <literal>NULL</literal> if not installed</entry>
7669      </row>
7670
7671      <row>
7672       <entry><structfield>comment</structfield></entry>
7673       <entry><type>text</type></entry>
7674       <entry>Comment string from the extension's control file</entry>
7675      </row>
7676     </tbody>
7677    </tgroup>
7678   </table>
7679
7680   <para>
7681    The <structname>pg_available_extensions</structname> view is read only.
7682   </para>
7683  </sect1>
7684
7685  <sect1 id="view-pg-available-extension-versions">
7686   <title><structname>pg_available_extension_versions</structname></title>
7687
7688   <indexterm zone="view-pg-available-extension-versions">
7689    <primary>pg_available_extension_versions</primary>
7690   </indexterm>
7691
7692   <para>
7693    The <structname>pg_available_extension_versions</structname> view lists the
7694    specific extension versions that are available for installation.
7695    See also the <link
7696    linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7697    catalog, which shows the extensions currently installed.
7698   </para>
7699
7700   <table>
7701    <title><structname>pg_available_extension_versions</> Columns</title>
7702
7703    <tgroup cols="3">
7704     <thead>
7705      <row>
7706       <entry>Name</entry>
7707       <entry>Type</entry>
7708       <entry>Description</entry>
7709      </row>
7710     </thead>
7711
7712     <tbody>
7713      <row>
7714       <entry><structfield>name</structfield></entry>
7715       <entry><type>name</type></entry>
7716       <entry>Extension name</entry>
7717      </row>
7718
7719      <row>
7720       <entry><structfield>version</structfield></entry>
7721       <entry><type>text</type></entry>
7722       <entry>Version name</entry>
7723      </row>
7724
7725      <row>
7726       <entry><structfield>installed</structfield></entry>
7727       <entry><type>bool</type></entry>
7728       <entry>True if this version of this extension is currently
7729        installed</entry>
7730      </row>
7731
7732      <row>
7733       <entry><structfield>superuser</structfield></entry>
7734       <entry><type>bool</type></entry>
7735       <entry>True if only superusers are allowed to install this extension</entry>
7736      </row>
7737
7738      <row>
7739       <entry><structfield>relocatable</structfield></entry>
7740       <entry><type>bool</type></entry>
7741       <entry>True if extension can be relocated to another schema</entry>
7742      </row>
7743
7744      <row>
7745       <entry><structfield>schema</structfield></entry>
7746       <entry><type>name</type></entry>
7747       <entry>Name of the schema that the extension must be installed into,
7748        or <literal>NULL</literal> if partially or fully relocatable</entry>
7749      </row>
7750
7751      <row>
7752       <entry><structfield>requires</structfield></entry>
7753       <entry><type>name[]</type></entry>
7754       <entry>Names of prerequisite extensions,
7755        or <literal>NULL</literal> if none</entry>
7756      </row>
7757
7758      <row>
7759       <entry><structfield>comment</structfield></entry>
7760       <entry><type>text</type></entry>
7761       <entry>Comment string from the extension's control file</entry>
7762      </row>
7763     </tbody>
7764    </tgroup>
7765   </table>
7766
7767   <para>
7768    The <structname>pg_available_extension_versions</structname> view is read
7769    only.
7770   </para>
7771  </sect1>
7772
7773  <sect1 id="view-pg-cursors">
7774   <title><structname>pg_cursors</structname></title>
7775
7776   <indexterm zone="view-pg-cursors">
7777    <primary>pg_cursors</primary>
7778   </indexterm>
7779
7780   <para>
7781    The <structname>pg_cursors</structname> view lists the cursors that
7782    are currently available. Cursors can be defined in several ways:
7783    <itemizedlist>
7784     <listitem>
7785      <para>
7786       via the <xref linkend="sql-declare">
7787       statement in SQL
7788      </para>
7789     </listitem>
7790
7791     <listitem>
7792      <para>
7793       via the Bind message in the frontend/backend protocol, as
7794       described in <xref linkend="protocol-flow-ext-query">
7795      </para>
7796     </listitem>
7797
7798     <listitem>
7799      <para>
7800       via the Server Programming Interface (SPI), as described in
7801       <xref linkend="spi-interface">
7802      </para>
7803     </listitem>
7804    </itemizedlist>
7805
7806    The <structname>pg_cursors</structname> view displays cursors
7807    created by any of these means. Cursors only exist for the duration
7808    of the transaction that defines them, unless they have been
7809    declared <literal>WITH HOLD</literal>. Therefore non-holdable
7810    cursors are only present in the view until the end of their
7811    creating transaction.
7812
7813    <note>
7814     <para>
7815      Cursors are used internally to implement some of the components
7816      of <productname>PostgreSQL</>, such as procedural languages.
7817      Therefore, the <structname>pg_cursors</> view might include cursors
7818      that have not been explicitly created by the user.
7819     </para>
7820    </note>
7821   </para>
7822
7823   <table>
7824    <title><structname>pg_cursors</> Columns</title>
7825
7826    <tgroup cols="3">
7827     <thead>
7828      <row>
7829       <entry>Name</entry>
7830       <entry>Type</entry>
7831       <entry>Description</entry>
7832      </row>
7833     </thead>
7834
7835     <tbody>
7836      <row>
7837       <entry><structfield>name</structfield></entry>
7838       <entry><type>text</type></entry>
7839       <entry>The name of the cursor</entry>
7840      </row>
7841
7842      <row>
7843       <entry><structfield>statement</structfield></entry>
7844       <entry><type>text</type></entry>
7845       <entry>The verbatim query string submitted to declare this cursor</entry>
7846      </row>
7847
7848      <row>
7849       <entry><structfield>is_holdable</structfield></entry>
7850       <entry><type>boolean</type></entry>
7851       <entry>
7852        <literal>true</literal> if the cursor is holdable (that is, it
7853        can be accessed after the transaction that declared the cursor
7854        has committed); <literal>false</literal> otherwise
7855        </entry>
7856      </row>
7857
7858      <row>
7859       <entry><structfield>is_binary</structfield></entry>
7860       <entry><type>boolean</type></entry>
7861       <entry>
7862        <literal>true</literal> if the cursor was declared
7863        <literal>BINARY</literal>; <literal>false</literal>
7864        otherwise
7865        </entry>
7866      </row>
7867
7868      <row>
7869       <entry><structfield>is_scrollable</structfield></entry>
7870       <entry><type>boolean</type></entry>
7871       <entry>
7872        <literal>true</> if the cursor is scrollable (that is, it
7873        allows rows to be retrieved in a nonsequential manner);
7874        <literal>false</literal> otherwise
7875        </entry>
7876      </row>
7877
7878      <row>
7879       <entry><structfield>creation_time</structfield></entry>
7880       <entry><type>timestamptz</type></entry>
7881       <entry>The time at which the cursor was declared</entry>
7882      </row>
7883     </tbody>
7884    </tgroup>
7885   </table>
7886
7887   <para>
7888    The <structname>pg_cursors</structname> view is read only.
7889   </para>
7890
7891  </sect1>
7892
7893  <sect1 id="view-pg-file-settings">
7894   <title><structname>pg_file_settings</structname></title>
7895
7896   <indexterm zone="view-pg-file-settings">
7897    <primary>pg_file_settings</primary>
7898   </indexterm>
7899
7900   <para>
7901    The view <structname>pg_file_settings</structname> provides a summary of
7902    the contents of the server's configuration file(s).  A row appears in
7903    this view for each <quote>name = value</> entry appearing in the files,
7904    with annotations indicating whether the value could be applied
7905    successfully.  Additional row(s) may appear for problems not linked to
7906    a <quote>name = value</> entry, such as syntax errors in the files.
7907   </para>
7908
7909   <para>
7910    This view is helpful for checking whether planned changes in the
7911    configuration files will work, or for diagnosing a previous failure.
7912    Note that this view reports on the <emphasis>current</> contents of the
7913    files, not on what was last applied by the server.  (The
7914    <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
7915    view is usually sufficient to determine that.)
7916   </para>
7917
7918   <para>
7919    The <structname>pg_file_settings</structname> view can be read only by
7920    superusers.
7921   </para>
7922
7923   <table>
7924    <title><structname>pg_file_settings</> Columns</title>
7925
7926   <tgroup cols="3">
7927    <thead>
7928     <row>
7929      <entry>Name</entry>
7930      <entry>Type</entry>
7931      <entry>Description</entry>
7932     </row>
7933    </thead>
7934    <tbody>
7935     <row>
7936      <entry><structfield>sourcefile</structfield></entry>
7937      <entry><structfield>text</structfield></entry>
7938      <entry>Full pathname of the configuration file</entry>
7939     </row>
7940     <row>
7941      <entry><structfield>sourceline</structfield></entry>
7942      <entry><structfield>integer</structfield></entry>
7943      <entry>
7944       Line number within the configuration file where the entry appears
7945      </entry>
7946     </row>
7947     <row>
7948      <entry><structfield>seqno</structfield></entry>
7949      <entry><structfield>integer</structfield></entry>
7950      <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
7951     </row>
7952     <row>
7953      <entry><structfield>name</structfield></entry>
7954      <entry><structfield>text</structfield></entry>
7955      <entry>Configuration parameter name</entry>
7956     </row>
7957     <row>
7958      <entry><structfield>setting</structfield></entry>
7959      <entry><structfield>text</structfield></entry>
7960      <entry>Value to be assigned to the parameter</entry>
7961     </row>
7962     <row>
7963      <entry><structfield>applied</structfield></entry>
7964      <entry><structfield>boolean</structfield></entry>
7965      <entry>True if the value can be applied successfully</entry>
7966     </row>
7967     <row>
7968      <entry><structfield>error</structfield></entry>
7969      <entry><structfield>text</structfield></entry>
7970      <entry>If not null, an error message indicating why this entry could
7971       not be applied</entry>
7972     </row>
7973    </tbody>
7974   </tgroup>
7975   </table>
7976
7977   <para>
7978    If the configuration file contains syntax errors or invalid parameter
7979    names, the server will not attempt to apply any settings from it, and
7980    therefore all the <structfield>applied</> fields will read as false.
7981    In such a case there will be one or more rows with
7982    non-null <structfield>error</structfield> fields indicating the
7983    problem(s).  Otherwise, individual settings will be applied if possible.
7984    If an individual setting cannot be applied (e.g., invalid value, or the
7985    setting cannot be changed after server start) it will have an appropriate
7986    message in the <structfield>error</structfield> field.  Another way that
7987    an entry might have <structfield>applied</> = false is that it is
7988    overridden by a later entry for the same parameter name; this case is not
7989    considered an error so nothing appears in
7990    the <structfield>error</structfield> field.
7991   </para>
7992
7993   <para>
7994    See <xref linkend="config-setting"> for more information about the various
7995    ways to change run-time parameters.
7996   </para>
7997
7998 </sect1>
7999
8000  <sect1 id="view-pg-group">
8001   <title><structname>pg_group</structname></title>
8002
8003   <indexterm zone="view-pg-group">
8004    <primary>pg_group</primary>
8005   </indexterm>
8006
8007   <para>
8008    The view <structname>pg_group</structname> exists for backwards
8009    compatibility: it emulates a catalog that existed in
8010    <productname>PostgreSQL</productname> before version 8.1.
8011    It shows the names and members of all roles that are marked as not
8012    <structfield>rolcanlogin</>, which is an approximation to the set
8013    of roles that are being used as groups.
8014   </para>
8015
8016   <table>
8017    <title><structname>pg_group</> Columns</title>
8018
8019    <tgroup cols="4">
8020     <thead>
8021      <row>
8022       <entry>Name</entry>
8023       <entry>Type</entry>
8024       <entry>References</entry>
8025       <entry>Description</entry>
8026      </row>
8027     </thead>
8028
8029     <tbody>
8030      <row>
8031       <entry><structfield>groname</structfield></entry>
8032       <entry><type>name</type></entry>
8033       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8034       <entry>Name of the group</entry>
8035      </row>
8036
8037      <row>
8038       <entry><structfield>grosysid</structfield></entry>
8039       <entry><type>oid</type></entry>
8040       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8041       <entry>ID of this group</entry>
8042      </row>
8043
8044      <row>
8045       <entry><structfield>grolist</structfield></entry>
8046       <entry><type>oid[]</type></entry>
8047       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8048       <entry>An array containing the IDs of the roles in this group</entry>
8049      </row>
8050     </tbody>
8051    </tgroup>
8052   </table>
8053
8054  </sect1>
8055
8056  <sect1 id="view-pg-indexes">
8057   <title><structname>pg_indexes</structname></title>
8058
8059   <indexterm zone="view-pg-indexes">
8060    <primary>pg_indexes</primary>
8061   </indexterm>
8062
8063   <para>
8064    The view <structname>pg_indexes</structname> provides access to
8065    useful information about each index in the database.
8066   </para>
8067
8068   <table>
8069    <title><structname>pg_indexes</> Columns</title>
8070
8071    <tgroup cols="4">
8072     <thead>
8073      <row>
8074       <entry>Name</entry>
8075       <entry>Type</entry>
8076       <entry>References</entry>
8077       <entry>Description</entry>
8078      </row>
8079     </thead>
8080     <tbody>
8081      <row>
8082       <entry><structfield>schemaname</structfield></entry>
8083       <entry><type>name</type></entry>
8084       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8085       <entry>Name of schema containing table and index</entry>
8086      </row>
8087      <row>
8088       <entry><structfield>tablename</structfield></entry>
8089       <entry><type>name</type></entry>
8090       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8091       <entry>Name of table the index is for</entry>
8092      </row>
8093      <row>
8094       <entry><structfield>indexname</structfield></entry>
8095       <entry><type>name</type></entry>
8096       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8097       <entry>Name of index</entry>
8098      </row>
8099      <row>
8100       <entry><structfield>tablespace</structfield></entry>
8101       <entry><type>name</type></entry>
8102       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8103       <entry>Name of tablespace containing index (null if default for database)</entry>
8104      </row>
8105      <row>
8106       <entry><structfield>indexdef</structfield></entry>
8107       <entry><type>text</type></entry>
8108       <entry></entry>
8109       <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8110       command)</entry>
8111      </row>
8112     </tbody>
8113    </tgroup>
8114   </table>
8115
8116  </sect1>
8117
8118  <sect1 id="view-pg-locks">
8119   <title><structname>pg_locks</structname></title>
8120
8121   <indexterm zone="view-pg-locks">
8122    <primary>pg_locks</primary>
8123   </indexterm>
8124
8125   <para>
8126    The view <structname>pg_locks</structname> provides access to
8127    information about the locks held by open transactions within the
8128    database server.  See <xref linkend="mvcc"> for more discussion
8129    of locking.
8130   </para>
8131
8132   <para>
8133    <structname>pg_locks</structname> contains one row per active lockable
8134    object, requested lock mode, and relevant transaction.  Thus, the same
8135    lockable object might
8136    appear many times, if multiple transactions are holding or waiting
8137    for locks on it.  However, an object that currently has no locks on it
8138    will not appear at all.
8139   </para>
8140
8141   <para>
8142    There are several distinct types of lockable objects:
8143    whole relations (e.g., tables), individual pages of relations,
8144    individual tuples of relations,
8145    transaction IDs (both virtual and permanent IDs),
8146    and general database objects (identified by class OID and object OID,
8147    in the same way as in <structname>pg_description</structname> or
8148    <structname>pg_depend</structname>).  Also, the right to extend a
8149    relation is represented as a separate lockable object.
8150    Also, <quote>advisory</> locks can be taken on numbers that have
8151    user-defined meanings.
8152   </para>
8153
8154   <table>
8155    <title><structname>pg_locks</> Columns</title>
8156
8157    <tgroup cols="4">
8158     <thead>
8159      <row>
8160       <entry>Name</entry>
8161       <entry>Type</entry>
8162       <entry>References</entry>
8163       <entry>Description</entry>
8164      </row>
8165     </thead>
8166     <tbody>
8167      <row>
8168       <entry><structfield>locktype</structfield></entry>
8169       <entry><type>text</type></entry>
8170       <entry></entry>
8171       <entry>
8172        Type of the lockable object:
8173        <literal>relation</>,
8174        <literal>extend</>,
8175        <literal>page</>,
8176        <literal>tuple</>,
8177        <literal>transactionid</>,
8178        <literal>virtualxid</>,
8179        <literal>object</>,
8180        <literal>userlock</>, or
8181        <literal>advisory</>
8182       </entry>
8183      </row>
8184      <row>
8185       <entry><structfield>database</structfield></entry>
8186       <entry><type>oid</type></entry>
8187       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8188       <entry>
8189        OID of the database in which the lock target exists, or
8190        zero if the target is a shared object, or
8191        null if the target is a transaction ID
8192       </entry>
8193      </row>
8194      <row>
8195       <entry><structfield>relation</structfield></entry>
8196       <entry><type>oid</type></entry>
8197       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8198       <entry>
8199        OID of the relation targeted by the lock, or null if the target is not
8200        a relation or part of a relation
8201       </entry>
8202      </row>
8203      <row>
8204       <entry><structfield>page</structfield></entry>
8205       <entry><type>integer</type></entry>
8206       <entry></entry>
8207       <entry>
8208        Page number targeted by the lock within the relation,
8209        or null if the target is not a relation page or tuple
8210       </entry>
8211      </row>
8212      <row>
8213       <entry><structfield>tuple</structfield></entry>
8214       <entry><type>smallint</type></entry>
8215       <entry></entry>
8216       <entry>
8217        Tuple number targeted by the lock within the page,
8218        or null if the target is not a tuple
8219       </entry>
8220      </row>
8221      <row>
8222       <entry><structfield>virtualxid</structfield></entry>
8223       <entry><type>text</type></entry>
8224       <entry></entry>
8225       <entry>
8226        Virtual ID of the transaction targeted by the lock,
8227        or null if the target is not a virtual transaction ID
8228       </entry>
8229      </row>
8230      <row>
8231       <entry><structfield>transactionid</structfield></entry>
8232       <entry><type>xid</type></entry>
8233       <entry></entry>
8234       <entry>
8235        ID of the transaction targeted by the lock,
8236        or null if the target is not a transaction ID
8237       </entry>
8238      </row>
8239      <row>
8240       <entry><structfield>classid</structfield></entry>
8241       <entry><type>oid</type></entry>
8242       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8243       <entry>
8244        OID of the system catalog containing the lock target, or null if the
8245        target is not a general database object
8246       </entry>
8247      </row>
8248      <row>
8249       <entry><structfield>objid</structfield></entry>
8250       <entry><type>oid</type></entry>
8251       <entry>any OID column</entry>
8252       <entry>
8253        OID of the lock target within its system catalog, or null if the
8254        target is not a general database object
8255       </entry>
8256      </row>
8257      <row>
8258       <entry><structfield>objsubid</structfield></entry>
8259       <entry><type>smallint</type></entry>
8260       <entry></entry>
8261       <entry>
8262        Column number targeted by the lock (the
8263        <structfield>classid</> and <structfield>objid</> refer to the
8264        table itself),
8265        or zero if the target is some other general database object,
8266        or null if the target is not a general database object
8267       </entry>
8268      </row>
8269      <row>
8270       <entry><structfield>virtualtransaction</structfield></entry>
8271       <entry><type>text</type></entry>
8272       <entry></entry>
8273       <entry>
8274        Virtual ID of the transaction that is holding or awaiting this lock
8275       </entry>
8276      </row>
8277      <row>
8278       <entry><structfield>pid</structfield></entry>
8279       <entry><type>integer</type></entry>
8280       <entry></entry>
8281       <entry>
8282        Process ID of the server process holding or awaiting this
8283        lock, or null if the lock is held by a prepared transaction
8284       </entry>
8285      </row>
8286      <row>
8287       <entry><structfield>mode</structfield></entry>
8288       <entry><type>text</type></entry>
8289       <entry></entry>
8290       <entry>Name of the lock mode held or desired by this process (see <xref
8291       linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8292      </row>
8293      <row>
8294       <entry><structfield>granted</structfield></entry>
8295       <entry><type>boolean</type></entry>
8296       <entry></entry>
8297       <entry>True if lock is held, false if lock is awaited</entry>
8298      </row>
8299      <row>
8300       <entry><structfield>fastpath</structfield></entry>
8301       <entry><type>boolean</type></entry>
8302       <entry></entry>
8303       <entry>True if lock was taken via fast path, false if taken via main
8304        lock table</entry>
8305      </row>
8306     </tbody>
8307    </tgroup>
8308   </table>
8309
8310   <para>
8311    <structfield>granted</structfield> is true in a row representing a lock
8312    held by the indicated transaction.  False indicates that this transaction is
8313    currently waiting to acquire this lock, which implies that some other
8314    transaction is holding a conflicting lock mode on the same lockable object.
8315    The waiting transaction will sleep until the other lock is released (or a
8316    deadlock situation is detected). A single transaction can be waiting to
8317    acquire at most one lock at a time.
8318   </para>
8319
8320   <para>
8321    Every transaction holds an exclusive lock on its virtual transaction ID for
8322    its entire duration.  If a permanent ID is assigned to the transaction
8323    (which normally happens only if the transaction changes the state of the
8324    database), it also holds an exclusive lock on its permanent transaction ID
8325    until it ends.  When one transaction finds it necessary to wait specifically
8326    for another transaction, it does so by attempting to acquire share lock on
8327    the other transaction ID (either virtual or permanent ID depending on the
8328    situation). That will succeed only when the other transaction
8329    terminates and releases its locks.
8330   </para>
8331
8332   <para>
8333    Although tuples are a lockable type of object,
8334    information about row-level locks is stored on disk, not in memory,
8335    and therefore row-level locks normally do not appear in this view.
8336    If a transaction is waiting for a
8337    row-level lock, it will usually appear in the view as waiting for the
8338    permanent transaction ID of the current holder of that row lock.
8339   </para>
8340
8341   <para>
8342    Advisory locks can be acquired on keys consisting of either a single
8343    <type>bigint</type> value or two integer values.
8344    A <type>bigint</type> key is displayed with its
8345    high-order half in the <structfield>classid</> column, its low-order half
8346    in the <structfield>objid</> column, and <structfield>objsubid</> equal
8347    to 1. The original <type>bigint</type> value can be reassembled with the
8348    expression <literal>(classid::bigint &lt;&lt; 32) |
8349    objid::bigint</literal>. Integer keys are displayed with the
8350    first key in the
8351    <structfield>classid</> column, the second key in the <structfield>objid</>
8352    column, and <structfield>objsubid</> equal to 2.  The actual meaning of
8353    the keys is up to the user.  Advisory locks are local to each database,
8354    so the <structfield>database</> column is meaningful for an advisory lock.
8355   </para>
8356
8357   <para>
8358    <structname>pg_locks</structname> provides a global view of all locks
8359    in the database cluster, not only those relevant to the current database.
8360    Although its <structfield>relation</structfield> column can be joined
8361    against <structname>pg_class</>.<structfield>oid</> to identify locked
8362    relations, this will only work correctly for relations in the current
8363    database (those for which the <structfield>database</structfield> column
8364    is either the current database's OID or zero).
8365   </para>
8366
8367   <para>
8368    The <structfield>pid</structfield> column can be joined to the
8369    <structfield>pid</structfield> column of the <link
8370    linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8371    view to get more
8372    information on the session holding or waiting to hold each lock,
8373    for example
8374 <programlisting>
8375 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8376     ON pl.pid = psa.pid;
8377 </programlisting>
8378    Also, if you are using prepared transactions, the
8379    <structfield>virtualtransaction</> column can be joined to the
8380    <structfield>transaction</structfield> column of the <link
8381    linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8382    view to get more information on prepared transactions that hold locks.
8383    (A prepared transaction can never be waiting for a lock,
8384    but it continues to hold the locks it acquired while running.)
8385    For example:
8386 <programlisting>
8387 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8388     ON pl.virtualtransaction = '-1/' || ppx.transaction;
8389 </programlisting>
8390   </para>
8391
8392   <para>
8393    The <structname>pg_locks</structname> view displays data from both the
8394    regular lock manager and the predicate lock manager, which are
8395    separate systems; in addition, the regular lock manager subdivides its
8396    locks into regular and <firstterm>fast-path</> locks.
8397    This data is not guaranteed to be entirely consistent.
8398    When the view is queried,
8399    data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8400    is gathered from each backend one at a time, without freezing the state of
8401    the entire lock manager, so it is possible for locks to be taken or
8402    released while information is gathered.  Note, however, that these locks are
8403    known not to conflict with any other lock currently in place.  After
8404    all backends have been queried for fast-path locks, the remainder of the
8405    regular lock manager is locked as a unit, and a consistent snapshot of all
8406    remaining locks is collected as an atomic action.  After unlocking the
8407    regular lock manager, the predicate lock manager is similarly locked and all
8408    predicate locks are collected as an atomic action.  Thus, with the exception
8409    of fast-path locks, each lock manager will deliver a consistent set of
8410    results, but as we do not lock both lock managers simultaneously, it is
8411    possible for locks to be taken or released after we interrogate the regular
8412    lock manager and before we interrogate the predicate lock manager.
8413   </para>
8414
8415   <para>
8416    Locking the regular and/or predicate lock manager could have some
8417    impact on database performance if this view is very frequently accessed.
8418    The locks are held only for the minimum amount of time necessary to
8419    obtain data from the lock managers, but this does not completely eliminate
8420    the possibility of a performance impact.
8421   </para>
8422
8423  </sect1>
8424
8425  <sect1 id="view-pg-matviews">
8426   <title><structname>pg_matviews</structname></title>
8427
8428   <indexterm zone="view-pg-matviews">
8429    <primary>pg_matviews</primary>
8430   </indexterm>
8431
8432   <indexterm zone="view-pg-matviews">
8433    <primary>materialized views</primary>
8434   </indexterm>
8435
8436   <para>
8437    The view <structname>pg_matviews</structname> provides access to
8438    useful information about each materialized view in the database.
8439   </para>
8440
8441   <table>
8442    <title><structname>pg_matviews</> Columns</title>
8443
8444    <tgroup cols="4">
8445     <thead>
8446      <row>
8447       <entry>Name</entry>
8448       <entry>Type</entry>
8449       <entry>References</entry>
8450       <entry>Description</entry>
8451      </row>
8452     </thead>
8453     <tbody>
8454      <row>
8455       <entry><structfield>schemaname</structfield></entry>
8456       <entry><type>name</type></entry>
8457       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8458       <entry>Name of schema containing materialized view</entry>
8459      </row>
8460      <row>
8461       <entry><structfield>matviewname</structfield></entry>
8462       <entry><type>name</type></entry>
8463       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8464       <entry>Name of materialized view</entry>
8465      </row>
8466      <row>
8467       <entry><structfield>matviewowner</structfield></entry>
8468       <entry><type>name</type></entry>
8469       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8470       <entry>Name of materialized view's owner</entry>
8471      </row>
8472      <row>
8473       <entry><structfield>tablespace</structfield></entry>
8474       <entry><type>name</type></entry>
8475       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8476       <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8477      </row>
8478      <row>
8479       <entry><structfield>hasindexes</structfield></entry>
8480       <entry><type>boolean</type></entry>
8481       <entry></entry>
8482       <entry>True if materialized view has (or recently had) any indexes</entry>
8483      </row>
8484      <row>
8485       <entry><structfield>ispopulated</structfield></entry>
8486       <entry><type>boolean</type></entry>
8487       <entry></entry>
8488       <entry>True if materialized view is currently populated</entry>
8489      </row>
8490      <row>
8491       <entry><structfield>definition</structfield></entry>
8492       <entry><type>text</type></entry>
8493       <entry></entry>
8494       <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8495      </row>
8496     </tbody>
8497    </tgroup>
8498   </table>
8499
8500  </sect1>
8501
8502  <sect1 id="view-pg-policies">
8503   <title><structname>pg_policies</structname></title>
8504
8505   <indexterm zone="view-pg-policies">
8506    <primary>pg_policies</primary>
8507   </indexterm>
8508
8509   <para>
8510    The view <structname>pg_policies</structname> provides access to
8511    useful information about each row-level security policy in the database.
8512   </para>
8513
8514   <table>
8515    <title><structname>pg_policies</> Columns</title>
8516
8517    <tgroup cols="4">
8518     <thead>
8519      <row>
8520       <entry>Name</entry>
8521       <entry>Type</entry>
8522       <entry>References</entry>
8523       <entry>Description</entry>
8524      </row>
8525     </thead>
8526     <tbody>
8527      <row>
8528       <entry><structfield>schemaname</structfield></entry>
8529       <entry><type>name</type></entry>
8530       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8531       <entry>Name of schema containing table policy is on</entry>
8532      </row>
8533      <row>
8534       <entry><structfield>tablename</structfield></entry>
8535       <entry><type>name</type></entry>
8536       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8537       <entry>Name of table policy is on</entry>
8538      </row>
8539      <row>
8540       <entry><structfield>policyname</structfield></entry>
8541       <entry><type>name</type></entry>
8542       <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
8543       <entry>Name of policy</entry>
8544      </row>
8545      <row>
8546       <entry><structfield>roles</structfield></entry>
8547       <entry><type>name[]</type></entry>
8548       <entry></entry>
8549       <entry>The roles to which this policy applies</entry>
8550      </row>
8551      <row>
8552       <entry><structfield>cmd</structfield></entry>
8553       <entry><type>text</type></entry>
8554       <entry></entry>
8555       <entry>The command type to which the policy is applied</entry>
8556      </row>
8557      <row>
8558       <entry><structfield>qual</structfield></entry>
8559       <entry><type>text</type></entry>
8560       <entry></entry>
8561       <entry>The expression added to the security barrier qualifications for
8562       queries that this policy applies to</entry>
8563      </row>
8564      <row>
8565       <entry><structfield>with_check</structfield></entry>
8566       <entry><type>text</type></entry>
8567       <entry></entry>
8568       <entry>The expression added to the WITH CHECK qualifications for
8569       queries that attempt to add rows to this table</entry>
8570      </row>
8571     </tbody>
8572    </tgroup>
8573   </table>
8574
8575  </sect1>
8576
8577  <sect1 id="view-pg-prepared-statements">
8578   <title><structname>pg_prepared_statements</structname></title>
8579
8580   <indexterm zone="view-pg-prepared-statements">
8581    <primary>pg_prepared_statements</primary>
8582   </indexterm>
8583
8584   <para>
8585    The <structname>pg_prepared_statements</structname> view displays
8586    all the prepared statements that are available in the current
8587    session. See <xref linkend="sql-prepare"> for more information about prepared
8588    statements.
8589   </para>
8590
8591   <para>
8592    <structname>pg_prepared_statements</structname> contains one row
8593    for each prepared statement. Rows are added to the view when a new
8594    prepared statement is created and removed when a prepared statement
8595    is released (for example, via the <xref linkend="sql-deallocate"> command).
8596   </para>
8597
8598   <table>
8599    <title><structname>pg_prepared_statements</> Columns</title>
8600
8601    <tgroup cols="3">
8602     <thead>
8603      <row>
8604       <entry>Name</entry>
8605       <entry>Type</entry>
8606       <entry>Description</entry>
8607      </row>
8608     </thead>
8609     <tbody>
8610      <row>
8611       <entry><structfield>name</structfield></entry>
8612       <entry><type>text</type></entry>
8613       <entry>
8614        The identifier of the prepared statement
8615       </entry>
8616      </row>
8617      <row>
8618       <entry><structfield>statement</structfield></entry>
8619       <entry><type>text</type></entry>
8620       <entry>
8621        The query string submitted by the client to create this
8622        prepared statement. For prepared statements created via SQL,
8623        this is the <command>PREPARE</command> statement submitted by
8624        the client. For prepared statements created via the
8625        frontend/backend protocol, this is the text of the prepared
8626        statement itself.
8627       </entry>
8628      </row>
8629      <row>
8630       <entry><structfield>prepare_time</structfield></entry>
8631       <entry><type>timestamptz</type></entry>
8632       <entry>
8633        The time at which the prepared statement was created
8634       </entry>
8635      </row>
8636      <row>
8637       <entry><structfield>parameter_types</structfield></entry>
8638       <entry><type>regtype[]</type></entry>
8639       <entry>
8640        The expected parameter types for the prepared statement in the
8641        form of an array of <type>regtype</type>. The OID corresponding
8642        to an element of this array can be obtained by casting the
8643        <type>regtype</type> value to <type>oid</type>.
8644       </entry>
8645      </row>
8646      <row>
8647       <entry><structfield>from_sql</structfield></entry>
8648       <entry><type>boolean</type></entry>
8649       <entry>
8650        <literal>true</literal> if the prepared statement was created
8651        via the <command>PREPARE</command> SQL statement;
8652        <literal>false</literal> if the statement was prepared via the
8653        frontend/backend protocol
8654       </entry>
8655      </row>
8656     </tbody>
8657    </tgroup>
8658   </table>
8659
8660   <para>
8661    The <structname>pg_prepared_statements</structname> view is read only.
8662   </para>
8663  </sect1>
8664
8665  <sect1 id="view-pg-prepared-xacts">
8666   <title><structname>pg_prepared_xacts</structname></title>
8667
8668   <indexterm zone="view-pg-prepared-xacts">
8669    <primary>pg_prepared_xacts</primary>
8670   </indexterm>
8671
8672   <para>
8673    The view <structname>pg_prepared_xacts</structname> displays
8674    information about transactions that are currently prepared for two-phase
8675    commit (see <xref linkend="sql-prepare-transaction"> for details).
8676   </para>
8677
8678   <para>
8679    <structname>pg_prepared_xacts</structname> contains one row per prepared
8680    transaction.  An entry is removed when the transaction is committed or
8681    rolled back.
8682   </para>
8683
8684   <table>
8685    <title><structname>pg_prepared_xacts</> Columns</title>
8686
8687    <tgroup cols="4">
8688     <thead>
8689      <row>
8690       <entry>Name</entry>
8691       <entry>Type</entry>
8692       <entry>References</entry>
8693       <entry>Description</entry>
8694      </row>
8695     </thead>
8696     <tbody>
8697      <row>
8698       <entry><structfield>transaction</structfield></entry>
8699       <entry><type>xid</type></entry>
8700       <entry></entry>
8701       <entry>
8702        Numeric transaction identifier of the prepared transaction
8703       </entry>
8704      </row>
8705      <row>
8706       <entry><structfield>gid</structfield></entry>
8707       <entry><type>text</type></entry>
8708       <entry></entry>
8709       <entry>
8710        Global transaction identifier that was assigned to the transaction
8711       </entry>
8712      </row>
8713      <row>
8714       <entry><structfield>prepared</structfield></entry>
8715       <entry><type>timestamp with time zone</type></entry>
8716       <entry></entry>
8717       <entry>
8718        Time at which the transaction was prepared for commit
8719       </entry>
8720      </row>
8721      <row>
8722       <entry><structfield>owner</structfield></entry>
8723       <entry><type>name</type></entry>
8724       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8725       <entry>
8726        Name of the user that executed the transaction
8727       </entry>
8728      </row>
8729      <row>
8730       <entry><structfield>database</structfield></entry>
8731       <entry><type>name</type></entry>
8732       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
8733       <entry>
8734        Name of the database in which the transaction was executed
8735       </entry>
8736      </row>
8737     </tbody>
8738    </tgroup>
8739   </table>
8740
8741   <para>
8742    When the <structname>pg_prepared_xacts</structname> view is accessed, the
8743    internal transaction manager data structures are momentarily locked, and
8744    a copy is made for the view to display.  This ensures that the
8745    view produces a consistent set of results, while not blocking
8746    normal operations longer than necessary.  Nonetheless
8747    there could be some impact on database performance if this view is
8748    frequently accessed.
8749   </para>
8750
8751  </sect1>
8752
8753  <sect1 id="view-pg-roles">
8754   <title><structname>pg_roles</structname></title>
8755
8756   <indexterm zone="view-pg-roles">
8757    <primary>pg_roles</primary>
8758   </indexterm>
8759
8760   <para>
8761    The view <structname>pg_roles</structname> provides access to
8762    information about database roles.  This is simply a publicly
8763    readable view of
8764    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
8765    that blanks out the password field.
8766   </para>
8767
8768   <para>
8769    This view explicitly exposes the OID column of the underlying table,
8770    since that is needed to do joins to other catalogs.
8771   </para>
8772
8773   <table>
8774    <title><structname>pg_roles</> Columns</title>
8775
8776    <tgroup cols="4">
8777     <thead>
8778      <row>
8779       <entry>Name</entry>
8780       <entry>Type</entry>
8781       <entry>References</entry>
8782       <entry>Description</entry>
8783      </row>
8784     </thead>
8785
8786     <tbody>
8787      <row>
8788       <entry><structfield>rolname</structfield></entry>
8789       <entry><type>name</type></entry>
8790       <entry></entry>
8791       <entry>Role name</entry>
8792      </row>
8793
8794      <row>
8795       <entry><structfield>rolsuper</structfield></entry>
8796       <entry><type>bool</type></entry>
8797       <entry></entry>
8798       <entry>Role has superuser privileges</entry>
8799      </row>
8800
8801      <row>
8802       <entry><structfield>rolinherit</structfield></entry>
8803       <entry><type>bool</type></entry>
8804       <entry></entry>
8805       <entry>Role automatically inherits privileges of roles it is a
8806        member of</entry>
8807      </row>
8808
8809      <row>
8810       <entry><structfield>rolcreaterole</structfield></entry>
8811       <entry><type>bool</type></entry>
8812       <entry></entry>
8813       <entry>Role can create more roles</entry>
8814      </row>
8815
8816      <row>
8817       <entry><structfield>rolcreatedb</structfield></entry>
8818       <entry><type>bool</type></entry>
8819       <entry></entry>
8820       <entry>Role can create databases</entry>
8821      </row>
8822
8823      <row>
8824       <entry><structfield>rolcanlogin</structfield></entry>
8825       <entry><type>bool</type></entry>
8826       <entry></entry>
8827       <entry>
8828        Role can log in. That is, this role can be given as the initial
8829        session authorization identifier
8830       </entry>
8831      </row>
8832
8833      <row>
8834       <entry><structfield>rolreplication</structfield></entry>
8835       <entry><type>bool</type></entry>
8836       <entry></entry>
8837       <entry>
8838        Role is a replication role. That is, this role can initiate streaming
8839        replication (see <xref linkend="streaming-replication">) and set/unset
8840        the system backup mode using <function>pg_start_backup</> and
8841        <function>pg_stop_backup</>
8842       </entry>
8843      </row>
8844
8845      <row>
8846       <entry><structfield>rolconnlimit</structfield></entry>
8847       <entry><type>int4</type></entry>
8848       <entry></entry>
8849       <entry>
8850        For roles that can log in, this sets maximum number of concurrent
8851        connections this role can make.  -1 means no limit.
8852       </entry>
8853      </row>
8854
8855      <row>
8856       <entry><structfield>rolpassword</structfield></entry>
8857       <entry><type>text</type></entry>
8858       <entry></entry>
8859       <entry>Not the password (always reads as <literal>********</>)</entry>
8860      </row>
8861
8862      <row>
8863       <entry><structfield>rolvaliduntil</structfield></entry>
8864       <entry><type>timestamptz</type></entry>
8865       <entry></entry>
8866       <entry>Password expiry time (only used for password authentication);
8867        null if no expiration</entry>
8868      </row>
8869
8870      <row>
8871       <entry><structfield>rolconfig</structfield></entry>
8872       <entry><type>text[]</type></entry>
8873       <entry></entry>
8874       <entry>Role-specific defaults for run-time configuration variables</entry>
8875      </row>
8876
8877      <row>
8878       <entry><structfield>oid</structfield></entry>
8879       <entry><type>oid</type></entry>
8880       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8881       <entry>ID of role</entry>
8882      </row>
8883     </tbody>
8884    </tgroup>
8885   </table>
8886
8887  </sect1>
8888
8889  <sect1 id="view-pg-rules">
8890   <title><structname>pg_rules</structname></title>
8891
8892   <indexterm zone="view-pg-rules">
8893    <primary>pg_rules</primary>
8894   </indexterm>
8895
8896   <para>
8897    The view <structname>pg_rules</structname> provides access to
8898    useful information about query rewrite rules.
8899   </para>
8900
8901   <table>
8902    <title><structname>pg_rules</> Columns</title>
8903
8904    <tgroup cols="4">
8905     <thead>
8906      <row>
8907       <entry>Name</entry>
8908       <entry>Type</entry>
8909       <entry>References</entry>
8910       <entry>Description</entry>
8911      </row>
8912     </thead>
8913     <tbody>
8914      <row>
8915       <entry><structfield>schemaname</structfield></entry>
8916       <entry><type>name</type></entry>
8917       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8918       <entry>Name of schema containing table</entry>
8919      </row>
8920      <row>
8921       <entry><structfield>tablename</structfield></entry>
8922       <entry><type>name</type></entry>
8923       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8924       <entry>Name of table the rule is for</entry>
8925      </row>
8926      <row>
8927       <entry><structfield>rulename</structfield></entry>
8928       <entry><type>name</type></entry>
8929       <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
8930       <entry>Name of rule</entry>
8931      </row>
8932      <row>
8933       <entry><structfield>definition</structfield></entry>
8934       <entry><type>text</type></entry>
8935       <entry></entry>
8936       <entry>Rule definition (a reconstructed creation command)</entry>
8937      </row>
8938     </tbody>
8939    </tgroup>
8940   </table>
8941
8942   <para>
8943    The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
8944    of views and materialized views; those can be seen in
8945    <structname>pg_views</> and <structname>pg_matviews</>.
8946   </para>
8947
8948  </sect1>
8949
8950  <sect1 id="view-pg-seclabels">
8951   <title><structname>pg_seclabels</structname></title>
8952
8953   <indexterm zone="view-pg-seclabels">
8954    <primary>pg_seclabels</primary>
8955   </indexterm>
8956
8957   <para>
8958    The view <structname>pg_seclabels</structname> provides information about
8959    security labels.  It as an easier-to-query version of the
8960    <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
8961   </para>
8962
8963   <table>
8964    <title><structname>pg_seclabels</> Columns</title>
8965
8966    <tgroup cols="4">
8967     <thead>
8968      <row>
8969       <entry>Name</entry>
8970       <entry>Type</entry>
8971       <entry>References</entry>
8972       <entry>Description</entry>
8973      </row>
8974     </thead>
8975     <tbody>
8976      <row>
8977       <entry><structfield>objoid</structfield></entry>
8978       <entry><type>oid</type></entry>
8979       <entry>any OID column</entry>
8980       <entry>The OID of the object this security label pertains to</entry>
8981      </row>
8982      <row>
8983       <entry><structfield>classoid</structfield></entry>
8984       <entry><type>oid</type></entry>
8985       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8986       <entry>The OID of the system catalog this object appears in</entry>
8987      </row>
8988      <row>
8989       <entry><structfield>objsubid</structfield></entry>
8990       <entry><type>int4</type></entry>
8991       <entry></entry>
8992       <entry>
8993        For a security label on a table column, this is the column number (the
8994        <structfield>objoid</> and <structfield>classoid</> refer to
8995        the table itself).  For all other object types, this column is
8996        zero.
8997       </entry>
8998      </row>
8999      <row>
9000       <entry><structfield>objtype</structfield></entry>
9001       <entry><type>text</type></entry>
9002       <entry></entry>
9003       <entry>
9004          The type of object to which this label applies, as text.
9005       </entry>
9006      </row>
9007      <row>
9008       <entry><structfield>objnamespace</structfield></entry>
9009       <entry><type>oid</type></entry>
9010       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9011       <entry>
9012        The OID of the namespace for this object, if applicable;
9013        otherwise NULL.
9014       </entry>
9015      </row>
9016      <row>
9017       <entry><structfield>objname</structfield></entry>
9018       <entry><type>text</type></entry>
9019       <entry></entry>
9020       <entry>
9021        The name of the object to which this label applies, as text.
9022       </entry>
9023      </row>
9024      <row>
9025       <entry><structfield>provider</structfield></entry>
9026       <entry><type>text</type></entry>
9027       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9028       <entry>The label provider associated with this label.</entry>
9029      </row>
9030      <row>
9031       <entry><structfield>label</structfield></entry>
9032       <entry><type>text</type></entry>
9033       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
9034       <entry>The security label applied to this object.</entry>
9035      </row>
9036     </tbody>
9037    </tgroup>
9038   </table>
9039  </sect1>
9040
9041  <sect1 id="view-pg-settings">
9042   <title><structname>pg_settings</structname></title>
9043
9044   <indexterm zone="view-pg-settings">
9045    <primary>pg_settings</primary>
9046   </indexterm>
9047
9048   <para>
9049    The view <structname>pg_settings</structname> provides access to
9050    run-time parameters of the server.  It is essentially an alternative
9051    interface to the <xref linkend="sql-show">
9052    and <xref linkend="sql-set"> commands.
9053    It also provides access to some facts about each parameter that are
9054    not directly available from <command>SHOW</>, such as minimum and
9055    maximum values.
9056   </para>
9057
9058   <table>
9059    <title><structname>pg_settings</> Columns</title>
9060
9061    <tgroup cols="3">
9062     <thead>
9063      <row>
9064       <entry>Name</entry>
9065       <entry>Type</entry>
9066       <entry>Description</entry>
9067      </row>
9068     </thead>
9069     <tbody>
9070      <row>
9071       <entry><structfield>name</structfield></entry>
9072       <entry><type>text</type></entry>
9073       <entry>Run-time configuration parameter name</entry>
9074      </row>
9075      <row>
9076       <entry><structfield>setting</structfield></entry>
9077       <entry><type>text</type></entry>
9078       <entry>Current value of the parameter</entry>
9079      </row>
9080      <row>
9081       <entry><structfield>unit</structfield></entry>
9082       <entry><type>text</type></entry>
9083       <entry>Implicit unit of the parameter</entry>
9084      </row>
9085      <row>
9086       <entry><structfield>category</structfield></entry>
9087       <entry><type>text</type></entry>
9088       <entry>Logical group of the parameter</entry>
9089      </row>
9090      <row>
9091       <entry><structfield>short_desc</structfield></entry>
9092       <entry><type>text</type></entry>
9093       <entry>A brief description of the parameter</entry>
9094      </row>
9095      <row>
9096       <entry><structfield>extra_desc</structfield></entry>
9097       <entry><type>text</type></entry>
9098       <entry>Additional, more detailed, description of the parameter</entry>
9099      </row>
9100      <row>
9101       <entry><structfield>context</structfield></entry>
9102       <entry><type>text</type></entry>
9103       <entry>Context required to set the parameter's value (see below)</entry>
9104      </row>
9105      <row>
9106       <entry><structfield>vartype</structfield></entry>
9107       <entry><type>text</type></entry>
9108       <entry>Parameter type (<literal>bool</>, <literal>enum</>,
9109        <literal>integer</>, <literal>real</>, or <literal>string</>)
9110       </entry>
9111      </row>
9112      <row>
9113       <entry><structfield>source</structfield></entry>
9114       <entry><type>text</type></entry>
9115       <entry>Source of the current parameter value</entry>
9116      </row>
9117      <row>
9118       <entry><structfield>min_val</structfield></entry>
9119       <entry><type>text</type></entry>
9120       <entry>Minimum allowed value of the parameter (null for non-numeric
9121       values)</entry>
9122      </row>
9123      <row>
9124       <entry><structfield>max_val</structfield></entry>
9125       <entry><type>text</type></entry>
9126       <entry>Maximum allowed value of the parameter (null for non-numeric
9127       values)</entry>
9128      </row>
9129      <row>
9130       <entry><structfield>enumvals</structfield></entry>
9131       <entry><type>text[]</type></entry>
9132       <entry>Allowed values of an enum parameter (null for non-enum
9133       values)</entry>
9134      </row>
9135      <row>
9136       <entry><structfield>boot_val</structfield></entry>
9137       <entry><type>text</type></entry>
9138       <entry>Parameter value assumed at server startup if the parameter is
9139       not otherwise set</entry>
9140      </row>
9141      <row>
9142       <entry><structfield>reset_val</structfield></entry>
9143       <entry><type>text</type></entry>
9144       <entry>Value that <command>RESET</command> would reset the parameter to
9145       in the current session</entry>
9146      </row>
9147      <row>
9148       <entry><structfield>sourcefile</structfield></entry>
9149       <entry><type>text</type></entry>
9150       <entry>Configuration file the current value was set in (null for
9151       values set from sources other than configuration files, or when
9152       examined by a non-superuser);
9153       helpful when using <literal>include</> directives in configuration files</entry>
9154      </row>
9155      <row>
9156       <entry><structfield>sourceline</structfield></entry>
9157       <entry><type>integer</type></entry>
9158       <entry>Line number within the configuration file the current value was
9159       set at (null for values set from sources other than configuration files,
9160       or when examined by a non-superuser)
9161       </entry>
9162      </row>
9163      <row>
9164       <entry><structfield>pending_restart</structfield></entry>
9165       <entry><type>boolean</type></entry>
9166       <entry><literal>true</literal> if the value has been changed in the
9167       configuration file but needs a restart; or <literal>false</literal>
9168       otherwise.
9169       </entry>
9170      </row>
9171     </tbody>
9172    </tgroup>
9173   </table>
9174
9175   <para>
9176    There are several possible values of <structfield>context</structfield>.
9177    In order of decreasing difficulty of changing the setting, they are:
9178   </para>
9179
9180   <variablelist>
9181    <varlistentry>
9182     <!-- PGC_INTERNAL -->
9183     <term><literal>internal</literal></term>
9184     <listitem>
9185      <para>
9186       These settings cannot be changed directly; they reflect internally
9187       determined values.  Some of them may be adjustable by rebuilding the
9188       server with different configuration options, or by changing options
9189       supplied to <command>initdb</command>.
9190      </para>
9191     </listitem>
9192    </varlistentry>
9193    <varlistentry>
9194     <!-- PGC_POSTMASTER -->
9195     <term><literal>postmaster</literal></term>
9196     <listitem>
9197      <para>
9198       These settings can only be applied when the server starts, so any change
9199       requires restarting the server.  Values for these settings are typically
9200       stored in the <filename>postgresql.conf</filename> file, or passed on
9201       the command line when starting the server.  Of course, settings with any
9202       of the lower <structfield>context</structfield> types can also be
9203       set at server start time.
9204      </para>
9205     </listitem>
9206    </varlistentry>
9207    <varlistentry>
9208     <!-- PGC_SIGHUP -->
9209     <term><literal>sighup</literal></term>
9210     <listitem>
9211      <para>
9212       Changes to these settings can be made in
9213       <filename>postgresql.conf</filename> without restarting the server.
9214       Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
9215       cause it to re-read <filename>postgresql.conf</filename> and apply
9216       the changes.  The postmaster will also forward the
9217       <systemitem>SIGHUP</systemitem> signal to its child processes so that
9218       they all pick up the new value.
9219      </para>
9220     </listitem>
9221    </varlistentry>
9222    <varlistentry>
9223     <!-- PGC_SU_BACKEND -->
9224     <term><literal>superuser-backend</literal></term>
9225     <listitem>
9226      <para>
9227       Changes to these settings can be made in
9228       <filename>postgresql.conf</filename> without restarting the server.
9229       They can also be set for a particular session in the connection request
9230       packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9231       environment variable), but only if the connecting user is a superuser.
9232       However, these settings never change in a session after it is started.
9233       If you change them in <filename>postgresql.conf</filename>, send a
9234       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9235       re-read <filename>postgresql.conf</filename>.  The new values will only
9236       affect subsequently-launched sessions.
9237      </para>
9238     </listitem>
9239    </varlistentry>
9240    <varlistentry>
9241     <!-- PGC_BACKEND -->
9242     <term><literal>backend</literal></term>
9243     <listitem>
9244      <para>
9245       Changes to these settings can be made in
9246       <filename>postgresql.conf</filename> without restarting the server.
9247       They can also be set for a particular session in the connection request
9248       packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
9249       environment variable); any user can make such a change for his session.
9250       However, these settings never change in a session after it is started.
9251       If you change them in <filename>postgresql.conf</filename>, send a
9252       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
9253       re-read <filename>postgresql.conf</filename>.  The new values will only
9254       affect subsequently-launched sessions.
9255      </para>
9256     </listitem>
9257    </varlistentry>
9258    <varlistentry>
9259     <!-- PGC_SUSET -->
9260     <term><literal>superuser</literal></term>
9261     <listitem>
9262      <para>
9263       These settings can be set from <filename>postgresql.conf</filename>,
9264       or within a session via the <command>SET</> command; but only superusers
9265       can change them via <command>SET</>.  Changes in
9266       <filename>postgresql.conf</filename> will affect existing sessions
9267       only if no session-local value has been established with <command>SET</>.
9268      </para>
9269     </listitem>
9270    </varlistentry>
9271    <varlistentry>
9272     <!-- PGC_USERSET -->
9273     <term><literal>user</literal></term>
9274     <listitem>
9275      <para>
9276       These settings can be set from <filename>postgresql.conf</filename>,
9277       or within a session via the <command>SET</> command.  Any user is
9278       allowed to change his session-local value.  Changes in
9279       <filename>postgresql.conf</filename> will affect existing sessions
9280       only if no session-local value has been established with <command>SET</>.
9281      </para>
9282     </listitem>
9283    </varlistentry>
9284   </variablelist>
9285
9286   <para>
9287    See <xref linkend="config-setting"> for more information about the various
9288    ways to change these parameters.
9289   </para>
9290
9291   <para>
9292    The <structname>pg_settings</structname> view cannot be inserted into or
9293    deleted from, but it can be updated.  An <command>UPDATE</command> applied
9294    to a row of <structname>pg_settings</structname> is equivalent to executing
9295    the <xref linkend="sql-set"> command on that named
9296    parameter. The change only affects the value used by the current
9297    session. If an <command>UPDATE</command> is issued within a transaction
9298    that is later aborted, the effects of the <command>UPDATE</command> command
9299    disappear when the transaction is rolled back. Once the surrounding
9300    transaction is committed, the effects will persist until the end of the
9301    session, unless overridden by another <command>UPDATE</command> or
9302    <command>SET</command>.
9303   </para>
9304
9305  </sect1>
9306
9307  <sect1 id="view-pg-shadow">
9308   <title><structname>pg_shadow</structname></title>
9309
9310   <indexterm zone="view-pg-shadow">
9311    <primary>pg_shadow</primary>
9312   </indexterm>
9313
9314   <para>
9315    The view <structname>pg_shadow</structname> exists for backwards
9316    compatibility: it emulates a catalog that existed in
9317    <productname>PostgreSQL</productname> before version 8.1.
9318    It shows properties of all roles that are marked as
9319    <structfield>rolcanlogin</> in
9320    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
9321   </para>
9322
9323   <para>
9324    The name stems from the fact that this table
9325    should not be readable by the public since it contains passwords.
9326    <link linkend="view-pg-user"><structname>pg_user</structname></link>
9327    is a publicly readable view on
9328    <structname>pg_shadow</structname> that blanks out the password field.
9329   </para>
9330
9331   <table>
9332    <title><structname>pg_shadow</> Columns</title>
9333
9334    <tgroup cols="4">
9335     <thead>
9336      <row>
9337       <entry>Name</entry>
9338       <entry>Type</entry>
9339       <entry>References</entry>
9340       <entry>Description</entry>
9341      </row>
9342     </thead>
9343
9344     <tbody>
9345      <row>
9346       <entry><structfield>usename</structfield></entry>
9347       <entry><type>name</type></entry>
9348       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9349       <entry>User name</entry>
9350      </row>
9351
9352      <row>
9353       <entry><structfield>usesysid</structfield></entry>
9354       <entry><type>oid</type></entry>
9355       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9356       <entry>ID of this user</entry>
9357      </row>
9358
9359      <row>
9360       <entry><structfield>usecreatedb</structfield></entry>
9361       <entry><type>bool</type></entry>
9362       <entry></entry>
9363       <entry>User can create databases</entry>
9364      </row>
9365
9366      <row>
9367       <entry><structfield>usesuper</structfield></entry>
9368       <entry><type>bool</type></entry>
9369       <entry></entry>
9370       <entry>User is a superuser</entry>
9371      </row>
9372
9373      <row>
9374       <entry><structfield>userepl</structfield></entry>
9375       <entry><type>bool</type></entry>
9376       <entry></entry>
9377       <entry>
9378        User can initiate streaming replication and put the system in and
9379        out of backup mode.
9380       </entry>
9381      </row>
9382
9383      <row>
9384       <entry><structfield>usebypassrls</structfield></entry>
9385       <entry><type>bool</type></entry>
9386       <entry></entry>
9387       <entry>
9388        User can bypass row level security policies, see
9389        <xref linkend="ddl-rowsecurity"> for more information.
9390       </entry>
9391      </row>
9392
9393      <row>
9394       <entry><structfield>passwd</structfield></entry>
9395       <entry><type>text</type></entry>
9396       <entry></entry>
9397       <entry>Password (possibly encrypted); null if none.  See
9398       <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9399       for details of how encrypted passwords are stored.</entry>
9400      </row>
9401
9402      <row>
9403       <entry><structfield>valuntil</structfield></entry>
9404       <entry><type>abstime</type></entry>
9405       <entry></entry>
9406       <entry>Password expiry time (only used for password authentication)</entry>
9407      </row>
9408
9409      <row>
9410       <entry><structfield>useconfig</structfield></entry>
9411       <entry><type>text[]</type></entry>
9412       <entry></entry>
9413       <entry>Session defaults for run-time configuration variables</entry>
9414      </row>
9415     </tbody>
9416    </tgroup>
9417   </table>
9418
9419  </sect1>
9420
9421  <sect1 id="view-pg-stats">
9422   <title><structname>pg_stats</structname></title>
9423
9424   <indexterm zone="view-pg-stats">
9425    <primary>pg_stats</primary>
9426   </indexterm>
9427
9428   <para>
9429    The view <structname>pg_stats</structname> provides access to
9430    the information stored in the <link
9431    linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
9432    catalog.  This view allows access only to rows of
9433    <structname>pg_statistic</structname> that correspond to tables the
9434    user has permission to read, and therefore it is safe to allow public
9435    read access to this view.
9436   </para>
9437
9438   <para>
9439    <structname>pg_stats</structname> is also designed to present the
9440    information in a more readable format than the underlying catalog
9441    &mdash; at the cost that its schema must be extended whenever new slot types
9442    are defined for <structname>pg_statistic</structname>.
9443   </para>
9444
9445   <table>
9446    <title><structname>pg_stats</> Columns</title>
9447
9448    <tgroup cols="4">
9449     <thead>
9450      <row>
9451       <entry>Name</entry>
9452       <entry>Type</entry>
9453       <entry>References</entry>
9454       <entry>Description</entry>
9455      </row>
9456     </thead>
9457     <tbody>
9458      <row>
9459       <entry><structfield>schemaname</structfield></entry>
9460       <entry><type>name</type></entry>
9461       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9462       <entry>Name of schema containing table</entry>
9463      </row>
9464
9465      <row>
9466       <entry><structfield>tablename</structfield></entry>
9467       <entry><type>name</type></entry>
9468       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9469       <entry>Name of table</entry>
9470      </row>
9471
9472      <row>
9473       <entry><structfield>attname</structfield></entry>
9474       <entry><type>name</type></entry>
9475       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
9476       <entry>Name of the column described by this row</entry>
9477      </row>
9478
9479      <row>
9480       <entry><structfield>inherited</structfield></entry>
9481       <entry><type>bool</type></entry>
9482       <entry></entry>
9483       <entry>If true, this row includes inheritance child columns, not just the
9484        values in the specified table</entry>
9485      </row>
9486
9487      <row>
9488       <entry><structfield>null_frac</structfield></entry>
9489       <entry><type>real</type></entry>
9490       <entry></entry>
9491       <entry>Fraction of column entries that are null</entry>
9492      </row>
9493
9494      <row>
9495       <entry><structfield>avg_width</structfield></entry>
9496       <entry><type>integer</type></entry>
9497       <entry></entry>
9498       <entry>Average width in bytes of column's entries</entry>
9499      </row>
9500
9501      <row>
9502       <entry><structfield>n_distinct</structfield></entry>
9503       <entry><type>real</type></entry>
9504       <entry></entry>
9505       <entry>
9506        If greater than zero, the estimated number of distinct values in the
9507        column.  If less than zero, the negative of the number of distinct
9508        values divided by the number of rows.  (The negated form is used when
9509        <command>ANALYZE</> believes that the number of distinct values is
9510        likely to increase as the table grows; the positive form is used when
9511        the column seems to have a fixed number of possible values.)  For
9512        example, -1 indicates a unique column in which the number of distinct
9513        values is the same as the number of rows.
9514       </entry>
9515      </row>
9516
9517      <row>
9518       <entry><structfield>most_common_vals</structfield></entry>
9519       <entry><type>anyarray</type></entry>
9520       <entry></entry>
9521       <entry>
9522        A list of the most common values in the column. (Null if
9523        no values seem to be more common than any others.)
9524       </entry>
9525      </row>
9526
9527      <row>
9528       <entry><structfield>most_common_freqs</structfield></entry>
9529       <entry><type>real[]</type></entry>
9530       <entry></entry>
9531       <entry>
9532        A list of the frequencies of the most common values,
9533        i.e., number of occurrences of each divided by total number of rows.
9534        (Null when <structfield>most_common_vals</structfield> is.)
9535       </entry>
9536      </row>
9537
9538      <row>
9539       <entry><structfield>histogram_bounds</structfield></entry>
9540       <entry><type>anyarray</type></entry>
9541       <entry></entry>
9542       <entry>
9543        A list of values that divide the column's values into groups of
9544        approximately equal population.  The values in
9545        <structfield>most_common_vals</>, if present, are omitted from this
9546        histogram calculation.  (This column is null if the column data type
9547        does not have a <literal>&lt;</> operator or if the
9548        <structfield>most_common_vals</> list accounts for the entire
9549        population.)
9550       </entry>
9551      </row>
9552
9553      <row>
9554       <entry><structfield>correlation</structfield></entry>
9555       <entry><type>real</type></entry>
9556       <entry></entry>
9557       <entry>
9558        Statistical correlation between physical row ordering and
9559        logical ordering of the column values.  This ranges from -1 to +1.
9560        When the value is near -1 or +1, an index scan on the column will
9561        be estimated to be cheaper than when it is near zero, due to reduction
9562        of random access to the disk.  (This column is null if the column data
9563        type does not have a <literal>&lt;</> operator.)
9564       </entry>
9565      </row>
9566
9567      <row>
9568       <entry><structfield>most_common_elems</structfield></entry>
9569       <entry><type>anyarray</type></entry>
9570       <entry></entry>
9571       <entry>
9572        A list of non-null element values most often appearing within values of
9573        the column. (Null for scalar types.)
9574       </entry>
9575      </row>
9576
9577      <row>
9578       <entry><structfield>most_common_elem_freqs</structfield></entry>
9579       <entry><type>real[]</type></entry>
9580       <entry></entry>
9581       <entry>
9582        A list of the frequencies of the most common element values, i.e., the
9583        fraction of rows containing at least one instance of the given value.
9584        Two or three additional values follow the per-element frequencies;
9585        these are the minimum and maximum of the preceding per-element
9586        frequencies, and optionally the frequency of null elements.
9587        (Null when <structfield>most_common_elems</structfield> is.)
9588       </entry>
9589      </row>
9590
9591      <row>
9592       <entry><structfield>elem_count_histogram</structfield></entry>
9593       <entry><type>real[]</type></entry>
9594       <entry></entry>
9595       <entry>
9596        A histogram of the counts of distinct non-null element values within the
9597        values of the column, followed by the average number of distinct
9598        non-null elements.  (Null for scalar types.)
9599       </entry>
9600      </row>
9601     </tbody>
9602    </tgroup>
9603   </table>
9604
9605   <para>
9606    The maximum number of entries in the array fields can be controlled on a
9607    column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
9608    command, or globally by setting the
9609    <xref linkend="guc-default-statistics-target"> run-time parameter.
9610   </para>
9611
9612  </sect1>
9613
9614  <sect1 id="view-pg-tables">
9615   <title><structname>pg_tables</structname></title>
9616
9617   <indexterm zone="view-pg-tables">
9618    <primary>pg_tables</primary>
9619   </indexterm>
9620
9621   <para>
9622    The view <structname>pg_tables</structname> provides access to
9623    useful information about each table in the database.
9624   </para>
9625
9626   <table>
9627    <title><structname>pg_tables</> Columns</title>
9628
9629    <tgroup cols="4">
9630     <thead>
9631      <row>
9632       <entry>Name</entry>
9633       <entry>Type</entry>
9634       <entry>References</entry>
9635       <entry>Description</entry>
9636      </row>
9637     </thead>
9638     <tbody>
9639      <row>
9640       <entry><structfield>schemaname</structfield></entry>
9641       <entry><type>name</type></entry>
9642       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9643       <entry>Name of schema containing table</entry>
9644      </row>
9645      <row>
9646       <entry><structfield>tablename</structfield></entry>
9647       <entry><type>name</type></entry>
9648       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9649       <entry>Name of table</entry>
9650      </row>
9651      <row>
9652       <entry><structfield>tableowner</structfield></entry>
9653       <entry><type>name</type></entry>
9654       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9655       <entry>Name of table's owner</entry>
9656      </row>
9657      <row>
9658       <entry><structfield>tablespace</structfield></entry>
9659       <entry><type>name</type></entry>
9660       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9661       <entry>Name of tablespace containing table (null if default for database)</entry>
9662      </row>
9663      <row>
9664       <entry><structfield>hasindexes</structfield></entry>
9665       <entry><type>boolean</type></entry>
9666       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
9667       <entry>True if table has (or recently had) any indexes</entry>
9668      </row>
9669      <row>
9670       <entry><structfield>hasrules</structfield></entry>
9671       <entry><type>boolean</type></entry>
9672       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
9673       <entry>True if table has (or once had) rules</entry>
9674      </row>
9675      <row>
9676       <entry><structfield>hastriggers</structfield></entry>
9677       <entry><type>boolean</type></entry>
9678       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
9679       <entry>True if table has (or once had) triggers</entry>
9680      </row>
9681      <row>
9682       <entry><structfield>rowsecurity</structfield></entry>
9683       <entry><type>boolean</type></entry>
9684       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
9685       <entry>True if row security is enabled on the table</entry>
9686      </row>
9687     </tbody>
9688    </tgroup>
9689   </table>
9690
9691  </sect1>
9692
9693  <sect1 id="view-pg-timezone-abbrevs">
9694   <title><structname>pg_timezone_abbrevs</structname></title>
9695
9696   <indexterm zone="view-pg-timezone-abbrevs">
9697    <primary>pg_timezone_abbrevs</primary>
9698   </indexterm>
9699
9700   <para>
9701    The view <structname>pg_timezone_abbrevs</structname> provides a list
9702    of time zone abbreviations that are currently recognized by the datetime
9703    input routines.  The contents of this view change when the
9704    <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
9705   </para>
9706
9707   <table>
9708    <title><structname>pg_timezone_abbrevs</> Columns</title>
9709
9710    <tgroup cols="3">
9711     <thead>
9712      <row>
9713       <entry>Name</entry>
9714       <entry>Type</entry>
9715       <entry>Description</entry>
9716      </row>
9717     </thead>
9718     <tbody>
9719      <row>
9720       <entry><structfield>abbrev</structfield></entry>
9721       <entry><type>text</type></entry>
9722       <entry>Time zone abbreviation</entry>
9723      </row>
9724      <row>
9725       <entry><structfield>utc_offset</structfield></entry>
9726       <entry><type>interval</type></entry>
9727       <entry>Offset from UTC (positive means east of Greenwich)</entry>
9728      </row>
9729      <row>
9730       <entry><structfield>is_dst</structfield></entry>
9731       <entry><type>boolean</type></entry>
9732       <entry>True if this is a daylight-savings abbreviation</entry>
9733      </row>
9734     </tbody>
9735    </tgroup>
9736   </table>
9737
9738  </sect1>
9739
9740  <sect1 id="view-pg-timezone-names">
9741   <title><structname>pg_timezone_names</structname></title>
9742
9743   <indexterm zone="view-pg-timezone-names">
9744    <primary>pg_timezone_names</primary>
9745   </indexterm>
9746
9747   <para>
9748    The view <structname>pg_timezone_names</structname> provides a list
9749    of time zone names that are recognized by <command>SET TIMEZONE</>,
9750    along with their associated abbreviations, UTC offsets,
9751    and daylight-savings status.  (Technically,
9752    <productname>PostgreSQL</productname> uses <acronym>UT1</> rather
9753    than UTC because leap seconds are not handled.)
9754    Unlike the abbreviations shown in <link
9755    linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
9756    date rules.  Therefore, the associated information changes across local DST
9757    boundaries.  The displayed information is computed based on the current
9758    value of <function>CURRENT_TIMESTAMP</>.
9759   </para>
9760
9761   <table>
9762    <title><structname>pg_timezone_names</> Columns</title>
9763
9764    <tgroup cols="3">
9765     <thead>
9766      <row>
9767       <entry>Name</entry>
9768       <entry>Type</entry>
9769       <entry>Description</entry>
9770      </row>
9771     </thead>
9772     <tbody>
9773      <row>
9774       <entry><structfield>name</structfield></entry>
9775       <entry><type>text</type></entry>
9776       <entry>Time zone name</entry>
9777      </row>
9778      <row>
9779       <entry><structfield>abbrev</structfield></entry>
9780       <entry><type>text</type></entry>
9781       <entry>Time zone abbreviation</entry>
9782      </row>
9783      <row>
9784       <entry><structfield>utc_offset</structfield></entry>
9785       <entry><type>interval</type></entry>
9786       <entry>Offset from UTC (positive means east of Greenwich)</entry>
9787      </row>
9788      <row>
9789       <entry><structfield>is_dst</structfield></entry>
9790       <entry><type>boolean</type></entry>
9791       <entry>True if currently observing daylight savings</entry>
9792      </row>
9793     </tbody>
9794    </tgroup>
9795   </table>
9796
9797  </sect1>
9798
9799  <sect1 id="view-pg-user">
9800   <title><structname>pg_user</structname></title>
9801
9802   <indexterm zone="view-pg-user">
9803    <primary>pg_user</primary>
9804   </indexterm>
9805
9806   <para>
9807    The view <structname>pg_user</structname> provides access to
9808    information about database users.  This is simply a publicly
9809    readable view of
9810    <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
9811    that blanks out the password field.
9812   </para>
9813
9814   <table>
9815    <title><structname>pg_user</> Columns</title>
9816
9817    <tgroup cols="3">
9818     <thead>
9819      <row>
9820       <entry>Name</entry>
9821       <entry>Type</entry>
9822       <entry>Description</entry>
9823      </row>
9824     </thead>
9825     <tbody>
9826      <row>
9827       <entry><structfield>usename</structfield></entry>
9828       <entry><type>name</type></entry>
9829       <entry>User name</entry>
9830      </row>
9831
9832      <row>
9833       <entry><structfield>usesysid</structfield></entry>
9834       <entry><type>oid</type></entry>
9835       <entry>ID of this user</entry>
9836      </row>
9837
9838      <row>
9839       <entry><structfield>usecreatedb</structfield></entry>
9840       <entry><type>bool</type></entry>
9841       <entry>User can create databases</entry>
9842      </row>
9843
9844      <row>
9845       <entry><structfield>usesuper</structfield></entry>
9846       <entry><type>bool</type></entry>
9847       <entry>User is a superuser</entry>
9848      </row>
9849
9850      <row>
9851       <entry><structfield>userepl</structfield></entry>
9852       <entry><type>bool</type></entry>
9853       <entry>
9854        User can initiate streaming replication and put the system in and
9855        out of backup mode.
9856       </entry>
9857      </row>
9858
9859      <row>
9860       <entry><structfield>usebypassrls</structfield></entry>
9861       <entry><type>bool</type></entry>
9862       <entry>
9863        User can bypass row level security policies, see
9864        <xref linkend="ddl-rowsecurity"> for more information.
9865       </entry>
9866      </row>
9867
9868      <row>
9869       <entry><structfield>passwd</structfield></entry>
9870       <entry><type>text</type></entry>
9871       <entry>Not the password (always reads as <literal>********</>)</entry>
9872      </row>
9873
9874      <row>
9875       <entry><structfield>valuntil</structfield></entry>
9876       <entry><type>abstime</type></entry>
9877       <entry>Password expiry time (only used for password authentication)</entry>
9878      </row>
9879
9880      <row>
9881       <entry><structfield>useconfig</structfield></entry>
9882       <entry><type>text[]</type></entry>
9883       <entry>Session defaults for run-time configuration variables</entry>
9884      </row>
9885     </tbody>
9886    </tgroup>
9887   </table>
9888
9889  </sect1>
9890
9891  <sect1 id="view-pg-user-mappings">
9892   <title><structname>pg_user_mappings</structname></title>
9893
9894   <indexterm zone="view-pg-user-mappings">
9895    <primary>pg_user_mappings</primary>
9896   </indexterm>
9897
9898   <para>
9899    The view <structname>pg_user_mappings</structname> provides access
9900    to information about user mappings.  This is essentially a publicly
9901    readable view of
9902    <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
9903    that leaves out the options field if the user has no rights to use
9904    it.
9905   </para>
9906
9907   <table>
9908    <title><structname>pg_user_mappings</> Columns</title>
9909
9910    <tgroup cols="4">
9911     <thead>
9912      <row>
9913       <entry>Name</entry>
9914       <entry>Type</entry>
9915       <entry>References</entry>
9916       <entry>Description</entry>
9917      </row>
9918     </thead>
9919
9920     <tbody>
9921      <row>
9922       <entry><structfield>umid</structfield></entry>
9923       <entry><type>oid</type></entry>
9924       <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
9925       <entry>OID of the user mapping</entry>
9926      </row>
9927
9928      <row>
9929       <entry><structfield>srvid</structfield></entry>
9930       <entry><type>oid</type></entry>
9931       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
9932       <entry>
9933        The OID of the foreign server that contains this mapping
9934       </entry>
9935      </row>
9936
9937      <row>
9938       <entry><structfield>srvname</structfield></entry>
9939       <entry><type>name</type></entry>
9940       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
9941       <entry>
9942        Name of the foreign server
9943       </entry>
9944      </row>
9945
9946      <row>
9947       <entry><structfield>umuser</structfield></entry>
9948       <entry><type>oid</type></entry>
9949       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9950       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
9951      </row>
9952
9953      <row>
9954       <entry><structfield>usename</structfield></entry>
9955       <entry><type>name</type></entry>
9956       <entry></entry>
9957       <entry>Name of the local user to be mapped</entry>
9958      </row>
9959
9960      <row>
9961       <entry><structfield>umoptions</structfield></entry>
9962       <entry><type>text[]</type></entry>
9963       <entry></entry>
9964       <entry>
9965        User mapping specific options, as <quote>keyword=value</>
9966        strings, if the current user is the owner of the foreign
9967        server, else null
9968       </entry>
9969      </row>
9970     </tbody>
9971    </tgroup>
9972   </table>
9973  </sect1>
9974
9975
9976  <sect1 id="view-pg-views">
9977   <title><structname>pg_views</structname></title>
9978
9979   <indexterm zone="view-pg-views">
9980    <primary>pg_views</primary>
9981   </indexterm>
9982
9983   <para>
9984    The view <structname>pg_views</structname> provides access to
9985    useful information about each view in the database.
9986   </para>
9987
9988   <table>
9989    <title><structname>pg_views</> Columns</title>
9990
9991    <tgroup cols="4">
9992     <thead>
9993      <row>
9994       <entry>Name</entry>
9995       <entry>Type</entry>
9996       <entry>References</entry>
9997       <entry>Description</entry>
9998      </row>
9999     </thead>
10000     <tbody>
10001      <row>
10002       <entry><structfield>schemaname</structfield></entry>
10003       <entry><type>name</type></entry>
10004       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10005       <entry>Name of schema containing view</entry>
10006      </row>
10007      <row>
10008       <entry><structfield>viewname</structfield></entry>
10009       <entry><type>name</type></entry>
10010       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10011       <entry>Name of view</entry>
10012      </row>
10013      <row>
10014       <entry><structfield>viewowner</structfield></entry>
10015       <entry><type>name</type></entry>
10016       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10017       <entry>Name of view's owner</entry>
10018      </row>
10019      <row>
10020       <entry><structfield>definition</structfield></entry>
10021       <entry><type>text</type></entry>
10022       <entry></entry>
10023       <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
10024      </row>
10025     </tbody>
10026    </tgroup>
10027   </table>
10028
10029  </sect1>
10030
10031 </chapter>