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