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