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