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