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