]> granicus.if.org Git - postgresql/blob - doc/src/sgml/catalogs.sgml
Fast ALTER TABLE ADD COLUMN with a non-NULL default
[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-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
225       <entry>information about partition key of tables</entry>
226      </row>
227
228      <row>
229       <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
230       <entry>template data for procedural languages</entry>
231      </row>
232
233      <row>
234       <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
235       <entry>row-security policies</entry>
236      </row>
237
238      <row>
239       <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
240       <entry>functions and procedures</entry>
241      </row>
242
243      <row>
244       <entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
245       <entry>publications for logical replication</entry>
246      </row>
247
248      <row>
249       <entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
250       <entry>relation to publication mapping</entry>
251      </row>
252
253      <row>
254       <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
255       <entry>information about range types</entry>
256      </row>
257
258      <row>
259       <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
260       <entry>registered replication origins</entry>
261      </row>
262
263      <row>
264       <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
265       <entry>query rewrite rules</entry>
266      </row>
267
268      <row>
269       <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
270       <entry>security labels on database objects</entry>
271      </row>
272
273      <row>
274       <entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
275       <entry>information about sequences</entry>
276      </row>
277
278      <row>
279       <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
280       <entry>dependencies on shared objects</entry>
281      </row>
282
283      <row>
284       <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
285       <entry>comments on shared objects</entry>
286      </row>
287
288      <row>
289       <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
290       <entry>security labels on shared database objects</entry>
291      </row>
292
293      <row>
294       <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
295       <entry>planner statistics</entry>
296      </row>
297
298      <row>
299       <entry><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link></entry>
300       <entry>extended planner statistics</entry>
301      </row>
302
303      <row>
304       <entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
305       <entry>logical replication subscriptions</entry>
306      </row>
307
308      <row>
309       <entry><link linkend="catalog-pg-subscription-rel"><structname>pg_subscription_rel</structname></link></entry>
310       <entry>relation state for subscriptions</entry>
311      </row>
312
313      <row>
314       <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
315       <entry>tablespaces within this database cluster</entry>
316      </row>
317
318      <row>
319       <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
320       <entry>transforms (data type to procedural language conversions)</entry>
321      </row>
322
323      <row>
324       <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
325       <entry>triggers</entry>
326      </row>
327
328      <row>
329       <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
330       <entry>text search configurations</entry>
331      </row>
332
333      <row>
334       <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
335       <entry>text search configurations' token mappings</entry>
336      </row>
337
338      <row>
339       <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
340       <entry>text search dictionaries</entry>
341      </row>
342
343      <row>
344       <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
345       <entry>text search parsers</entry>
346      </row>
347
348      <row>
349       <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
350       <entry>text search templates</entry>
351      </row>
352
353      <row>
354       <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
355       <entry>data types</entry>
356      </row>
357
358      <row>
359       <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
360       <entry>mappings of users to foreign servers</entry>
361      </row>
362     </tbody>
363    </tgroup>
364   </table>
365  </sect1>
366
367
368  <sect1 id="catalog-pg-aggregate">
369   <title><structname>pg_aggregate</structname></title>
370
371   <indexterm zone="catalog-pg-aggregate">
372    <primary>pg_aggregate</primary>
373   </indexterm>
374
375   <para>
376    The catalog <structname>pg_aggregate</structname> stores information about
377    aggregate functions.  An aggregate function is a function that
378    operates on a set of values (typically one column from each row
379    that matches a query condition) and returns a single value computed
380    from all these values.  Typical aggregate functions are
381    <function>sum</function>, <function>count</function>, and
382    <function>max</function>.  Each entry in
383    <structname>pg_aggregate</structname> is an extension of an entry
384    in <structname>pg_proc</structname>.  The <structname>pg_proc</structname>
385    entry carries the aggregate's name, input and output data types, and
386    other information that is similar to ordinary functions.
387   </para>
388
389   <table>
390    <title><structname>pg_aggregate</structname> Columns</title>
391
392    <tgroup cols="4">
393     <thead>
394      <row>
395       <entry>Name</entry>
396       <entry>Type</entry>
397       <entry>References</entry>
398       <entry>Description</entry>
399      </row>
400     </thead>
401     <tbody>
402      <row>
403       <entry><structfield>aggfnoid</structfield></entry>
404       <entry><type>regproc</type></entry>
405       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
406       <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
407      </row>
408      <row>
409       <entry><structfield>aggkind</structfield></entry>
410       <entry><type>char</type></entry>
411       <entry></entry>
412       <entry>Aggregate kind:
413        <literal>n</literal> for <quote>normal</quote> aggregates,
414        <literal>o</literal> for <quote>ordered-set</quote> aggregates, or
415        <literal>h</literal> for <quote>hypothetical-set</quote> aggregates
416       </entry>
417      </row>
418      <row>
419       <entry><structfield>aggnumdirectargs</structfield></entry>
420       <entry><type>int2</type></entry>
421       <entry></entry>
422       <entry>Number of direct (non-aggregated) arguments of an ordered-set or
423        hypothetical-set aggregate, counting a variadic array as one argument.
424        If equal to <structfield>pronargs</structfield>, the aggregate must be variadic
425        and the variadic array describes the aggregated arguments as well as
426        the final direct arguments.
427        Always zero for normal aggregates.</entry>
428      </row>
429      <row>
430       <entry><structfield>aggtransfn</structfield></entry>
431       <entry><type>regproc</type></entry>
432       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
433       <entry>Transition function</entry>
434      </row>
435      <row>
436       <entry><structfield>aggfinalfn</structfield></entry>
437       <entry><type>regproc</type></entry>
438       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
439       <entry>Final function (zero if none)</entry>
440      </row>
441      <row>
442       <entry><structfield>aggcombinefn</structfield></entry>
443       <entry><type>regproc</type></entry>
444       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
445       <entry>Combine function (zero if none)</entry>
446      </row>
447      <row>
448       <entry><structfield>aggserialfn</structfield></entry>
449       <entry><type>regproc</type></entry>
450       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
451       <entry>Serialization function (zero if none)</entry>
452      </row>
453      <row>
454       <entry><structfield>aggdeserialfn</structfield></entry>
455       <entry><type>regproc</type></entry>
456       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
457       <entry>Deserialization function (zero if none)</entry>
458      </row>
459      <row>
460       <entry><structfield>aggmtransfn</structfield></entry>
461       <entry><type>regproc</type></entry>
462       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
463       <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
464      </row>
465      <row>
466       <entry><structfield>aggminvtransfn</structfield></entry>
467       <entry><type>regproc</type></entry>
468       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
469       <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
470      </row>
471      <row>
472       <entry><structfield>aggmfinalfn</structfield></entry>
473       <entry><type>regproc</type></entry>
474       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
475       <entry>Final function for moving-aggregate mode (zero if none)</entry>
476      </row>
477      <row>
478       <entry><structfield>aggfinalextra</structfield></entry>
479       <entry><type>bool</type></entry>
480       <entry></entry>
481       <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
482      </row>
483      <row>
484       <entry><structfield>aggmfinalextra</structfield></entry>
485       <entry><type>bool</type></entry>
486       <entry></entry>
487       <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
488      </row>
489      <row>
490       <entry><structfield>aggfinalmodify</structfield></entry>
491       <entry><type>char</type></entry>
492       <entry></entry>
493       <entry>Whether <structfield>aggfinalfn</structfield> modifies the
494        transition state value:
495        <literal>r</literal> if it is read-only,
496        <literal>s</literal> if the <structfield>aggtransfn</structfield>
497        cannot be applied after the <structfield>aggfinalfn</structfield>, or
498        <literal>w</literal> if it writes on the value
499       </entry>
500      </row>
501      <row>
502       <entry><structfield>aggmfinalmodify</structfield></entry>
503       <entry><type>char</type></entry>
504       <entry></entry>
505       <entry>Like <structfield>aggfinalmodify</structfield>, but for
506        the <structfield>aggmfinalfn</structfield>
507       </entry>
508      </row>
509      <row>
510       <entry><structfield>aggsortop</structfield></entry>
511       <entry><type>oid</type></entry>
512       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
513       <entry>Associated sort operator (zero if none)</entry>
514      </row>
515      <row>
516       <entry><structfield>aggtranstype</structfield></entry>
517       <entry><type>oid</type></entry>
518       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
519       <entry>Data type of the aggregate function's internal transition (state) data</entry>
520      </row>
521      <row>
522       <entry><structfield>aggtransspace</structfield></entry>
523       <entry><type>int4</type></entry>
524       <entry></entry>
525       <entry>Approximate average size (in bytes) of the transition state
526        data, or zero to use a default estimate</entry>
527      </row>
528      <row>
529       <entry><structfield>aggmtranstype</structfield></entry>
530       <entry><type>oid</type></entry>
531       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
532       <entry>Data type of the aggregate function's internal transition (state)
533        data for moving-aggregate mode (zero if none)</entry>
534      </row>
535      <row>
536       <entry><structfield>aggmtransspace</structfield></entry>
537       <entry><type>int4</type></entry>
538       <entry></entry>
539       <entry>Approximate average size (in bytes) of the transition state data
540        for moving-aggregate mode, or zero to use a default estimate</entry>
541      </row>
542      <row>
543       <entry><structfield>agginitval</structfield></entry>
544       <entry><type>text</type></entry>
545       <entry></entry>
546       <entry>
547        The initial value of the transition state.  This is a text
548        field containing the initial value in its external string
549        representation.  If this field is null, the transition state
550        value starts out null.
551       </entry>
552      </row>
553      <row>
554       <entry><structfield>aggminitval</structfield></entry>
555       <entry><type>text</type></entry>
556       <entry></entry>
557       <entry>
558        The initial value of the transition state for moving-aggregate mode.
559        This is a text field containing the initial value in its external
560        string representation.  If this field is null, the transition state
561        value starts out null.
562       </entry>
563      </row>
564     </tbody>
565    </tgroup>
566   </table>
567
568   <para>
569    New aggregate functions are registered with the <xref
570    linkend="sql-createaggregate"/>
571    command.  See <xref linkend="xaggr"/> for more information about
572    writing aggregate functions and the meaning of the transition
573    functions, etc.
574   </para>
575
576  </sect1>
577
578
579  <sect1 id="catalog-pg-am">
580   <title><structname>pg_am</structname></title>
581
582   <indexterm zone="catalog-pg-am">
583    <primary>pg_am</primary>
584   </indexterm>
585
586   <para>
587    The catalog <structname>pg_am</structname> stores information about
588    relation access methods.  There is one row for each access method supported
589    by the system.
590    Currently, only indexes have access methods.  The requirements for index
591    access methods are discussed in detail in <xref linkend="indexam"/>.
592   </para>
593
594   <table>
595    <title><structname>pg_am</structname> Columns</title>
596
597    <tgroup cols="4">
598     <thead>
599      <row>
600       <entry>Name</entry>
601       <entry>Type</entry>
602       <entry>References</entry>
603       <entry>Description</entry>
604      </row>
605     </thead>
606     <tbody>
607
608      <row>
609       <entry><structfield>oid</structfield></entry>
610       <entry><type>oid</type></entry>
611       <entry></entry>
612       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
613      </row>
614
615      <row>
616       <entry><structfield>amname</structfield></entry>
617       <entry><type>name</type></entry>
618       <entry></entry>
619       <entry>Name of the access method</entry>
620      </row>
621
622      <row>
623       <entry><structfield>amhandler</structfield></entry>
624       <entry><type>regproc</type></entry>
625       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
626       <entry>
627        OID of a handler function that is responsible for supplying information
628        about the access method
629       </entry>
630      </row>
631
632      <row>
633       <entry><structfield>amtype</structfield></entry>
634       <entry><type>char</type></entry>
635       <entry></entry>
636       <entry>
637        Currently always <literal>i</literal> to indicate an index access
638        method; other values may be allowed in future
639       </entry>
640      </row>
641     </tbody>
642    </tgroup>
643   </table>
644
645   <note>
646    <para>
647     Before <productname>PostgreSQL</productname> 9.6, <structname>pg_am</structname>
648     contained many additional columns representing properties of index access
649     methods.  That data is now only directly visible at the C code level.
650     However, <function>pg_index_column_has_property()</function> and related
651     functions have been added to allow SQL queries to inspect index access
652     method properties; see <xref linkend="functions-info-catalog-table"/>.
653    </para>
654   </note>
655
656  </sect1>
657
658
659  <sect1 id="catalog-pg-amop">
660   <title><structname>pg_amop</structname></title>
661
662   <indexterm zone="catalog-pg-amop">
663    <primary>pg_amop</primary>
664   </indexterm>
665
666   <para>
667    The catalog <structname>pg_amop</structname> stores information about
668    operators associated with access method operator families.  There is one
669    row for each operator that is a member of an operator family.  A family
670    member can be either a <firstterm>search</firstterm> operator or an
671    <firstterm>ordering</firstterm> operator.  An operator
672    can appear in more than one family, but cannot appear in more than one
673    search position nor more than one ordering position within a family.
674    (It is allowed, though unlikely, for an operator to be used for both
675    search and ordering purposes.)
676   </para>
677
678   <table>
679    <title><structname>pg_amop</structname> Columns</title>
680
681    <tgroup cols="4">
682     <thead>
683      <row>
684       <entry>Name</entry>
685       <entry>Type</entry>
686       <entry>References</entry>
687       <entry>Description</entry>
688      </row>
689     </thead>
690     <tbody>
691
692      <row>
693       <entry><structfield>oid</structfield></entry>
694       <entry><type>oid</type></entry>
695       <entry></entry>
696       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
697      </row>
698
699      <row>
700       <entry><structfield>amopfamily</structfield></entry>
701       <entry><type>oid</type></entry>
702       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
703       <entry>The operator family this entry is for</entry>
704      </row>
705
706      <row>
707       <entry><structfield>amoplefttype</structfield></entry>
708       <entry><type>oid</type></entry>
709       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
710       <entry>Left-hand input data type of operator</entry>
711      </row>
712
713      <row>
714       <entry><structfield>amoprighttype</structfield></entry>
715       <entry><type>oid</type></entry>
716       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
717       <entry>Right-hand input data type of operator</entry>
718      </row>
719
720      <row>
721       <entry><structfield>amopstrategy</structfield></entry>
722       <entry><type>int2</type></entry>
723       <entry></entry>
724       <entry>Operator strategy number</entry>
725      </row>
726
727      <row>
728       <entry><structfield>amoppurpose</structfield></entry>
729       <entry><type>char</type></entry>
730       <entry></entry>
731       <entry>Operator purpose, either <literal>s</literal> for search or
732        <literal>o</literal> for ordering</entry>
733      </row>
734
735      <row>
736       <entry><structfield>amopopr</structfield></entry>
737       <entry><type>oid</type></entry>
738       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
739       <entry>OID of the operator</entry>
740      </row>
741
742      <row>
743       <entry><structfield>amopmethod</structfield></entry>
744       <entry><type>oid</type></entry>
745       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
746       <entry>Index access method operator family is for</entry>
747      </row>
748
749      <row>
750       <entry><structfield>amopsortfamily</structfield></entry>
751       <entry><type>oid</type></entry>
752       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
753       <entry>The B-tree operator family this entry sorts according to, if an
754        ordering operator; zero if a search operator</entry>
755      </row>
756
757     </tbody>
758    </tgroup>
759   </table>
760
761   <para>
762    A <quote>search</quote> operator entry indicates that an index of this operator
763    family can be searched to find all rows satisfying
764    <literal>WHERE</literal>
765    <replaceable>indexed_column</replaceable>
766    <replaceable>operator</replaceable>
767    <replaceable>constant</replaceable>.
768    Obviously, such an operator must return <type>boolean</type>, and its left-hand input
769    type must match the index's column data type.
770   </para>
771
772   <para>
773    An <quote>ordering</quote> operator entry indicates that an index of this
774    operator family can be scanned to return rows in the order represented by
775    <literal>ORDER BY</literal>
776    <replaceable>indexed_column</replaceable>
777    <replaceable>operator</replaceable>
778    <replaceable>constant</replaceable>.
779    Such an operator could return any sortable data type, though again
780    its left-hand input type must match the index's column data type.
781    The exact semantics of the <literal>ORDER BY</literal> are specified by the
782    <structfield>amopsortfamily</structfield> column, which must reference
783    a B-tree operator family for the operator's result type.
784   </para>
785
786   <note>
787    <para>
788     At present, it's assumed that the sort order for an ordering operator
789     is the default for the referenced operator family, i.e., <literal>ASC NULLS
790     LAST</literal>.  This might someday be relaxed by adding additional columns
791     to specify sort options explicitly.
792    </para>
793   </note>
794
795   <para>
796    An entry's <structfield>amopmethod</structfield> must match the
797    <structname>opfmethod</structname> of its containing operator family (including
798    <structfield>amopmethod</structfield> here is an intentional denormalization of the
799    catalog structure for performance reasons).  Also,
800    <structfield>amoplefttype</structfield> and <structfield>amoprighttype</structfield> must match
801    the <structfield>oprleft</structfield> and <structfield>oprright</structfield> fields of the
802    referenced <structname>pg_operator</structname> entry.
803   </para>
804
805  </sect1>
806
807
808  <sect1 id="catalog-pg-amproc">
809   <title><structname>pg_amproc</structname></title>
810
811   <indexterm zone="catalog-pg-amproc">
812    <primary>pg_amproc</primary>
813   </indexterm>
814
815   <para>
816    The catalog <structname>pg_amproc</structname> stores information about
817    support procedures associated with access method operator families.  There
818    is one row for each support procedure belonging to an operator family.
819   </para>
820
821   <table>
822    <title><structname>pg_amproc</structname> Columns</title>
823
824    <tgroup cols="4">
825     <thead>
826      <row>
827       <entry>Name</entry>
828       <entry>Type</entry>
829       <entry>References</entry>
830       <entry>Description</entry>
831      </row>
832     </thead>
833     <tbody>
834
835      <row>
836       <entry><structfield>oid</structfield></entry>
837       <entry><type>oid</type></entry>
838       <entry></entry>
839       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
840      </row>
841
842      <row>
843       <entry><structfield>amprocfamily</structfield></entry>
844       <entry><type>oid</type></entry>
845       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
846       <entry>The operator family this entry is for</entry>
847      </row>
848
849      <row>
850       <entry><structfield>amproclefttype</structfield></entry>
851       <entry><type>oid</type></entry>
852       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
853       <entry>Left-hand input data type of associated operator</entry>
854      </row>
855
856      <row>
857       <entry><structfield>amprocrighttype</structfield></entry>
858       <entry><type>oid</type></entry>
859       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
860       <entry>Right-hand input data type of associated operator</entry>
861      </row>
862
863      <row>
864       <entry><structfield>amprocnum</structfield></entry>
865       <entry><type>int2</type></entry>
866       <entry></entry>
867       <entry>Support procedure number</entry>
868      </row>
869
870      <row>
871       <entry><structfield>amproc</structfield></entry>
872       <entry><type>regproc</type></entry>
873       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
874       <entry>OID of the procedure</entry>
875      </row>
876
877     </tbody>
878    </tgroup>
879   </table>
880
881   <para>
882    The usual interpretation of the
883    <structfield>amproclefttype</structfield> and <structfield>amprocrighttype</structfield> fields
884    is that they identify the left and right input types of the operator(s)
885    that a particular support procedure supports.  For some access methods
886    these match the input data type(s) of the support procedure itself, for
887    others not.  There is a notion of <quote>default</quote> support procedures for
888    an index, which are those with <structfield>amproclefttype</structfield> and
889    <structfield>amprocrighttype</structfield> both equal to the index operator class's
890    <structfield>opcintype</structfield>.
891   </para>
892
893  </sect1>
894
895
896  <sect1 id="catalog-pg-attrdef">
897   <title><structname>pg_attrdef</structname></title>
898
899   <indexterm zone="catalog-pg-attrdef">
900    <primary>pg_attrdef</primary>
901   </indexterm>
902
903   <para>
904    The catalog <structname>pg_attrdef</structname> stores column default values.  The main information
905    about columns is stored in <structname>pg_attribute</structname>
906    (see below).  Only columns that explicitly specify a default value
907    (when the table is created or the column is added) will have an
908    entry here.
909   </para>
910
911   <table>
912    <title><structname>pg_attrdef</structname> Columns</title>
913
914    <tgroup cols="4">
915     <thead>
916      <row>
917       <entry>Name</entry>
918       <entry>Type</entry>
919       <entry>References</entry>
920       <entry>Description</entry>
921      </row>
922     </thead>
923
924     <tbody>
925      <row>
926       <entry><structfield>oid</structfield></entry>
927       <entry><type>oid</type></entry>
928       <entry></entry>
929       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
930      </row>
931
932      <row>
933       <entry><structfield>adrelid</structfield></entry>
934       <entry><type>oid</type></entry>
935       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
936       <entry>The table this column belongs to</entry>
937      </row>
938
939      <row>
940       <entry><structfield>adnum</structfield></entry>
941       <entry><type>int2</type></entry>
942       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
943       <entry>The number of the column</entry>
944      </row>
945
946      <row>
947       <entry><structfield>adbin</structfield></entry>
948       <entry><type>pg_node_tree</type></entry>
949       <entry></entry>
950       <entry>The internal representation of the column default value</entry>
951      </row>
952
953      <row>
954       <entry><structfield>adsrc</structfield></entry>
955       <entry><type>text</type></entry>
956       <entry></entry>
957       <entry>A human-readable representation of the default value</entry>
958      </row>
959     </tbody>
960    </tgroup>
961   </table>
962
963    <para>
964     The <structfield>adsrc</structfield> field is historical, and is best
965     not used, because it does not track outside changes that might affect
966     the representation of the default value.  Reverse-compiling the
967     <structfield>adbin</structfield> field (with <function>pg_get_expr</function> for
968     example) is a better way to display the default value.
969    </para>
970
971  </sect1>
972
973
974  <sect1 id="catalog-pg-attribute">
975   <title><structname>pg_attribute</structname></title>
976
977   <indexterm zone="catalog-pg-attribute">
978    <primary>pg_attribute</primary>
979   </indexterm>
980
981   <para>
982    The catalog <structname>pg_attribute</structname> stores information about
983    table columns.  There will be exactly one
984    <structname>pg_attribute</structname> row for every column in every
985    table in the database.  (There will also be attribute entries for
986    indexes, and indeed all objects that have <structname>pg_class</structname>
987    entries.)
988   </para>
989
990   <para>
991    The term attribute is equivalent to column and is used for
992    historical reasons.
993   </para>
994
995   <table>
996    <title><structname>pg_attribute</structname> Columns</title>
997
998    <tgroup cols="4">
999     <thead>
1000      <row>
1001       <entry>Name</entry>
1002       <entry>Type</entry>
1003       <entry>References</entry>
1004       <entry>Description</entry>
1005      </row>
1006     </thead>
1007
1008     <tbody>
1009      <row>
1010       <entry><structfield>attrelid</structfield></entry>
1011       <entry><type>oid</type></entry>
1012       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1013       <entry>The table this column belongs to</entry>
1014      </row>
1015
1016      <row>
1017       <entry><structfield>attname</structfield></entry>
1018       <entry><type>name</type></entry>
1019       <entry></entry>
1020       <entry>The column name</entry>
1021      </row>
1022
1023      <row>
1024       <entry><structfield>atttypid</structfield></entry>
1025       <entry><type>oid</type></entry>
1026       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1027       <entry>The data type of this column</entry>
1028      </row>
1029
1030      <row>
1031       <entry><structfield>attstattarget</structfield></entry>
1032       <entry><type>int4</type></entry>
1033       <entry></entry>
1034       <entry>
1035        <structfield>attstattarget</structfield> controls the level of detail
1036        of statistics accumulated for this column by
1037        <xref linkend="sql-analyze"/>.
1038        A zero value indicates that no statistics should be collected.
1039        A negative value says to use the system default statistics target.
1040        The exact meaning of positive values is data type-dependent.
1041        For scalar data types, <structfield>attstattarget</structfield>
1042        is both the target number of <quote>most common values</quote>
1043        to collect, and the target number of histogram bins to create.
1044       </entry>
1045      </row>
1046
1047      <row>
1048       <entry><structfield>attlen</structfield></entry>
1049       <entry><type>int2</type></entry>
1050       <entry></entry>
1051       <entry>
1052        A copy of <literal>pg_type.typlen</literal> of this column's
1053        type
1054       </entry>
1055      </row>
1056
1057      <row>
1058       <entry><structfield>attnum</structfield></entry>
1059       <entry><type>int2</type></entry>
1060       <entry></entry>
1061       <entry>
1062        The number of the column.  Ordinary columns are numbered from 1
1063        up.  System columns, such as <structfield>oid</structfield>,
1064        have (arbitrary) negative numbers.
1065       </entry>
1066      </row>
1067
1068      <row>
1069       <entry><structfield>attndims</structfield></entry>
1070       <entry><type>int4</type></entry>
1071       <entry></entry>
1072       <entry>
1073        Number of dimensions, if the column is an array type; otherwise 0.
1074        (Presently, the number of dimensions of an array is not enforced,
1075        so any nonzero value effectively means <quote>it's an array</quote>.)
1076       </entry>
1077      </row>
1078
1079      <row>
1080       <entry><structfield>attcacheoff</structfield></entry>
1081       <entry><type>int4</type></entry>
1082       <entry></entry>
1083       <entry>
1084        Always -1 in storage, but when loaded into a row descriptor
1085        in memory this might be updated to cache the offset of the attribute
1086        within the row
1087       </entry>
1088      </row>
1089
1090      <row>
1091       <entry><structfield>atttypmod</structfield></entry>
1092       <entry><type>int4</type></entry>
1093       <entry></entry>
1094       <entry>
1095        <structfield>atttypmod</structfield> records type-specific data
1096        supplied at table creation time (for example, the maximum
1097        length of a <type>varchar</type> column).  It is passed to
1098        type-specific input functions and length coercion functions.
1099        The value will generally be -1 for types that do not need <structfield>atttypmod</structfield>.
1100       </entry>
1101      </row>
1102
1103      <row>
1104       <entry><structfield>attbyval</structfield></entry>
1105       <entry><type>bool</type></entry>
1106       <entry></entry>
1107       <entry>
1108        A copy of <literal>pg_type.typbyval</literal> of this column's type
1109       </entry>
1110      </row>
1111
1112      <row>
1113       <entry><structfield>attstorage</structfield></entry>
1114       <entry><type>char</type></entry>
1115       <entry></entry>
1116       <entry>
1117        Normally a copy of <literal>pg_type.typstorage</literal> of this
1118        column's type.  For TOAST-able data types, this can be altered
1119        after column creation to control storage policy.
1120       </entry>
1121      </row>
1122
1123      <row>
1124       <entry><structfield>attalign</structfield></entry>
1125       <entry><type>char</type></entry>
1126       <entry></entry>
1127       <entry>
1128        A copy of <literal>pg_type.typalign</literal> of this column's type
1129       </entry>
1130      </row>
1131
1132      <row>
1133       <entry><structfield>attnotnull</structfield></entry>
1134       <entry><type>bool</type></entry>
1135       <entry></entry>
1136       <entry>
1137        This represents a not-null constraint.
1138       </entry>
1139      </row>
1140
1141      <row>
1142       <entry><structfield>atthasdef</structfield></entry>
1143       <entry><type>bool</type></entry>
1144       <entry></entry>
1145       <entry>
1146        This column has a default value, in which case there will be a
1147        corresponding entry in the <structname>pg_attrdef</structname>
1148        catalog that actually defines the value.
1149       </entry>
1150      </row>
1151
1152      <row>
1153       <entry><structfield>atthasmissing</structfield></entry>
1154       <entry><type>bool</type></entry>
1155       <entry></entry>
1156       <entry>
1157        This column has a value which is used where the column is entirely
1158        missing from the row, as happens when a column is added with a
1159        non-volatile <literal>DEFAULT</literal> value after the row is created.
1160        The actual value used is stored in the
1161        <structfield>attmissingval</structfield> column.
1162       </entry>
1163      </row>
1164
1165      <row>
1166       <entry><structfield>attidentity</structfield></entry>
1167       <entry><type>char</type></entry>
1168       <entry></entry>
1169       <entry>
1170        If a zero byte (<literal>''</literal>), then not an identity column.
1171        Otherwise, <literal>a</literal> = generated
1172        always, <literal>d</literal> = generated by default.
1173       </entry>
1174      </row>
1175
1176      <row>
1177       <entry><structfield>attisdropped</structfield></entry>
1178       <entry><type>bool</type></entry>
1179       <entry></entry>
1180       <entry>
1181        This column has been dropped and is no longer valid.  A dropped
1182        column is still physically present in the table, but is
1183        ignored by the parser and so cannot be accessed via SQL.
1184       </entry>
1185      </row>
1186
1187      <row>
1188       <entry><structfield>attislocal</structfield></entry>
1189       <entry><type>bool</type></entry>
1190       <entry></entry>
1191       <entry>
1192        This column is defined locally in the relation.  Note that a column can
1193        be locally defined and inherited simultaneously.
1194       </entry>
1195      </row>
1196
1197      <row>
1198       <entry><structfield>attinhcount</structfield></entry>
1199       <entry><type>int4</type></entry>
1200       <entry></entry>
1201       <entry>
1202        The number of direct ancestors this column has.  A column with a
1203        nonzero number of ancestors cannot be dropped nor renamed.
1204       </entry>
1205      </row>
1206
1207      <row>
1208       <entry><structfield>attcollation</structfield></entry>
1209       <entry><type>oid</type></entry>
1210       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1211       <entry>
1212        The defined collation of the column, or zero if the column is
1213        not of a collatable data type.
1214       </entry>
1215      </row>
1216
1217      <row>
1218       <entry><structfield>attacl</structfield></entry>
1219       <entry><type>aclitem[]</type></entry>
1220       <entry></entry>
1221       <entry>
1222        Column-level access privileges, if any have been granted specifically
1223        on this column
1224       </entry>
1225      </row>
1226
1227      <row>
1228       <entry><structfield>attoptions</structfield></entry>
1229       <entry><type>text[]</type></entry>
1230       <entry></entry>
1231       <entry>
1232        Attribute-level options, as <quote>keyword=value</quote> strings
1233       </entry>
1234      </row>
1235
1236      <row>
1237       <entry><structfield>attfdwoptions</structfield></entry>
1238       <entry><type>text[]</type></entry>
1239       <entry></entry>
1240       <entry>
1241        Attribute-level foreign data wrapper options, as <quote>keyword=value</quote> strings
1242       </entry>
1243      </row>
1244
1245      <row>
1246       <entry><structfield>attmissingval</structfield></entry>
1247       <entry><type>anyarray</type></entry>
1248       <entry></entry>
1249       <entry>
1250        This column has a one element array containing the value used when the
1251        column is entirely missing from the row, as happens when the column is
1252        added with a non-volatile <literal>DEFAULT</literal> value after the
1253        row is created.  The value is only used when
1254        <structfield>atthasmissing</structfield> is true.  If there is no value
1255        the column is null.
1256       </entry>
1257      </row>
1258
1259     </tbody>
1260    </tgroup>
1261   </table>
1262
1263   <para>
1264    In a dropped column's <structname>pg_attribute</structname> entry,
1265    <structfield>atttypid</structfield> is reset to zero, but
1266    <structfield>attlen</structfield> and the other fields copied from
1267    <structname>pg_type</structname> are still valid.  This arrangement is needed
1268    to cope with the situation where the dropped column's data type was
1269    later dropped, and so there is no <structname>pg_type</structname> row anymore.
1270    <structfield>attlen</structfield> and the other fields can be used
1271    to interpret the contents of a row of the table.
1272   </para>
1273  </sect1>
1274
1275
1276  <sect1 id="catalog-pg-authid">
1277   <title><structname>pg_authid</structname></title>
1278
1279   <indexterm zone="catalog-pg-authid">
1280    <primary>pg_authid</primary>
1281   </indexterm>
1282
1283   <para>
1284    The catalog <structname>pg_authid</structname> contains information about
1285    database authorization identifiers (roles).  A role subsumes the concepts
1286    of <quote>users</quote> and <quote>groups</quote>.  A user is essentially just a
1287    role with the <structfield>rolcanlogin</structfield> flag set.  Any role (with or
1288    without <structfield>rolcanlogin</structfield>) can have other roles as members; see
1289    <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1290   </para>
1291
1292   <para>
1293    Since this catalog contains passwords, it must not be publicly readable.
1294    <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1295    is a publicly readable view on
1296    <structname>pg_authid</structname> that blanks out the password field.
1297   </para>
1298
1299   <para>
1300    <xref linkend="user-manag"/> contains detailed information about user and
1301    privilege management.
1302   </para>
1303
1304   <para>
1305    Because user identities are cluster-wide,
1306    <structname>pg_authid</structname>
1307    is shared across all databases of a cluster: there is only one
1308    copy of <structname>pg_authid</structname> per cluster, not
1309    one per database.
1310   </para>
1311
1312   <table>
1313    <title><structname>pg_authid</structname> Columns</title>
1314
1315    <tgroup cols="3">
1316     <thead>
1317      <row>
1318       <entry>Name</entry>
1319       <entry>Type</entry>
1320       <entry>Description</entry>
1321      </row>
1322     </thead>
1323
1324     <tbody>
1325
1326      <row>
1327       <entry><structfield>oid</structfield></entry>
1328       <entry><type>oid</type></entry>
1329       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1330      </row>
1331
1332      <row>
1333       <entry><structfield>rolname</structfield></entry>
1334       <entry><type>name</type></entry>
1335       <entry>Role name</entry>
1336      </row>
1337
1338      <row>
1339       <entry><structfield>rolsuper</structfield></entry>
1340       <entry><type>bool</type></entry>
1341       <entry>Role has superuser privileges</entry>
1342      </row>
1343
1344      <row>
1345       <entry><structfield>rolinherit</structfield></entry>
1346       <entry><type>bool</type></entry>
1347       <entry>Role automatically inherits privileges of roles it is a
1348        member of</entry>
1349      </row>
1350
1351      <row>
1352       <entry><structfield>rolcreaterole</structfield></entry>
1353       <entry><type>bool</type></entry>
1354       <entry>Role can create more roles</entry>
1355      </row>
1356
1357      <row>
1358       <entry><structfield>rolcreatedb</structfield></entry>
1359       <entry><type>bool</type></entry>
1360       <entry>Role can create databases</entry>
1361      </row>
1362
1363      <row>
1364       <entry><structfield>rolcanlogin</structfield></entry>
1365       <entry><type>bool</type></entry>
1366       <entry>
1367        Role can log in. That is, this role can be given as the initial
1368        session authorization identifier
1369       </entry>
1370      </row>
1371
1372      <row>
1373       <entry><structfield>rolreplication</structfield></entry>
1374       <entry><type>bool</type></entry>
1375       <entry>
1376        Role is a replication role. A replication role can initiate replication
1377        connections and create and drop replication slots.
1378       </entry>
1379      </row>
1380
1381      <row>
1382       <entry><structfield>rolbypassrls</structfield></entry>
1383       <entry><type>bool</type></entry>
1384       <entry>
1385        Role bypasses every row level security policy, see
1386        <xref linkend="ddl-rowsecurity"/> for more information.
1387       </entry>
1388      </row>
1389
1390      <row>
1391       <entry><structfield>rolconnlimit</structfield></entry>
1392       <entry><type>int4</type></entry>
1393       <entry>
1394        For roles that can log in, this sets maximum number of concurrent
1395        connections this role can make.  -1 means no limit.
1396       </entry>
1397      </row>
1398
1399      <row>
1400       <entry><structfield>rolpassword</structfield></entry>
1401       <entry><type>text</type></entry>
1402       <entry>
1403        Password (possibly encrypted); null if none. The format depends
1404        on the form of encryption used.
1405       </entry>
1406      </row>
1407
1408      <row>
1409       <entry><structfield>rolvaliduntil</structfield></entry>
1410       <entry><type>timestamptz</type></entry>
1411       <entry>Password expiry time (only used for password authentication);
1412        null if no expiration</entry>
1413      </row>
1414     </tbody>
1415    </tgroup>
1416   </table>
1417
1418   <para>
1419    For an MD5 encrypted password, <structfield>rolpassword</structfield>
1420    column will begin with the string <literal>md5</literal> followed by a
1421    32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
1422    password concatenated to their user name. For example, if user
1423    <literal>joe</literal> has password <literal>xyzzy</literal>, <productname>PostgreSQL</productname>
1424    will store the md5 hash of <literal>xyzzyjoe</literal>.
1425   </para>
1426
1427   <para>
1428    If the password is encrypted with SCRAM-SHA-256, it has the format:
1429 <synopsis>
1430 SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&lt;salt&gt;</replaceable>$<replaceable>&lt;StoredKey&gt;</replaceable>:<replaceable>&lt;ServerKey&gt;</replaceable>
1431 </synopsis>
1432    where <replaceable>salt</replaceable>, <replaceable>StoredKey</replaceable> and
1433    <replaceable>ServerKey</replaceable> are in Base64 encoded format. This format is
1434    the same as that specified by RFC 5803.
1435   </para>
1436
1437   <para>
1438     A password that does not follow either of those formats is assumed to be
1439     unencrypted.
1440   </para>
1441  </sect1>
1442
1443
1444  <sect1 id="catalog-pg-auth-members">
1445   <title><structname>pg_auth_members</structname></title>
1446
1447   <indexterm zone="catalog-pg-auth-members">
1448    <primary>pg_auth_members</primary>
1449   </indexterm>
1450
1451   <para>
1452    The catalog <structname>pg_auth_members</structname> shows the membership
1453    relations between roles.  Any non-circular set of relationships is allowed.
1454   </para>
1455
1456   <para>
1457    Because user identities are cluster-wide,
1458    <structname>pg_auth_members</structname>
1459    is shared across all databases of a cluster: there is only one
1460    copy of <structname>pg_auth_members</structname> per cluster, not
1461    one per database.
1462   </para>
1463
1464   <table>
1465    <title><structname>pg_auth_members</structname> Columns</title>
1466
1467    <tgroup cols="4">
1468     <thead>
1469      <row>
1470       <entry>Name</entry>
1471       <entry>Type</entry>
1472       <entry>References</entry>
1473       <entry>Description</entry>
1474      </row>
1475     </thead>
1476
1477     <tbody>
1478      <row>
1479       <entry><structfield>roleid</structfield></entry>
1480       <entry><type>oid</type></entry>
1481       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1482       <entry>ID of a role that has a member</entry>
1483      </row>
1484
1485      <row>
1486       <entry><structfield>member</structfield></entry>
1487       <entry><type>oid</type></entry>
1488       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1489       <entry>ID of a role that is a member of <structfield>roleid</structfield></entry>
1490      </row>
1491
1492      <row>
1493       <entry><structfield>grantor</structfield></entry>
1494       <entry><type>oid</type></entry>
1495       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1496       <entry>ID of the role that granted this membership</entry>
1497      </row>
1498
1499      <row>
1500       <entry><structfield>admin_option</structfield></entry>
1501       <entry><type>bool</type></entry>
1502       <entry></entry>
1503       <entry>True if <structfield>member</structfield> can grant membership in
1504        <structfield>roleid</structfield> to others</entry>
1505      </row>
1506     </tbody>
1507    </tgroup>
1508   </table>
1509
1510  </sect1>
1511
1512
1513  <sect1 id="catalog-pg-cast">
1514   <title><structname>pg_cast</structname></title>
1515
1516   <indexterm zone="catalog-pg-cast">
1517    <primary>pg_cast</primary>
1518   </indexterm>
1519
1520   <para>
1521    The catalog <structname>pg_cast</structname> stores data type conversion
1522    paths, both built-in and user-defined.
1523   </para>
1524
1525   <para>
1526    It should be noted that <structname>pg_cast</structname> does not represent
1527    every type conversion that the system knows how to perform; only those that
1528    cannot be deduced from some generic rule.  For example, casting between a
1529    domain and its base type is not explicitly represented in
1530    <structname>pg_cast</structname>.  Another important exception is that
1531    <quote>automatic I/O conversion casts</quote>, those performed using a data
1532    type's own I/O functions to convert to or from <type>text</type> or other
1533    string types, are not explicitly represented in
1534    <structname>pg_cast</structname>.
1535   </para>
1536
1537   <table>
1538    <title><structname>pg_cast</structname> Columns</title>
1539
1540    <tgroup cols="4">
1541     <thead>
1542      <row>
1543       <entry>Name</entry>
1544       <entry>Type</entry>
1545       <entry>References</entry>
1546       <entry>Description</entry>
1547      </row>
1548     </thead>
1549
1550     <tbody>
1551      <row>
1552       <entry><structfield>oid</structfield></entry>
1553       <entry><type>oid</type></entry>
1554       <entry></entry>
1555       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1556      </row>
1557
1558      <row>
1559       <entry><structfield>castsource</structfield></entry>
1560       <entry><type>oid</type></entry>
1561       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1562       <entry>OID of the source data type</entry>
1563      </row>
1564
1565      <row>
1566       <entry><structfield>casttarget</structfield></entry>
1567       <entry><type>oid</type></entry>
1568       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1569       <entry>OID of the target data type</entry>
1570      </row>
1571
1572      <row>
1573       <entry><structfield>castfunc</structfield></entry>
1574       <entry><type>oid</type></entry>
1575       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1576       <entry>
1577        The OID of the function to use to perform this cast.  Zero is
1578        stored if the cast method doesn't require a function.
1579       </entry>
1580      </row>
1581
1582      <row>
1583       <entry><structfield>castcontext</structfield></entry>
1584       <entry><type>char</type></entry>
1585       <entry></entry>
1586       <entry>
1587        Indicates what contexts the cast can be invoked in.
1588        <literal>e</literal> means only as an explicit cast (using
1589        <literal>CAST</literal> or <literal>::</literal> syntax).
1590        <literal>a</literal> means implicitly in assignment
1591        to a target column, as well as explicitly.
1592        <literal>i</literal> means implicitly in expressions, as well as the
1593        other cases.
1594       </entry>
1595      </row>
1596      <row>
1597       <entry><structfield>castmethod</structfield></entry>
1598       <entry><type>char</type></entry>
1599       <entry></entry>
1600       <entry>
1601        Indicates how the cast is performed.
1602        <literal>f</literal> means that the function specified in the <structfield>castfunc</structfield> field is used.
1603        <literal>i</literal> means that the input/output functions are used.
1604        <literal>b</literal> means that the types are binary-coercible, thus no conversion is required.
1605       </entry>
1606      </row>
1607     </tbody>
1608    </tgroup>
1609   </table>
1610
1611   <para>
1612    The cast functions listed in <structname>pg_cast</structname> must
1613    always take the cast source type as their first argument type, and
1614    return the cast destination type as their result type.  A cast
1615    function can have up to three arguments.  The second argument,
1616    if present, must be type <type>integer</type>; it receives the type
1617    modifier associated with the destination type, or -1
1618    if there is none.  The third argument,
1619    if present, must be type <type>boolean</type>; it receives <literal>true</literal>
1620    if the cast is an explicit cast, <literal>false</literal> otherwise.
1621   </para>
1622
1623   <para>
1624    It is legitimate to create a <structname>pg_cast</structname> entry
1625    in which the source and target types are the same, if the associated
1626    function takes more than one argument.  Such entries represent
1627    <quote>length coercion functions</quote> that coerce values of the type
1628    to be legal for a particular type modifier value.
1629   </para>
1630
1631   <para>
1632    When a <structname>pg_cast</structname> entry has different source and
1633    target types and a function that takes more than one argument, it
1634    represents converting from one type to another and applying a length
1635    coercion in a single step.  When no such entry is available, coercion
1636    to a type that uses a type modifier involves two steps, one to
1637    convert between data types and a second to apply the modifier.
1638   </para>
1639  </sect1>
1640
1641  <sect1 id="catalog-pg-class">
1642   <title><structname>pg_class</structname></title>
1643
1644   <indexterm zone="catalog-pg-class">
1645    <primary>pg_class</primary>
1646   </indexterm>
1647
1648   <para>
1649    The catalog <structname>pg_class</structname> catalogs tables and most
1650    everything else that has columns or is otherwise similar to a
1651    table.  This includes indexes (but see also
1652    <structname>pg_index</structname>), sequences (but see also
1653    <structname>pg_sequence</structname>), views, materialized
1654    views, composite types, and TOAST tables; see <structfield>relkind</structfield>.
1655    Below, when we mean all of these
1656    kinds of objects we speak of <quote>relations</quote>.  Not all
1657    columns are meaningful for all relation types.
1658   </para>
1659
1660   <table>
1661    <title><structname>pg_class</structname> Columns</title>
1662
1663    <tgroup cols="4">
1664     <thead>
1665      <row>
1666       <entry>Name</entry>
1667       <entry>Type</entry>
1668       <entry>References</entry>
1669       <entry>Description</entry>
1670      </row>
1671     </thead>
1672
1673     <tbody>
1674      <row>
1675       <entry><structfield>oid</structfield></entry>
1676       <entry><type>oid</type></entry>
1677       <entry></entry>
1678       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1679      </row>
1680
1681      <row>
1682       <entry><structfield>relname</structfield></entry>
1683       <entry><type>name</type></entry>
1684       <entry></entry>
1685       <entry>Name of the table, index, view, etc.</entry>
1686      </row>
1687
1688      <row>
1689       <entry><structfield>relnamespace</structfield></entry>
1690       <entry><type>oid</type></entry>
1691       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1692       <entry>
1693        The OID of the namespace that contains this relation
1694       </entry>
1695      </row>
1696
1697      <row>
1698       <entry><structfield>reltype</structfield></entry>
1699       <entry><type>oid</type></entry>
1700       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1701       <entry>
1702        The OID of the data type that corresponds to this table's row type,
1703        if any (zero for indexes, which have no <structname>pg_type</structname> entry)
1704       </entry>
1705      </row>
1706
1707      <row>
1708       <entry><structfield>reloftype</structfield></entry>
1709       <entry><type>oid</type></entry>
1710       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1711       <entry>
1712        For typed tables, the OID of the underlying composite type,
1713        zero for all other relations
1714       </entry>
1715      </row>
1716
1717      <row>
1718       <entry><structfield>relowner</structfield></entry>
1719       <entry><type>oid</type></entry>
1720       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1721       <entry>Owner of the relation</entry>
1722      </row>
1723
1724      <row>
1725       <entry><structfield>relam</structfield></entry>
1726       <entry><type>oid</type></entry>
1727       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1728       <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1729      </row>
1730
1731      <row>
1732       <entry><structfield>relfilenode</structfield></entry>
1733       <entry><type>oid</type></entry>
1734       <entry></entry>
1735       <entry>Name of the on-disk file of this relation; zero means this
1736        is a <quote>mapped</quote> relation whose disk file name is determined
1737        by low-level state</entry>
1738      </row>
1739
1740      <row>
1741       <entry><structfield>reltablespace</structfield></entry>
1742       <entry><type>oid</type></entry>
1743       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1744       <entry>
1745        The tablespace in which this relation is stored.  If zero,
1746        the database's default tablespace is implied.  (Not meaningful
1747        if the relation has no on-disk file.)
1748       </entry>
1749      </row>
1750
1751      <row>
1752       <entry><structfield>relpages</structfield></entry>
1753       <entry><type>int4</type></entry>
1754       <entry></entry>
1755       <entry>
1756        Size of the on-disk representation of this table in pages (of size
1757        <symbol>BLCKSZ</symbol>).  This is only an estimate used by the
1758        planner.  It is updated by <command>VACUUM</command>,
1759        <command>ANALYZE</command>, and a few DDL commands such as
1760        <command>CREATE INDEX</command>.
1761       </entry>
1762      </row>
1763
1764      <row>
1765       <entry><structfield>reltuples</structfield></entry>
1766       <entry><type>float4</type></entry>
1767       <entry></entry>
1768       <entry>
1769        Number of live rows in the table.  This is only an estimate used by
1770        the planner.  It is updated by <command>VACUUM</command>,
1771        <command>ANALYZE</command>, and a few DDL commands such as
1772        <command>CREATE INDEX</command>.
1773       </entry>
1774      </row>
1775
1776      <row>
1777       <entry><structfield>relallvisible</structfield></entry>
1778       <entry><type>int4</type></entry>
1779       <entry></entry>
1780       <entry>
1781        Number of pages that are marked all-visible in the table's
1782        visibility map.  This is only an estimate used by the
1783        planner.  It is updated by <command>VACUUM</command>,
1784        <command>ANALYZE</command>, and a few DDL commands such as
1785        <command>CREATE INDEX</command>.
1786       </entry>
1787      </row>
1788
1789      <row>
1790       <entry><structfield>reltoastrelid</structfield></entry>
1791       <entry><type>oid</type></entry>
1792       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1793       <entry>
1794        OID of the TOAST table associated with this table, 0 if none.  The
1795        TOAST table stores large attributes <quote>out of line</quote> in a
1796        secondary table.
1797       </entry>
1798      </row>
1799
1800      <row>
1801       <entry><structfield>relhasindex</structfield></entry>
1802       <entry><type>bool</type></entry>
1803       <entry></entry>
1804       <entry>
1805        True if this is a table and it has (or recently had) any indexes
1806       </entry>
1807      </row>
1808
1809      <row>
1810       <entry><structfield>relisshared</structfield></entry>
1811       <entry><type>bool</type></entry>
1812       <entry></entry>
1813       <entry>
1814        True if this table is shared across all databases in the cluster.  Only
1815        certain system catalogs (such as <structname>pg_database</structname>)
1816        are shared.
1817       </entry>
1818      </row>
1819
1820      <row>
1821       <entry><structfield>relpersistence</structfield></entry>
1822       <entry><type>char</type></entry>
1823       <entry></entry>
1824       <entry>
1825        <literal>p</literal> = permanent table, <literal>u</literal> = unlogged table,
1826        <literal>t</literal> = temporary table
1827       </entry>
1828      </row>
1829
1830      <row>
1831       <entry><structfield>relkind</structfield></entry>
1832       <entry><type>char</type></entry>
1833       <entry></entry>
1834       <entry>
1835        <literal>r</literal> = ordinary table,
1836        <literal>i</literal> = index,
1837        <literal>S</literal> = sequence,
1838        <literal>t</literal> = TOAST table,
1839        <literal>v</literal> = view,
1840        <literal>m</literal> = materialized view,
1841        <literal>c</literal> = composite type,
1842        <literal>f</literal> = foreign table,
1843        <literal>p</literal> = partitioned table
1844       </entry>
1845      </row>
1846
1847      <row>
1848       <entry><structfield>relnatts</structfield></entry>
1849       <entry><type>int2</type></entry>
1850       <entry></entry>
1851       <entry>
1852        Number of user columns in the relation (system columns not
1853        counted).  There must be this many corresponding entries in
1854        <structname>pg_attribute</structname>.  See also
1855        <literal>pg_attribute.attnum</literal>.
1856       </entry>
1857      </row>
1858
1859      <row>
1860       <entry><structfield>relchecks</structfield></entry>
1861       <entry><type>int2</type></entry>
1862       <entry></entry>
1863       <entry>
1864        Number of <literal>CHECK</literal> constraints on the table; see
1865        <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1866       </entry>
1867      </row>
1868
1869      <row>
1870       <entry><structfield>relhasoids</structfield></entry>
1871       <entry><type>bool</type></entry>
1872       <entry></entry>
1873       <entry>
1874        True if we generate an OID for each row of the relation
1875       </entry>
1876      </row>
1877
1878      <row>
1879       <entry><structfield>relhasrules</structfield></entry>
1880       <entry><type>bool</type></entry>
1881       <entry></entry>
1882       <entry>
1883        True if table has (or once had) rules; see
1884        <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1885       </entry>
1886      </row>
1887
1888      <row>
1889       <entry><structfield>relhastriggers</structfield></entry>
1890       <entry><type>bool</type></entry>
1891       <entry></entry>
1892       <entry>
1893        True if table has (or once had) triggers; see
1894        <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1895       </entry>
1896      </row>
1897
1898      <row>
1899       <entry><structfield>relhassubclass</structfield></entry>
1900       <entry><type>bool</type></entry>
1901       <entry></entry>
1902       <entry>True if table has (or once had) any inheritance children</entry>
1903      </row>
1904
1905      <row>
1906       <entry><structfield>relrowsecurity</structfield></entry>
1907       <entry><type>bool</type></entry>
1908       <entry></entry>
1909       <entry>
1910        True if table has row level security enabled; see
1911        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1912       </entry>
1913      </row>
1914
1915      <row>
1916       <entry><structfield>relforcerowsecurity</structfield></entry>
1917       <entry><type>bool</type></entry>
1918       <entry></entry>
1919       <entry>
1920        True if row level security (when enabled) will also apply to table owner; see
1921        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1922       </entry>
1923      </row>
1924
1925      <row>
1926       <entry><structfield>relispopulated</structfield></entry>
1927       <entry><type>bool</type></entry>
1928       <entry></entry>
1929       <entry>True if relation is populated (this is true for all
1930        relations other than some materialized views)</entry>
1931      </row>
1932
1933      <row>
1934       <entry><structfield>relreplident</structfield></entry>
1935       <entry><type>char</type></entry>
1936       <entry></entry>
1937       <entry>
1938        Columns used to form <quote>replica identity</quote> for rows:
1939        <literal>d</literal> = default (primary key, if any),
1940        <literal>n</literal> = nothing,
1941        <literal>f</literal> = all columns
1942        <literal>i</literal> = index with <structfield>indisreplident</structfield> set, or default
1943       </entry>
1944      </row>
1945
1946      <row>
1947       <entry><structfield>relispartition</structfield></entry>
1948       <entry><type>bool</type></entry>
1949       <entry></entry>
1950       <entry>True if table is a partition</entry>
1951      </row>
1952
1953      <row>
1954       <entry><structfield>relrewrite</structfield></entry>
1955       <entry><type>oid</type></entry>
1956       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1957       <entry>
1958        For new relations being written during a DDL operation that requires a
1959        table rewrite, this contains the OID of the original relation;
1960        otherwise 0.  That state is only visible internally; this field should
1961        never contain anything other than 0 for a user-visible relation.
1962       </entry>
1963      </row>
1964
1965      <row>
1966       <entry><structfield>relfrozenxid</structfield></entry>
1967       <entry><type>xid</type></entry>
1968       <entry></entry>
1969       <entry>
1970        All transaction IDs before this one have been replaced with a permanent
1971        (<quote>frozen</quote>) transaction ID in this table.  This is used to track
1972        whether the table needs to be vacuumed in order to prevent transaction
1973        ID wraparound or to allow <literal>pg_xact</literal> to be shrunk.  Zero
1974        (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1975       </entry>
1976      </row>
1977
1978      <row>
1979       <entry><structfield>relminmxid</structfield></entry>
1980       <entry><type>xid</type></entry>
1981       <entry></entry>
1982       <entry>
1983        All multixact IDs before this one have been replaced by a
1984        transaction ID in this table.  This is used to track
1985        whether the table needs to be vacuumed in order to prevent multixact ID
1986        wraparound or to allow <literal>pg_multixact</literal> to be shrunk.  Zero
1987        (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1988       </entry>
1989      </row>
1990
1991      <row>
1992       <entry><structfield>relacl</structfield></entry>
1993       <entry><type>aclitem[]</type></entry>
1994       <entry></entry>
1995       <entry>
1996        Access privileges; see
1997        <xref linkend="sql-grant"/> and
1998        <xref linkend="sql-revoke"/>
1999        for details
2000       </entry>
2001      </row>
2002
2003      <row>
2004       <entry><structfield>reloptions</structfield></entry>
2005       <entry><type>text[]</type></entry>
2006       <entry></entry>
2007       <entry>
2008        Access-method-specific options, as <quote>keyword=value</quote> strings
2009       </entry>
2010      </row>
2011
2012      <row>
2013       <entry><structfield>relpartbound</structfield></entry>
2014       <entry><type>pg_node_tree</type></entry>
2015       <entry></entry>
2016       <entry>
2017        If table is a partition (see <structfield>relispartition</structfield>),
2018        internal representation of the partition bound
2019       </entry>
2020      </row>
2021     </tbody>
2022    </tgroup>
2023   </table>
2024
2025   <para>
2026    Several of the Boolean flags in <structname>pg_class</structname> are maintained
2027    lazily: they are guaranteed to be true if that's the correct state, but
2028    may not be reset to false immediately when the condition is no longer
2029    true.  For example, <structfield>relhasindex</structfield> is set by
2030    <command>CREATE INDEX</command>, but it is never cleared by
2031    <command>DROP INDEX</command>.  Instead, <command>VACUUM</command> clears
2032    <structfield>relhasindex</structfield> if it finds the table has no indexes.  This
2033    arrangement avoids race conditions and improves concurrency.
2034   </para>
2035  </sect1>
2036
2037  <sect1 id="catalog-pg-collation">
2038   <title><structname>pg_collation</structname></title>
2039
2040   <indexterm zone="catalog-pg-collation">
2041    <primary>pg_collation</primary>
2042   </indexterm>
2043
2044   <para>
2045    The catalog <structname>pg_collation</structname> describes the
2046    available collations, which are essentially mappings from an SQL
2047    name to operating system locale categories.
2048    See <xref linkend="collation"/> for more information.
2049   </para>
2050
2051   <table>
2052    <title><structname>pg_collation</structname> Columns</title>
2053
2054    <tgroup cols="4">
2055     <thead>
2056      <row>
2057       <entry>Name</entry>
2058       <entry>Type</entry>
2059       <entry>References</entry>
2060       <entry>Description</entry>
2061      </row>
2062     </thead>
2063
2064     <tbody>
2065      <row>
2066       <entry><structfield>oid</structfield></entry>
2067       <entry><type>oid</type></entry>
2068       <entry></entry>
2069       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2070      </row>
2071
2072      <row>
2073       <entry><structfield>collname</structfield></entry>
2074       <entry><type>name</type></entry>
2075       <entry></entry>
2076       <entry>Collation name (unique per namespace and encoding)</entry>
2077      </row>
2078
2079      <row>
2080       <entry><structfield>collnamespace</structfield></entry>
2081       <entry><type>oid</type></entry>
2082       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2083       <entry>
2084        The OID of the namespace that contains this collation
2085       </entry>
2086      </row>
2087
2088      <row>
2089       <entry><structfield>collowner</structfield></entry>
2090       <entry><type>oid</type></entry>
2091       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2092       <entry>Owner of the collation</entry>
2093      </row>
2094
2095      <row>
2096       <entry><structfield>collprovider</structfield></entry>
2097       <entry><type>char</type></entry>
2098       <entry></entry>
2099       <entry>Provider of the collation: <literal>d</literal> = database
2100        default, <literal>c</literal> = libc, <literal>i</literal> = icu</entry>
2101      </row>
2102
2103      <row>
2104       <entry><structfield>collencoding</structfield></entry>
2105       <entry><type>int4</type></entry>
2106       <entry></entry>
2107       <entry>Encoding in which the collation is applicable, or -1 if it
2108        works for any encoding</entry>
2109      </row>
2110
2111      <row>
2112       <entry><structfield>collcollate</structfield></entry>
2113       <entry><type>name</type></entry>
2114       <entry></entry>
2115       <entry><symbol>LC_COLLATE</symbol> for this collation object</entry>
2116      </row>
2117
2118      <row>
2119       <entry><structfield>collctype</structfield></entry>
2120       <entry><type>name</type></entry>
2121       <entry></entry>
2122       <entry><symbol>LC_CTYPE</symbol> for this collation object</entry>
2123      </row>
2124
2125      <row>
2126       <entry><structfield>collversion</structfield></entry>
2127       <entry><type>text</type></entry>
2128       <entry></entry>
2129       <entry>
2130        Provider-specific version of the collation.  This is recorded when the
2131        collation is created and then checked when it is used, to detect
2132        changes in the collation definition that could lead to data corruption.
2133       </entry>
2134      </row>
2135     </tbody>
2136    </tgroup>
2137   </table>
2138
2139   <para>
2140    Note that the unique key on this catalog is (<structfield>collname</structfield>,
2141    <structfield>collencoding</structfield>, <structfield>collnamespace</structfield>) not just
2142    (<structfield>collname</structfield>, <structfield>collnamespace</structfield>).
2143    <productname>PostgreSQL</productname> generally ignores all
2144    collations that do not have <structfield>collencoding</structfield> equal to
2145    either the current database's encoding or -1, and creation of new entries
2146    with the same name as an entry with <structfield>collencoding</structfield> = -1
2147    is forbidden.  Therefore it is sufficient to use a qualified SQL name
2148    (<replaceable>schema</replaceable>.<replaceable>name</replaceable>) to identify a collation,
2149    even though this is not unique according to the catalog definition.
2150    The reason for defining the catalog this way is that
2151    <application>initdb</application> fills it in at cluster initialization time with
2152    entries for all locales available on the system, so it must be able to
2153    hold entries for all encodings that might ever be used in the cluster.
2154   </para>
2155
2156   <para>
2157    In the <literal>template0</literal> database, it could be useful to create
2158    collations whose encoding does not match the database encoding,
2159    since they could match the encodings of databases later cloned from
2160    <literal>template0</literal>.  This would currently have to be done manually.
2161   </para>
2162  </sect1>
2163
2164  <sect1 id="catalog-pg-constraint">
2165   <title><structname>pg_constraint</structname></title>
2166
2167   <indexterm zone="catalog-pg-constraint">
2168    <primary>pg_constraint</primary>
2169   </indexterm>
2170
2171   <para>
2172    The catalog <structname>pg_constraint</structname> stores check, primary
2173    key, unique, foreign key, and exclusion constraints on tables.
2174    (Column constraints are not treated specially.  Every column constraint is
2175    equivalent to some table constraint.)
2176    Not-null constraints are represented in the <structname>pg_attribute</structname>
2177    catalog, not here.
2178   </para>
2179
2180   <para>
2181    User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2182    TRIGGER</command>) also give rise to an entry in this table.
2183   </para>
2184
2185   <para>
2186    Check constraints on domains are stored here, too.
2187   </para>
2188
2189   <table>
2190    <title><structname>pg_constraint</structname> Columns</title>
2191
2192    <tgroup cols="4">
2193     <thead>
2194      <row>
2195       <entry>Name</entry>
2196       <entry>Type</entry>
2197       <entry>References</entry>
2198       <entry>Description</entry>
2199      </row>
2200     </thead>
2201
2202     <tbody>
2203      <row>
2204       <entry><structfield>oid</structfield></entry>
2205       <entry><type>oid</type></entry>
2206       <entry></entry>
2207       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2208      </row>
2209
2210      <row>
2211       <entry><structfield>conname</structfield></entry>
2212       <entry><type>name</type></entry>
2213       <entry></entry>
2214       <entry>Constraint name (not necessarily unique!)</entry>
2215      </row>
2216
2217      <row>
2218       <entry><structfield>connamespace</structfield></entry>
2219       <entry><type>oid</type></entry>
2220       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2221       <entry>
2222        The OID of the namespace that contains this constraint
2223       </entry>
2224      </row>
2225
2226      <row>
2227       <entry><structfield>contype</structfield></entry>
2228       <entry><type>char</type></entry>
2229       <entry></entry>
2230       <entry>
2231         <literal>c</literal> = check constraint,
2232         <literal>f</literal> = foreign key constraint,
2233         <literal>p</literal> = primary key constraint,
2234         <literal>u</literal> = unique constraint,
2235         <literal>t</literal> = constraint trigger,
2236         <literal>x</literal> = exclusion constraint
2237       </entry>
2238      </row>
2239
2240      <row>
2241       <entry><structfield>condeferrable</structfield></entry>
2242       <entry><type>bool</type></entry>
2243       <entry></entry>
2244       <entry>Is the constraint deferrable?</entry>
2245      </row>
2246
2247      <row>
2248       <entry><structfield>condeferred</structfield></entry>
2249       <entry><type>bool</type></entry>
2250       <entry></entry>
2251       <entry>Is the constraint deferred by default?</entry>
2252      </row>
2253
2254      <row>
2255       <entry><structfield>convalidated</structfield></entry>
2256       <entry><type>bool</type></entry>
2257       <entry></entry>
2258       <entry>Has the constraint been validated?
2259        Currently, can only be false for foreign keys and CHECK constraints</entry>
2260      </row>
2261
2262      <row>
2263       <entry><structfield>conrelid</structfield></entry>
2264       <entry><type>oid</type></entry>
2265       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2266       <entry>The table this constraint is on; 0 if not a table constraint</entry>
2267      </row>
2268
2269      <row>
2270       <entry><structfield>contypid</structfield></entry>
2271       <entry><type>oid</type></entry>
2272       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2273       <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2274      </row>
2275
2276      <row>
2277       <entry><structfield>conindid</structfield></entry>
2278       <entry><type>oid</type></entry>
2279       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2280       <entry>The index supporting this constraint, if it's a unique, primary
2281        key, foreign key, or exclusion constraint; else 0</entry>
2282      </row>
2283
2284      <row>
2285       <entry><structfield>conparentid</structfield></entry>
2286       <entry><type>oid</type></entry>
2287       <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
2288       <entry>The corresponding constraint in the parent partitioned table,
2289        if this is a constraint in a partition; else 0</entry>
2290      </row>
2291
2292      <row>
2293       <entry><structfield>confrelid</structfield></entry>
2294       <entry><type>oid</type></entry>
2295       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2296       <entry>If a foreign key, the referenced table; else 0</entry>
2297      </row>
2298
2299      <row>
2300       <entry><structfield>confupdtype</structfield></entry>
2301       <entry><type>char</type></entry>
2302       <entry></entry>
2303       <entry>Foreign key update action code:
2304             <literal>a</literal> = no action,
2305             <literal>r</literal> = restrict,
2306             <literal>c</literal> = cascade,
2307             <literal>n</literal> = set null,
2308             <literal>d</literal> = set default
2309           </entry>
2310      </row>
2311
2312      <row>
2313       <entry><structfield>confdeltype</structfield></entry>
2314       <entry><type>char</type></entry>
2315       <entry></entry>
2316       <entry>Foreign key deletion action code:
2317             <literal>a</literal> = no action,
2318             <literal>r</literal> = restrict,
2319             <literal>c</literal> = cascade,
2320             <literal>n</literal> = set null,
2321             <literal>d</literal> = set default
2322           </entry>
2323      </row>
2324
2325      <row>
2326       <entry><structfield>confmatchtype</structfield></entry>
2327       <entry><type>char</type></entry>
2328       <entry></entry>
2329       <entry>Foreign key match type:
2330             <literal>f</literal> = full,
2331             <literal>p</literal> = partial,
2332             <literal>s</literal> = simple
2333           </entry>
2334      </row>
2335
2336      <row>
2337       <entry><structfield>conislocal</structfield></entry>
2338       <entry><type>bool</type></entry>
2339       <entry></entry>
2340       <entry>
2341        This constraint is defined locally for the relation.  Note that a
2342        constraint can be locally defined and inherited simultaneously.
2343       </entry>
2344      </row>
2345
2346      <row>
2347       <entry><structfield>coninhcount</structfield></entry>
2348       <entry><type>int4</type></entry>
2349       <entry></entry>
2350       <entry>
2351        The number of direct inheritance ancestors this constraint has.
2352        A constraint with
2353        a nonzero number of ancestors cannot be dropped nor renamed.
2354       </entry>
2355      </row>
2356
2357      <row>
2358       <entry><structfield>connoinherit</structfield></entry>
2359       <entry><type>bool</type></entry>
2360       <entry></entry>
2361       <entry>
2362        This constraint is defined locally for the relation.  It is a
2363        non-inheritable constraint.
2364       </entry>
2365      </row>
2366
2367      <row>
2368       <entry><structfield>conkey</structfield></entry>
2369       <entry><type>int2[]</type></entry>
2370       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2371       <entry>If a table constraint (including foreign keys, but not constraint
2372        triggers), list of the constrained columns</entry>
2373      </row>
2374
2375      <row>
2376       <entry><structfield>confkey</structfield></entry>
2377       <entry><type>int2[]</type></entry>
2378       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2379       <entry>If a foreign key, list of the referenced columns</entry>
2380      </row>
2381
2382      <row>
2383       <entry><structfield>conpfeqop</structfield></entry>
2384       <entry><type>oid[]</type></entry>
2385       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
2386       <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2387      </row>
2388
2389      <row>
2390       <entry><structfield>conppeqop</structfield></entry>
2391       <entry><type>oid[]</type></entry>
2392       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
2393       <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2394      </row>
2395
2396      <row>
2397       <entry><structfield>conffeqop</structfield></entry>
2398       <entry><type>oid[]</type></entry>
2399       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
2400       <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2401      </row>
2402
2403      <row>
2404       <entry><structfield>conexclop</structfield></entry>
2405       <entry><type>oid[]</type></entry>
2406       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
2407       <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2408      </row>
2409
2410      <row>
2411       <entry><structfield>conbin</structfield></entry>
2412       <entry><type>pg_node_tree</type></entry>
2413       <entry></entry>
2414       <entry>If a check constraint, an internal representation of the expression</entry>
2415      </row>
2416
2417      <row>
2418       <entry><structfield>consrc</structfield></entry>
2419       <entry><type>text</type></entry>
2420       <entry></entry>
2421       <entry>If a check constraint, a human-readable representation of the expression</entry>
2422      </row>
2423     </tbody>
2424    </tgroup>
2425   </table>
2426
2427   <para>
2428    In the case of an exclusion constraint, <structfield>conkey</structfield>
2429    is only useful for constraint elements that are simple column references.
2430    For other cases, a zero appears in <structfield>conkey</structfield>
2431    and the associated index must be consulted to discover the expression
2432    that is constrained.  (<structfield>conkey</structfield> thus has the
2433    same contents as <structname>pg_index</structname>.<structfield>indkey</structfield> for the
2434    index.)
2435   </para>
2436
2437   <note>
2438    <para>
2439     <structfield>consrc</structfield> is not updated when referenced objects
2440     change; for example, it won't track renaming of columns.  Rather than
2441     relying on this field, it's best to use <function>pg_get_constraintdef()</function>
2442     to extract the definition of a check constraint.
2443    </para>
2444   </note>
2445
2446   <note>
2447    <para>
2448     <literal>pg_class.relchecks</literal> needs to agree with the
2449     number of check-constraint entries found in this table for each
2450     relation.
2451    </para>
2452   </note>
2453  </sect1>
2454
2455
2456  <sect1 id="catalog-pg-conversion">
2457   <title><structname>pg_conversion</structname></title>
2458
2459   <indexterm zone="catalog-pg-conversion">
2460    <primary>pg_conversion</primary>
2461   </indexterm>
2462
2463   <para>
2464    The catalog <structname>pg_conversion</structname> describes
2465    encoding conversion procedures.  See <xref linkend="sql-createconversion"/>
2466    for more information.
2467   </para>
2468
2469   <table>
2470    <title><structname>pg_conversion</structname> Columns</title>
2471
2472    <tgroup cols="4">
2473     <thead>
2474      <row>
2475       <entry>Name</entry>
2476       <entry>Type</entry>
2477       <entry>References</entry>
2478       <entry>Description</entry>
2479      </row>
2480     </thead>
2481
2482     <tbody>
2483      <row>
2484       <entry><structfield>oid</structfield></entry>
2485       <entry><type>oid</type></entry>
2486       <entry></entry>
2487       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2488      </row>
2489
2490      <row>
2491       <entry><structfield>conname</structfield></entry>
2492       <entry><type>name</type></entry>
2493       <entry></entry>
2494       <entry>Conversion name (unique within a namespace)</entry>
2495      </row>
2496
2497      <row>
2498       <entry><structfield>connamespace</structfield></entry>
2499       <entry><type>oid</type></entry>
2500       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2501       <entry>
2502        The OID of the namespace that contains this conversion
2503       </entry>
2504      </row>
2505
2506      <row>
2507       <entry><structfield>conowner</structfield></entry>
2508       <entry><type>oid</type></entry>
2509       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2510       <entry>Owner of the conversion</entry>
2511      </row>
2512
2513      <row>
2514       <entry><structfield>conforencoding</structfield></entry>
2515       <entry><type>int4</type></entry>
2516       <entry></entry>
2517       <entry>Source encoding ID</entry>
2518      </row>
2519
2520      <row>
2521       <entry><structfield>contoencoding</structfield></entry>
2522       <entry><type>int4</type></entry>
2523       <entry></entry>
2524       <entry>Destination encoding ID</entry>
2525      </row>
2526
2527      <row>
2528       <entry><structfield>conproc</structfield></entry>
2529       <entry><type>regproc</type></entry>
2530       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2531       <entry>Conversion procedure</entry>
2532      </row>
2533
2534      <row>
2535       <entry><structfield>condefault</structfield></entry>
2536       <entry><type>bool</type></entry>
2537       <entry></entry>
2538       <entry>True if this is the default conversion</entry>
2539      </row>
2540
2541     </tbody>
2542    </tgroup>
2543   </table>
2544
2545  </sect1>
2546
2547  <sect1 id="catalog-pg-database">
2548   <title><structname>pg_database</structname></title>
2549
2550   <indexterm zone="catalog-pg-database">
2551    <primary>pg_database</primary>
2552   </indexterm>
2553
2554   <para>
2555    The catalog <structname>pg_database</structname> stores information about
2556    the available databases.  Databases are created with the <xref
2557    linkend="sql-createdatabase"/> command.
2558    Consult <xref linkend="managing-databases"/> for details about the meaning
2559    of some of the parameters.
2560   </para>
2561
2562   <para>
2563    Unlike most system catalogs, <structname>pg_database</structname>
2564    is shared across all databases of a cluster: there is only one
2565    copy of <structname>pg_database</structname> per cluster, not
2566    one per database.
2567   </para>
2568
2569   <table>
2570    <title><structname>pg_database</structname> Columns</title>
2571
2572    <tgroup cols="4">
2573     <thead>
2574      <row>
2575       <entry>Name</entry>
2576       <entry>Type</entry>
2577       <entry>References</entry>
2578       <entry>Description</entry>
2579      </row>
2580     </thead>
2581
2582     <tbody>
2583      <row>
2584       <entry><structfield>oid</structfield></entry>
2585       <entry><type>oid</type></entry>
2586       <entry></entry>
2587       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2588      </row>
2589
2590      <row>
2591       <entry><structfield>datname</structfield></entry>
2592       <entry><type>name</type></entry>
2593       <entry></entry>
2594       <entry>Database name</entry>
2595      </row>
2596
2597      <row>
2598       <entry><structfield>datdba</structfield></entry>
2599       <entry><type>oid</type></entry>
2600       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2601       <entry>Owner of the database, usually the user who created it</entry>
2602      </row>
2603
2604      <row>
2605       <entry><structfield>encoding</structfield></entry>
2606       <entry><type>int4</type></entry>
2607       <entry></entry>
2608       <entry>Character encoding for this database
2609           (<function>pg_encoding_to_char()</function> can translate
2610            this number to the encoding name)</entry>
2611      </row>
2612
2613      <row>
2614       <entry><structfield>datcollate</structfield></entry>
2615       <entry><type>name</type></entry>
2616       <entry></entry>
2617       <entry>LC_COLLATE for this database</entry>
2618      </row>
2619
2620      <row>
2621       <entry><structfield>datctype</structfield></entry>
2622       <entry><type>name</type></entry>
2623       <entry></entry>
2624       <entry>LC_CTYPE for this database</entry>
2625      </row>
2626
2627      <row>
2628       <entry><structfield>datistemplate</structfield></entry>
2629       <entry><type>bool</type></entry>
2630       <entry></entry>
2631       <entry>
2632        If true, then this database can be cloned by
2633        any user with <literal>CREATEDB</literal> privileges;
2634        if false, then only superusers or the owner of
2635        the database can clone it.
2636       </entry>
2637      </row>
2638
2639      <row>
2640       <entry><structfield>datallowconn</structfield></entry>
2641       <entry><type>bool</type></entry>
2642       <entry></entry>
2643       <entry>
2644        If false then no one can connect to this database.  This is
2645        used to protect the <literal>template0</literal> database from being altered.
2646       </entry>
2647      </row>
2648
2649      <row>
2650       <entry><structfield>datconnlimit</structfield></entry>
2651       <entry><type>int4</type></entry>
2652       <entry></entry>
2653       <entry>
2654        Sets maximum number of concurrent connections that can be made
2655        to this database.  -1 means no limit.
2656       </entry>
2657      </row>
2658
2659      <row>
2660       <entry><structfield>datlastsysoid</structfield></entry>
2661       <entry><type>oid</type></entry>
2662       <entry></entry>
2663       <entry>
2664        Last system OID in the database; useful
2665        particularly to <application>pg_dump</application>
2666       </entry>
2667      </row>
2668
2669      <row>
2670       <entry><structfield>datfrozenxid</structfield></entry>
2671       <entry><type>xid</type></entry>
2672       <entry></entry>
2673       <entry>
2674        All transaction IDs before this one have been replaced with a permanent
2675        (<quote>frozen</quote>) transaction ID in this database.  This is used to
2676        track whether the database needs to be vacuumed in order to prevent
2677        transaction ID wraparound or to allow <literal>pg_xact</literal> to be shrunk.
2678        It is the minimum of the per-table
2679        <structname>pg_class</structname>.<structfield>relfrozenxid</structfield> values.
2680       </entry>
2681      </row>
2682
2683      <row>
2684       <entry><structfield>datminmxid</structfield></entry>
2685       <entry><type>xid</type></entry>
2686       <entry></entry>
2687       <entry>
2688        All multixact IDs before this one have been replaced with a
2689        transaction ID in this database.  This is used to
2690        track whether the database needs to be vacuumed in order to prevent
2691        multixact ID wraparound or to allow <literal>pg_multixact</literal> to be shrunk.
2692        It is the minimum of the per-table
2693        <structname>pg_class</structname>.<structfield>relminmxid</structfield> values.
2694       </entry>
2695      </row>
2696
2697      <row>
2698       <entry><structfield>dattablespace</structfield></entry>
2699       <entry><type>oid</type></entry>
2700       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2701       <entry>
2702        The default tablespace for the database.
2703        Within this database, all tables for which
2704        <structname>pg_class</structname>.<structfield>reltablespace</structfield> is zero
2705        will be stored in this tablespace; in particular, all the non-shared
2706        system catalogs will be there.
2707       </entry>
2708      </row>
2709
2710      <row>
2711       <entry><structfield>datacl</structfield></entry>
2712       <entry><type>aclitem[]</type></entry>
2713       <entry></entry>
2714       <entry>
2715        Access privileges; see
2716        <xref linkend="sql-grant"/> and
2717        <xref linkend="sql-revoke"/>
2718        for details
2719       </entry>
2720      </row>
2721     </tbody>
2722    </tgroup>
2723   </table>
2724  </sect1>
2725
2726
2727  <sect1 id="catalog-pg-db-role-setting">
2728   <title><structname>pg_db_role_setting</structname></title>
2729
2730   <indexterm zone="catalog-pg-db-role-setting">
2731    <primary>pg_db_role_setting</primary>
2732   </indexterm>
2733
2734   <para>
2735    The catalog <structname>pg_db_role_setting</structname> records the default
2736    values that have been set for run-time configuration variables,
2737    for each role and database combination.
2738   </para>
2739
2740   <para>
2741    Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2742    is shared across all databases of a cluster: there is only one
2743    copy of <structname>pg_db_role_setting</structname> per cluster, not
2744    one per database.
2745   </para>
2746
2747   <table>
2748    <title><structname>pg_db_role_setting</structname> Columns</title>
2749
2750    <tgroup cols="4">
2751     <thead>
2752      <row>
2753       <entry>Name</entry>
2754       <entry>Type</entry>
2755       <entry>References</entry>
2756       <entry>Description</entry>
2757      </row>
2758     </thead>
2759
2760     <tbody>
2761      <row>
2762       <entry><structfield>setdatabase</structfield></entry>
2763       <entry><type>oid</type></entry>
2764       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2765       <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2766      </row>
2767
2768      <row>
2769       <entry><structfield>setrole</structfield></entry>
2770       <entry><type>oid</type></entry>
2771       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2772       <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2773      </row>
2774
2775      <row>
2776       <entry><structfield>setconfig</structfield></entry>
2777       <entry><type>text[]</type></entry>
2778       <entry></entry>
2779       <entry>Defaults for run-time configuration variables</entry>
2780      </row>
2781     </tbody>
2782    </tgroup>
2783   </table>
2784  </sect1>
2785
2786
2787  <sect1 id="catalog-pg-default-acl">
2788   <title><structname>pg_default_acl</structname></title>
2789
2790   <indexterm zone="catalog-pg-default-acl">
2791    <primary>pg_default_acl</primary>
2792   </indexterm>
2793
2794   <para>
2795    The catalog <structname>pg_default_acl</structname> stores initial
2796    privileges to be assigned to newly created objects.
2797   </para>
2798
2799   <table>
2800    <title><structname>pg_default_acl</structname> Columns</title>
2801
2802    <tgroup cols="4">
2803     <thead>
2804      <row>
2805       <entry>Name</entry>
2806       <entry>Type</entry>
2807       <entry>References</entry>
2808       <entry>Description</entry>
2809      </row>
2810     </thead>
2811
2812     <tbody>
2813      <row>
2814       <entry><structfield>oid</structfield></entry>
2815       <entry><type>oid</type></entry>
2816       <entry></entry>
2817       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2818      </row>
2819
2820      <row>
2821       <entry><structfield>defaclrole</structfield></entry>
2822       <entry><type>oid</type></entry>
2823       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2824       <entry>The OID of the role associated with this entry</entry>
2825      </row>
2826
2827      <row>
2828       <entry><structfield>defaclnamespace</structfield></entry>
2829       <entry><type>oid</type></entry>
2830       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2831       <entry>The OID of the namespace associated with this entry,
2832        or 0 if none</entry>
2833      </row>
2834
2835      <row>
2836       <entry><structfield>defaclobjtype</structfield></entry>
2837       <entry><type>char</type></entry>
2838       <entry></entry>
2839       <entry>
2840        Type of object this entry is for:
2841        <literal>r</literal> = relation (table, view),
2842        <literal>S</literal> = sequence,
2843        <literal>f</literal> = function,
2844        <literal>T</literal> = type
2845       </entry>
2846      </row>
2847
2848      <row>
2849       <entry><structfield>defaclacl</structfield></entry>
2850       <entry><type>aclitem[]</type></entry>
2851       <entry></entry>
2852       <entry>
2853        Access privileges that this type of object should have on creation
2854       </entry>
2855      </row>
2856     </tbody>
2857    </tgroup>
2858   </table>
2859
2860   <para>
2861    A <structname>pg_default_acl</structname> entry shows the initial privileges to
2862    be assigned to an object belonging to the indicated user.  There are
2863    currently two types of entry: <quote>global</quote> entries with
2864    <structfield>defaclnamespace</structfield> = 0, and <quote>per-schema</quote> entries
2865    that reference a particular schema.  If a global entry is present then
2866    it <emphasis>overrides</emphasis> the normal hard-wired default privileges
2867    for the object type.  A per-schema entry, if present, represents privileges
2868    to be <emphasis>added to</emphasis> the global or hard-wired default privileges.
2869   </para>
2870
2871   <para>
2872    Note that when an ACL entry in another catalog is null, it is taken
2873    to represent the hard-wired default privileges for its object,
2874    <emphasis>not</emphasis> whatever might be in <structname>pg_default_acl</structname>
2875    at the moment.  <structname>pg_default_acl</structname> is only consulted during
2876    object creation.
2877   </para>
2878
2879  </sect1>
2880
2881
2882  <sect1 id="catalog-pg-depend">
2883   <title><structname>pg_depend</structname></title>
2884
2885   <indexterm zone="catalog-pg-depend">
2886    <primary>pg_depend</primary>
2887   </indexterm>
2888
2889   <para>
2890    The catalog <structname>pg_depend</structname> records the dependency
2891    relationships between database objects.  This information allows
2892    <command>DROP</command> commands to find which other objects must be dropped
2893    by <command>DROP CASCADE</command> or prevent dropping in the <command>DROP
2894    RESTRICT</command> case.
2895   </para>
2896
2897   <para>
2898    See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2899    which performs a similar function for dependencies involving objects
2900    that are shared across a database cluster.
2901   </para>
2902
2903   <table>
2904    <title><structname>pg_depend</structname> Columns</title>
2905
2906    <tgroup cols="4">
2907     <thead>
2908      <row>
2909       <entry>Name</entry>
2910       <entry>Type</entry>
2911       <entry>References</entry>
2912       <entry>Description</entry>
2913      </row>
2914     </thead>
2915
2916     <tbody>
2917      <row>
2918       <entry><structfield>classid</structfield></entry>
2919       <entry><type>oid</type></entry>
2920       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2921       <entry>The OID of the system catalog the dependent object is in</entry>
2922      </row>
2923
2924      <row>
2925       <entry><structfield>objid</structfield></entry>
2926       <entry><type>oid</type></entry>
2927       <entry>any OID column</entry>
2928       <entry>The OID of the specific dependent object</entry>
2929      </row>
2930
2931      <row>
2932       <entry><structfield>objsubid</structfield></entry>
2933       <entry><type>int4</type></entry>
2934       <entry></entry>
2935       <entry>
2936        For a table column, this is the column number (the
2937        <structfield>objid</structfield> and <structfield>classid</structfield> refer to the
2938        table itself).  For all other object types, this column is
2939        zero.
2940       </entry>
2941      </row>
2942
2943      <row>
2944       <entry><structfield>refclassid</structfield></entry>
2945       <entry><type>oid</type></entry>
2946       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2947       <entry>The OID of the system catalog the referenced object is in</entry>
2948      </row>
2949
2950      <row>
2951       <entry><structfield>refobjid</structfield></entry>
2952       <entry><type>oid</type></entry>
2953       <entry>any OID column</entry>
2954       <entry>The OID of the specific referenced object</entry>
2955      </row>
2956
2957      <row>
2958       <entry><structfield>refobjsubid</structfield></entry>
2959       <entry><type>int4</type></entry>
2960       <entry></entry>
2961       <entry>
2962        For a table column, this is the column number (the
2963        <structfield>refobjid</structfield> and <structfield>refclassid</structfield> refer
2964        to the table itself).  For all other object types, this column
2965        is zero.
2966       </entry>
2967      </row>
2968
2969      <row>
2970       <entry><structfield>deptype</structfield></entry>
2971       <entry><type>char</type></entry>
2972       <entry></entry>
2973       <entry>
2974        A code defining the specific semantics of this dependency relationship; see text
2975       </entry>
2976      </row>
2977
2978     </tbody>
2979    </tgroup>
2980   </table>
2981
2982   <para>
2983    In all cases, a <structname>pg_depend</structname> entry indicates that the
2984    referenced object cannot be dropped without also dropping the dependent
2985    object.  However, there are several subflavors identified by
2986    <structfield>deptype</structfield>:
2987
2988    <variablelist>
2989     <varlistentry>
2990      <term><symbol>DEPENDENCY_NORMAL</symbol> (<literal>n</literal>)</term>
2991      <listitem>
2992       <para>
2993        A normal relationship between separately-created objects.  The
2994        dependent object can be dropped without affecting the
2995        referenced object.  The referenced object can only be dropped
2996        by specifying <literal>CASCADE</literal>, in which case the dependent
2997        object is dropped, too.  Example: a table column has a normal
2998        dependency on its data type.
2999       </para>
3000      </listitem>
3001     </varlistentry>
3002
3003     <varlistentry>
3004      <term><symbol>DEPENDENCY_AUTO</symbol> (<literal>a</literal>)</term>
3005      <listitem>
3006       <para>
3007        The dependent object can be dropped separately from the
3008        referenced object, and should be automatically dropped
3009        (regardless of <literal>RESTRICT</literal> or <literal>CASCADE</literal>
3010        mode) if the referenced object is dropped.  Example: a named
3011        constraint on a table is made autodependent on the table, so
3012        that it will go away if the table is dropped.
3013       </para>
3014      </listitem>
3015     </varlistentry>
3016
3017     <varlistentry>
3018      <term><symbol>DEPENDENCY_INTERNAL</symbol> (<literal>i</literal>)</term>
3019      <listitem>
3020       <para>
3021        The dependent object was created as part of creation of the
3022        referenced object, and is really just a part of its internal
3023        implementation.  A <command>DROP</command> of the dependent object
3024        will be disallowed outright (we'll tell the user to issue a
3025        <command>DROP</command> against the referenced object, instead).  A
3026        <command>DROP</command> of the referenced object will be propagated
3027        through to drop the dependent object whether
3028        <command>CASCADE</command> is specified or not.  Example: a trigger
3029        that's created to enforce a foreign-key constraint is made
3030        internally dependent on the constraint's
3031        <structname>pg_constraint</structname> entry.
3032       </para>
3033      </listitem>
3034     </varlistentry>
3035
3036     <varlistentry>
3037      <term><symbol>DEPENDENCY_INTERNAL_AUTO</symbol> (<literal>I</literal>)</term>
3038      <listitem>
3039       <para>
3040        The dependent object was created as part of creation of the
3041        referenced object, and is really just a part of its internal
3042        implementation.  A <command>DROP</command> of the dependent object
3043        will be disallowed outright (we'll tell the user to issue a
3044        <command>DROP</command> against the referenced object, instead).
3045        While a regular internal dependency will prevent
3046        the dependent object from being dropped while any such dependencies
3047        remain, <literal>DEPENDENCY_INTERNAL_AUTO</literal> will allow such
3048        a drop as long as the object can be found by following any of such
3049        dependencies.
3050        Example: an index on a partition is made internal-auto-dependent on
3051        both the partition itself as well as on the index on the parent
3052        partitioned table; so the partition index is dropped together with
3053        either the partition it indexes, or with the parent index it is
3054        attached to.
3055       </para>
3056      </listitem>
3057     </varlistentry>
3058
3059     <varlistentry>
3060      <term><symbol>DEPENDENCY_EXTENSION</symbol> (<literal>e</literal>)</term>
3061      <listitem>
3062       <para>
3063        The dependent object is a member of the <firstterm>extension</firstterm> that is
3064        the referenced object (see
3065        <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3066        The dependent object can be dropped only via
3067        <command>DROP EXTENSION</command> on the referenced object.  Functionally
3068        this dependency type acts the same as an internal dependency, but
3069        it's kept separate for clarity and to simplify <application>pg_dump</application>.
3070       </para>
3071      </listitem>
3072     </varlistentry>
3073
3074     <varlistentry>
3075      <term><symbol>DEPENDENCY_AUTO_EXTENSION</symbol> (<literal>x</literal>)</term>
3076      <listitem>
3077       <para>
3078        The dependent object is not a member of the extension that is the
3079        referenced object (and so should not be ignored by pg_dump), but
3080        cannot function without it and should be dropped when the
3081        extension itself is. The dependent object may be dropped on its
3082        own as well.
3083       </para>
3084      </listitem>
3085     </varlistentry>
3086
3087     <varlistentry>
3088      <term><symbol>DEPENDENCY_PIN</symbol> (<literal>p</literal>)</term>
3089      <listitem>
3090       <para>
3091        There is no dependent object; this type of entry is a signal
3092        that the system itself depends on the referenced object, and so
3093        that object must never be deleted.  Entries of this type are
3094        created only by <command>initdb</command>.  The columns for the
3095        dependent object contain zeroes.
3096       </para>
3097      </listitem>
3098     </varlistentry>
3099    </variablelist>
3100
3101    Other dependency flavors might be needed in future.
3102   </para>
3103
3104  </sect1>
3105
3106
3107  <sect1 id="catalog-pg-description">
3108   <title><structname>pg_description</structname></title>
3109
3110   <indexterm zone="catalog-pg-description">
3111    <primary>pg_description</primary>
3112   </indexterm>
3113
3114   <para>
3115    The catalog <structname>pg_description</structname> stores optional descriptions
3116    (comments) for each database object.  Descriptions can be manipulated
3117    with the <xref linkend="sql-comment"/> command and viewed with
3118    <application>psql</application>'s <literal>\d</literal> commands.
3119    Descriptions of many built-in system objects are provided in the initial
3120    contents of <structname>pg_description</structname>.
3121   </para>
3122
3123   <para>
3124    See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3125    which performs a similar function for descriptions involving objects that
3126    are shared across a database cluster.
3127   </para>
3128
3129   <table>
3130    <title><structname>pg_description</structname> Columns</title>
3131
3132    <tgroup cols="4">
3133     <thead>
3134      <row>
3135       <entry>Name</entry>
3136       <entry>Type</entry>
3137       <entry>References</entry>
3138       <entry>Description</entry>
3139      </row>
3140     </thead>
3141
3142     <tbody>
3143      <row>
3144       <entry><structfield>objoid</structfield></entry>
3145       <entry><type>oid</type></entry>
3146       <entry>any OID column</entry>
3147       <entry>The OID of the object this description pertains to</entry>
3148      </row>
3149
3150      <row>
3151       <entry><structfield>classoid</structfield></entry>
3152       <entry><type>oid</type></entry>
3153       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3154       <entry>The OID of the system catalog this object appears in</entry>
3155      </row>
3156
3157      <row>
3158       <entry><structfield>objsubid</structfield></entry>
3159       <entry><type>int4</type></entry>
3160       <entry></entry>
3161       <entry>
3162        For a comment on a table column, this is the column number (the
3163        <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
3164        the table itself).  For all other object types, this column is
3165        zero.
3166       </entry>
3167      </row>
3168
3169      <row>
3170       <entry><structfield>description</structfield></entry>
3171       <entry><type>text</type></entry>
3172       <entry></entry>
3173       <entry>Arbitrary text that serves as the description of this object</entry>
3174      </row>
3175     </tbody>
3176    </tgroup>
3177   </table>
3178
3179  </sect1>
3180
3181
3182  <sect1 id="catalog-pg-enum">
3183   <title><structname>pg_enum</structname></title>
3184
3185   <indexterm zone="catalog-pg-enum">
3186    <primary>pg_enum</primary>
3187   </indexterm>
3188
3189   <para>
3190    The <structname>pg_enum</structname> catalog contains entries
3191    showing the values and labels for each enum type. The
3192    internal representation of a given enum value is actually the OID
3193    of its associated row in <structname>pg_enum</structname>.
3194   </para>
3195
3196   <table>
3197    <title><structname>pg_enum</structname> Columns</title>
3198
3199    <tgroup cols="4">
3200     <thead>
3201      <row>
3202       <entry>Name</entry>
3203       <entry>Type</entry>
3204       <entry>References</entry>
3205       <entry>Description</entry>
3206      </row>
3207     </thead>
3208
3209     <tbody>
3210      <row>
3211       <entry><structfield>oid</structfield></entry>
3212       <entry><type>oid</type></entry>
3213       <entry></entry>
3214       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3215      </row>
3216
3217      <row>
3218       <entry><structfield>enumtypid</structfield></entry>
3219       <entry><type>oid</type></entry>
3220       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3221       <entry>The OID of the <structname>pg_type</structname> entry owning this enum value</entry>
3222      </row>
3223
3224      <row>
3225       <entry><structfield>enumsortorder</structfield></entry>
3226       <entry><type>float4</type></entry>
3227       <entry></entry>
3228       <entry>The sort position of this enum value within its enum type</entry>
3229      </row>
3230
3231      <row>
3232       <entry><structfield>enumlabel</structfield></entry>
3233       <entry><type>name</type></entry>
3234       <entry></entry>
3235       <entry>The textual label for this enum value</entry>
3236      </row>
3237     </tbody>
3238    </tgroup>
3239   </table>
3240
3241   <para>
3242    The OIDs for <structname>pg_enum</structname> rows follow a special
3243    rule: even-numbered OIDs are guaranteed to be ordered in the same way
3244    as the sort ordering of their enum type.  That is, if two even OIDs
3245    belong to the same enum type, the smaller OID must have the smaller
3246    <structfield>enumsortorder</structfield> value.  Odd-numbered OID values
3247    need bear no relationship to the sort order.  This rule allows the
3248    enum comparison routines to avoid catalog lookups in many common cases.
3249    The routines that create and alter enum types attempt to assign even
3250    OIDs to enum values whenever possible.
3251   </para>
3252
3253   <para>
3254    When an enum type is created, its members are assigned sort-order
3255    positions 1..<replaceable>n</replaceable>.  But members added later might be given
3256    negative or fractional values of <structfield>enumsortorder</structfield>.
3257    The only requirement on these values is that they be correctly
3258    ordered and unique within each enum type.
3259   </para>
3260  </sect1>
3261
3262
3263  <sect1 id="catalog-pg-event-trigger">
3264   <title><structname>pg_event_trigger</structname></title>
3265
3266   <indexterm zone="catalog-pg-event-trigger">
3267    <primary>pg_event_trigger</primary>
3268   </indexterm>
3269
3270   <para>
3271    The catalog <structname>pg_event_trigger</structname> stores event triggers.
3272    See <xref linkend="event-triggers"/> for more information.
3273   </para>
3274
3275   <table>
3276    <title><structname>pg_event_trigger</structname> Columns</title>
3277
3278    <tgroup cols="4">
3279     <thead>
3280      <row>
3281       <entry>Name</entry>
3282       <entry>Type</entry>
3283       <entry>References</entry>
3284       <entry>Description</entry>
3285      </row>
3286     </thead>
3287
3288     <tbody>
3289      <row>
3290       <entry><structfield>evtname</structfield></entry>
3291       <entry><type>name</type></entry>
3292       <entry></entry>
3293       <entry>Trigger name (must be unique)</entry>
3294      </row>
3295
3296      <row>
3297       <entry><structfield>evtevent</structfield></entry>
3298       <entry><type>name</type></entry>
3299       <entry></entry>
3300       <entry>Identifies the event for which this trigger fires</entry>
3301      </row>
3302
3303      <row>
3304       <entry><structfield>evtowner</structfield></entry>
3305       <entry><type>oid</type></entry>
3306       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3307       <entry>Owner of the event trigger</entry>
3308      </row>
3309
3310      <row>
3311       <entry><structfield>evtfoid</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>The function to be called</entry>
3315      </row>
3316
3317      <row>
3318       <entry><structfield>evtenabled</structfield></entry>
3319       <entry><type>char</type></entry>
3320       <entry></entry>
3321       <entry>
3322        Controls in which <xref linkend="guc-session-replication-role"/> modes
3323        the event trigger fires.
3324        <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
3325        <literal>D</literal> = trigger is disabled,
3326        <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
3327        <literal>A</literal> = trigger fires always.
3328       </entry>
3329      </row>
3330
3331      <row>
3332       <entry><structfield>evttags</structfield></entry>
3333       <entry><type>text[]</type></entry>
3334       <entry></entry>
3335       <entry>
3336         Command tags for which this trigger will fire.  If NULL, the firing
3337         of this trigger is not restricted on the basis of the command tag.
3338       </entry>
3339      </row>
3340     </tbody>
3341    </tgroup>
3342   </table>
3343  </sect1>
3344
3345
3346  <sect1 id="catalog-pg-extension">
3347   <title><structname>pg_extension</structname></title>
3348
3349   <indexterm zone="catalog-pg-extension">
3350    <primary>pg_extension</primary>
3351   </indexterm>
3352
3353   <para>
3354    The catalog <structname>pg_extension</structname> stores information
3355    about the installed extensions.  See <xref linkend="extend-extensions"/>
3356    for details about extensions.
3357   </para>
3358
3359   <table>
3360    <title><structname>pg_extension</structname> Columns</title>
3361
3362    <tgroup cols="4">
3363     <thead>
3364      <row>
3365       <entry>Name</entry>
3366       <entry>Type</entry>
3367       <entry>References</entry>
3368       <entry>Description</entry>
3369      </row>
3370     </thead>
3371
3372     <tbody>
3373      <row>
3374       <entry><structfield>oid</structfield></entry>
3375       <entry><type>oid</type></entry>
3376       <entry></entry>
3377       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3378      </row>
3379
3380      <row>
3381       <entry><structfield>extname</structfield></entry>
3382       <entry><type>name</type></entry>
3383       <entry></entry>
3384       <entry>Name of the extension</entry>
3385      </row>
3386
3387      <row>
3388       <entry><structfield>extowner</structfield></entry>
3389       <entry><type>oid</type></entry>
3390       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3391       <entry>Owner of the extension</entry>
3392      </row>
3393
3394      <row>
3395       <entry><structfield>extnamespace</structfield></entry>
3396       <entry><type>oid</type></entry>
3397       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3398       <entry>Schema containing the extension's exported objects</entry>
3399      </row>
3400
3401      <row>
3402       <entry><structfield>extrelocatable</structfield></entry>
3403       <entry><type>bool</type></entry>
3404       <entry></entry>
3405       <entry>True if extension can be relocated to another schema</entry>
3406      </row>
3407
3408      <row>
3409       <entry><structfield>extversion</structfield></entry>
3410       <entry><type>text</type></entry>
3411       <entry></entry>
3412       <entry>Version name for the extension</entry>
3413      </row>
3414
3415      <row>
3416       <entry><structfield>extconfig</structfield></entry>
3417       <entry><type>oid[]</type></entry>
3418       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3419       <entry>Array of <type>regclass</type> OIDs for the extension's configuration
3420        table(s), or <literal>NULL</literal> if none</entry>
3421      </row>
3422
3423      <row>
3424       <entry><structfield>extcondition</structfield></entry>
3425       <entry><type>text[]</type></entry>
3426       <entry></entry>
3427       <entry>Array of <literal>WHERE</literal>-clause filter conditions for the
3428        extension's configuration table(s), or <literal>NULL</literal> if none</entry>
3429      </row>
3430
3431     </tbody>
3432    </tgroup>
3433   </table>
3434
3435   <para>
3436    Note that unlike most catalogs with a <quote>namespace</quote> column,
3437    <structfield>extnamespace</structfield> is not meant to imply
3438    that the extension belongs to that schema.  Extension names are never
3439    schema-qualified.  Rather, <structfield>extnamespace</structfield>
3440    indicates the schema that contains most or all of the extension's
3441    objects.  If <structfield>extrelocatable</structfield> is true, then
3442    this schema must in fact contain all schema-qualifiable objects
3443    belonging to the extension.
3444   </para>
3445  </sect1>
3446
3447
3448  <sect1 id="catalog-pg-foreign-data-wrapper">
3449   <title><structname>pg_foreign_data_wrapper</structname></title>
3450
3451   <indexterm zone="catalog-pg-foreign-data-wrapper">
3452    <primary>pg_foreign_data_wrapper</primary>
3453   </indexterm>
3454
3455   <para>
3456    The catalog <structname>pg_foreign_data_wrapper</structname> stores
3457    foreign-data wrapper definitions.  A foreign-data wrapper is the
3458    mechanism by which external data, residing on foreign servers, is
3459    accessed.
3460   </para>
3461
3462   <table>
3463    <title><structname>pg_foreign_data_wrapper</structname> Columns</title>
3464
3465    <tgroup cols="4">
3466     <thead>
3467      <row>
3468       <entry>Name</entry>
3469       <entry>Type</entry>
3470       <entry>References</entry>
3471       <entry>Description</entry>
3472      </row>
3473     </thead>
3474
3475     <tbody>
3476      <row>
3477       <entry><structfield>oid</structfield></entry>
3478       <entry><type>oid</type></entry>
3479       <entry></entry>
3480       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3481      </row>
3482
3483      <row>
3484       <entry><structfield>fdwname</structfield></entry>
3485       <entry><type>name</type></entry>
3486       <entry></entry>
3487       <entry>Name of the foreign-data wrapper</entry>
3488      </row>
3489
3490      <row>
3491       <entry><structfield>fdwowner</structfield></entry>
3492       <entry><type>oid</type></entry>
3493       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3494       <entry>Owner of the foreign-data wrapper</entry>
3495      </row>
3496
3497      <row>
3498       <entry><structfield>fdwhandler</structfield></entry>
3499       <entry><type>oid</type></entry>
3500       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3501       <entry>
3502        References a handler function that is responsible for
3503        supplying execution routines for the foreign-data wrapper.
3504        Zero if no handler is provided
3505       </entry>
3506      </row>
3507
3508      <row>
3509       <entry><structfield>fdwvalidator</structfield></entry>
3510       <entry><type>oid</type></entry>
3511       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3512       <entry>
3513        References a validator function that is responsible for
3514        checking the validity of the options given to the
3515        foreign-data wrapper, as well as options for foreign servers and user
3516        mappings using the foreign-data wrapper.  Zero if no validator
3517        is provided
3518       </entry>
3519      </row>
3520
3521      <row>
3522       <entry><structfield>fdwacl</structfield></entry>
3523       <entry><type>aclitem[]</type></entry>
3524       <entry></entry>
3525       <entry>
3526        Access privileges; see
3527        <xref linkend="sql-grant"/> and
3528        <xref linkend="sql-revoke"/>
3529        for details
3530       </entry>
3531      </row>
3532
3533      <row>
3534       <entry><structfield>fdwoptions</structfield></entry>
3535       <entry><type>text[]</type></entry>
3536       <entry></entry>
3537       <entry>
3538        Foreign-data wrapper specific options, as <quote>keyword=value</quote> strings
3539       </entry>
3540      </row>
3541     </tbody>
3542    </tgroup>
3543   </table>
3544  </sect1>
3545
3546
3547  <sect1 id="catalog-pg-foreign-server">
3548   <title><structname>pg_foreign_server</structname></title>
3549
3550   <indexterm zone="catalog-pg-foreign-server">
3551    <primary>pg_foreign_server</primary>
3552   </indexterm>
3553
3554   <para>
3555    The catalog <structname>pg_foreign_server</structname> stores
3556    foreign server definitions.  A foreign server describes a source
3557    of external data, such as a remote server.  Foreign
3558    servers are accessed via foreign-data wrappers.
3559   </para>
3560
3561   <table>
3562    <title><structname>pg_foreign_server</structname> Columns</title>
3563
3564    <tgroup cols="4">
3565     <thead>
3566      <row>
3567       <entry>Name</entry>
3568       <entry>Type</entry>
3569       <entry>References</entry>
3570       <entry>Description</entry>
3571      </row>
3572     </thead>
3573
3574     <tbody>
3575      <row>
3576       <entry><structfield>oid</structfield></entry>
3577       <entry><type>oid</type></entry>
3578       <entry></entry>
3579       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3580      </row>
3581
3582      <row>
3583       <entry><structfield>srvname</structfield></entry>
3584       <entry><type>name</type></entry>
3585       <entry></entry>
3586       <entry>Name of the foreign server</entry>
3587      </row>
3588
3589      <row>
3590       <entry><structfield>srvowner</structfield></entry>
3591       <entry><type>oid</type></entry>
3592       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3593       <entry>Owner of the foreign server</entry>
3594      </row>
3595
3596      <row>
3597       <entry><structfield>srvfdw</structfield></entry>
3598       <entry><type>oid</type></entry>
3599       <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3600       <entry>OID of the foreign-data wrapper of this foreign server</entry>
3601      </row>
3602
3603      <row>
3604       <entry><structfield>srvtype</structfield></entry>
3605       <entry><type>text</type></entry>
3606       <entry></entry>
3607       <entry>Type of the server (optional)</entry>
3608      </row>
3609
3610      <row>
3611       <entry><structfield>srvversion</structfield></entry>
3612       <entry><type>text</type></entry>
3613       <entry></entry>
3614       <entry>Version of the server (optional)</entry>
3615      </row>
3616
3617      <row>
3618       <entry><structfield>srvacl</structfield></entry>
3619       <entry><type>aclitem[]</type></entry>
3620       <entry></entry>
3621       <entry>
3622        Access privileges; see
3623        <xref linkend="sql-grant"/> and
3624        <xref linkend="sql-revoke"/>
3625        for details
3626       </entry>
3627      </row>
3628
3629      <row>
3630       <entry><structfield>srvoptions</structfield></entry>
3631       <entry><type>text[]</type></entry>
3632       <entry></entry>
3633       <entry>
3634        Foreign server specific options, as <quote>keyword=value</quote> strings
3635       </entry>
3636      </row>
3637     </tbody>
3638    </tgroup>
3639   </table>
3640  </sect1>
3641
3642
3643  <sect1 id="catalog-pg-foreign-table">
3644   <title><structname>pg_foreign_table</structname></title>
3645
3646   <indexterm zone="catalog-pg-foreign-table">
3647    <primary>pg_foreign_table</primary>
3648   </indexterm>
3649
3650   <para>
3651    The catalog <structname>pg_foreign_table</structname> contains
3652    auxiliary information about foreign tables.  A foreign table is
3653    primarily represented by a <structname>pg_class</structname> entry,
3654    just like a regular table.  Its <structname>pg_foreign_table</structname>
3655    entry contains the information that is pertinent only to foreign tables
3656    and not any other kind of relation.
3657   </para>
3658
3659   <table>
3660    <title><structname>pg_foreign_table</structname> Columns</title>
3661
3662    <tgroup cols="4">
3663     <thead>
3664      <row>
3665       <entry>Name</entry>
3666       <entry>Type</entry>
3667       <entry>References</entry>
3668       <entry>Description</entry>
3669      </row>
3670     </thead>
3671
3672     <tbody>
3673      <row>
3674       <entry><structfield>ftrelid</structfield></entry>
3675       <entry><type>oid</type></entry>
3676       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3677       <entry>OID of the <structname>pg_class</structname> entry for this foreign table</entry>
3678      </row>
3679
3680      <row>
3681       <entry><structfield>ftserver</structfield></entry>
3682       <entry><type>oid</type></entry>
3683       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3684       <entry>OID of the foreign server for this foreign table</entry>
3685      </row>
3686
3687      <row>
3688       <entry><structfield>ftoptions</structfield></entry>
3689       <entry><type>text[]</type></entry>
3690       <entry></entry>
3691       <entry>
3692        Foreign table options, as <quote>keyword=value</quote> strings
3693       </entry>
3694      </row>
3695     </tbody>
3696    </tgroup>
3697   </table>
3698  </sect1>
3699
3700
3701  <sect1 id="catalog-pg-index">
3702   <title><structname>pg_index</structname></title>
3703
3704   <indexterm zone="catalog-pg-index">
3705    <primary>pg_index</primary>
3706   </indexterm>
3707
3708   <para>
3709    The catalog <structname>pg_index</structname> contains part of the information
3710    about indexes.  The rest is mostly in
3711    <structname>pg_class</structname>.
3712   </para>
3713
3714   <table>
3715    <title><structname>pg_index</structname> Columns</title>
3716
3717    <tgroup cols="4">
3718     <thead>
3719      <row>
3720       <entry>Name</entry>
3721       <entry>Type</entry>
3722       <entry>References</entry>
3723       <entry>Description</entry>
3724      </row>
3725     </thead>
3726
3727     <tbody>
3728      <row>
3729       <entry><structfield>indexrelid</structfield></entry>
3730       <entry><type>oid</type></entry>
3731       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3732       <entry>The OID of the <structname>pg_class</structname> entry for this index</entry>
3733      </row>
3734
3735      <row>
3736       <entry><structfield>indrelid</structfield></entry>
3737       <entry><type>oid</type></entry>
3738       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3739       <entry>The OID of the <structname>pg_class</structname> entry for the table this index is for</entry>
3740      </row>
3741
3742      <row>
3743       <entry><structfield>indnatts</structfield></entry>
3744       <entry><type>int2</type></entry>
3745       <entry></entry>
3746       <entry>The number of columns in the index (duplicates
3747       <literal>pg_class.relnatts</literal>)</entry>
3748      </row>
3749
3750      <row>
3751       <entry><structfield>indisunique</structfield></entry>
3752       <entry><type>bool</type></entry>
3753       <entry></entry>
3754       <entry>If true, this is a unique index</entry>
3755      </row>
3756
3757      <row>
3758       <entry><structfield>indisprimary</structfield></entry>
3759       <entry><type>bool</type></entry>
3760       <entry></entry>
3761       <entry>If true, this index represents the primary key of the table
3762       (<structfield>indisunique</structfield> should always be true when this is true)</entry>
3763      </row>
3764
3765      <row>
3766       <entry><structfield>indisexclusion</structfield></entry>
3767       <entry><type>bool</type></entry>
3768       <entry></entry>
3769       <entry>If true, this index supports an exclusion constraint</entry>
3770      </row>
3771
3772      <row>
3773       <entry><structfield>indimmediate</structfield></entry>
3774       <entry><type>bool</type></entry>
3775       <entry></entry>
3776       <entry>If true, the uniqueness check is enforced immediately on
3777        insertion
3778        (irrelevant if <structfield>indisunique</structfield> is not true)</entry>
3779      </row>
3780
3781      <row>
3782       <entry><structfield>indisclustered</structfield></entry>
3783       <entry><type>bool</type></entry>
3784       <entry></entry>
3785       <entry>If true, the table was last clustered on this index</entry>
3786      </row>
3787
3788      <row>
3789       <entry><structfield>indisvalid</structfield></entry>
3790       <entry><type>bool</type></entry>
3791       <entry></entry>
3792       <entry>
3793        If true, the index is currently valid for queries.  False means the
3794        index is possibly incomplete: it must still be modified by
3795        <command>INSERT</command>/<command>UPDATE</command> operations, but it cannot safely
3796        be used for queries. If it is unique, the uniqueness property is not
3797        guaranteed true either.
3798       </entry>
3799      </row>
3800
3801      <row>
3802       <entry><structfield>indcheckxmin</structfield></entry>
3803       <entry><type>bool</type></entry>
3804       <entry></entry>
3805       <entry>
3806        If true, queries must not use the index until the <structfield>xmin</structfield>
3807        of this <structname>pg_index</structname> row is below their <symbol>TransactionXmin</symbol>
3808        event horizon, because the table may contain broken HOT chains with
3809        incompatible rows that they can see
3810       </entry>
3811      </row>
3812
3813      <row>
3814       <entry><structfield>indisready</structfield></entry>
3815       <entry><type>bool</type></entry>
3816       <entry></entry>
3817       <entry>
3818        If true, the index is currently ready for inserts.  False means the
3819        index must be ignored by <command>INSERT</command>/<command>UPDATE</command>
3820        operations.
3821       </entry>
3822      </row>
3823
3824      <row>
3825       <entry><structfield>indislive</structfield></entry>
3826       <entry><type>bool</type></entry>
3827       <entry></entry>
3828       <entry>
3829        If false, the index is in process of being dropped, and should be
3830        ignored for all purposes (including HOT-safety decisions)
3831       </entry>
3832      </row>
3833
3834      <row>
3835       <entry><structfield>indisreplident</structfield></entry>
3836       <entry><type>bool</type></entry>
3837       <entry></entry>
3838       <entry>
3839        If true this index has been chosen as <quote>replica identity</quote>
3840        using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3841        ...</command>
3842       </entry>
3843      </row>
3844
3845      <row>
3846       <entry><structfield>indkey</structfield></entry>
3847       <entry><type>int2vector</type></entry>
3848       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3849       <entry>
3850        This is an array of <structfield>indnatts</structfield> values that
3851        indicate which table columns this index indexes.  For example a value
3852        of <literal>1 3</literal> would mean that the first and the third table
3853        columns make up the index key.  A zero in this array indicates that the
3854        corresponding index attribute is an expression over the table columns,
3855        rather than a simple column reference.
3856       </entry>
3857      </row>
3858
3859      <row>
3860       <entry><structfield>indcollation</structfield></entry>
3861       <entry><type>oidvector</type></entry>
3862       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3863       <entry>
3864        For each column in the index key, this contains the OID of the
3865        collation to use for the index, or zero if the column is not
3866        of a collatable data type.
3867       </entry>
3868      </row>
3869
3870      <row>
3871       <entry><structfield>indclass</structfield></entry>
3872       <entry><type>oidvector</type></entry>
3873       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3874       <entry>
3875        For each column in the index key, this contains the OID of
3876        the operator class to use.  See
3877        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3878       </entry>
3879      </row>
3880
3881      <row>
3882       <entry><structfield>indoption</structfield></entry>
3883       <entry><type>int2vector</type></entry>
3884       <entry></entry>
3885       <entry>
3886        This is an array of <structfield>indnatts</structfield> values that
3887        store per-column flag bits.  The meaning of the bits is defined by
3888        the index's access method.
3889       </entry>
3890      </row>
3891
3892      <row>
3893       <entry><structfield>indexprs</structfield></entry>
3894       <entry><type>pg_node_tree</type></entry>
3895       <entry></entry>
3896       <entry>
3897        Expression trees (in <function>nodeToString()</function>
3898        representation) for index attributes that are not simple column
3899        references.  This is a list with one element for each zero
3900        entry in <structfield>indkey</structfield>.  Null if all index attributes
3901        are simple references.
3902       </entry>
3903      </row>
3904
3905      <row>
3906       <entry><structfield>indpred</structfield></entry>
3907       <entry><type>pg_node_tree</type></entry>
3908       <entry></entry>
3909       <entry>
3910        Expression tree (in <function>nodeToString()</function>
3911        representation) for partial index predicate.  Null if not a
3912        partial index.
3913       </entry>
3914      </row>
3915     </tbody>
3916    </tgroup>
3917   </table>
3918
3919  </sect1>
3920
3921
3922  <sect1 id="catalog-pg-inherits">
3923   <title><structname>pg_inherits</structname></title>
3924
3925   <indexterm zone="catalog-pg-inherits">
3926    <primary>pg_inherits</primary>
3927   </indexterm>
3928
3929   <para>
3930    The catalog <structname>pg_inherits</structname> records information about
3931    table inheritance hierarchies.  There is one entry for each direct
3932    parent-child table relationship in the database.  (Indirect inheritance can be determined
3933    by following chains of entries.)
3934   </para>
3935
3936   <table>
3937    <title><structname>pg_inherits</structname> Columns</title>
3938
3939    <tgroup cols="4">
3940     <thead>
3941      <row>
3942       <entry>Name</entry>
3943       <entry>Type</entry>
3944       <entry>References</entry>
3945       <entry>Description</entry>
3946      </row>
3947     </thead>
3948
3949     <tbody>
3950      <row>
3951       <entry><structfield>inhrelid</structfield></entry>
3952       <entry><type>oid</type></entry>
3953       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3954       <entry>
3955        The OID of the child table
3956       </entry>
3957      </row>
3958
3959      <row>
3960       <entry><structfield>inhparent</structfield></entry>
3961       <entry><type>oid</type></entry>
3962       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3963       <entry>
3964        The OID of the parent table
3965       </entry>
3966      </row>
3967
3968      <row>
3969       <entry><structfield>inhseqno</structfield></entry>
3970       <entry><type>int4</type></entry>
3971       <entry></entry>
3972       <entry>
3973        If there is more than one direct parent for a child table (multiple
3974        inheritance), this number tells the order in which the
3975        inherited columns are to be arranged.  The count starts at 1.
3976       </entry>
3977      </row>
3978     </tbody>
3979    </tgroup>
3980   </table>
3981
3982  </sect1>
3983
3984  <sect1 id="catalog-pg-init-privs">
3985   <title><structname>pg_init_privs</structname></title>
3986
3987   <indexterm zone="catalog-pg-init-privs">
3988    <primary>pg_init_privs</primary>
3989   </indexterm>
3990
3991   <para>
3992    The catalog <structname>pg_init_privs</structname> records information about
3993    the initial privileges of objects in the system.  There is one entry
3994    for each object in the database which has a non-default (non-NULL)
3995    initial set of privileges.
3996   </para>
3997
3998   <para>
3999    Objects can have initial privileges either by having those privileges set
4000    when the system is initialized (by <application>initdb</application>) or when the
4001    object is created during a <command>CREATE EXTENSION</command> and the
4002    extension script sets initial privileges using the <command>GRANT</command>
4003    system.  Note that the system will automatically handle recording of the
4004    privileges during the extension script and that extension authors need
4005    only use the <command>GRANT</command> and <command>REVOKE</command>
4006    statements in their script to have the privileges recorded.  The
4007    <literal>privtype</literal> column indicates if the initial privilege was
4008    set by <application>initdb</application> or during a
4009    <command>CREATE EXTENSION</command> command.
4010   </para>
4011
4012   <para>
4013    Objects which have initial privileges set by <application>initdb</application> will
4014    have entries where <literal>privtype</literal> is
4015    <literal>'i'</literal>, while objects which have initial privileges set
4016    by <command>CREATE EXTENSION</command> will have entries where
4017    <literal>privtype</literal> is <literal>'e'</literal>.
4018   </para>
4019
4020   <table>
4021    <title><structname>pg_init_privs</structname> Columns</title>
4022
4023    <tgroup cols="4">
4024     <thead>
4025      <row>
4026       <entry>Name</entry>
4027       <entry>Type</entry>
4028       <entry>References</entry>
4029       <entry>Description</entry>
4030      </row>
4031     </thead>
4032
4033     <tbody>
4034      <row>
4035       <entry><structfield>objoid</structfield></entry>
4036       <entry><type>oid</type></entry>
4037       <entry>any OID column</entry>
4038       <entry>The OID of the specific object</entry>
4039      </row>
4040
4041      <row>
4042       <entry><structfield>classoid</structfield></entry>
4043       <entry><type>oid</type></entry>
4044       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4045       <entry>The OID of the system catalog the object is in</entry>
4046      </row>
4047
4048      <row>
4049       <entry><structfield>objsubid</structfield></entry>
4050       <entry><type>int4</type></entry>
4051       <entry></entry>
4052       <entry>
4053        For a table column, this is the column number (the
4054        <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to the
4055        table itself).  For all other object types, this column is
4056        zero.
4057       </entry>
4058      </row>
4059
4060      <row>
4061       <entry><structfield>privtype</structfield></entry>
4062       <entry><type>char</type></entry>
4063       <entry></entry>
4064       <entry>
4065        A code defining the type of initial privilege of this object; see text
4066       </entry>
4067      </row>
4068
4069      <row>
4070       <entry><structfield>initprivs</structfield></entry>
4071       <entry><type>aclitem[]</type></entry>
4072       <entry></entry>
4073       <entry>
4074        The initial access privileges; see
4075        <xref linkend="sql-grant"/> and
4076        <xref linkend="sql-revoke"/>
4077        for details
4078       </entry>
4079      </row>
4080
4081     </tbody>
4082    </tgroup>
4083   </table>
4084
4085  </sect1>
4086
4087
4088  <sect1 id="catalog-pg-language">
4089   <title><structname>pg_language</structname></title>
4090
4091   <indexterm zone="catalog-pg-language">
4092    <primary>pg_language</primary>
4093   </indexterm>
4094
4095   <para>
4096    The catalog <structname>pg_language</structname> registers
4097    languages in which you can write functions or stored procedures.
4098    See <xref linkend="sql-createlanguage"/>
4099    and <xref linkend="xplang"/> for more information about language handlers.
4100   </para>
4101
4102   <table>
4103    <title><structname>pg_language</structname> Columns</title>
4104
4105    <tgroup cols="4">
4106     <thead>
4107      <row>
4108       <entry>Name</entry>
4109       <entry>Type</entry>
4110       <entry>References</entry>
4111       <entry>Description</entry>
4112      </row>
4113     </thead>
4114
4115     <tbody>
4116      <row>
4117       <entry><structfield>oid</structfield></entry>
4118       <entry><type>oid</type></entry>
4119       <entry></entry>
4120       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4121      </row>
4122
4123      <row>
4124       <entry><structfield>lanname</structfield></entry>
4125       <entry><type>name</type></entry>
4126       <entry></entry>
4127       <entry>Name of the language</entry>
4128      </row>
4129
4130      <row>
4131       <entry><structfield>lanowner</structfield></entry>
4132       <entry><type>oid</type></entry>
4133       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4134       <entry>Owner of the language</entry>
4135      </row>
4136
4137      <row>
4138       <entry><structfield>lanispl</structfield></entry>
4139       <entry><type>bool</type></entry>
4140       <entry></entry>
4141       <entry>
4142        This is false for internal languages (such as
4143        <acronym>SQL</acronym>) and true for user-defined languages.
4144        Currently, <application>pg_dump</application> still uses this
4145        to determine which languages need to be dumped, but this might be
4146        replaced by a different mechanism in the future.
4147       </entry>
4148      </row>
4149
4150      <row>
4151       <entry><structfield>lanpltrusted</structfield></entry>
4152       <entry><type>bool</type></entry>
4153       <entry></entry>
4154       <entry>
4155        True if this is a trusted language, which means that it is believed
4156        not to grant access to anything outside the normal SQL execution
4157        environment.  Only superusers can create functions in untrusted
4158        languages.
4159       </entry>
4160      </row>
4161
4162      <row>
4163       <entry><structfield>lanplcallfoid</structfield></entry>
4164       <entry><type>oid</type></entry>
4165       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4166       <entry>
4167        For noninternal languages this references the language
4168        handler, which is a special function that is responsible for
4169        executing all functions that are written in the particular
4170        language
4171       </entry>
4172      </row>
4173
4174      <row>
4175       <entry><structfield>laninline</structfield></entry>
4176       <entry><type>oid</type></entry>
4177       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4178       <entry>
4179        This references a function that is responsible for executing
4180        <quote>inline</quote> anonymous code blocks
4181        (<xref linkend="sql-do"/> blocks).
4182        Zero if inline blocks are not supported.
4183       </entry>
4184      </row>
4185
4186      <row>
4187       <entry><structfield>lanvalidator</structfield></entry>
4188       <entry><type>oid</type></entry>
4189       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4190       <entry>
4191        This references a language validator function that is responsible
4192        for checking the syntax and validity of new functions when they
4193        are created.  Zero if no validator is provided.
4194       </entry>
4195      </row>
4196
4197      <row>
4198       <entry><structfield>lanacl</structfield></entry>
4199       <entry><type>aclitem[]</type></entry>
4200       <entry></entry>
4201       <entry>
4202        Access privileges; see
4203        <xref linkend="sql-grant"/> and
4204        <xref linkend="sql-revoke"/>
4205        for details
4206       </entry>
4207      </row>
4208     </tbody>
4209    </tgroup>
4210   </table>
4211
4212  </sect1>
4213
4214
4215  <sect1 id="catalog-pg-largeobject">
4216   <title><structname>pg_largeobject</structname></title>
4217
4218   <indexterm zone="catalog-pg-largeobject">
4219    <primary>pg_largeobject</primary>
4220   </indexterm>
4221
4222   <para>
4223    The catalog <structname>pg_largeobject</structname> holds the data making up
4224    <quote>large objects</quote>.  A large object is identified by an OID
4225    assigned when it is created.  Each large object is broken into
4226    segments or <quote>pages</quote> small enough to be conveniently stored as rows
4227    in <structname>pg_largeobject</structname>.
4228    The amount of data per page is defined to be <symbol>LOBLKSIZE</symbol> (which is currently
4229    <literal>BLCKSZ/4</literal>, or typically 2 kB).
4230   </para>
4231
4232   <para>
4233    Prior to <productname>PostgreSQL</productname> 9.0, there was no permission structure
4234    associated with large objects.  As a result,
4235    <structname>pg_largeobject</structname> was publicly readable and could be
4236    used to obtain the OIDs (and contents) of all large objects in the system.
4237    This is no longer the case; use
4238    <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>
4239    to obtain a list of large object OIDs.
4240   </para>
4241
4242   <table>
4243    <title><structname>pg_largeobject</structname> Columns</title>
4244
4245    <tgroup cols="4">
4246     <thead>
4247      <row>
4248       <entry>Name</entry>
4249       <entry>Type</entry>
4250       <entry>References</entry>
4251       <entry>Description</entry>
4252      </row>
4253     </thead>
4254
4255     <tbody>
4256      <row>
4257       <entry><structfield>loid</structfield></entry>
4258       <entry><type>oid</type></entry>
4259       <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4260       <entry>Identifier of the large object that includes this page</entry>
4261      </row>
4262
4263      <row>
4264       <entry><structfield>pageno</structfield></entry>
4265       <entry><type>int4</type></entry>
4266       <entry></entry>
4267       <entry>Page number of this page within its large object
4268       (counting from zero)</entry>
4269      </row>
4270
4271      <row>
4272       <entry><structfield>data</structfield></entry>
4273       <entry><type>bytea</type></entry>
4274       <entry></entry>
4275       <entry>
4276        Actual data stored in the large object.
4277        This will never be more than <symbol>LOBLKSIZE</symbol> bytes and might be less.
4278       </entry>
4279      </row>
4280     </tbody>
4281    </tgroup>
4282   </table>
4283
4284   <para>
4285    Each row of <structname>pg_largeobject</structname> holds data
4286    for one page of a large object, beginning at
4287    byte offset (<literal>pageno * LOBLKSIZE</literal>) within the object.  The implementation
4288    allows sparse storage: pages might be missing, and might be shorter than
4289    <literal>LOBLKSIZE</literal> bytes even if they are not the last page of the object.
4290    Missing regions within a large object read as zeroes.
4291   </para>
4292
4293  </sect1>
4294
4295  <sect1 id="catalog-pg-largeobject-metadata">
4296   <title><structname>pg_largeobject_metadata</structname></title>
4297
4298   <indexterm zone="catalog-pg-largeobject-metadata">
4299    <primary>pg_largeobject_metadata</primary>
4300   </indexterm>
4301
4302   <para>
4303    The catalog <structname>pg_largeobject_metadata</structname>
4304    holds metadata associated with large objects.  The actual large object
4305    data is stored in
4306    <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link>.
4307   </para>
4308
4309   <table>
4310    <title><structname>pg_largeobject_metadata</structname> Columns</title>
4311
4312    <tgroup cols="4">
4313     <thead>
4314      <row>
4315       <entry>Name</entry>
4316       <entry>Type</entry>
4317       <entry>References</entry>
4318       <entry>Description</entry>
4319      </row>
4320     </thead>
4321
4322     <tbody>
4323      <row>
4324       <entry><structfield>oid</structfield></entry>
4325       <entry><type>oid</type></entry>
4326       <entry></entry>
4327       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4328      </row>
4329
4330      <row>
4331       <entry><structfield>lomowner</structfield></entry>
4332       <entry><type>oid</type></entry>
4333       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4334       <entry>Owner of the large object</entry>
4335      </row>
4336
4337      <row>
4338       <entry><structfield>lomacl</structfield></entry>
4339       <entry><type>aclitem[]</type></entry>
4340       <entry></entry>
4341       <entry>
4342        Access privileges; see
4343        <xref linkend="sql-grant"/> and
4344        <xref linkend="sql-revoke"/>
4345        for details
4346       </entry>
4347      </row>
4348
4349     </tbody>
4350    </tgroup>
4351   </table>
4352  </sect1>
4353
4354
4355  <sect1 id="catalog-pg-namespace">
4356   <title><structname>pg_namespace</structname></title>
4357
4358   <indexterm zone="catalog-pg-namespace">
4359    <primary>pg_namespace</primary>
4360   </indexterm>
4361
4362   <para>
4363    The catalog <structname>pg_namespace</structname> stores namespaces.
4364    A namespace is the structure underlying SQL schemas: each namespace
4365    can have a separate collection of relations, types, etc. without name
4366    conflicts.
4367   </para>
4368
4369   <table>
4370    <title><structname>pg_namespace</structname> Columns</title>
4371
4372    <tgroup cols="4">
4373     <thead>
4374      <row>
4375       <entry>Name</entry>
4376       <entry>Type</entry>
4377       <entry>References</entry>
4378       <entry>Description</entry>
4379      </row>
4380     </thead>
4381
4382     <tbody>
4383      <row>
4384       <entry><structfield>oid</structfield></entry>
4385       <entry><type>oid</type></entry>
4386       <entry></entry>
4387       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4388      </row>
4389
4390      <row>
4391       <entry><structfield>nspname</structfield></entry>
4392       <entry><type>name</type></entry>
4393       <entry></entry>
4394       <entry>Name of the namespace</entry>
4395      </row>
4396
4397      <row>
4398       <entry><structfield>nspowner</structfield></entry>
4399       <entry><type>oid</type></entry>
4400       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4401       <entry>Owner of the namespace</entry>
4402      </row>
4403
4404      <row>
4405       <entry><structfield>nspacl</structfield></entry>
4406       <entry><type>aclitem[]</type></entry>
4407       <entry></entry>
4408       <entry>
4409        Access privileges; see
4410        <xref linkend="sql-grant"/> and
4411        <xref linkend="sql-revoke"/>
4412        for details
4413       </entry>
4414      </row>
4415     </tbody>
4416    </tgroup>
4417   </table>
4418
4419  </sect1>
4420
4421
4422  <sect1 id="catalog-pg-opclass">
4423   <title><structname>pg_opclass</structname></title>
4424
4425   <indexterm zone="catalog-pg-opclass">
4426    <primary>pg_opclass</primary>
4427   </indexterm>
4428
4429   <para>
4430    The catalog <structname>pg_opclass</structname> defines
4431    index access method operator classes.  Each operator class defines
4432    semantics for index columns of a particular data type and a particular
4433    index access method.  An operator class essentially specifies that a
4434    particular operator family is applicable to a particular indexable column
4435    data type.  The set of operators from the family that are actually usable
4436    with the indexed column are whichever ones accept the column's data type
4437    as their left-hand input.
4438   </para>
4439
4440   <para>
4441    Operator classes are described at length in <xref linkend="xindex"/>.
4442   </para>
4443
4444   <table>
4445    <title><structname>pg_opclass</structname> Columns</title>
4446
4447    <tgroup cols="4">
4448     <thead>
4449      <row>
4450       <entry>Name</entry>
4451       <entry>Type</entry>
4452       <entry>References</entry>
4453       <entry>Description</entry>
4454      </row>
4455     </thead>
4456     <tbody>
4457
4458      <row>
4459       <entry><structfield>oid</structfield></entry>
4460       <entry><type>oid</type></entry>
4461       <entry></entry>
4462       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4463      </row>
4464
4465      <row>
4466       <entry><structfield>opcmethod</structfield></entry>
4467       <entry><type>oid</type></entry>
4468       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4469       <entry>Index access method operator class is for</entry>
4470      </row>
4471
4472      <row>
4473       <entry><structfield>opcname</structfield></entry>
4474       <entry><type>name</type></entry>
4475       <entry></entry>
4476       <entry>Name of this operator class</entry>
4477      </row>
4478
4479      <row>
4480       <entry><structfield>opcnamespace</structfield></entry>
4481       <entry><type>oid</type></entry>
4482       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4483       <entry>Namespace of this operator class</entry>
4484      </row>
4485
4486      <row>
4487       <entry><structfield>opcowner</structfield></entry>
4488       <entry><type>oid</type></entry>
4489       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4490       <entry>Owner of the operator class</entry>
4491      </row>
4492
4493      <row>
4494       <entry><structfield>opcfamily</structfield></entry>
4495       <entry><type>oid</type></entry>
4496       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4497       <entry>Operator family containing the operator class</entry>
4498      </row>
4499
4500      <row>
4501       <entry><structfield>opcintype</structfield></entry>
4502       <entry><type>oid</type></entry>
4503       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4504       <entry>Data type that the operator class indexes</entry>
4505      </row>
4506
4507      <row>
4508       <entry><structfield>opcdefault</structfield></entry>
4509       <entry><type>bool</type></entry>
4510       <entry></entry>
4511       <entry>True if this operator class is the default for <structfield>opcintype</structfield></entry>
4512      </row>
4513
4514      <row>
4515       <entry><structfield>opckeytype</structfield></entry>
4516       <entry><type>oid</type></entry>
4517       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4518       <entry>Type of data stored in index, or zero if same as <structfield>opcintype</structfield></entry>
4519      </row>
4520
4521     </tbody>
4522    </tgroup>
4523   </table>
4524
4525   <para>
4526    An operator class's <structfield>opcmethod</structfield> must match the
4527    <structname>opfmethod</structname> of its containing operator family.
4528    Also, there must be no more than one <structname>pg_opclass</structname>
4529    row having <structname>opcdefault</structname> true for any given combination of
4530    <structname>opcmethod</structname> and <structname>opcintype</structname>.
4531   </para>
4532
4533  </sect1>
4534
4535
4536  <sect1 id="catalog-pg-operator">
4537   <title><structname>pg_operator</structname></title>
4538
4539   <indexterm zone="catalog-pg-operator">
4540    <primary>pg_operator</primary>
4541   </indexterm>
4542
4543   <para>
4544    The catalog <structname>pg_operator</structname> stores information about operators.
4545    See <xref linkend="sql-createoperator"/>
4546    and <xref linkend="xoper"/> for more information.
4547   </para>
4548
4549   <table>
4550    <title><structname>pg_operator</structname> Columns</title>
4551
4552    <tgroup cols="4">
4553     <thead>
4554      <row>
4555       <entry>Name</entry>
4556       <entry>Type</entry>
4557       <entry>References</entry>
4558       <entry>Description</entry>
4559      </row>
4560     </thead>
4561
4562     <tbody>
4563      <row>
4564       <entry><structfield>oid</structfield></entry>
4565       <entry><type>oid</type></entry>
4566       <entry></entry>
4567       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4568      </row>
4569
4570      <row>
4571       <entry><structfield>oprname</structfield></entry>
4572       <entry><type>name</type></entry>
4573       <entry></entry>
4574       <entry>Name of the operator</entry>
4575      </row>
4576
4577      <row>
4578       <entry><structfield>oprnamespace</structfield></entry>
4579       <entry><type>oid</type></entry>
4580       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4581       <entry>
4582        The OID of the namespace that contains this operator
4583       </entry>
4584      </row>
4585
4586      <row>
4587       <entry><structfield>oprowner</structfield></entry>
4588       <entry><type>oid</type></entry>
4589       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4590       <entry>Owner of the operator</entry>
4591      </row>
4592
4593      <row>
4594       <entry><structfield>oprkind</structfield></entry>
4595       <entry><type>char</type></entry>
4596       <entry></entry>
4597       <entry>
4598        <literal>b</literal> = infix (<quote>both</quote>), <literal>l</literal> = prefix
4599        (<quote>left</quote>), <literal>r</literal> = postfix (<quote>right</quote>)
4600       </entry>
4601      </row>
4602
4603      <row>
4604       <entry><structfield>oprcanmerge</structfield></entry>
4605       <entry><type>bool</type></entry>
4606       <entry></entry>
4607       <entry>This operator supports merge joins</entry>
4608      </row>
4609
4610      <row>
4611       <entry><structfield>oprcanhash</structfield></entry>
4612       <entry><type>bool</type></entry>
4613       <entry></entry>
4614       <entry>This operator supports hash joins</entry>
4615      </row>
4616
4617      <row>
4618       <entry><structfield>oprleft</structfield></entry>
4619       <entry><type>oid</type></entry>
4620       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4621       <entry>Type of the left operand</entry>
4622      </row>
4623
4624      <row>
4625       <entry><structfield>oprright</structfield></entry>
4626       <entry><type>oid</type></entry>
4627       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4628       <entry>Type of the right operand</entry>
4629      </row>
4630
4631      <row>
4632       <entry><structfield>oprresult</structfield></entry>
4633       <entry><type>oid</type></entry>
4634       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4635       <entry>Type of the result</entry>
4636      </row>
4637
4638      <row>
4639       <entry><structfield>oprcom</structfield></entry>
4640       <entry><type>oid</type></entry>
4641       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4642       <entry>Commutator of this operator, if any</entry>
4643      </row>
4644
4645      <row>
4646       <entry><structfield>oprnegate</structfield></entry>
4647       <entry><type>oid</type></entry>
4648       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4649       <entry>Negator of this operator, if any</entry>
4650      </row>
4651
4652      <row>
4653       <entry><structfield>oprcode</structfield></entry>
4654       <entry><type>regproc</type></entry>
4655       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4656       <entry>Function that implements this operator</entry>
4657      </row>
4658
4659      <row>
4660       <entry><structfield>oprrest</structfield></entry>
4661       <entry><type>regproc</type></entry>
4662       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4663       <entry>Restriction selectivity estimation function for this operator</entry>
4664      </row>
4665
4666      <row>
4667       <entry><structfield>oprjoin</structfield></entry>
4668       <entry><type>regproc</type></entry>
4669       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4670       <entry>Join selectivity estimation function for this operator</entry>
4671      </row>
4672     </tbody>
4673    </tgroup>
4674   </table>
4675
4676   <para>
4677    Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4678    is zero for a prefix operator.
4679   </para>
4680
4681  </sect1>
4682
4683
4684  <sect1 id="catalog-pg-opfamily">
4685   <title><structname>pg_opfamily</structname></title>
4686
4687   <indexterm zone="catalog-pg-opfamily">
4688    <primary>pg_opfamily</primary>
4689   </indexterm>
4690
4691   <para>
4692    The catalog <structname>pg_opfamily</structname> defines operator families.
4693    Each operator family is a collection of operators and associated
4694    support routines that implement the semantics specified for a particular
4695    index access method.  Furthermore, the operators in a family are all
4696    <quote>compatible</quote>, in a way that is specified by the access method.
4697    The operator family concept allows cross-data-type operators to be used
4698    with indexes and to be reasoned about using knowledge of access method
4699    semantics.
4700   </para>
4701
4702   <para>
4703    Operator families are described at length in <xref linkend="xindex"/>.
4704   </para>
4705
4706   <table>
4707    <title><structname>pg_opfamily</structname> Columns</title>
4708
4709    <tgroup cols="4">
4710     <thead>
4711      <row>
4712       <entry>Name</entry>
4713       <entry>Type</entry>
4714       <entry>References</entry>
4715       <entry>Description</entry>
4716      </row>
4717     </thead>
4718     <tbody>
4719
4720      <row>
4721       <entry><structfield>oid</structfield></entry>
4722       <entry><type>oid</type></entry>
4723       <entry></entry>
4724       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4725      </row>
4726
4727      <row>
4728       <entry><structfield>opfmethod</structfield></entry>
4729       <entry><type>oid</type></entry>
4730       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4731       <entry>Index access method operator family is for</entry>
4732      </row>
4733
4734      <row>
4735       <entry><structfield>opfname</structfield></entry>
4736       <entry><type>name</type></entry>
4737       <entry></entry>
4738       <entry>Name of this operator family</entry>
4739      </row>
4740
4741      <row>
4742       <entry><structfield>opfnamespace</structfield></entry>
4743       <entry><type>oid</type></entry>
4744       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4745       <entry>Namespace of this operator family</entry>
4746      </row>
4747
4748      <row>
4749       <entry><structfield>opfowner</structfield></entry>
4750       <entry><type>oid</type></entry>
4751       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4752       <entry>Owner of the operator family</entry>
4753      </row>
4754
4755     </tbody>
4756    </tgroup>
4757   </table>
4758
4759   <para>
4760    The majority of the information defining an operator family is not in its
4761    <structname>pg_opfamily</structname> row, but in the associated rows in
4762    <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4763    <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4764    and
4765    <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4766   </para>
4767
4768  </sect1>
4769
4770
4771  <sect1 id="catalog-pg-partitioned-table">
4772   <title><structname>pg_partitioned_table</structname></title>
4773
4774   <indexterm zone="catalog-pg-partitioned-table">
4775    <primary>pg_partitioned_table</primary>
4776   </indexterm>
4777
4778   <para>
4779    The catalog <structname>pg_partitioned_table</structname> stores
4780    information about how tables are partitioned.
4781   </para>
4782
4783   <table>
4784    <title><structname>pg_partitioned_table</structname> Columns</title>
4785
4786    <tgroup cols="4">
4787     <thead>
4788      <row>
4789       <entry>Name</entry>
4790       <entry>Type</entry>
4791       <entry>References</entry>
4792       <entry>Description</entry>
4793      </row>
4794     </thead>
4795
4796     <tbody>
4797
4798      <row>
4799       <entry><structfield>partrelid</structfield></entry>
4800       <entry><type>oid</type></entry>
4801       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4802       <entry>The OID of the <structname>pg_class</structname> entry for this partitioned table</entry>
4803      </row>
4804
4805      <row>
4806       <entry><structfield>partstrat</structfield></entry>
4807       <entry><type>char</type></entry>
4808       <entry></entry>
4809       <entry>
4810        Partitioning strategy; <literal>l</literal> = list partitioned table,
4811        <literal>r</literal> = range partitioned table
4812       </entry>
4813      </row>
4814
4815      <row>
4816       <entry><structfield>partnatts</structfield></entry>
4817       <entry><type>int2</type></entry>
4818       <entry></entry>
4819       <entry>The number of columns in partition key</entry>
4820      </row>
4821
4822      <row>
4823       <entry><structfield>partdefid</structfield></entry>
4824       <entry><type>oid</type></entry>
4825       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4826       <entry>
4827        The OID of the <structname>pg_class</structname> entry for the default partition
4828        of this partitioned table, or zero if this partitioned table does not
4829        have a default partition.
4830      </entry>
4831      </row>
4832
4833      <row>
4834       <entry><structfield>partattrs</structfield></entry>
4835       <entry><type>int2vector</type></entry>
4836       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4837       <entry>
4838        This is an array of <structfield>partnatts</structfield> values that
4839        indicate which table columns are part of the partition key.  For
4840        example, a value of <literal>1 3</literal> would mean that the first
4841        and the third table columns make up the partition key.  A zero in this
4842        array indicates that the corresponding partition key column is an
4843        expression, rather than a simple column reference.
4844       </entry>
4845      </row>
4846
4847      <row>
4848       <entry><structfield>partclass</structfield></entry>
4849       <entry><type>oidvector</type></entry>
4850       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4851       <entry>
4852        For each column in the partition key, this contains the OID of the
4853        operator class to use.  See
4854        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4855       </entry>
4856      </row>
4857
4858      <row>
4859       <entry><structfield>partcollation</structfield></entry>
4860       <entry><type>oidvector</type></entry>
4861       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4862       <entry>
4863        For each column in the partition key, this contains the OID of the
4864        collation to use for partitioning, or zero if the column is not
4865        of a collatable data type.
4866       </entry>
4867      </row>
4868
4869      <row>
4870       <entry><structfield>partexprs</structfield></entry>
4871       <entry><type>pg_node_tree</type></entry>
4872       <entry></entry>
4873       <entry>
4874        Expression trees (in <function>nodeToString()</function>
4875        representation) for partition key columns that are not simple column
4876        references.  This is a list with one element for each zero
4877        entry in <structfield>partattrs</structfield>.  Null if all partition key columns
4878        are simple references.
4879       </entry>
4880      </row>
4881
4882     </tbody>
4883    </tgroup>
4884   </table>
4885  </sect1>
4886
4887
4888  <sect1 id="catalog-pg-pltemplate">
4889   <title><structname>pg_pltemplate</structname></title>
4890
4891   <indexterm zone="catalog-pg-pltemplate">
4892    <primary>pg_pltemplate</primary>
4893   </indexterm>
4894
4895   <para>
4896    The catalog <structname>pg_pltemplate</structname> stores
4897    <quote>template</quote> information for procedural languages.
4898    A template for a language allows the language to be created in a
4899    particular database by a simple <command>CREATE LANGUAGE</command> command,
4900    with no need to specify implementation details.
4901   </para>
4902
4903   <para>
4904    Unlike most system catalogs, <structname>pg_pltemplate</structname>
4905    is shared across all databases of a cluster: there is only one
4906    copy of <structname>pg_pltemplate</structname> per cluster, not
4907    one per database.  This allows the information to be accessible in
4908    each database as it is needed.
4909   </para>
4910
4911   <table>
4912    <title><structname>pg_pltemplate</structname> Columns</title>
4913
4914    <tgroup cols="3">
4915     <thead>
4916      <row>
4917       <entry>Name</entry>
4918       <entry>Type</entry>
4919       <entry>Description</entry>
4920      </row>
4921     </thead>
4922
4923     <tbody>
4924      <row>
4925       <entry><structfield>tmplname</structfield></entry>
4926       <entry><type>name</type></entry>
4927       <entry>Name of the language this template is for</entry>
4928      </row>
4929
4930      <row>
4931       <entry><structfield>tmpltrusted</structfield></entry>
4932       <entry><type>boolean</type></entry>
4933       <entry>True if language is considered trusted</entry>
4934      </row>
4935
4936      <row>
4937       <entry><structfield>tmpldbacreate</structfield></entry>
4938       <entry><type>boolean</type></entry>
4939       <entry>True if language may be created by a database owner</entry>
4940      </row>
4941
4942      <row>
4943       <entry><structfield>tmplhandler</structfield></entry>
4944       <entry><type>text</type></entry>
4945       <entry>Name of call handler function</entry>
4946      </row>
4947
4948      <row>
4949       <entry><structfield>tmplinline</structfield></entry>
4950       <entry><type>text</type></entry>
4951       <entry>Name of anonymous-block handler function, or null if none</entry>
4952      </row>
4953
4954      <row>
4955       <entry><structfield>tmplvalidator</structfield></entry>
4956       <entry><type>text</type></entry>
4957       <entry>Name of validator function, or null if none</entry>
4958      </row>
4959
4960      <row>
4961       <entry><structfield>tmpllibrary</structfield></entry>
4962       <entry><type>text</type></entry>
4963       <entry>Path of shared library that implements language</entry>
4964      </row>
4965
4966      <row>
4967       <entry><structfield>tmplacl</structfield></entry>
4968       <entry><type>aclitem[]</type></entry>
4969       <entry>Access privileges for template (not actually used)</entry>
4970      </row>
4971
4972     </tbody>
4973    </tgroup>
4974   </table>
4975
4976   <para>
4977    There are not currently any commands that manipulate procedural language
4978    templates; to change the built-in information, a superuser must modify
4979    the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4980    or <command>UPDATE</command> commands.
4981   </para>
4982
4983   <note>
4984    <para>
4985     It is likely that <structname>pg_pltemplate</structname> will be removed in some
4986     future release of <productname>PostgreSQL</productname>, in favor of
4987     keeping this knowledge about procedural languages in their respective
4988     extension installation scripts.
4989    </para>
4990   </note>
4991
4992  </sect1>
4993
4994
4995  <sect1 id="catalog-pg-policy">
4996   <title><structname>pg_policy</structname></title>
4997
4998   <indexterm zone="catalog-pg-policy">
4999    <primary>pg_policy</primary>
5000   </indexterm>
5001
5002   <para>
5003    The catalog <structname>pg_policy</structname> stores row level
5004    security policies for tables.  A policy includes the kind of
5005    command that it applies to (possibly all commands), the roles that it
5006    applies to, the expression to be added as a security-barrier
5007    qualification to queries that include the table, and the expression
5008    to be added as a <literal>WITH CHECK</literal> option for queries that attempt to
5009    add new records to the table.
5010   </para>
5011
5012   <table>
5013
5014    <title><structname>pg_policy</structname> Columns</title>
5015
5016    <tgroup cols="4">
5017     <thead>
5018      <row>
5019       <entry>Name</entry>
5020       <entry>Type</entry>
5021       <entry>References</entry>
5022       <entry>Description</entry>
5023      </row>
5024     </thead>
5025
5026     <tbody>
5027      <row>
5028       <entry><structfield>polname</structfield></entry>
5029       <entry><type>name</type></entry>
5030       <entry></entry>
5031       <entry>The name of the policy</entry>
5032      </row>
5033
5034      <row>
5035       <entry><structfield>polrelid</structfield></entry>
5036       <entry><type>oid</type></entry>
5037       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5038       <entry>The table to which the policy applies</entry>
5039      </row>
5040
5041      <row>
5042       <entry><structfield>polcmd</structfield></entry>
5043       <entry><type>char</type></entry>
5044       <entry></entry>
5045       <entry>The command type to which the policy is applied:
5046        <literal>r</literal> for <command>SELECT</command>,
5047        <literal>a</literal> for <command>INSERT</command>,
5048        <literal>w</literal> for <command>UPDATE</command>,
5049        <literal>d</literal> for <command>DELETE</command>,
5050        or <literal>*</literal> for all</entry>
5051      </row>
5052
5053      <row>
5054       <entry><structfield>polpermissive</structfield></entry>
5055       <entry><type>boolean</type></entry>
5056       <entry></entry>
5057       <entry>Is the policy permissive or restrictive?</entry>
5058      </row>
5059
5060      <row>
5061       <entry><structfield>polroles</structfield></entry>
5062       <entry><type>oid[]</type></entry>
5063       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5064       <entry>The roles to which the policy is applied</entry>
5065      </row>
5066
5067      <row>
5068       <entry><structfield>polqual</structfield></entry>
5069       <entry><type>pg_node_tree</type></entry>
5070       <entry></entry>
5071       <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
5072      </row>
5073
5074      <row>
5075       <entry><structfield>polwithcheck</structfield></entry>
5076       <entry><type>pg_node_tree</type></entry>
5077       <entry></entry>
5078       <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
5079      </row>
5080
5081     </tbody>
5082    </tgroup>
5083   </table>
5084
5085   <note>
5086    <para>
5087     Policies stored in <structname>pg_policy</structname> are applied only when
5088     <structname>pg_class</structname>.<structfield>relrowsecurity</structfield> is set for
5089     their table.
5090    </para>
5091   </note>
5092
5093  </sect1>
5094
5095  <sect1 id="catalog-pg-proc">
5096   <title><structname>pg_proc</structname></title>
5097
5098   <indexterm zone="catalog-pg-proc">
5099    <primary>pg_proc</primary>
5100   </indexterm>
5101
5102   <para>
5103    The catalog <structname>pg_proc</structname> stores information about
5104    functions, procedures, aggregate functions, and window functions
5105    (collectively also known as routines).  See <xref
5106    linkend="sql-createfunction"/>, <xref linkend="sql-createprocedure"/>, and
5107    <xref linkend="xfunc"/> for more information.
5108   </para>
5109
5110   <para>
5111    If <structfield>prokind</structfield> indicates that the entry is for an
5112    aggregate function, there should be a matching row in
5113    <structfield>pg_aggregate</structfield>.
5114   </para>
5115
5116   <table>
5117    <title><structname>pg_proc</structname> Columns</title>
5118
5119    <tgroup cols="4">
5120     <thead>
5121      <row>
5122       <entry>Name</entry>
5123       <entry>Type</entry>
5124       <entry>References</entry>
5125       <entry>Description</entry>
5126      </row>
5127     </thead>
5128
5129     <tbody>
5130      <row>
5131       <entry><structfield>oid</structfield></entry>
5132       <entry><type>oid</type></entry>
5133       <entry></entry>
5134       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5135      </row>
5136
5137      <row>
5138       <entry><structfield>proname</structfield></entry>
5139       <entry><type>name</type></entry>
5140       <entry></entry>
5141       <entry>Name of the function</entry>
5142      </row>
5143
5144      <row>
5145       <entry><structfield>pronamespace</structfield></entry>
5146       <entry><type>oid</type></entry>
5147       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5148       <entry>
5149        The OID of the namespace that contains this function
5150       </entry>
5151      </row>
5152
5153      <row>
5154       <entry><structfield>proowner</structfield></entry>
5155       <entry><type>oid</type></entry>
5156       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5157       <entry>Owner of the function</entry>
5158      </row>
5159
5160      <row>
5161       <entry><structfield>prolang</structfield></entry>
5162       <entry><type>oid</type></entry>
5163       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
5164       <entry>Implementation language or call interface of this function</entry>
5165      </row>
5166
5167      <row>
5168       <entry><structfield>procost</structfield></entry>
5169       <entry><type>float4</type></entry>
5170       <entry></entry>
5171       <entry>Estimated execution cost (in units of
5172        <xref linkend="guc-cpu-operator-cost"/>); if <structfield>proretset</structfield>,
5173        this is cost per row returned</entry>
5174      </row>
5175
5176      <row>
5177       <entry><structfield>prorows</structfield></entry>
5178       <entry><type>float4</type></entry>
5179       <entry></entry>
5180       <entry>Estimated number of result rows (zero if not <structfield>proretset</structfield>)</entry>
5181      </row>
5182
5183      <row>
5184       <entry><structfield>provariadic</structfield></entry>
5185       <entry><type>oid</type></entry>
5186       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5187       <entry>Data type of the variadic array parameter's elements,
5188        or zero if the function does not have a variadic parameter</entry>
5189      </row>
5190
5191      <row>
5192       <entry><structfield>protransform</structfield></entry>
5193       <entry><type>regproc</type></entry>
5194       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5195       <entry>Calls to this function can be simplified by this other function
5196        (see <xref linkend="xfunc-transform-functions"/>)</entry>
5197      </row>
5198
5199      <row>
5200       <entry><structfield>prokind</structfield></entry>
5201       <entry><type>char</type></entry>
5202       <entry></entry>
5203       <entry><literal>f</literal> for a normal function, <literal>p</literal>
5204       for a procedure, <literal>a</literal> for an aggregate function, or
5205       <literal>w</literal> for a window function</entry>
5206      </row>
5207
5208      <row>
5209       <entry><structfield>prosecdef</structfield></entry>
5210       <entry><type>bool</type></entry>
5211       <entry></entry>
5212       <entry>Function is a security definer (i.e., a <quote>setuid</quote>
5213       function)</entry>
5214      </row>
5215
5216      <row>
5217       <entry><structfield>proleakproof</structfield></entry>
5218       <entry><type>bool</type></entry>
5219       <entry></entry>
5220       <entry>
5221        The function has no side effects.  No information about the
5222        arguments is conveyed except via the return value.  Any function
5223        that might throw an error depending on the values of its arguments
5224        is not leak-proof.
5225       </entry>
5226      </row>
5227
5228      <row>
5229       <entry><structfield>proisstrict</structfield></entry>
5230       <entry><type>bool</type></entry>
5231       <entry></entry>
5232       <entry>
5233        Function returns null if any call argument is null.  In that
5234        case the function won't actually be called at all.  Functions
5235        that are not <quote>strict</quote> must be prepared to handle
5236        null inputs.
5237       </entry>
5238      </row>
5239
5240      <row>
5241       <entry><structfield>proretset</structfield></entry>
5242       <entry><type>bool</type></entry>
5243       <entry></entry>
5244       <entry>Function returns a set (i.e., multiple values of the specified
5245       data type)</entry>
5246      </row>
5247
5248      <row>
5249       <entry><structfield>provolatile</structfield></entry>
5250       <entry><type>char</type></entry>
5251       <entry></entry>
5252       <entry>
5253        <structfield>provolatile</structfield> tells whether the function's
5254        result depends only on its input arguments, or is affected by outside
5255        factors.
5256        It is <literal>i</literal> for <quote>immutable</quote> functions,
5257        which always deliver the same result for the same inputs.
5258        It is <literal>s</literal> for <quote>stable</quote> functions,
5259        whose results (for fixed inputs) do not change within a scan.
5260        It is <literal>v</literal> for <quote>volatile</quote> functions,
5261        whose results might change at any time.  (Use <literal>v</literal> also
5262        for functions with side-effects, so that calls to them cannot get
5263        optimized away.)
5264       </entry>
5265      </row>
5266
5267      <row>
5268       <entry><structfield>proparallel</structfield></entry>
5269       <entry><type>char</type></entry>
5270       <entry></entry>
5271       <entry>
5272        <structfield>proparallel</structfield> tells whether the function
5273        can be safely run in parallel mode.
5274        It is <literal>s</literal> for functions which are safe to run in
5275        parallel mode without restriction.
5276        It is <literal>r</literal> for functions which can be run in parallel
5277        mode, but their execution is restricted to the parallel group leader;
5278        parallel worker processes cannot invoke these functions.
5279        It is <literal>u</literal> for functions which are unsafe in parallel
5280        mode; the presence of such a function forces a serial execution plan.
5281       </entry>
5282      </row>
5283
5284      <row>
5285       <entry><structfield>pronargs</structfield></entry>
5286       <entry><type>int2</type></entry>
5287       <entry></entry>
5288       <entry>Number of input arguments</entry>
5289      </row>
5290
5291      <row>
5292       <entry><structfield>pronargdefaults</structfield></entry>
5293       <entry><type>int2</type></entry>
5294       <entry></entry>
5295       <entry>Number of arguments that have defaults</entry>
5296      </row>
5297
5298      <row>
5299       <entry><structfield>prorettype</structfield></entry>
5300       <entry><type>oid</type></entry>
5301       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5302       <entry>Data type of the return value</entry>
5303      </row>
5304
5305      <row>
5306       <entry><structfield>proargtypes</structfield></entry>
5307       <entry><type>oidvector</type></entry>
5308       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5309       <entry>
5310        An array with the data types of the function arguments.  This includes
5311        only input arguments (including <literal>INOUT</literal> and
5312        <literal>VARIADIC</literal> arguments), and thus represents
5313        the call signature of the function.
5314       </entry>
5315      </row>
5316
5317      <row>
5318       <entry><structfield>proallargtypes</structfield></entry>
5319       <entry><type>oid[]</type></entry>
5320       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5321       <entry>
5322        An array with the data types of the function arguments.  This includes
5323        all arguments (including <literal>OUT</literal> and
5324        <literal>INOUT</literal> arguments); however, if all the
5325        arguments are <literal>IN</literal> arguments, this field will be null.
5326        Note that subscripting is 1-based, whereas for historical reasons
5327        <structfield>proargtypes</structfield> is subscripted from 0.
5328       </entry>
5329      </row>
5330
5331      <row>
5332       <entry><structfield>proargmodes</structfield></entry>
5333       <entry><type>char[]</type></entry>
5334       <entry></entry>
5335       <entry>
5336         An array with the modes of the function arguments, encoded as
5337         <literal>i</literal> for <literal>IN</literal> arguments,
5338         <literal>o</literal> for <literal>OUT</literal> arguments,
5339         <literal>b</literal> for <literal>INOUT</literal> arguments,
5340         <literal>v</literal> for <literal>VARIADIC</literal> arguments,
5341         <literal>t</literal> for <literal>TABLE</literal> arguments.
5342         If all the arguments are <literal>IN</literal> arguments,
5343         this field will be null.
5344         Note that subscripts correspond to positions of
5345         <structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
5346       </entry>
5347      </row>
5348
5349      <row>
5350       <entry><structfield>proargnames</structfield></entry>
5351       <entry><type>text[]</type></entry>
5352       <entry></entry>
5353       <entry>
5354         An array with the names of the function arguments.
5355         Arguments without a name are set to empty strings in the array.
5356         If none of the arguments have a name, this field will be null.
5357         Note that subscripts correspond to positions of
5358         <structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
5359       </entry>
5360      </row>
5361
5362      <row>
5363       <entry><structfield>proargdefaults</structfield></entry>
5364       <entry><type>pg_node_tree</type></entry>
5365       <entry></entry>
5366       <entry>
5367        Expression trees (in <function>nodeToString()</function> representation)
5368        for default values.  This is a list with
5369        <structfield>pronargdefaults</structfield> elements, corresponding to the last
5370        <replaceable>N</replaceable> <emphasis>input</emphasis> arguments (i.e., the last
5371        <replaceable>N</replaceable> <structfield>proargtypes</structfield> positions).
5372        If none of the arguments have defaults, this field will be null.
5373       </entry>
5374      </row>
5375
5376      <row>
5377       <entry><structfield>protrftypes</structfield></entry>
5378       <entry><type>oid[]</type></entry>
5379       <entry></entry>
5380       <entry>
5381        Data type OIDs for which to apply transforms.
5382       </entry>
5383      </row>
5384
5385      <row>
5386       <entry><structfield>prosrc</structfield></entry>
5387       <entry><type>text</type></entry>
5388       <entry></entry>
5389       <entry>
5390        This tells the function handler how to invoke the function.  It
5391        might be the actual source code of the function for interpreted
5392        languages, a link symbol, a file name, or just about anything
5393        else, depending on the implementation language/call convention.
5394       </entry>
5395      </row>
5396
5397      <row>
5398       <entry><structfield>probin</structfield></entry>
5399       <entry><type>text</type></entry>
5400       <entry></entry>
5401       <entry>
5402        Additional information about how to invoke the function.
5403        Again, the interpretation is language-specific.
5404       </entry>
5405      </row>
5406
5407      <row>
5408       <entry><structfield>proconfig</structfield></entry>
5409       <entry><type>text[]</type></entry>
5410       <entry></entry>
5411       <entry>Function's local settings for run-time configuration variables</entry>
5412      </row>
5413
5414      <row>
5415       <entry><structfield>proacl</structfield></entry>
5416       <entry><type>aclitem[]</type></entry>
5417       <entry></entry>
5418       <entry>
5419        Access privileges; see
5420        <xref linkend="sql-grant"/> and
5421        <xref linkend="sql-revoke"/>
5422        for details
5423       </entry>
5424      </row>
5425     </tbody>
5426    </tgroup>
5427   </table>
5428
5429   <para>
5430    For compiled functions, both built-in and dynamically loaded,
5431    <structfield>prosrc</structfield> contains the function's C-language
5432    name (link symbol).  For all other currently-known language types,
5433    <structfield>prosrc</structfield> contains the function's source
5434    text.  <structfield>probin</structfield> is unused except for
5435    dynamically-loaded C functions, for which it gives the name of the
5436    shared library file containing the function.
5437   </para>
5438
5439  </sect1>
5440
5441  <sect1 id="catalog-pg-publication">
5442   <title><structname>pg_publication</structname></title>
5443
5444   <indexterm zone="catalog-pg-publication">
5445    <primary>pg_publication</primary>
5446   </indexterm>
5447
5448   <para>
5449    The catalog <structname>pg_publication</structname> contains all
5450    publications created in the database.  For more on publications see
5451    <xref linkend="logical-replication-publication"/>.
5452   </para>
5453
5454   <table>
5455    <title><structname>pg_publication</structname> Columns</title>
5456
5457    <tgroup cols="4">
5458     <thead>
5459      <row>
5460       <entry>Name</entry>
5461       <entry>Type</entry>
5462       <entry>References</entry>
5463       <entry>Description</entry>
5464      </row>
5465     </thead>
5466
5467     <tbody>
5468      <row>
5469       <entry><structfield>oid</structfield></entry>
5470       <entry><type>oid</type></entry>
5471       <entry></entry>
5472       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5473      </row>
5474
5475      <row>
5476       <entry><structfield>pubname</structfield></entry>
5477       <entry><type>name</type></entry>
5478       <entry></entry>
5479       <entry>Name of the publication</entry>
5480      </row>
5481
5482      <row>
5483       <entry><structfield>pubowner</structfield></entry>
5484       <entry><type>oid</type></entry>
5485       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5486       <entry>Owner of the publication</entry>
5487      </row>
5488
5489      <row>
5490       <entry><structfield>puballtables</structfield></entry>
5491       <entry><type>bool</type></entry>
5492       <entry></entry>
5493       <entry>If true, this publication automatically includes all tables
5494        in the database, including any that will be created in the future.
5495       </entry>
5496      </row>
5497
5498      <row>
5499       <entry><structfield>pubinsert</structfield></entry>
5500       <entry><type>bool</type></entry>
5501       <entry></entry>
5502       <entry>If true, <command>INSERT</command> operations are replicated for
5503        tables in the publication.</entry>
5504      </row>
5505
5506      <row>
5507       <entry><structfield>pubupdate</structfield></entry>
5508       <entry><type>bool</type></entry>
5509       <entry></entry>
5510       <entry>If true, <command>UPDATE</command> operations are replicated for
5511        tables in the publication.</entry>
5512      </row>
5513
5514      <row>
5515       <entry><structfield>pubdelete</structfield></entry>
5516       <entry><type>bool</type></entry>
5517       <entry></entry>
5518       <entry>If true, <command>DELETE</command> operations are replicated for
5519        tables in the publication.</entry>
5520      </row>
5521     </tbody>
5522    </tgroup>
5523   </table>
5524  </sect1>
5525
5526  <sect1 id="catalog-pg-publication-rel">
5527   <title><structname>pg_publication_rel</structname></title>
5528
5529   <indexterm zone="catalog-pg-publication-rel">
5530    <primary>pg_publication_rel</primary>
5531   </indexterm>
5532
5533   <para>
5534    The catalog <structname>pg_publication_rel</structname> contains the
5535    mapping between relations and publications in the database.  This is a
5536    many-to-many mapping.  See also <xref linkend="view-pg-publication-tables"/>
5537    for a more user-friendly view of this information.
5538   </para>
5539
5540   <table>
5541    <title><structname>pg_publication_rel</structname> Columns</title>
5542
5543    <tgroup cols="4">
5544     <thead>
5545      <row>
5546       <entry>Name</entry>
5547       <entry>Type</entry>
5548       <entry>References</entry>
5549       <entry>Description</entry>
5550      </row>
5551     </thead>
5552
5553     <tbody>
5554      <row>
5555       <entry><structfield>prpubid</structfield></entry>
5556       <entry><type>oid</type></entry>
5557       <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
5558       <entry>Reference to publication</entry>
5559      </row>
5560
5561      <row>
5562       <entry><structfield>prrelid</structfield></entry>
5563       <entry><type>oid</type></entry>
5564       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5565       <entry>Reference to relation</entry>
5566      </row>
5567     </tbody>
5568    </tgroup>
5569   </table>
5570  </sect1>
5571
5572  <sect1 id="catalog-pg-range">
5573   <title><structname>pg_range</structname></title>
5574
5575   <indexterm zone="catalog-pg-range">
5576    <primary>pg_range</primary>
5577   </indexterm>
5578
5579   <para>
5580    The catalog <structname>pg_range</structname> stores information about
5581    range types.  This is in addition to the types' entries in
5582    <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5583   </para>
5584
5585   <table>
5586    <title><structname>pg_range</structname> Columns</title>
5587
5588    <tgroup cols="4">
5589     <thead>
5590      <row>
5591       <entry>Name</entry>
5592       <entry>Type</entry>
5593       <entry>References</entry>
5594       <entry>Description</entry>
5595      </row>
5596     </thead>
5597
5598     <tbody>
5599      <row>
5600       <entry><structfield>rngtypid</structfield></entry>
5601       <entry><type>oid</type></entry>
5602       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5603       <entry>OID of the range type</entry>
5604      </row>
5605
5606      <row>
5607       <entry><structfield>rngsubtype</structfield></entry>
5608       <entry><type>oid</type></entry>
5609       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5610       <entry>OID of the element type (subtype) of this range type</entry>
5611      </row>
5612
5613      <row>
5614       <entry><structfield>rngcollation</structfield></entry>
5615       <entry><type>oid</type></entry>
5616       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5617       <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5618      </row>
5619
5620      <row>
5621       <entry><structfield>rngsubopc</structfield></entry>
5622       <entry><type>oid</type></entry>
5623       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5624       <entry>OID of the subtype's operator class used for range comparisons</entry>
5625      </row>
5626
5627      <row>
5628       <entry><structfield>rngcanonical</structfield></entry>
5629       <entry><type>regproc</type></entry>
5630       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5631       <entry>OID of the function to convert a range value into canonical form,
5632       or 0 if none</entry>
5633      </row>
5634
5635      <row>
5636       <entry><structfield>rngsubdiff</structfield></entry>
5637       <entry><type>regproc</type></entry>
5638       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5639       <entry>OID of the function to return the difference between two element
5640       values as <type>double precision</type>, or 0 if none</entry>
5641      </row>
5642     </tbody>
5643    </tgroup>
5644   </table>
5645
5646   <para>
5647    <structfield>rngsubopc</structfield> (plus <structfield>rngcollation</structfield>, if the
5648    element type is collatable) determines the sort ordering used by the range
5649    type.  <structfield>rngcanonical</structfield> is used when the element type is
5650    discrete.  <structfield>rngsubdiff</structfield> is optional but should be supplied to
5651    improve performance of GiST indexes on the range type.
5652   </para>
5653
5654  </sect1>
5655
5656  <sect1 id="catalog-pg-replication-origin">
5657   <title><structname>pg_replication_origin</structname></title>
5658
5659   <indexterm zone="catalog-pg-replication-origin">
5660    <primary>pg_replication_origin</primary>
5661   </indexterm>
5662
5663   <para>
5664    The <structname>pg_replication_origin</structname> catalog contains
5665    all replication origins created.  For more on replication origins
5666    see <xref linkend="replication-origins"/>.
5667   </para>
5668
5669   <table>
5670
5671    <title><structname>pg_replication_origin</structname> Columns</title>
5672
5673    <tgroup cols="4">
5674     <thead>
5675      <row>
5676       <entry>Name</entry>
5677       <entry>Type</entry>
5678       <entry>References</entry>
5679       <entry>Description</entry>
5680      </row>
5681     </thead>
5682
5683     <tbody>
5684      <row>
5685       <entry><structfield>roident</structfield></entry>
5686       <entry><type>Oid</type></entry>
5687       <entry></entry>
5688       <entry>A unique, cluster-wide identifier for the replication
5689       origin. Should never leave the system.</entry>
5690      </row>
5691
5692      <row>
5693       <entry><structfield>roname</structfield></entry>
5694       <entry><type>text</type></entry>
5695       <entry></entry>
5696       <entry>The external, user defined, name of a replication
5697       origin.</entry>
5698      </row>
5699     </tbody>
5700    </tgroup>
5701   </table>
5702  </sect1>
5703
5704  <sect1 id="catalog-pg-rewrite">
5705   <title><structname>pg_rewrite</structname></title>
5706
5707   <indexterm zone="catalog-pg-rewrite">
5708    <primary>pg_rewrite</primary>
5709   </indexterm>
5710
5711   <para>
5712    The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5713   </para>
5714
5715   <table>
5716    <title><structname>pg_rewrite</structname> Columns</title>
5717
5718    <tgroup cols="4">
5719     <thead>
5720      <row>
5721       <entry>Name</entry>
5722       <entry>Type</entry>
5723       <entry>References</entry>
5724       <entry>Description</entry>
5725      </row>
5726     </thead>
5727
5728     <tbody>
5729      <row>
5730       <entry><structfield>oid</structfield></entry>
5731       <entry><type>oid</type></entry>
5732       <entry></entry>
5733       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5734      </row>
5735
5736      <row>
5737       <entry><structfield>rulename</structfield></entry>
5738       <entry><type>name</type></entry>
5739       <entry></entry>
5740       <entry>Rule name</entry>
5741      </row>
5742
5743      <row>
5744       <entry><structfield>ev_class</structfield></entry>
5745       <entry><type>oid</type></entry>
5746       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5747       <entry>The table this rule is for</entry>
5748      </row>
5749
5750      <row>
5751       <entry><structfield>ev_type</structfield></entry>
5752       <entry><type>char</type></entry>
5753       <entry></entry>
5754       <entry>
5755        Event type that the rule is for: 1 = <command>SELECT</command>, 2 =
5756        <command>UPDATE</command>, 3 = <command>INSERT</command>, 4 =
5757        <command>DELETE</command>
5758       </entry>
5759      </row>
5760
5761      <row>
5762       <entry><structfield>ev_enabled</structfield></entry>
5763       <entry><type>char</type></entry>
5764       <entry></entry>
5765       <entry>
5766        Controls in which <xref linkend="guc-session-replication-role"/> modes
5767        the rule fires.
5768        <literal>O</literal> = rule fires in <quote>origin</quote> and <quote>local</quote> modes,
5769        <literal>D</literal> = rule is disabled,
5770        <literal>R</literal> = rule fires in <quote>replica</quote> mode,
5771        <literal>A</literal> = rule fires always.
5772       </entry>
5773      </row>
5774
5775      <row>
5776       <entry><structfield>is_instead</structfield></entry>
5777       <entry><type>bool</type></entry>
5778       <entry></entry>
5779       <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5780      </row>
5781
5782      <row>
5783       <entry><structfield>ev_qual</structfield></entry>
5784       <entry><type>pg_node_tree</type></entry>
5785       <entry></entry>
5786       <entry>
5787        Expression tree (in the form of a
5788        <function>nodeToString()</function> representation) for the
5789        rule's qualifying condition
5790       </entry>
5791      </row>
5792
5793      <row>
5794       <entry><structfield>ev_action</structfield></entry>
5795       <entry><type>pg_node_tree</type></entry>
5796       <entry></entry>
5797       <entry>
5798        Query tree (in the form of a
5799        <function>nodeToString()</function> representation) for the
5800        rule's action
5801       </entry>
5802      </row>
5803     </tbody>
5804    </tgroup>
5805   </table>
5806
5807   <note>
5808    <para>
5809     <literal>pg_class.relhasrules</literal>
5810     must be true if a table has any rules in this catalog.
5811    </para>
5812   </note>
5813
5814  </sect1>
5815
5816  <sect1 id="catalog-pg-seclabel">
5817   <title><structname>pg_seclabel</structname></title>
5818
5819   <indexterm zone="catalog-pg-seclabel">
5820    <primary>pg_seclabel</primary>
5821   </indexterm>
5822
5823   <para>
5824    The catalog <structname>pg_seclabel</structname> stores security
5825    labels on database objects.  Security labels can be manipulated
5826    with the <xref linkend="sql-security-label"/> command.  For an easier
5827    way to view security labels, see <xref linkend="view-pg-seclabels"/>.
5828   </para>
5829
5830   <para>
5831    See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5832    which performs a similar function for security labels of database objects
5833    that are shared across a database cluster.
5834   </para>
5835
5836   <table>
5837    <title><structname>pg_seclabel</structname> Columns</title>
5838
5839    <tgroup cols="4">
5840     <thead>
5841      <row>
5842       <entry>Name</entry>
5843       <entry>Type</entry>
5844       <entry>References</entry>
5845       <entry>Description</entry>
5846      </row>
5847     </thead>
5848
5849     <tbody>
5850      <row>
5851       <entry><structfield>objoid</structfield></entry>
5852       <entry><type>oid</type></entry>
5853       <entry>any OID column</entry>
5854       <entry>The OID of the object this security label pertains to</entry>
5855      </row>
5856
5857      <row>
5858       <entry><structfield>classoid</structfield></entry>
5859       <entry><type>oid</type></entry>
5860       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5861       <entry>The OID of the system catalog this object appears in</entry>
5862      </row>
5863
5864      <row>
5865       <entry><structfield>objsubid</structfield></entry>
5866       <entry><type>int4</type></entry>
5867       <entry></entry>
5868       <entry>
5869        For a security label on a table column, this is the column number (the
5870        <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
5871        the table itself).  For all other object types, this column is
5872        zero.
5873       </entry>
5874      </row>
5875
5876      <row>
5877       <entry><structfield>provider</structfield></entry>
5878       <entry><type>text</type></entry>
5879       <entry></entry>
5880       <entry>The label provider associated with this label.</entry>
5881      </row>
5882
5883      <row>
5884       <entry><structfield>label</structfield></entry>
5885       <entry><type>text</type></entry>
5886       <entry></entry>
5887       <entry>The security label applied to this object.</entry>
5888      </row>
5889     </tbody>
5890    </tgroup>
5891   </table>
5892  </sect1>
5893
5894  <sect1 id="catalog-pg-sequence">
5895   <title><structname>pg_sequence</structname></title>
5896
5897   <indexterm zone="catalog-pg-sequence">
5898    <primary>pg_sequence</primary>
5899   </indexterm>
5900
5901   <para>
5902    The catalog <structname>pg_sequence</structname> contains information about
5903    sequences.  Some of the information about sequences, such as the name and
5904    the schema, is in <structname>pg_class</structname>.
5905   </para>
5906
5907   <table>
5908    <title><structname>pg_sequence</structname> Columns</title>
5909
5910    <tgroup cols="4">
5911     <thead>
5912      <row>
5913       <entry>Name</entry>
5914       <entry>Type</entry>
5915       <entry>References</entry>
5916       <entry>Description</entry>
5917      </row>
5918     </thead>
5919
5920     <tbody>
5921      <row>
5922       <entry><structfield>seqrelid</structfield></entry>
5923       <entry><type>oid</type></entry>
5924       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5925       <entry>The OID of the <structname>pg_class</structname> entry for this sequence</entry>
5926      </row>
5927
5928      <row>
5929       <entry><structfield>seqtypid</structfield></entry>
5930       <entry><type>oid</type></entry>
5931       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5932       <entry>Data type of the sequence</entry>
5933      </row>
5934
5935      <row>
5936       <entry><structfield>seqstart</structfield></entry>
5937       <entry><type>int8</type></entry>
5938       <entry></entry>
5939       <entry>Start value of the sequence</entry>
5940      </row>
5941
5942      <row>
5943       <entry><structfield>seqincrement</structfield></entry>
5944       <entry><type>int8</type></entry>
5945       <entry></entry>
5946       <entry>Increment value of the sequence</entry>
5947      </row>
5948
5949      <row>
5950       <entry><structfield>seqmax</structfield></entry>
5951       <entry><type>int8</type></entry>
5952       <entry></entry>
5953       <entry>Maximum value of the sequence</entry>
5954      </row>
5955
5956      <row>
5957       <entry><structfield>seqmin</structfield></entry>
5958       <entry><type>int8</type></entry>
5959       <entry></entry>
5960       <entry>Minimum value of the sequence</entry>
5961      </row>
5962
5963      <row>
5964       <entry><structfield>seqcache</structfield></entry>
5965       <entry><type>int8</type></entry>
5966       <entry></entry>
5967       <entry>Cache size of the sequence</entry>
5968      </row>
5969
5970      <row>
5971       <entry><structfield>seqcycle</structfield></entry>
5972       <entry><type>bool</type></entry>
5973       <entry></entry>
5974       <entry>Whether the sequence cycles</entry>
5975      </row>
5976     </tbody>
5977    </tgroup>
5978   </table>
5979  </sect1>
5980
5981  <sect1 id="catalog-pg-shdepend">
5982   <title><structname>pg_shdepend</structname></title>
5983
5984   <indexterm zone="catalog-pg-shdepend">
5985    <primary>pg_shdepend</primary>
5986   </indexterm>
5987
5988   <para>
5989    The catalog <structname>pg_shdepend</structname> records the
5990    dependency relationships between database objects and shared objects,
5991    such as roles.  This information allows
5992    <productname>PostgreSQL</productname> to ensure that those objects are
5993    unreferenced before attempting to delete them.
5994   </para>
5995
5996   <para>
5997    See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5998    which performs a similar function for dependencies involving objects
5999    within a single database.
6000   </para>
6001
6002   <para>
6003    Unlike most system catalogs, <structname>pg_shdepend</structname>
6004    is shared across all databases of a cluster: there is only one
6005    copy of <structname>pg_shdepend</structname> per cluster, not
6006    one per database.
6007   </para>
6008
6009   <table>
6010    <title><structname>pg_shdepend</structname> Columns</title>
6011
6012    <tgroup cols="4">
6013     <thead>
6014      <row>
6015       <entry>Name</entry>
6016       <entry>Type</entry>
6017       <entry>References</entry>
6018       <entry>Description</entry>
6019      </row>
6020     </thead>
6021
6022     <tbody>
6023      <row>
6024       <entry><structfield>dbid</structfield></entry>
6025       <entry><type>oid</type></entry>
6026       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6027       <entry>The OID of the database the dependent object is in,
6028        or zero for a shared object</entry>
6029      </row>
6030
6031      <row>
6032       <entry><structfield>classid</structfield></entry>
6033       <entry><type>oid</type></entry>
6034       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6035       <entry>The OID of the system catalog the dependent object is in</entry>
6036      </row>
6037
6038      <row>
6039       <entry><structfield>objid</structfield></entry>
6040       <entry><type>oid</type></entry>
6041       <entry>any OID column</entry>
6042       <entry>The OID of the specific dependent object</entry>
6043      </row>
6044
6045      <row>
6046       <entry><structfield>objsubid</structfield></entry>
6047       <entry><type>int4</type></entry>
6048       <entry></entry>
6049       <entry>
6050        For a table column, this is the column number (the
6051        <structfield>objid</structfield> and <structfield>classid</structfield> refer to the
6052        table itself).  For all other object types, this column is zero.
6053       </entry>
6054      </row>
6055
6056      <row>
6057       <entry><structfield>refclassid</structfield></entry>
6058       <entry><type>oid</type></entry>
6059       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6060       <entry>The OID of the system catalog the referenced object is in
6061        (must be a shared catalog)</entry>
6062      </row>
6063
6064      <row>
6065       <entry><structfield>refobjid</structfield></entry>
6066       <entry><type>oid</type></entry>
6067       <entry>any OID column</entry>
6068       <entry>The OID of the specific referenced object</entry>
6069      </row>
6070
6071      <row>
6072       <entry><structfield>deptype</structfield></entry>
6073       <entry><type>char</type></entry>
6074       <entry></entry>
6075       <entry>
6076        A code defining the specific semantics of this dependency relationship; see text
6077       </entry>
6078      </row>
6079
6080     </tbody>
6081    </tgroup>
6082   </table>
6083
6084   <para>
6085    In all cases, a <structname>pg_shdepend</structname> entry indicates that
6086    the referenced object cannot be dropped without also dropping the dependent
6087    object.  However, there are several subflavors identified by
6088    <structfield>deptype</structfield>:
6089
6090    <variablelist>
6091     <varlistentry>
6092      <term><symbol>SHARED_DEPENDENCY_OWNER</symbol> (<literal>o</literal>)</term>
6093      <listitem>
6094       <para>
6095        The referenced object (which must be a role) is the owner of the
6096        dependent object.
6097       </para>
6098      </listitem>
6099     </varlistentry>
6100
6101     <varlistentry>
6102      <term><symbol>SHARED_DEPENDENCY_ACL</symbol> (<literal>a</literal>)</term>
6103      <listitem>
6104       <para>
6105        The referenced object (which must be a role) is mentioned in the
6106        ACL (access control list, i.e., privileges list) of the
6107        dependent object.  (A <symbol>SHARED_DEPENDENCY_ACL</symbol> entry is
6108        not made for the owner of the object, since the owner will have
6109        a <symbol>SHARED_DEPENDENCY_OWNER</symbol> entry anyway.)
6110       </para>
6111      </listitem>
6112     </varlistentry>
6113
6114     <varlistentry>
6115      <term><symbol>SHARED_DEPENDENCY_POLICY</symbol> (<literal>r</literal>)</term>
6116      <listitem>
6117       <para>
6118        The referenced object (which must be a role) is mentioned as the
6119        target of a dependent policy object.
6120       </para>
6121      </listitem>
6122     </varlistentry>
6123
6124     <varlistentry>
6125      <term><symbol>SHARED_DEPENDENCY_PIN</symbol> (<literal>p</literal>)</term>
6126      <listitem>
6127       <para>
6128        There is no dependent object; this type of entry is a signal
6129        that the system itself depends on the referenced object, and so
6130        that object must never be deleted.  Entries of this type are
6131        created only by <command>initdb</command>.  The columns for the
6132        dependent object contain zeroes.
6133       </para>
6134      </listitem>
6135     </varlistentry>
6136    </variablelist>
6137
6138    Other dependency flavors might be needed in future.  Note in particular
6139    that the current definition only supports roles as referenced objects.
6140   </para>
6141
6142  </sect1>
6143
6144  <sect1 id="catalog-pg-shdescription">
6145   <title><structname>pg_shdescription</structname></title>
6146
6147   <indexterm zone="catalog-pg-shdescription">
6148    <primary>pg_shdescription</primary>
6149   </indexterm>
6150
6151   <para>
6152    The catalog <structname>pg_shdescription</structname> stores optional
6153    descriptions (comments) for shared database objects.  Descriptions can be
6154    manipulated with the <xref linkend="sql-comment"/> command and viewed with
6155    <application>psql</application>'s <literal>\d</literal> commands.
6156   </para>
6157
6158   <para>
6159    See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6160    which performs a similar function for descriptions involving objects
6161    within a single database.
6162   </para>
6163
6164   <para>
6165    Unlike most system catalogs, <structname>pg_shdescription</structname>
6166    is shared across all databases of a cluster: there is only one
6167    copy of <structname>pg_shdescription</structname> per cluster, not
6168    one per database.
6169   </para>
6170
6171   <table>
6172    <title><structname>pg_shdescription</structname> Columns</title>
6173
6174    <tgroup cols="4">
6175     <thead>
6176      <row>
6177       <entry>Name</entry>
6178       <entry>Type</entry>
6179       <entry>References</entry>
6180       <entry>Description</entry>
6181      </row>
6182     </thead>
6183
6184     <tbody>
6185      <row>
6186       <entry><structfield>objoid</structfield></entry>
6187       <entry><type>oid</type></entry>
6188       <entry>any OID column</entry>
6189       <entry>The OID of the object this description pertains to</entry>
6190      </row>
6191
6192      <row>
6193       <entry><structfield>classoid</structfield></entry>
6194       <entry><type>oid</type></entry>
6195       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6196       <entry>The OID of the system catalog this object appears in</entry>
6197      </row>
6198
6199      <row>
6200       <entry><structfield>description</structfield></entry>
6201       <entry><type>text</type></entry>
6202       <entry></entry>
6203       <entry>Arbitrary text that serves as the description of this object</entry>
6204      </row>
6205     </tbody>
6206    </tgroup>
6207   </table>
6208
6209  </sect1>
6210
6211  <sect1 id="catalog-pg-shseclabel">
6212   <title><structname>pg_shseclabel</structname></title>
6213
6214   <indexterm zone="catalog-pg-shseclabel">
6215    <primary>pg_shseclabel</primary>
6216   </indexterm>
6217
6218   <para>
6219    The catalog <structname>pg_shseclabel</structname> stores security
6220    labels on shared database objects.  Security labels can be manipulated
6221    with the <xref linkend="sql-security-label"/> command.  For an easier
6222    way to view security labels, see <xref linkend="view-pg-seclabels"/>.
6223   </para>
6224
6225   <para>
6226    See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6227    which performs a similar function for security labels involving objects
6228    within a single database.
6229   </para>
6230
6231   <para>
6232    Unlike most system catalogs, <structname>pg_shseclabel</structname>
6233    is shared across all databases of a cluster: there is only one
6234    copy of <structname>pg_shseclabel</structname> per cluster, not
6235    one per database.
6236   </para>
6237
6238   <table>
6239    <title><structname>pg_shseclabel</structname> Columns</title>
6240    <tgroup cols="4">
6241     <thead>
6242      <row>
6243       <entry>Name</entry>
6244       <entry>Type</entry>
6245       <entry>References</entry>
6246       <entry>Description</entry>
6247      </row>
6248     </thead>
6249     <tbody>
6250      <row>
6251       <entry><structfield>objoid</structfield></entry>
6252       <entry><type>oid</type></entry>
6253       <entry>any OID column</entry>
6254       <entry>The OID of the object this security label pertains to</entry>
6255      </row>
6256      <row>
6257       <entry><structfield>classoid</structfield></entry>
6258       <entry><type>oid</type></entry>
6259       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6260       <entry>The OID of the system catalog this object appears in</entry>
6261      </row>
6262      <row>
6263       <entry><structfield>provider</structfield></entry>
6264       <entry><type>text</type></entry>
6265       <entry></entry>
6266       <entry>The label provider associated with this label.</entry>
6267      </row>
6268      <row>
6269       <entry><structfield>label</structfield></entry>
6270       <entry><type>text</type></entry>
6271       <entry></entry>
6272       <entry>The security label applied to this object.</entry>
6273      </row>
6274     </tbody>
6275    </tgroup>
6276   </table>
6277  </sect1>
6278
6279  <sect1 id="catalog-pg-statistic">
6280   <title><structname>pg_statistic</structname></title>
6281
6282   <indexterm zone="catalog-pg-statistic">
6283    <primary>pg_statistic</primary>
6284   </indexterm>
6285
6286   <para>
6287    The catalog <structname>pg_statistic</structname> stores
6288    statistical data about the contents of the database.  Entries are
6289    created by <xref linkend="sql-analyze"/>
6290    and subsequently used by the query planner.  Note that all the
6291    statistical data is inherently approximate, even assuming that it
6292    is up-to-date.
6293   </para>
6294
6295   <para>
6296    Normally there is one entry, with <structfield>stainherit</structfield> =
6297    <literal>false</literal>, for each table column that has been analyzed.
6298    If the table has inheritance children, a second entry with
6299    <structfield>stainherit</structfield> = <literal>true</literal> is also created.  This row
6300    represents the column's statistics over the inheritance tree, i.e.,
6301    statistics for the data you'd see with
6302    <literal>SELECT <replaceable>column</replaceable> FROM <replaceable>table</replaceable>*</literal>,
6303    whereas the <structfield>stainherit</structfield> = <literal>false</literal> row represents
6304    the results of
6305    <literal>SELECT <replaceable>column</replaceable> FROM ONLY <replaceable>table</replaceable></literal>.
6306   </para>
6307
6308   <para>
6309    <structname>pg_statistic</structname> also stores statistical data about
6310    the values of index expressions.  These are described as if they were
6311    actual data columns; in particular, <structfield>starelid</structfield>
6312    references the index.  No entry is made for an ordinary non-expression
6313    index column, however, since it would be redundant with the entry
6314    for the underlying table column.  Currently, entries for index expressions
6315    always have <structfield>stainherit</structfield> = <literal>false</literal>.
6316   </para>
6317
6318   <para>
6319    Since different kinds of statistics might be appropriate for different
6320    kinds of data, <structname>pg_statistic</structname> is designed not
6321    to assume very much about what sort of statistics it stores.  Only
6322    extremely general statistics (such as nullness) are given dedicated
6323    columns in <structname>pg_statistic</structname>.  Everything else
6324    is stored in <quote>slots</quote>, which are groups of associated columns
6325    whose content is identified by a code number in one of the slot's columns.
6326    For more information see
6327    <filename>src/include/catalog/pg_statistic.h</filename>.
6328   </para>
6329
6330   <para>
6331    <structname>pg_statistic</structname> should not be readable by the
6332    public, since even statistical information about a table's contents
6333    might be considered sensitive.  (Example: minimum and maximum values
6334    of a salary column might be quite interesting.)
6335    <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6336    is a publicly readable view on
6337    <structname>pg_statistic</structname> that only exposes information
6338    about those tables that are readable by the current user.
6339   </para>
6340
6341   <table>
6342    <title><structname>pg_statistic</structname> Columns</title>
6343
6344    <tgroup cols="4">
6345     <thead>
6346      <row>
6347       <entry>Name</entry>
6348       <entry>Type</entry>
6349       <entry>References</entry>
6350       <entry>Description</entry>
6351      </row>
6352     </thead>
6353
6354     <tbody>
6355      <row>
6356       <entry><structfield>starelid</structfield></entry>
6357       <entry><type>oid</type></entry>
6358       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6359       <entry>The table or index that the described column belongs to</entry>
6360      </row>
6361
6362      <row>
6363       <entry><structfield>staattnum</structfield></entry>
6364       <entry><type>int2</type></entry>
6365       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6366       <entry>The number of the described column</entry>
6367      </row>
6368
6369      <row>
6370       <entry><structfield>stainherit</structfield></entry>
6371       <entry><type>bool</type></entry>
6372       <entry></entry>
6373       <entry>If true, the stats include inheritance child columns, not just the
6374        values in the specified relation</entry>
6375      </row>
6376
6377      <row>
6378       <entry><structfield>stanullfrac</structfield></entry>
6379       <entry><type>float4</type></entry>
6380       <entry></entry>
6381       <entry>The fraction of the column's entries that are null</entry>
6382      </row>
6383
6384      <row>
6385       <entry><structfield>stawidth</structfield></entry>
6386       <entry><type>int4</type></entry>
6387       <entry></entry>
6388       <entry>The average stored width, in bytes, of nonnull entries</entry>
6389      </row>
6390
6391      <row>
6392       <entry><structfield>stadistinct</structfield></entry>
6393       <entry><type>float4</type></entry>
6394       <entry></entry>
6395       <entry>The number of distinct nonnull data values in the column.
6396       A value greater than zero is the actual number of distinct values.
6397       A value less than zero is the negative of a multiplier for the number
6398       of rows in the table; for example, a column in which about 80% of the
6399       values are nonnull and each nonnull value appears about twice on
6400       average could be represented by <structfield>stadistinct</structfield> = -0.4.
6401       A zero value means the number of distinct values is unknown.
6402       </entry>
6403      </row>
6404
6405      <row>
6406       <entry><structfield>stakind<replaceable>N</replaceable></structfield></entry>
6407       <entry><type>int2</type></entry>
6408       <entry></entry>
6409       <entry>
6410        A code number indicating the kind of statistics stored in the
6411        <replaceable>N</replaceable>th <quote>slot</quote> of the
6412        <structname>pg_statistic</structname> row.
6413       </entry>
6414      </row>
6415
6416      <row>
6417       <entry><structfield>staop<replaceable>N</replaceable></structfield></entry>
6418       <entry><type>oid</type></entry>
6419       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6420       <entry>
6421        An operator used to derive the statistics stored in the
6422        <replaceable>N</replaceable>th <quote>slot</quote>.  For example, a
6423        histogram slot would show the <literal>&lt;</literal> operator
6424        that defines the sort order of the data.
6425       </entry>
6426      </row>
6427
6428      <row>
6429       <entry><structfield>stanumbers<replaceable>N</replaceable></structfield></entry>
6430       <entry><type>float4[]</type></entry>
6431       <entry></entry>
6432       <entry>
6433        Numerical statistics of the appropriate kind for the
6434        <replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
6435        kind does not involve numerical values
6436       </entry>
6437      </row>
6438
6439      <row>
6440       <entry><structfield>stavalues<replaceable>N</replaceable></structfield></entry>
6441       <entry><type>anyarray</type></entry>
6442       <entry></entry>
6443       <entry>
6444        Column data values of the appropriate kind for the
6445        <replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
6446        kind does not store any data values.  Each array's element
6447        values are actually of the specific column's data type, or a related
6448        type such as an array's element type, so there is no way to define
6449        these columns' type more specifically than <type>anyarray</type>.
6450       </entry>
6451      </row>
6452     </tbody>
6453    </tgroup>
6454   </table>
6455
6456  </sect1>
6457
6458  <sect1 id="catalog-pg-statistic-ext">
6459   <title><structname>pg_statistic_ext</structname></title>
6460
6461   <indexterm zone="catalog-pg-statistic-ext">
6462    <primary>pg_statistic_ext</primary>
6463   </indexterm>
6464
6465   <para>
6466    The catalog <structname>pg_statistic_ext</structname>
6467    holds extended planner statistics.
6468    Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
6469    created with <xref linkend="sql-createstatistics"/>.
6470   </para>
6471
6472   <table>
6473    <title><structname>pg_statistic_ext</structname> Columns</title>
6474
6475    <tgroup cols="4">
6476     <thead>
6477      <row>
6478       <entry>Name</entry>
6479       <entry>Type</entry>
6480       <entry>References</entry>
6481       <entry>Description</entry>
6482      </row>
6483     </thead>
6484
6485     <tbody>
6486
6487      <row>
6488       <entry><structfield>stxrelid</structfield></entry>
6489       <entry><type>oid</type></entry>
6490       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6491       <entry>Table containing the columns described by this object</entry>
6492      </row>
6493
6494      <row>
6495       <entry><structfield>stxname</structfield></entry>
6496       <entry><type>name</type></entry>
6497       <entry></entry>
6498       <entry>Name of the statistics object</entry>
6499      </row>
6500
6501      <row>
6502       <entry><structfield>stxnamespace</structfield></entry>
6503       <entry><type>oid</type></entry>
6504       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6505       <entry>
6506        The OID of the namespace that contains this statistics object
6507       </entry>
6508      </row>
6509
6510      <row>
6511       <entry><structfield>stxowner</structfield></entry>
6512       <entry><type>oid</type></entry>
6513       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6514       <entry>Owner of the statistics object</entry>
6515      </row>
6516
6517      <row>
6518       <entry><structfield>stxkeys</structfield></entry>
6519       <entry><type>int2vector</type></entry>
6520       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6521       <entry>
6522        An array of attribute numbers, indicating which table columns are
6523        covered by this statistics object;
6524        for example a value of <literal>1 3</literal> would
6525        mean that the first and the third table columns are covered
6526       </entry>
6527      </row>
6528
6529      <row>
6530       <entry><structfield>stxkind</structfield></entry>
6531       <entry><type>char[]</type></entry>
6532       <entry></entry>
6533       <entry>
6534         An array containing codes for the enabled statistic kinds;
6535         valid values are:
6536         <literal>d</literal> for n-distinct statistics,
6537         <literal>f</literal> for functional dependency statistics
6538       </entry>
6539      </row>
6540
6541      <row>
6542       <entry><structfield>stxndistinct</structfield></entry>
6543       <entry><type>pg_ndistinct</type></entry>
6544       <entry></entry>
6545       <entry>
6546        N-distinct counts, serialized as <structname>pg_ndistinct</structname> type
6547       </entry>
6548      </row>
6549
6550      <row>
6551       <entry><structfield>stxdependencies</structfield></entry>
6552       <entry><type>pg_dependencies</type></entry>
6553       <entry></entry>
6554       <entry>
6555        Functional dependency statistics, serialized
6556        as <structname>pg_dependencies</structname> type
6557       </entry>
6558      </row>
6559
6560     </tbody>
6561    </tgroup>
6562   </table>
6563
6564   <para>
6565    The <structfield>stxkind</structfield> field is filled at creation of the
6566    statistics object, indicating which statistic type(s) are desired.
6567    The fields after it are initially NULL and are filled only when the
6568    corresponding statistic has been computed by <command>ANALYZE</command>.
6569   </para>
6570  </sect1>
6571
6572  <sect1 id="catalog-pg-subscription">
6573   <title><structname>pg_subscription</structname></title>
6574
6575   <indexterm zone="catalog-pg-subscription">
6576    <primary>pg_subscription</primary>
6577   </indexterm>
6578
6579   <para>
6580    The catalog <structname>pg_subscription</structname> contains all existing
6581    logical replication subscriptions.  For more information about logical
6582    replication see <xref linkend="logical-replication"/>.
6583   </para>
6584
6585   <para>
6586    Unlike most system catalogs, <structname>pg_subscription</structname> is
6587    shared across all databases of a cluster: There is only one copy
6588    of <structname>pg_subscription</structname> per cluster, not one per
6589    database.
6590   </para>
6591
6592   <para>
6593    Access to the column <structfield>subconninfo</structfield> is revoked from
6594    normal users, because it could contain plain-text passwords.
6595   </para>
6596
6597   <table>
6598    <title><structname>pg_subscription</structname> Columns</title>
6599
6600    <tgroup cols="4">
6601     <thead>
6602      <row>
6603       <entry>Name</entry>
6604       <entry>Type</entry>
6605       <entry>References</entry>
6606       <entry>Description</entry>
6607      </row>
6608     </thead>
6609
6610     <tbody>
6611      <row>
6612       <entry><structfield>oid</structfield></entry>
6613       <entry><type>oid</type></entry>
6614       <entry></entry>
6615       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6616      </row>
6617
6618      <row>
6619       <entry><structfield>subdbid</structfield></entry>
6620       <entry><type>oid</type></entry>
6621       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6622       <entry>OID of the database which the subscription resides in</entry>
6623      </row>
6624
6625      <row>
6626       <entry><structfield>subname</structfield></entry>
6627       <entry><type>name</type></entry>
6628       <entry></entry>
6629       <entry>Name of the subscription</entry>
6630      </row>
6631
6632      <row>
6633       <entry><structfield>subowner</structfield></entry>
6634       <entry><type>oid</type></entry>
6635       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6636       <entry>Owner of the subscription</entry>
6637      </row>
6638
6639      <row>
6640       <entry><structfield>subenabled</structfield></entry>
6641       <entry><type>bool</type></entry>
6642       <entry></entry>
6643       <entry>If true, the subscription is enabled and should be replicating.</entry>
6644      </row>
6645
6646      <row>
6647       <entry><structfield>subsynccommit</structfield></entry>
6648       <entry><type>text</type></entry>
6649       <entry></entry>
6650       <entry>
6651        Contains the value of the <varname>synchronous_commit</varname>
6652        setting for the subscription workers.
6653       </entry>
6654      </row>
6655
6656      <row>
6657       <entry><structfield>subconninfo</structfield></entry>
6658       <entry><type>text</type></entry>
6659       <entry></entry>
6660       <entry>Connection string to the upstream database</entry>
6661      </row>
6662
6663      <row>
6664       <entry><structfield>subslotname</structfield></entry>
6665       <entry><type>name</type></entry>
6666       <entry></entry>
6667       <entry>Name of the replication slot in the upstream database. Also used
6668        for local replication origin name.</entry>
6669      </row>
6670
6671      <row>
6672       <entry><structfield>subpublications</structfield></entry>
6673       <entry><type>text[]</type></entry>
6674       <entry></entry>
6675       <entry>Array of subscribed publication names. These reference the
6676        publications on the publisher server. For more on publications
6677        see <xref linkend="logical-replication-publication"/>.
6678       </entry>
6679      </row>
6680     </tbody>
6681    </tgroup>
6682   </table>
6683  </sect1>
6684
6685  <sect1 id="catalog-pg-subscription-rel">
6686   <title><structname>pg_subscription_rel</structname></title>
6687
6688   <indexterm zone="catalog-pg-subscription-rel">
6689    <primary>pg_subscription_rel</primary>
6690   </indexterm>
6691
6692   <para>
6693    The catalog <structname>pg_subscription_rel</structname> contains the
6694    state for each replicated relation in each subscription.  This is a
6695    many-to-many mapping.
6696   </para>
6697
6698   <para>
6699    This catalog only contains tables known to the subscription after running
6700    either <command>CREATE SUBSCRIPTION</command> or
6701    <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command>.
6702   </para>
6703
6704   <table>
6705    <title><structname>pg_subscription_rel</structname> Columns</title>
6706
6707    <tgroup cols="4">
6708     <thead>
6709      <row>
6710       <entry>Name</entry>
6711       <entry>Type</entry>
6712       <entry>References</entry>
6713       <entry>Description</entry>
6714      </row>
6715     </thead>
6716
6717     <tbody>
6718      <row>
6719       <entry><structfield>srsubid</structfield></entry>
6720       <entry><type>oid</type></entry>
6721       <entry><literal><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.oid</literal></entry>
6722       <entry>Reference to subscription</entry>
6723      </row>
6724
6725      <row>
6726       <entry><structfield>srrelid</structfield></entry>
6727       <entry><type>oid</type></entry>
6728       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6729       <entry>Reference to relation</entry>
6730      </row>
6731
6732      <row>
6733       <entry><structfield>srsubstate</structfield></entry>
6734       <entry><type>char</type></entry>
6735       <entry></entry>
6736       <entry>
6737        State code:
6738        <literal>i</literal> = initialize,
6739        <literal>d</literal> = data is being copied,
6740        <literal>s</literal> = synchronized,
6741        <literal>r</literal> = ready (normal replication)
6742       </entry>
6743      </row>
6744
6745      <row>
6746       <entry><structfield>srsublsn</structfield></entry>
6747       <entry><type>pg_lsn</type></entry>
6748       <entry></entry>
6749       <entry>
6750        End LSN for <literal>s</literal> and <literal>r</literal> states.
6751       </entry>
6752      </row>
6753     </tbody>
6754    </tgroup>
6755   </table>
6756  </sect1>
6757
6758  <sect1 id="catalog-pg-tablespace">
6759   <title><structname>pg_tablespace</structname></title>
6760
6761   <indexterm zone="catalog-pg-tablespace">
6762    <primary>pg_tablespace</primary>
6763   </indexterm>
6764
6765   <para>
6766    The catalog <structname>pg_tablespace</structname> stores information
6767    about the available tablespaces.  Tables can be placed in particular
6768    tablespaces to aid administration of disk layout.
6769   </para>
6770
6771   <para>
6772    Unlike most system catalogs, <structname>pg_tablespace</structname>
6773    is shared across all databases of a cluster: there is only one
6774    copy of <structname>pg_tablespace</structname> per cluster, not
6775    one per database.
6776   </para>
6777
6778   <table>
6779    <title><structname>pg_tablespace</structname> Columns</title>
6780
6781    <tgroup cols="4">
6782     <thead>
6783      <row>
6784       <entry>Name</entry>
6785       <entry>Type</entry>
6786       <entry>References</entry>
6787       <entry>Description</entry>
6788      </row>
6789     </thead>
6790
6791     <tbody>
6792      <row>
6793       <entry><structfield>oid</structfield></entry>
6794       <entry><type>oid</type></entry>
6795       <entry></entry>
6796       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6797      </row>
6798
6799      <row>
6800       <entry><structfield>spcname</structfield></entry>
6801       <entry><type>name</type></entry>
6802       <entry></entry>
6803       <entry>Tablespace name</entry>
6804      </row>
6805
6806      <row>
6807       <entry><structfield>spcowner</structfield></entry>
6808       <entry><type>oid</type></entry>
6809       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6810       <entry>Owner of the tablespace, usually the user who created it</entry>
6811      </row>
6812
6813      <row>
6814       <entry><structfield>spcacl</structfield></entry>
6815       <entry><type>aclitem[]</type></entry>
6816       <entry></entry>
6817       <entry>
6818        Access privileges; see
6819        <xref linkend="sql-grant"/> and
6820        <xref linkend="sql-revoke"/>
6821        for details
6822       </entry>
6823      </row>
6824
6825      <row>
6826       <entry><structfield>spcoptions</structfield></entry>
6827       <entry><type>text[]</type></entry>
6828       <entry></entry>
6829       <entry>
6830        Tablespace-level options, as <quote>keyword=value</quote> strings
6831       </entry>
6832      </row>
6833     </tbody>
6834    </tgroup>
6835   </table>
6836  </sect1>
6837
6838
6839  <sect1 id="catalog-pg-transform">
6840   <title><structname>pg_transform</structname></title>
6841
6842   <indexterm zone="catalog-pg-transform">
6843    <primary>pg_transform</primary>
6844   </indexterm>
6845
6846   <para>
6847    The catalog <structname>pg_transform</structname> stores information about
6848    transforms, which are a mechanism to adapt data types to procedural
6849    languages.  See <xref linkend="sql-createtransform"/> for more information.
6850   </para>
6851
6852   <table>
6853    <title><structname>pg_transform</structname> Columns</title>
6854
6855    <tgroup cols="4">
6856     <thead>
6857      <row>
6858       <entry>Name</entry>
6859       <entry>Type</entry>
6860       <entry>References</entry>
6861       <entry>Description</entry>
6862      </row>
6863     </thead>
6864
6865     <tbody>
6866      <row>
6867       <entry><structfield>trftype</structfield></entry>
6868       <entry><type>oid</type></entry>
6869       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6870       <entry>OID of the data type this transform is for</entry>
6871      </row>
6872
6873      <row>
6874       <entry><structfield>trflang</structfield></entry>
6875       <entry><type>oid</type></entry>
6876       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6877       <entry>OID of the language this transform is for</entry>
6878      </row>
6879
6880      <row>
6881       <entry><structfield>trffromsql</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>
6885        The OID of the function to use when converting the data type for input
6886        to the procedural language (e.g., function parameters).  Zero is stored
6887        if this operation is not supported.
6888       </entry>
6889      </row>
6890
6891      <row>
6892       <entry><structfield>trftosql</structfield></entry>
6893       <entry><type>regproc</type></entry>
6894       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6895       <entry>
6896        The OID of the function to use when converting output from the
6897        procedural language (e.g., return values) to the data type.  Zero is
6898        stored if this operation is not supported.
6899       </entry>
6900      </row>
6901     </tbody>
6902    </tgroup>
6903   </table>
6904  </sect1>
6905
6906
6907  <sect1 id="catalog-pg-trigger">
6908   <title><structname>pg_trigger</structname></title>
6909
6910   <indexterm zone="catalog-pg-trigger">
6911    <primary>pg_trigger</primary>
6912   </indexterm>
6913
6914   <para>
6915    The catalog <structname>pg_trigger</structname> stores triggers on tables
6916    and views.
6917    See <xref linkend="sql-createtrigger"/>
6918    for more information.
6919   </para>
6920
6921   <table>
6922    <title><structname>pg_trigger</structname> Columns</title>
6923
6924    <tgroup cols="4">
6925     <thead>
6926      <row>
6927       <entry>Name</entry>
6928       <entry>Type</entry>
6929       <entry>References</entry>
6930       <entry>Description</entry>
6931      </row>
6932     </thead>
6933
6934     <tbody>
6935      <row>
6936       <entry><structfield>oid</structfield></entry>
6937       <entry><type>oid</type></entry>
6938       <entry></entry>
6939       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6940      </row>
6941
6942      <row>
6943       <entry><structfield>tgrelid</structfield></entry>
6944       <entry><type>oid</type></entry>
6945       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6946       <entry>The table this trigger is on</entry>
6947      </row>
6948
6949      <row>
6950       <entry><structfield>tgname</structfield></entry>
6951       <entry><type>name</type></entry>
6952       <entry></entry>
6953       <entry>Trigger name (must be unique among triggers of same table)</entry>
6954      </row>
6955
6956      <row>
6957       <entry><structfield>tgfoid</structfield></entry>
6958       <entry><type>oid</type></entry>
6959       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6960       <entry>The function to be called</entry>
6961      </row>
6962
6963      <row>
6964       <entry><structfield>tgtype</structfield></entry>
6965       <entry><type>int2</type></entry>
6966       <entry></entry>
6967       <entry>Bit mask identifying trigger firing conditions</entry>
6968      </row>
6969
6970      <row>
6971       <entry><structfield>tgenabled</structfield></entry>
6972       <entry><type>char</type></entry>
6973       <entry></entry>
6974       <entry>
6975        Controls in which <xref linkend="guc-session-replication-role"/> modes
6976        the trigger fires.
6977        <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
6978        <literal>D</literal> = trigger is disabled,
6979        <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
6980        <literal>A</literal> = trigger fires always.
6981       </entry>
6982      </row>
6983
6984      <row>
6985       <entry><structfield>tgisinternal</structfield></entry>
6986       <entry><type>bool</type></entry>
6987       <entry></entry>
6988       <entry>True if trigger is internally generated (usually, to enforce
6989        the constraint identified by <structfield>tgconstraint</structfield>)</entry>
6990      </row>
6991
6992      <row>
6993       <entry><structfield>tgconstrrelid</structfield></entry>
6994       <entry><type>oid</type></entry>
6995       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6996       <entry>The table referenced by a referential integrity constraint</entry>
6997      </row>
6998
6999      <row>
7000       <entry><structfield>tgconstrindid</structfield></entry>
7001       <entry><type>oid</type></entry>
7002       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7003       <entry>The index supporting a unique, primary key, referential integrity,
7004        or exclusion constraint</entry>
7005      </row>
7006
7007      <row>
7008       <entry><structfield>tgconstraint</structfield></entry>
7009       <entry><type>oid</type></entry>
7010       <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
7011       <entry>The <structname>pg_constraint</structname> entry associated with the trigger, if any</entry>
7012      </row>
7013
7014      <row>
7015       <entry><structfield>tgdeferrable</structfield></entry>
7016       <entry><type>bool</type></entry>
7017       <entry></entry>
7018       <entry>True if constraint trigger is deferrable</entry>
7019      </row>
7020
7021      <row>
7022       <entry><structfield>tginitdeferred</structfield></entry>
7023       <entry><type>bool</type></entry>
7024       <entry></entry>
7025       <entry>True if constraint trigger is initially deferred</entry>
7026      </row>
7027
7028      <row>
7029       <entry><structfield>tgnargs</structfield></entry>
7030       <entry><type>int2</type></entry>
7031       <entry></entry>
7032       <entry>Number of argument strings passed to trigger function</entry>
7033      </row>
7034
7035      <row>
7036       <entry><structfield>tgattr</structfield></entry>
7037       <entry><type>int2vector</type></entry>
7038       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
7039       <entry>Column numbers, if trigger is column-specific; otherwise an
7040        empty array</entry>
7041      </row>
7042
7043      <row>
7044       <entry><structfield>tgargs</structfield></entry>
7045       <entry><type>bytea</type></entry>
7046       <entry></entry>
7047       <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
7048      </row>
7049
7050      <row>
7051       <entry><structfield>tgqual</structfield></entry>
7052       <entry><type>pg_node_tree</type></entry>
7053       <entry></entry>
7054       <entry>Expression tree (in <function>nodeToString()</function>
7055        representation) for the trigger's <literal>WHEN</literal> condition, or null
7056        if none</entry>
7057      </row>
7058
7059      <row>
7060       <entry><structfield>tgoldtable</structfield></entry>
7061       <entry><type>name</type></entry>
7062       <entry></entry>
7063       <entry><literal>REFERENCING</literal> clause name for <literal>OLD TABLE</literal>,
7064        or null if none</entry>
7065      </row>
7066
7067      <row>
7068       <entry><structfield>tgnewtable</structfield></entry>
7069       <entry><type>name</type></entry>
7070       <entry></entry>
7071       <entry><literal>REFERENCING</literal> clause name for <literal>NEW TABLE</literal>,
7072        or null if none</entry>
7073      </row>
7074     </tbody>
7075    </tgroup>
7076   </table>
7077
7078   <para>
7079    Currently, column-specific triggering is supported only for
7080    <literal>UPDATE</literal> events, and so <structfield>tgattr</structfield> is relevant
7081    only for that event type.  <structfield>tgtype</structfield> might
7082    contain bits for other event types as well, but those are presumed
7083    to be table-wide regardless of what is in <structfield>tgattr</structfield>.
7084   </para>
7085
7086   <note>
7087    <para>
7088     When <structfield>tgconstraint</structfield> is nonzero,
7089     <structfield>tgconstrrelid</structfield>, <structfield>tgconstrindid</structfield>,
7090     <structfield>tgdeferrable</structfield>, and <structfield>tginitdeferred</structfield> are
7091     largely redundant with the referenced <structname>pg_constraint</structname> entry.
7092     However, it is possible for a non-deferrable trigger to be associated
7093     with a deferrable constraint: foreign key constraints can have some
7094     deferrable and some non-deferrable triggers.
7095    </para>
7096   </note>
7097
7098   <note>
7099    <para>
7100     <literal>pg_class.relhastriggers</literal>
7101     must be true if a relation has any triggers in this catalog.
7102    </para>
7103   </note>
7104
7105  </sect1>
7106
7107
7108  <sect1 id="catalog-pg-ts-config">
7109   <title><structname>pg_ts_config</structname></title>
7110
7111   <indexterm zone="catalog-pg-ts-config">
7112    <primary>pg_ts_config</primary>
7113   </indexterm>
7114
7115   <para>
7116    The <structname>pg_ts_config</structname> catalog contains entries
7117    representing text search configurations.  A configuration specifies
7118    a particular text search parser and a list of dictionaries to use
7119    for each of the parser's output token types.  The parser is shown
7120    in the <structname>pg_ts_config</structname> entry, but the
7121    token-to-dictionary mapping is defined by subsidiary entries in <link
7122    linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
7123   </para>
7124
7125   <para>
7126    <productname>PostgreSQL</productname>'s text search features are
7127    described at length in <xref linkend="textsearch"/>.
7128   </para>
7129
7130   <table>
7131    <title><structname>pg_ts_config</structname> Columns</title>
7132
7133    <tgroup cols="4">
7134     <thead>
7135      <row>
7136       <entry>Name</entry>
7137       <entry>Type</entry>
7138       <entry>References</entry>
7139       <entry>Description</entry>
7140      </row>
7141     </thead>
7142
7143     <tbody>
7144      <row>
7145       <entry><structfield>oid</structfield></entry>
7146       <entry><type>oid</type></entry>
7147       <entry></entry>
7148       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7149      </row>
7150
7151      <row>
7152       <entry><structfield>cfgname</structfield></entry>
7153       <entry><type>name</type></entry>
7154       <entry></entry>
7155       <entry>Text search configuration name</entry>
7156      </row>
7157
7158      <row>
7159       <entry><structfield>cfgnamespace</structfield></entry>
7160       <entry><type>oid</type></entry>
7161       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7162       <entry>
7163        The OID of the namespace that contains this configuration
7164       </entry>
7165      </row>
7166
7167      <row>
7168       <entry><structfield>cfgowner</structfield></entry>
7169       <entry><type>oid</type></entry>
7170       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7171       <entry>Owner of the configuration</entry>
7172      </row>
7173
7174      <row>
7175       <entry><structfield>cfgparser</structfield></entry>
7176       <entry><type>oid</type></entry>
7177       <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
7178       <entry>The OID of the text search parser for this configuration</entry>
7179      </row>
7180     </tbody>
7181    </tgroup>
7182   </table>
7183  </sect1>
7184
7185
7186  <sect1 id="catalog-pg-ts-config-map">
7187   <title><structname>pg_ts_config_map</structname></title>
7188
7189   <indexterm zone="catalog-pg-ts-config-map">
7190    <primary>pg_ts_config_map</primary>
7191   </indexterm>
7192
7193   <para>
7194    The <structname>pg_ts_config_map</structname> catalog contains entries
7195    showing which text search dictionaries should be consulted, and in
7196    what order, for each output token type of each text search configuration's
7197    parser.
7198   </para>
7199
7200   <para>
7201    <productname>PostgreSQL</productname>'s text search features are
7202    described at length in <xref linkend="textsearch"/>.
7203   </para>
7204
7205   <table>
7206    <title><structname>pg_ts_config_map</structname> Columns</title>
7207
7208    <tgroup cols="4">
7209     <thead>
7210      <row>
7211       <entry>Name</entry>
7212       <entry>Type</entry>
7213       <entry>References</entry>
7214       <entry>Description</entry>
7215      </row>
7216     </thead>
7217
7218     <tbody>
7219      <row>
7220       <entry><structfield>mapcfg</structfield></entry>
7221       <entry><type>oid</type></entry>
7222       <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
7223       <entry>The OID of the <structname>pg_ts_config</structname> entry owning this map entry</entry>
7224      </row>
7225
7226      <row>
7227       <entry><structfield>maptokentype</structfield></entry>
7228       <entry><type>integer</type></entry>
7229       <entry></entry>
7230       <entry>A token type emitted by the configuration's parser</entry>
7231      </row>
7232
7233      <row>
7234       <entry><structfield>mapseqno</structfield></entry>
7235       <entry><type>integer</type></entry>
7236       <entry></entry>
7237       <entry>Order in which to consult this entry (lower
7238        <structfield>mapseqno</structfield>s first)</entry>
7239      </row>
7240
7241      <row>
7242       <entry><structfield>mapdict</structfield></entry>
7243       <entry><type>oid</type></entry>
7244       <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
7245       <entry>The OID of the text search dictionary to consult</entry>
7246      </row>
7247     </tbody>
7248    </tgroup>
7249   </table>
7250  </sect1>
7251
7252
7253  <sect1 id="catalog-pg-ts-dict">
7254   <title><structname>pg_ts_dict</structname></title>
7255
7256   <indexterm zone="catalog-pg-ts-dict">
7257    <primary>pg_ts_dict</primary>
7258   </indexterm>
7259
7260   <para>
7261    The <structname>pg_ts_dict</structname> catalog contains entries
7262    defining text search dictionaries.  A dictionary depends on a text
7263    search template, which specifies all the implementation functions
7264    needed; the dictionary itself provides values for the user-settable
7265    parameters supported by the template.  This division of labor allows
7266    dictionaries to be created by unprivileged users.  The parameters
7267    are specified by a text string <structfield>dictinitoption</structfield>,
7268    whose format and meaning vary depending on the template.
7269   </para>
7270
7271   <para>
7272    <productname>PostgreSQL</productname>'s text search features are
7273    described at length in <xref linkend="textsearch"/>.
7274   </para>
7275
7276   <table>
7277    <title><structname>pg_ts_dict</structname> Columns</title>
7278
7279    <tgroup cols="4">
7280     <thead>
7281      <row>
7282       <entry>Name</entry>
7283       <entry>Type</entry>
7284       <entry>References</entry>
7285       <entry>Description</entry>
7286      </row>
7287     </thead>
7288
7289     <tbody>
7290      <row>
7291       <entry><structfield>oid</structfield></entry>
7292       <entry><type>oid</type></entry>
7293       <entry></entry>
7294       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7295      </row>
7296
7297      <row>
7298       <entry><structfield>dictname</structfield></entry>
7299       <entry><type>name</type></entry>
7300       <entry></entry>
7301       <entry>Text search dictionary name</entry>
7302      </row>
7303
7304      <row>
7305       <entry><structfield>dictnamespace</structfield></entry>
7306       <entry><type>oid</type></entry>
7307       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7308       <entry>
7309        The OID of the namespace that contains this dictionary
7310       </entry>
7311      </row>
7312
7313      <row>
7314       <entry><structfield>dictowner</structfield></entry>
7315       <entry><type>oid</type></entry>
7316       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7317       <entry>Owner of the dictionary</entry>
7318      </row>
7319
7320      <row>
7321       <entry><structfield>dicttemplate</structfield></entry>
7322       <entry><type>oid</type></entry>
7323       <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
7324       <entry>The OID of the text search template for this dictionary</entry>
7325      </row>
7326
7327      <row>
7328       <entry><structfield>dictinitoption</structfield></entry>
7329       <entry><type>text</type></entry>
7330       <entry></entry>
7331       <entry>Initialization option string for the template</entry>
7332      </row>
7333     </tbody>
7334    </tgroup>
7335   </table>
7336  </sect1>
7337
7338
7339  <sect1 id="catalog-pg-ts-parser">
7340   <title><structname>pg_ts_parser</structname></title>
7341
7342   <indexterm zone="catalog-pg-ts-parser">
7343    <primary>pg_ts_parser</primary>
7344   </indexterm>
7345
7346   <para>
7347    The <structname>pg_ts_parser</structname> catalog contains entries
7348    defining text search parsers.  A parser is responsible for splitting
7349    input text into lexemes and assigning a token type to each lexeme.
7350    Since a parser must be implemented by C-language-level functions,
7351    creation of new parsers is restricted to database superusers.
7352   </para>
7353
7354   <para>
7355    <productname>PostgreSQL</productname>'s text search features are
7356    described at length in <xref linkend="textsearch"/>.
7357   </para>
7358
7359   <table>
7360    <title><structname>pg_ts_parser</structname> Columns</title>
7361
7362    <tgroup cols="4">
7363     <thead>
7364      <row>
7365       <entry>Name</entry>
7366       <entry>Type</entry>
7367       <entry>References</entry>
7368       <entry>Description</entry>
7369      </row>
7370     </thead>
7371
7372     <tbody>
7373      <row>
7374       <entry><structfield>oid</structfield></entry>
7375       <entry><type>oid</type></entry>
7376       <entry></entry>
7377       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7378      </row>
7379
7380      <row>
7381       <entry><structfield>prsname</structfield></entry>
7382       <entry><type>name</type></entry>
7383       <entry></entry>
7384       <entry>Text search parser name</entry>
7385      </row>
7386
7387      <row>
7388       <entry><structfield>prsnamespace</structfield></entry>
7389       <entry><type>oid</type></entry>
7390       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7391       <entry>
7392        The OID of the namespace that contains this parser
7393       </entry>
7394      </row>
7395
7396      <row>
7397       <entry><structfield>prsstart</structfield></entry>
7398       <entry><type>regproc</type></entry>
7399       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7400       <entry>OID of the parser's startup function</entry>
7401      </row>
7402
7403      <row>
7404       <entry><structfield>prstoken</structfield></entry>
7405       <entry><type>regproc</type></entry>
7406       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7407       <entry>OID of the parser's next-token function</entry>
7408      </row>
7409
7410      <row>
7411       <entry><structfield>prsend</structfield></entry>
7412       <entry><type>regproc</type></entry>
7413       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7414       <entry>OID of the parser's shutdown function</entry>
7415      </row>
7416
7417      <row>
7418       <entry><structfield>prsheadline</structfield></entry>
7419       <entry><type>regproc</type></entry>
7420       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7421       <entry>OID of the parser's headline function</entry>
7422      </row>
7423
7424      <row>
7425       <entry><structfield>prslextype</structfield></entry>
7426       <entry><type>regproc</type></entry>
7427       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7428       <entry>OID of the parser's lextype function</entry>
7429      </row>
7430     </tbody>
7431    </tgroup>
7432   </table>
7433  </sect1>
7434
7435
7436  <sect1 id="catalog-pg-ts-template">
7437   <title><structname>pg_ts_template</structname></title>
7438
7439   <indexterm zone="catalog-pg-ts-template">
7440    <primary>pg_ts_template</primary>
7441   </indexterm>
7442
7443   <para>
7444    The <structname>pg_ts_template</structname> catalog contains entries
7445    defining text search templates.  A template is the implementation
7446    skeleton for a class of text search dictionaries.
7447    Since a template must be implemented by C-language-level functions,
7448    creation of new templates is restricted to database superusers.
7449   </para>
7450
7451   <para>
7452    <productname>PostgreSQL</productname>'s text search features are
7453    described at length in <xref linkend="textsearch"/>.
7454   </para>
7455
7456   <table>
7457    <title><structname>pg_ts_template</structname> Columns</title>
7458
7459    <tgroup cols="4">
7460     <thead>
7461      <row>
7462       <entry>Name</entry>
7463       <entry>Type</entry>
7464       <entry>References</entry>
7465       <entry>Description</entry>
7466      </row>
7467     </thead>
7468
7469     <tbody>
7470      <row>
7471       <entry><structfield>oid</structfield></entry>
7472       <entry><type>oid</type></entry>
7473       <entry></entry>
7474       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7475      </row>
7476
7477      <row>
7478       <entry><structfield>tmplname</structfield></entry>
7479       <entry><type>name</type></entry>
7480       <entry></entry>
7481       <entry>Text search template name</entry>
7482      </row>
7483
7484      <row>
7485       <entry><structfield>tmplnamespace</structfield></entry>
7486       <entry><type>oid</type></entry>
7487       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7488       <entry>
7489        The OID of the namespace that contains this template
7490       </entry>
7491      </row>
7492
7493      <row>
7494       <entry><structfield>tmplinit</structfield></entry>
7495       <entry><type>regproc</type></entry>
7496       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7497       <entry>OID of the template's initialization function</entry>
7498      </row>
7499
7500      <row>
7501       <entry><structfield>tmpllexize</structfield></entry>
7502       <entry><type>regproc</type></entry>
7503       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7504       <entry>OID of the template's lexize function</entry>
7505      </row>
7506     </tbody>
7507    </tgroup>
7508   </table>
7509  </sect1>
7510
7511
7512  <sect1 id="catalog-pg-type">
7513   <title><structname>pg_type</structname></title>
7514
7515   <indexterm zone="catalog-pg-type">
7516    <primary>pg_type</primary>
7517   </indexterm>
7518
7519   <para>
7520    The catalog <structname>pg_type</structname> stores information about data
7521    types.  Base types and enum types (scalar types) are created with
7522    <xref linkend="sql-createtype"/>, and
7523    domains with
7524    <xref linkend="sql-createdomain"/>.
7525    A composite type is automatically created for each table in the database, to
7526    represent the row structure of the table.  It is also possible to create
7527    composite types with <command>CREATE TYPE AS</command>.
7528   </para>
7529
7530   <table>
7531    <title><structname>pg_type</structname> Columns</title>
7532
7533    <tgroup cols="4">
7534     <thead>
7535      <row>
7536       <entry>Name</entry>
7537       <entry>Type</entry>
7538       <entry>References</entry>
7539       <entry>Description</entry>
7540      </row>
7541     </thead>
7542
7543     <tbody>
7544      <row>
7545       <entry><structfield>oid</structfield></entry>
7546       <entry><type>oid</type></entry>
7547       <entry></entry>
7548       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7549      </row>
7550
7551      <row>
7552       <entry><structfield>typname</structfield></entry>
7553       <entry><type>name</type></entry>
7554       <entry></entry>
7555       <entry>Data type name</entry>
7556      </row>
7557
7558      <row>
7559       <entry><structfield>typnamespace</structfield></entry>
7560       <entry><type>oid</type></entry>
7561       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7562       <entry>
7563        The OID of the namespace that contains this type
7564       </entry>
7565      </row>
7566
7567      <row>
7568       <entry><structfield>typowner</structfield></entry>
7569       <entry><type>oid</type></entry>
7570       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7571       <entry>Owner of the type</entry>
7572      </row>
7573
7574      <row>
7575       <entry><structfield>typlen</structfield></entry>
7576       <entry><type>int2</type></entry>
7577       <entry></entry>
7578       <entry>
7579        For a fixed-size type, <structfield>typlen</structfield> is the number
7580        of bytes in the internal representation of the type.  But for a
7581        variable-length type, <structfield>typlen</structfield> is negative.
7582        -1 indicates a <quote>varlena</quote> type (one that has a length word),
7583        -2 indicates a null-terminated C string.
7584       </entry>
7585      </row>
7586
7587      <row>
7588       <entry><structfield>typbyval</structfield></entry>
7589       <entry><type>bool</type></entry>
7590       <entry></entry>
7591       <entry>
7592        <structfield>typbyval</structfield> determines whether internal
7593        routines pass a value of this type by value or by reference.
7594        <structfield>typbyval</structfield> had better be false if
7595        <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7596        where Datum is 8 bytes).
7597        Variable-length types are always passed by reference. Note that
7598        <structfield>typbyval</structfield> can be false even if the
7599        length would allow pass-by-value.
7600       </entry>
7601      </row>
7602
7603      <row>
7604       <entry><structfield>typtype</structfield></entry>
7605       <entry><type>char</type></entry>
7606       <entry></entry>
7607       <entry>
7608        <structfield>typtype</structfield> is
7609        <literal>b</literal> for a base type,
7610        <literal>c</literal> for a composite type (e.g., a table's row type),
7611        <literal>d</literal> for a domain,
7612        <literal>e</literal> for an enum type,
7613        <literal>p</literal> for a pseudo-type, or
7614        <literal>r</literal> for a range type.
7615        See also <structfield>typrelid</structfield> and
7616        <structfield>typbasetype</structfield>.
7617       </entry>
7618      </row>
7619
7620      <row>
7621       <entry><structfield>typcategory</structfield></entry>
7622       <entry><type>char</type></entry>
7623       <entry></entry>
7624       <entry>
7625        <structfield>typcategory</structfield> is an arbitrary classification
7626        of data types that is used by the parser to determine which implicit
7627        casts should be <quote>preferred</quote>.
7628        See <xref linkend="catalog-typcategory-table"/>.
7629       </entry>
7630      </row>
7631
7632      <row>
7633       <entry><structfield>typispreferred</structfield></entry>
7634       <entry><type>bool</type></entry>
7635       <entry></entry>
7636       <entry>
7637        True if the type is a preferred cast target within its
7638        <structfield>typcategory</structfield>
7639       </entry>
7640      </row>
7641
7642      <row>
7643       <entry><structfield>typisdefined</structfield></entry>
7644       <entry><type>bool</type></entry>
7645       <entry></entry>
7646       <entry>
7647        True if the type is defined, false if this is a placeholder
7648        entry for a not-yet-defined type.  When
7649        <structfield>typisdefined</structfield> is false, nothing
7650        except the type name, namespace, and OID can be relied on.
7651       </entry>
7652      </row>
7653
7654      <row>
7655       <entry><structfield>typdelim</structfield></entry>
7656       <entry><type>char</type></entry>
7657       <entry></entry>
7658       <entry>
7659        Character that separates two values of this type when parsing
7660        array input.  Note that the delimiter is associated with the array
7661        element data type, not the array data type.
7662       </entry>
7663      </row>
7664
7665      <row>
7666       <entry><structfield>typrelid</structfield></entry>
7667       <entry><type>oid</type></entry>
7668       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7669       <entry>
7670        If this is a composite type (see
7671        <structfield>typtype</structfield>), then this column points to
7672        the <structname>pg_class</structname> entry that defines the
7673        corresponding table.  (For a free-standing composite type, the
7674        <structname>pg_class</structname> entry doesn't really represent
7675        a table, but it is needed anyway for the type's
7676        <structname>pg_attribute</structname> entries to link to.)
7677        Zero for non-composite types.
7678       </entry>
7679      </row>
7680
7681      <row>
7682       <entry><structfield>typelem</structfield></entry>
7683       <entry><type>oid</type></entry>
7684       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7685       <entry>
7686        If <structfield>typelem</structfield> is not 0 then it
7687        identifies another row in <structname>pg_type</structname>.
7688        The current type can then be subscripted like an array yielding
7689        values of type <structfield>typelem</structfield>.  A
7690        <quote>true</quote> array type is variable length
7691        (<structfield>typlen</structfield> = -1),
7692        but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
7693        also have nonzero <structfield>typelem</structfield>, for example
7694        <type>name</type> and <type>point</type>.
7695        If a fixed-length type has a <structfield>typelem</structfield> then
7696        its internal representation must be some number of values of the
7697        <structfield>typelem</structfield> data type with no other data.
7698        Variable-length array types have a header defined by the array
7699        subroutines.
7700       </entry>
7701      </row>
7702
7703      <row>
7704       <entry><structfield>typarray</structfield></entry>
7705       <entry><type>oid</type></entry>
7706       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7707       <entry>
7708        If <structfield>typarray</structfield> is not 0 then it
7709        identifies another row in <structname>pg_type</structname>, which
7710        is the <quote>true</quote> array type having this type as element
7711       </entry>
7712      </row>
7713
7714      <row>
7715       <entry><structfield>typinput</structfield></entry>
7716       <entry><type>regproc</type></entry>
7717       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7718       <entry>Input conversion function (text format)</entry>
7719      </row>
7720
7721      <row>
7722       <entry><structfield>typoutput</structfield></entry>
7723       <entry><type>regproc</type></entry>
7724       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7725       <entry>Output conversion function (text format)</entry>
7726      </row>
7727
7728      <row>
7729       <entry><structfield>typreceive</structfield></entry>
7730       <entry><type>regproc</type></entry>
7731       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7732       <entry>Input conversion function (binary format), or 0 if none</entry>
7733      </row>
7734
7735      <row>
7736       <entry><structfield>typsend</structfield></entry>
7737       <entry><type>regproc</type></entry>
7738       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7739       <entry>Output conversion function (binary format), or 0 if none</entry>
7740      </row>
7741
7742      <row>
7743       <entry><structfield>typmodin</structfield></entry>
7744       <entry><type>regproc</type></entry>
7745       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7746       <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7747      </row>
7748
7749      <row>
7750       <entry><structfield>typmodout</structfield></entry>
7751       <entry><type>regproc</type></entry>
7752       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7753       <entry>Type modifier output function, or 0 to use the standard format</entry>
7754      </row>
7755
7756      <row>
7757       <entry><structfield>typanalyze</structfield></entry>
7758       <entry><type>regproc</type></entry>
7759       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7760       <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7761      </row>
7762
7763      <row>
7764       <entry><structfield>typalign</structfield></entry>
7765       <entry><type>char</type></entry>
7766       <entry></entry>
7767       <entry><para>
7768
7769        <structfield>typalign</structfield> is the alignment required
7770        when storing a value of this type.  It applies to storage on
7771        disk as well as most representations of the value inside
7772        <productname>PostgreSQL</productname>.
7773        When multiple values are stored consecutively, such
7774        as in the representation of a complete row on disk, padding is
7775        inserted before a datum of this type so that it begins on the
7776        specified boundary.  The alignment reference is the beginning
7777        of the first datum in the sequence.
7778       </para>
7779
7780       <para>
7781        Possible values are:
7782        <itemizedlist>
7783         <listitem>
7784          <para><literal>c</literal> = <type>char</type> alignment, i.e., no alignment needed.</para>
7785         </listitem>
7786         <listitem>
7787          <para><literal>s</literal> = <type>short</type> alignment (2 bytes on most machines).</para>
7788         </listitem>
7789         <listitem>
7790          <para><literal>i</literal> = <type>int</type> alignment (4 bytes on most machines).</para>
7791         </listitem>
7792         <listitem>
7793          <para><literal>d</literal> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7794         </listitem>
7795        </itemizedlist>
7796       </para><note>
7797        <para>
7798         For types used in system tables, it is critical that the size
7799         and alignment defined in <structname>pg_type</structname>
7800         agree with the way that the compiler will lay out the column in
7801         a structure representing a table row.
7802        </para>
7803       </note></entry>
7804      </row>
7805
7806      <row>
7807       <entry><structfield>typstorage</structfield></entry>
7808       <entry><type>char</type></entry>
7809       <entry></entry>
7810       <entry><para>
7811        <structfield>typstorage</structfield> tells for varlena
7812        types (those with <structfield>typlen</structfield> = -1) if
7813        the type is prepared for toasting and what the default strategy
7814        for attributes of this type should be.
7815        Possible values are
7816        <itemizedlist>
7817         <listitem>
7818          <para><literal>p</literal>: Value must always be stored plain.</para>
7819         </listitem>
7820         <listitem>
7821          <para>
7822           <literal>e</literal>: Value can be stored in a <quote>secondary</quote>
7823           relation (if relation has one, see
7824           <literal>pg_class.reltoastrelid</literal>).
7825          </para>
7826         </listitem>
7827         <listitem>
7828          <para><literal>m</literal>: Value can be stored compressed inline.</para>
7829         </listitem>
7830         <listitem>
7831          <para><literal>x</literal>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7832         </listitem>
7833        </itemizedlist>
7834        Note that <literal>m</literal> columns can also be moved out to secondary
7835        storage, but only as a last resort (<literal>e</literal> and <literal>x</literal> columns are
7836        moved first).
7837       </para></entry>
7838      </row>
7839
7840      <row>
7841       <entry><structfield>typnotnull</structfield></entry>
7842       <entry><type>bool</type></entry>
7843       <entry></entry>
7844       <entry><para>
7845        <structfield>typnotnull</structfield> represents a not-null
7846        constraint on a type.  Used for domains only.
7847       </para></entry>
7848      </row>
7849
7850      <row>
7851       <entry><structfield>typbasetype</structfield></entry>
7852       <entry><type>oid</type></entry>
7853       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7854       <entry><para>
7855        If this is a domain (see <structfield>typtype</structfield>), then
7856        <structfield>typbasetype</structfield> identifies the type that this
7857        one is based on.  Zero if this type is not a domain.
7858       </para></entry>
7859      </row>
7860
7861      <row>
7862       <entry><structfield>typtypmod</structfield></entry>
7863       <entry><type>int4</type></entry>
7864       <entry></entry>
7865       <entry><para>
7866        Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</literal>
7867        to be applied to their base type (-1 if base type does not use a
7868        <literal>typmod</literal>).  -1 if this type is not a domain.
7869       </para></entry>
7870      </row>
7871
7872      <row>
7873       <entry><structfield>typndims</structfield></entry>
7874       <entry><type>int4</type></entry>
7875       <entry></entry>
7876       <entry><para>
7877        <structfield>typndims</structfield> is the number of array dimensions
7878        for a domain over an array (that is, <structfield>typbasetype</structfield> is
7879        an array type).
7880        Zero for types other than domains over array types.
7881        </para></entry>
7882      </row>
7883
7884      <row>
7885       <entry><structfield>typcollation</structfield></entry>
7886       <entry><type>oid</type></entry>
7887       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7888       <entry><para>
7889        <structfield>typcollation</structfield> specifies the collation
7890        of the type.  If the type does not support collations, this will
7891        be zero.  A base type that supports collations will have
7892        <symbol>DEFAULT_COLLATION_OID</symbol> here.  A domain over a
7893        collatable type can have some other collation OID, if one was
7894        specified for the domain.
7895       </para></entry>
7896      </row>
7897
7898      <row>
7899       <entry><structfield>typdefaultbin</structfield></entry>
7900       <entry><type>pg_node_tree</type></entry>
7901       <entry></entry>
7902       <entry><para>
7903        If <structfield>typdefaultbin</structfield> is not null, it is the
7904        <function>nodeToString()</function>
7905        representation of a default expression for the type.  This is
7906        only used for domains.
7907       </para></entry>
7908      </row>
7909
7910      <row>
7911       <entry><structfield>typdefault</structfield></entry>
7912       <entry><type>text</type></entry>
7913       <entry></entry>
7914       <entry><para>
7915        <structfield>typdefault</structfield> is null if the type has no associated
7916        default value. If <structfield>typdefaultbin</structfield> is not null,
7917        <structfield>typdefault</structfield> must contain a human-readable version of the
7918        default expression represented by <structfield>typdefaultbin</structfield>.  If
7919        <structfield>typdefaultbin</structfield> is null and <structfield>typdefault</structfield> is
7920        not, then <structfield>typdefault</structfield> is the external representation of
7921        the type's default value, which can be fed to the type's input
7922        converter to produce a constant.
7923       </para></entry>
7924      </row>
7925
7926      <row>
7927       <entry><structfield>typacl</structfield></entry>
7928       <entry><type>aclitem[]</type></entry>
7929       <entry></entry>
7930       <entry>
7931        Access privileges; see
7932        <xref linkend="sql-grant"/> and
7933        <xref linkend="sql-revoke"/>
7934        for details
7935       </entry>
7936      </row>
7937     </tbody>
7938    </tgroup>
7939   </table>
7940
7941   <para>
7942    <xref linkend="catalog-typcategory-table"/> lists the system-defined values
7943    of <structfield>typcategory</structfield>.  Any future additions to this list will
7944    also be upper-case ASCII letters.  All other ASCII characters are reserved
7945    for user-defined categories.
7946   </para>
7947
7948   <table id="catalog-typcategory-table">
7949    <title><structfield>typcategory</structfield> Codes</title>
7950
7951    <tgroup cols="2">
7952     <thead>
7953      <row>
7954       <entry>Code</entry>
7955       <entry>Category</entry>
7956      </row>
7957     </thead>
7958
7959     <tbody>
7960      <row>
7961       <entry><literal>A</literal></entry>
7962       <entry>Array types</entry>
7963      </row>
7964      <row>
7965       <entry><literal>B</literal></entry>
7966       <entry>Boolean types</entry>
7967      </row>
7968      <row>
7969       <entry><literal>C</literal></entry>
7970       <entry>Composite types</entry>
7971      </row>
7972      <row>
7973       <entry><literal>D</literal></entry>
7974       <entry>Date/time types</entry>
7975      </row>
7976      <row>
7977       <entry><literal>E</literal></entry>
7978       <entry>Enum types</entry>
7979      </row>
7980      <row>
7981       <entry><literal>G</literal></entry>
7982       <entry>Geometric types</entry>
7983      </row>
7984      <row>
7985       <entry><literal>I</literal></entry>
7986       <entry>Network address types</entry>
7987      </row>
7988      <row>
7989       <entry><literal>N</literal></entry>
7990       <entry>Numeric types</entry>
7991      </row>
7992      <row>
7993       <entry><literal>P</literal></entry>
7994       <entry>Pseudo-types</entry>
7995      </row>
7996      <row>
7997       <entry><literal>R</literal></entry>
7998       <entry>Range types</entry>
7999      </row>
8000      <row>
8001       <entry><literal>S</literal></entry>
8002       <entry>String types</entry>
8003      </row>
8004      <row>
8005       <entry><literal>T</literal></entry>
8006       <entry>Timespan types</entry>
8007      </row>
8008      <row>
8009       <entry><literal>U</literal></entry>
8010       <entry>User-defined types</entry>
8011      </row>
8012      <row>
8013       <entry><literal>V</literal></entry>
8014       <entry>Bit-string types</entry>
8015      </row>
8016      <row>
8017       <entry><literal>X</literal></entry>
8018       <entry><type>unknown</type> type</entry>
8019      </row>
8020     </tbody>
8021    </tgroup>
8022   </table>
8023
8024  </sect1>
8025
8026
8027  <sect1 id="catalog-pg-user-mapping">
8028   <title><structname>pg_user_mapping</structname></title>
8029
8030   <indexterm zone="catalog-pg-user-mapping">
8031    <primary>pg_user_mapping</primary>
8032   </indexterm>
8033
8034   <para>
8035    The catalog <structname>pg_user_mapping</structname> stores
8036    the mappings from local user to remote.  Access to this catalog is
8037    restricted from normal users, use the view
8038    <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
8039    instead.
8040   </para>
8041
8042   <table>
8043    <title><structname>pg_user_mapping</structname> Columns</title>
8044
8045    <tgroup cols="4">
8046     <thead>
8047      <row>
8048       <entry>Name</entry>
8049       <entry>Type</entry>
8050       <entry>References</entry>
8051       <entry>Description</entry>
8052      </row>
8053     </thead>
8054
8055     <tbody>
8056      <row>
8057       <entry><structfield>oid</structfield></entry>
8058       <entry><type>oid</type></entry>
8059       <entry></entry>
8060       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
8061      </row>
8062
8063      <row>
8064       <entry><structfield>umuser</structfield></entry>
8065       <entry><type>oid</type></entry>
8066       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8067       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
8068      </row>
8069
8070      <row>
8071       <entry><structfield>umserver</structfield></entry>
8072       <entry><type>oid</type></entry>
8073       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
8074       <entry>
8075        The OID of the foreign server that contains this mapping
8076       </entry>
8077      </row>
8078
8079      <row>
8080       <entry><structfield>umoptions</structfield></entry>
8081       <entry><type>text[]</type></entry>
8082       <entry></entry>
8083       <entry>
8084        User mapping specific options, as <quote>keyword=value</quote> strings
8085       </entry>
8086      </row>
8087     </tbody>
8088    </tgroup>
8089   </table>
8090  </sect1>
8091
8092
8093  <sect1 id="views-overview">
8094   <title>System Views</title>
8095
8096   <para>
8097    In addition to the system catalogs, <productname>PostgreSQL</productname>
8098    provides a number of built-in views.  Some system views provide convenient
8099    access to some commonly used queries on the system catalogs.  Other views
8100    provide access to internal server state.
8101   </para>
8102
8103   <para>
8104    The information schema (<xref linkend="information-schema"/>) provides
8105    an alternative set of views which overlap the functionality of the system
8106    views.  Since the information schema is SQL-standard whereas the views
8107    described here are <productname>PostgreSQL</productname>-specific,
8108    it's usually better to use the information schema if it provides all
8109    the information you need.
8110   </para>
8111
8112   <para>
8113    <xref linkend="view-table"/> lists the system views described here.
8114    More detailed documentation of each view follows below.
8115    There are some additional views that provide access to the results of
8116    the statistics collector; they are described in <xref
8117    linkend="monitoring-stats-views-table"/>.
8118   </para>
8119
8120   <para>
8121    Except where noted, all the views described here are read-only.
8122   </para>
8123
8124   <table id="view-table">
8125    <title>System Views</title>
8126
8127    <tgroup cols="2">
8128     <thead>
8129      <row>
8130       <entry>View Name</entry>
8131       <entry>Purpose</entry>
8132      </row>
8133     </thead>
8134
8135     <tbody>
8136      <row>
8137       <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
8138       <entry>available extensions</entry>
8139      </row>
8140
8141      <row>
8142       <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
8143       <entry>available versions of extensions</entry>
8144      </row>
8145
8146      <row>
8147       <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
8148       <entry>compile-time configuration parameters</entry>
8149      </row>
8150
8151      <row>
8152       <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
8153       <entry>open cursors</entry>
8154      </row>
8155
8156      <row>
8157       <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
8158       <entry>summary of configuration file contents</entry>
8159      </row>
8160
8161      <row>
8162       <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
8163       <entry>groups of database users</entry>
8164      </row>
8165
8166      <row>
8167       <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
8168       <entry>summary of client authentication configuration file contents</entry>
8169      </row>
8170
8171      <row>
8172       <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
8173       <entry>indexes</entry>
8174      </row>
8175
8176      <row>
8177       <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
8178       <entry>locks currently held or awaited</entry>
8179      </row>
8180
8181      <row>
8182       <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
8183       <entry>materialized views</entry>
8184      </row>
8185
8186      <row>
8187       <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
8188       <entry>policies</entry>
8189      </row>
8190
8191      <row>
8192       <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
8193       <entry>prepared statements</entry>
8194      </row>
8195
8196      <row>
8197       <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
8198       <entry>prepared transactions</entry>
8199      </row>
8200
8201      <row>
8202       <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
8203       <entry>publications and their associated tables</entry>
8204      </row>
8205
8206      <row>
8207       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
8208       <entry>information about replication origins, including replication progress</entry>
8209      </row>
8210
8211      <row>
8212       <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
8213       <entry>replication slot information</entry>
8214      </row>
8215
8216      <row>
8217       <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
8218       <entry>database roles</entry>
8219      </row>
8220
8221      <row>
8222       <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
8223       <entry>rules</entry>
8224      </row>
8225
8226      <row>
8227       <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
8228       <entry>security labels</entry>
8229      </row>
8230
8231      <row>
8232       <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
8233       <entry>sequences</entry>
8234      </row>
8235
8236      <row>
8237       <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
8238       <entry>parameter settings</entry>
8239      </row>
8240
8241      <row>
8242       <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
8243       <entry>database users</entry>
8244      </row>
8245
8246      <row>
8247       <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
8248       <entry>planner statistics</entry>
8249      </row>
8250
8251      <row>
8252       <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
8253       <entry>tables</entry>
8254      </row>
8255
8256      <row>
8257       <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
8258       <entry>time zone abbreviations</entry>
8259      </row>
8260
8261      <row>
8262       <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
8263       <entry>time zone names</entry>
8264      </row>
8265
8266      <row>
8267       <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
8268       <entry>database users</entry>
8269      </row>
8270
8271      <row>
8272       <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
8273       <entry>user mappings</entry>
8274      </row>
8275
8276      <row>
8277       <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
8278       <entry>views</entry>
8279      </row>
8280
8281     </tbody>
8282    </tgroup>
8283   </table>
8284  </sect1>
8285
8286  <sect1 id="view-pg-available-extensions">
8287   <title><structname>pg_available_extensions</structname></title>
8288
8289   <indexterm zone="view-pg-available-extensions">
8290    <primary>pg_available_extensions</primary>
8291   </indexterm>
8292
8293   <para>
8294    The <structname>pg_available_extensions</structname> view lists the
8295    extensions that are available for installation.
8296    See also the
8297    <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8298    catalog, which shows the extensions currently installed.
8299   </para>
8300
8301   <table>
8302    <title><structname>pg_available_extensions</structname> Columns</title>
8303
8304    <tgroup cols="3">
8305     <thead>
8306      <row>
8307       <entry>Name</entry>
8308       <entry>Type</entry>
8309       <entry>Description</entry>
8310      </row>
8311     </thead>
8312
8313     <tbody>
8314      <row>
8315       <entry><structfield>name</structfield></entry>
8316       <entry><type>name</type></entry>
8317       <entry>Extension name</entry>
8318      </row>
8319
8320      <row>
8321       <entry><structfield>default_version</structfield></entry>
8322       <entry><type>text</type></entry>
8323       <entry>Name of default version, or <literal>NULL</literal> if none is
8324        specified</entry>
8325      </row>
8326
8327      <row>
8328       <entry><structfield>installed_version</structfield></entry>
8329       <entry><type>text</type></entry>
8330       <entry>Currently installed version of the extension,
8331        or <literal>NULL</literal> if not installed</entry>
8332      </row>
8333
8334      <row>
8335       <entry><structfield>comment</structfield></entry>
8336       <entry><type>text</type></entry>
8337       <entry>Comment string from the extension's control file</entry>
8338      </row>
8339     </tbody>
8340    </tgroup>
8341   </table>
8342
8343   <para>
8344    The <structname>pg_available_extensions</structname> view is read only.
8345   </para>
8346  </sect1>
8347
8348  <sect1 id="view-pg-available-extension-versions">
8349   <title><structname>pg_available_extension_versions</structname></title>
8350
8351   <indexterm zone="view-pg-available-extension-versions">
8352    <primary>pg_available_extension_versions</primary>
8353   </indexterm>
8354
8355   <para>
8356    The <structname>pg_available_extension_versions</structname> view lists the
8357    specific extension versions that are available for installation.
8358    See also the <link
8359    linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8360    catalog, which shows the extensions currently installed.
8361   </para>
8362
8363   <table>
8364    <title><structname>pg_available_extension_versions</structname> Columns</title>
8365
8366    <tgroup cols="3">
8367     <thead>
8368      <row>
8369       <entry>Name</entry>
8370       <entry>Type</entry>
8371       <entry>Description</entry>
8372      </row>
8373     </thead>
8374
8375     <tbody>
8376      <row>
8377       <entry><structfield>name</structfield></entry>
8378       <entry><type>name</type></entry>
8379       <entry>Extension name</entry>
8380      </row>
8381
8382      <row>
8383       <entry><structfield>version</structfield></entry>
8384       <entry><type>text</type></entry>
8385       <entry>Version name</entry>
8386      </row>
8387
8388      <row>
8389       <entry><structfield>installed</structfield></entry>
8390       <entry><type>bool</type></entry>
8391       <entry>True if this version of this extension is currently
8392        installed</entry>
8393      </row>
8394
8395      <row>
8396       <entry><structfield>superuser</structfield></entry>
8397       <entry><type>bool</type></entry>
8398       <entry>True if only superusers are allowed to install this extension</entry>
8399      </row>
8400
8401      <row>
8402       <entry><structfield>relocatable</structfield></entry>
8403       <entry><type>bool</type></entry>
8404       <entry>True if extension can be relocated to another schema</entry>
8405      </row>
8406
8407      <row>
8408       <entry><structfield>schema</structfield></entry>
8409       <entry><type>name</type></entry>
8410       <entry>Name of the schema that the extension must be installed into,
8411        or <literal>NULL</literal> if partially or fully relocatable</entry>
8412      </row>
8413
8414      <row>
8415       <entry><structfield>requires</structfield></entry>
8416       <entry><type>name[]</type></entry>
8417       <entry>Names of prerequisite extensions,
8418        or <literal>NULL</literal> if none</entry>
8419      </row>
8420
8421      <row>
8422       <entry><structfield>comment</structfield></entry>
8423       <entry><type>text</type></entry>
8424       <entry>Comment string from the extension's control file</entry>
8425      </row>
8426     </tbody>
8427    </tgroup>
8428   </table>
8429
8430   <para>
8431    The <structname>pg_available_extension_versions</structname> view is read
8432    only.
8433   </para>
8434  </sect1>
8435
8436  <sect1 id="view-pg-config">
8437   <title><structname>pg_config</structname></title>
8438
8439   <indexterm zone="view-pg-config">
8440    <primary>pg_config</primary>
8441   </indexterm>
8442
8443   <para>
8444    The view <structname>pg_config</structname> describes the
8445    compile-time configuration parameters of the currently installed
8446    version of <productname>PostgreSQL</productname>. It is intended, for example, to
8447    be used by software packages that want to interface to
8448    <productname>PostgreSQL</productname> to facilitate finding the required header
8449    files and libraries. It provides the same basic information as the
8450    <xref linkend="app-pgconfig"/> <productname>PostgreSQL</productname> client
8451    application.
8452   </para>
8453
8454   <para>
8455    By default, the <structname>pg_config</structname> view can be read
8456    only by superusers.
8457   </para>
8458
8459   <table>
8460    <title><structname>pg_config</structname> Columns</title>
8461    <tgroup cols="3">
8462     <thead>
8463      <row>
8464       <entry>Name</entry>
8465       <entry>Type</entry>
8466       <entry>Description</entry>
8467      </row>
8468     </thead>
8469
8470     <tbody>
8471      <row>
8472       <entry><structfield>name</structfield></entry>
8473       <entry><type>text</type></entry>
8474       <entry>The parameter name</entry>
8475      </row>
8476
8477      <row>
8478       <entry><structfield>setting</structfield></entry>
8479       <entry><type>text</type></entry>
8480       <entry>The parameter value</entry>
8481      </row>
8482     </tbody>
8483    </tgroup>
8484   </table>
8485
8486  </sect1>
8487
8488  <sect1 id="view-pg-cursors">
8489   <title><structname>pg_cursors</structname></title>
8490
8491   <indexterm zone="view-pg-cursors">
8492    <primary>pg_cursors</primary>
8493   </indexterm>
8494
8495   <para>
8496    The <structname>pg_cursors</structname> view lists the cursors that
8497    are currently available. Cursors can be defined in several ways:
8498    <itemizedlist>
8499     <listitem>
8500      <para>
8501       via the <xref linkend="sql-declare"/>
8502       statement in SQL
8503      </para>
8504     </listitem>
8505
8506     <listitem>
8507      <para>
8508       via the Bind message in the frontend/backend protocol, as
8509       described in <xref linkend="protocol-flow-ext-query"/>
8510      </para>
8511     </listitem>
8512
8513     <listitem>
8514      <para>
8515       via the Server Programming Interface (SPI), as described in
8516       <xref linkend="spi-interface"/>
8517      </para>
8518     </listitem>
8519    </itemizedlist>
8520
8521    The <structname>pg_cursors</structname> view displays cursors
8522    created by any of these means. Cursors only exist for the duration
8523    of the transaction that defines them, unless they have been
8524    declared <literal>WITH HOLD</literal>. Therefore non-holdable
8525    cursors are only present in the view until the end of their
8526    creating transaction.
8527
8528    <note>
8529     <para>
8530      Cursors are used internally to implement some of the components
8531      of <productname>PostgreSQL</productname>, such as procedural languages.
8532      Therefore, the <structname>pg_cursors</structname> view might include cursors
8533      that have not been explicitly created by the user.
8534     </para>
8535    </note>
8536   </para>
8537
8538   <table>
8539    <title><structname>pg_cursors</structname> Columns</title>
8540
8541    <tgroup cols="3">
8542     <thead>
8543      <row>
8544       <entry>Name</entry>
8545       <entry>Type</entry>
8546       <entry>Description</entry>
8547      </row>
8548     </thead>
8549
8550     <tbody>
8551      <row>
8552       <entry><structfield>name</structfield></entry>
8553       <entry><type>text</type></entry>
8554       <entry>The name of the cursor</entry>
8555      </row>
8556
8557      <row>
8558       <entry><structfield>statement</structfield></entry>
8559       <entry><type>text</type></entry>
8560       <entry>The verbatim query string submitted to declare this cursor</entry>
8561      </row>
8562
8563      <row>
8564       <entry><structfield>is_holdable</structfield></entry>
8565       <entry><type>boolean</type></entry>
8566       <entry>
8567        <literal>true</literal> if the cursor is holdable (that is, it
8568        can be accessed after the transaction that declared the cursor
8569        has committed); <literal>false</literal> otherwise
8570        </entry>
8571      </row>
8572
8573      <row>
8574       <entry><structfield>is_binary</structfield></entry>
8575       <entry><type>boolean</type></entry>
8576       <entry>
8577        <literal>true</literal> if the cursor was declared
8578        <literal>BINARY</literal>; <literal>false</literal>
8579        otherwise
8580        </entry>
8581      </row>
8582
8583      <row>
8584       <entry><structfield>is_scrollable</structfield></entry>
8585       <entry><type>boolean</type></entry>
8586       <entry>
8587        <literal>true</literal> if the cursor is scrollable (that is, it
8588        allows rows to be retrieved in a nonsequential manner);
8589        <literal>false</literal> otherwise
8590        </entry>
8591      </row>
8592
8593      <row>
8594       <entry><structfield>creation_time</structfield></entry>
8595       <entry><type>timestamptz</type></entry>
8596       <entry>The time at which the cursor was declared</entry>
8597      </row>
8598     </tbody>
8599    </tgroup>
8600   </table>
8601
8602   <para>
8603    The <structname>pg_cursors</structname> view is read only.
8604   </para>
8605
8606  </sect1>
8607
8608  <sect1 id="view-pg-file-settings">
8609   <title><structname>pg_file_settings</structname></title>
8610
8611   <indexterm zone="view-pg-file-settings">
8612    <primary>pg_file_settings</primary>
8613   </indexterm>
8614
8615   <para>
8616    The view <structname>pg_file_settings</structname> provides a summary of
8617    the contents of the server's configuration file(s).  A row appears in
8618    this view for each <quote>name = value</quote> entry appearing in the files,
8619    with annotations indicating whether the value could be applied
8620    successfully.  Additional row(s) may appear for problems not linked to
8621    a <quote>name = value</quote> entry, such as syntax errors in the files.
8622   </para>
8623
8624   <para>
8625    This view is helpful for checking whether planned changes in the
8626    configuration files will work, or for diagnosing a previous failure.
8627    Note that this view reports on the <emphasis>current</emphasis> contents of the
8628    files, not on what was last applied by the server.  (The
8629    <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
8630    view is usually sufficient to determine that.)
8631   </para>
8632
8633   <para>
8634    By default, the <structname>pg_file_settings</structname> view can be read
8635    only by superusers.
8636   </para>
8637
8638   <table>
8639    <title><structname>pg_file_settings</structname> Columns</title>
8640
8641   <tgroup cols="3">
8642    <thead>
8643     <row>
8644      <entry>Name</entry>
8645      <entry>Type</entry>
8646      <entry>Description</entry>
8647     </row>
8648    </thead>
8649    <tbody>
8650     <row>
8651      <entry><structfield>sourcefile</structfield></entry>
8652      <entry><structfield>text</structfield></entry>
8653      <entry>Full path name of the configuration file</entry>
8654     </row>
8655     <row>
8656      <entry><structfield>sourceline</structfield></entry>
8657      <entry><structfield>integer</structfield></entry>
8658      <entry>
8659       Line number within the configuration file where the entry appears
8660      </entry>
8661     </row>
8662     <row>
8663      <entry><structfield>seqno</structfield></entry>
8664      <entry><structfield>integer</structfield></entry>
8665      <entry>Order in which the entries are processed (1..<replaceable>n</replaceable>)</entry>
8666     </row>
8667     <row>
8668      <entry><structfield>name</structfield></entry>
8669      <entry><structfield>text</structfield></entry>
8670      <entry>Configuration parameter name</entry>
8671     </row>
8672     <row>
8673      <entry><structfield>setting</structfield></entry>
8674      <entry><structfield>text</structfield></entry>
8675      <entry>Value to be assigned to the parameter</entry>
8676     </row>
8677     <row>
8678      <entry><structfield>applied</structfield></entry>
8679      <entry><structfield>boolean</structfield></entry>
8680      <entry>True if the value can be applied successfully</entry>
8681     </row>
8682     <row>
8683      <entry><structfield>error</structfield></entry>
8684      <entry><structfield>text</structfield></entry>
8685      <entry>If not null, an error message indicating why this entry could
8686       not be applied</entry>
8687     </row>
8688    </tbody>
8689   </tgroup>
8690   </table>
8691
8692   <para>
8693    If the configuration file contains syntax errors or invalid parameter
8694    names, the server will not attempt to apply any settings from it, and
8695    therefore all the <structfield>applied</structfield> fields will read as false.
8696    In such a case there will be one or more rows with
8697    non-null <structfield>error</structfield> fields indicating the
8698    problem(s).  Otherwise, individual settings will be applied if possible.
8699    If an individual setting cannot be applied (e.g., invalid value, or the
8700    setting cannot be changed after server start) it will have an appropriate
8701    message in the <structfield>error</structfield> field.  Another way that
8702    an entry might have <structfield>applied</structfield> = false is that it is
8703    overridden by a later entry for the same parameter name; this case is not
8704    considered an error so nothing appears in
8705    the <structfield>error</structfield> field.
8706   </para>
8707
8708   <para>
8709    See <xref linkend="config-setting"/> for more information about the various
8710    ways to change run-time parameters.
8711   </para>
8712
8713 </sect1>
8714
8715  <sect1 id="view-pg-group">
8716   <title><structname>pg_group</structname></title>
8717
8718   <indexterm zone="view-pg-group">
8719    <primary>pg_group</primary>
8720   </indexterm>
8721
8722   <para>
8723    The view <structname>pg_group</structname> exists for backwards
8724    compatibility: it emulates a catalog that existed in
8725    <productname>PostgreSQL</productname> before version 8.1.
8726    It shows the names and members of all roles that are marked as not
8727    <structfield>rolcanlogin</structfield>, which is an approximation to the set
8728    of roles that are being used as groups.
8729   </para>
8730
8731   <table>
8732    <title><structname>pg_group</structname> Columns</title>
8733
8734    <tgroup cols="4">
8735     <thead>
8736      <row>
8737       <entry>Name</entry>
8738       <entry>Type</entry>
8739       <entry>References</entry>
8740       <entry>Description</entry>
8741      </row>
8742     </thead>
8743
8744     <tbody>
8745      <row>
8746       <entry><structfield>groname</structfield></entry>
8747       <entry><type>name</type></entry>
8748       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8749       <entry>Name of the group</entry>
8750      </row>
8751
8752      <row>
8753       <entry><structfield>grosysid</structfield></entry>
8754       <entry><type>oid</type></entry>
8755       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8756       <entry>ID of this group</entry>
8757      </row>
8758
8759      <row>
8760       <entry><structfield>grolist</structfield></entry>
8761       <entry><type>oid[]</type></entry>
8762       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8763       <entry>An array containing the IDs of the roles in this group</entry>
8764      </row>
8765     </tbody>
8766    </tgroup>
8767   </table>
8768
8769  </sect1>
8770
8771  <sect1 id="view-pg-hba-file-rules">
8772   <title><structname>pg_hba_file_rules</structname></title>
8773
8774   <indexterm zone="view-pg-hba-file-rules">
8775    <primary>pg_hba_file_rules</primary>
8776   </indexterm>
8777
8778   <para>
8779    The view <structname>pg_hba_file_rules</structname> provides a summary of
8780    the contents of the client authentication configuration
8781    file, <filename>pg_hba.conf</filename>.  A row appears in this view for each
8782    non-empty, non-comment line in the file, with annotations indicating
8783    whether the rule could be applied successfully.
8784   </para>
8785
8786   <para>
8787    This view can be helpful for checking whether planned changes in the
8788    authentication configuration file will work, or for diagnosing a previous
8789    failure.  Note that this view reports on the <emphasis>current</emphasis> contents
8790    of the file, not on what was last loaded by the server.
8791   </para>
8792
8793   <para>
8794    By default, the <structname>pg_hba_file_rules</structname> view can be read
8795    only by superusers.
8796   </para>
8797
8798   <table>
8799    <title><structname>pg_hba_file_rules</structname> Columns</title>
8800
8801   <tgroup cols="3">
8802    <thead>
8803     <row>
8804      <entry>Name</entry>
8805      <entry>Type</entry>
8806      <entry>Description</entry>
8807     </row>
8808    </thead>
8809    <tbody>
8810     <row>
8811      <entry><structfield>line_number</structfield></entry>
8812      <entry><structfield>integer</structfield></entry>
8813      <entry>
8814       Line number of this rule in <filename>pg_hba.conf</filename>
8815      </entry>
8816     </row>
8817     <row>
8818      <entry><structfield>type</structfield></entry>
8819      <entry><structfield>text</structfield></entry>
8820      <entry>Type of connection</entry>
8821     </row>
8822     <row>
8823      <entry><structfield>database</structfield></entry>
8824      <entry><structfield>text[]</structfield></entry>
8825      <entry>List of database name(s) to which this rule applies</entry>
8826     </row>
8827     <row>
8828      <entry><structfield>user_name</structfield></entry>
8829      <entry><structfield>text[]</structfield></entry>
8830      <entry>List of user and group name(s) to which this rule applies</entry>
8831     </row>
8832     <row>
8833      <entry><structfield>address</structfield></entry>
8834      <entry><structfield>text</structfield></entry>
8835      <entry>
8836       Host name or IP address, or one
8837       of <literal>all</literal>, <literal>samehost</literal>,
8838       or <literal>samenet</literal>, or null for local connections
8839      </entry>
8840     </row>
8841     <row>
8842      <entry><structfield>netmask</structfield></entry>
8843      <entry><structfield>text</structfield></entry>
8844      <entry>IP address mask, or null if not applicable</entry>
8845     </row>
8846     <row>
8847      <entry><structfield>auth_method</structfield></entry>
8848      <entry><type>text</type></entry>
8849      <entry>Authentication method</entry>
8850     </row>
8851     <row>
8852      <entry><structfield>options</structfield></entry>
8853      <entry><type>text[]</type></entry>
8854      <entry>Options specified for authentication method, if any</entry>
8855     </row>
8856     <row>
8857      <entry><structfield>error</structfield></entry>
8858      <entry><structfield>text</structfield></entry>
8859      <entry>
8860       If not null, an error message indicating why this
8861       line could not be processed
8862      </entry>
8863     </row>
8864    </tbody>
8865   </tgroup>
8866   </table>
8867
8868   <para>
8869    Usually, a row reflecting an incorrect entry will have values for only
8870    the <structfield>line_number</structfield> and <structfield>error</structfield> fields.
8871   </para>
8872
8873   <para>
8874    See <xref linkend="client-authentication"/> for more information about
8875    client authentication configuration.
8876   </para>
8877  </sect1>
8878
8879  <sect1 id="view-pg-indexes">
8880   <title><structname>pg_indexes</structname></title>
8881
8882   <indexterm zone="view-pg-indexes">
8883    <primary>pg_indexes</primary>
8884   </indexterm>
8885
8886   <para>
8887    The view <structname>pg_indexes</structname> provides access to
8888    useful information about each index in the database.
8889   </para>
8890
8891   <table>
8892    <title><structname>pg_indexes</structname> Columns</title>
8893
8894    <tgroup cols="4">
8895     <thead>
8896      <row>
8897       <entry>Name</entry>
8898       <entry>Type</entry>
8899       <entry>References</entry>
8900       <entry>Description</entry>
8901      </row>
8902     </thead>
8903     <tbody>
8904      <row>
8905       <entry><structfield>schemaname</structfield></entry>
8906       <entry><type>name</type></entry>
8907       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8908       <entry>Name of schema containing table and index</entry>
8909      </row>
8910      <row>
8911       <entry><structfield>tablename</structfield></entry>
8912       <entry><type>name</type></entry>
8913       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8914       <entry>Name of table the index is for</entry>
8915      </row>
8916      <row>
8917       <entry><structfield>indexname</structfield></entry>
8918       <entry><type>name</type></entry>
8919       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8920       <entry>Name of index</entry>
8921      </row>
8922      <row>
8923       <entry><structfield>tablespace</structfield></entry>
8924       <entry><type>name</type></entry>
8925       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8926       <entry>Name of tablespace containing index (null if default for database)</entry>
8927      </row>
8928      <row>
8929       <entry><structfield>indexdef</structfield></entry>
8930       <entry><type>text</type></entry>
8931       <entry></entry>
8932       <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8933       command)</entry>
8934      </row>
8935     </tbody>
8936    </tgroup>
8937   </table>
8938
8939  </sect1>
8940
8941  <sect1 id="view-pg-locks">
8942   <title><structname>pg_locks</structname></title>
8943
8944   <indexterm zone="view-pg-locks">
8945    <primary>pg_locks</primary>
8946   </indexterm>
8947
8948   <para>
8949    The view <structname>pg_locks</structname> provides access to
8950    information about the locks held by active processes within the
8951    database server.  See <xref linkend="mvcc"/> for more discussion
8952    of locking.
8953   </para>
8954
8955   <para>
8956    <structname>pg_locks</structname> contains one row per active lockable
8957    object, requested lock mode, and relevant process.  Thus, the same
8958    lockable object might
8959    appear many times, if multiple processes are holding or waiting
8960    for locks on it.  However, an object that currently has no locks on it
8961    will not appear at all.
8962   </para>
8963
8964   <para>
8965    There are several distinct types of lockable objects:
8966    whole relations (e.g., tables), individual pages of relations,
8967    individual tuples of relations,
8968    transaction IDs (both virtual and permanent IDs),
8969    and general database objects (identified by class OID and object OID,
8970    in the same way as in <structname>pg_description</structname> or
8971    <structname>pg_depend</structname>).  Also, the right to extend a
8972    relation is represented as a separate lockable object.
8973    Also, <quote>advisory</quote> locks can be taken on numbers that have
8974    user-defined meanings.
8975   </para>
8976
8977   <table>
8978    <title><structname>pg_locks</structname> Columns</title>
8979
8980    <tgroup cols="4">
8981     <thead>
8982      <row>
8983       <entry>Name</entry>
8984       <entry>Type</entry>
8985       <entry>References</entry>
8986       <entry>Description</entry>
8987      </row>
8988     </thead>
8989     <tbody>
8990      <row>
8991       <entry><structfield>locktype</structfield></entry>
8992       <entry><type>text</type></entry>
8993       <entry></entry>
8994       <entry>
8995        Type of the lockable object:
8996        <literal>relation</literal>,
8997        <literal>extend</literal>,
8998        <literal>page</literal>,
8999        <literal>tuple</literal>,
9000        <literal>transactionid</literal>,
9001        <literal>virtualxid</literal>,
9002        <literal>object</literal>,
9003        <literal>userlock</literal>, or
9004        <literal>advisory</literal>
9005       </entry>
9006      </row>
9007      <row>
9008       <entry><structfield>database</structfield></entry>
9009       <entry><type>oid</type></entry>
9010       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9011       <entry>
9012        OID of the database in which the lock target exists, or
9013        zero if the target is a shared object, or
9014        null if the target is a transaction ID
9015       </entry>
9016      </row>
9017      <row>
9018       <entry><structfield>relation</structfield></entry>
9019       <entry><type>oid</type></entry>
9020       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9021       <entry>
9022        OID of the relation targeted by the lock, or null if the target is not
9023        a relation or part of a relation
9024       </entry>
9025      </row>
9026      <row>
9027       <entry><structfield>page</structfield></entry>
9028       <entry><type>integer</type></entry>
9029       <entry></entry>
9030       <entry>
9031        Page number targeted by the lock within the relation,
9032        or null if the target is not a relation page or tuple
9033       </entry>
9034      </row>
9035      <row>
9036       <entry><structfield>tuple</structfield></entry>
9037       <entry><type>smallint</type></entry>
9038       <entry></entry>
9039       <entry>
9040        Tuple number targeted by the lock within the page,
9041        or null if the target is not a tuple
9042       </entry>
9043      </row>
9044      <row>
9045       <entry><structfield>virtualxid</structfield></entry>
9046       <entry><type>text</type></entry>
9047       <entry></entry>
9048       <entry>
9049        Virtual ID of the transaction targeted by the lock,
9050        or null if the target is not a virtual transaction ID
9051       </entry>
9052      </row>
9053      <row>
9054       <entry><structfield>transactionid</structfield></entry>
9055       <entry><type>xid</type></entry>
9056       <entry></entry>
9057       <entry>
9058        ID of the transaction targeted by the lock,
9059        or null if the target is not a transaction ID
9060       </entry>
9061      </row>
9062      <row>
9063       <entry><structfield>classid</structfield></entry>
9064       <entry><type>oid</type></entry>
9065       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9066       <entry>
9067        OID of the system catalog containing the lock target, or null if the
9068        target is not a general database object
9069       </entry>
9070      </row>
9071      <row>
9072       <entry><structfield>objid</structfield></entry>
9073       <entry><type>oid</type></entry>
9074       <entry>any OID column</entry>
9075       <entry>
9076        OID of the lock target within its system catalog, or null if the
9077        target is not a general database object
9078       </entry>
9079      </row>
9080      <row>
9081       <entry><structfield>objsubid</structfield></entry>
9082       <entry><type>smallint</type></entry>
9083       <entry></entry>
9084       <entry>
9085        Column number targeted by the lock (the
9086        <structfield>classid</structfield> and <structfield>objid</structfield> refer to the
9087        table itself),
9088        or zero if the target is some other general database object,
9089        or null if the target is not a general database object
9090       </entry>
9091      </row>
9092      <row>
9093       <entry><structfield>virtualtransaction</structfield></entry>
9094       <entry><type>text</type></entry>
9095       <entry></entry>
9096       <entry>
9097        Virtual ID of the transaction that is holding or awaiting this lock
9098       </entry>
9099      </row>
9100      <row>
9101       <entry><structfield>pid</structfield></entry>
9102       <entry><type>integer</type></entry>
9103       <entry></entry>
9104       <entry>
9105        Process ID of the server process holding or awaiting this
9106        lock, or null if the lock is held by a prepared transaction
9107       </entry>
9108      </row>
9109      <row>
9110       <entry><structfield>mode</structfield></entry>
9111       <entry><type>text</type></entry>
9112       <entry></entry>
9113       <entry>Name of the lock mode held or desired by this process (see <xref
9114       linkend="locking-tables"/> and <xref linkend="xact-serializable"/>)</entry>
9115      </row>
9116      <row>
9117       <entry><structfield>granted</structfield></entry>
9118       <entry><type>boolean</type></entry>
9119       <entry></entry>
9120       <entry>True if lock is held, false if lock is awaited</entry>
9121      </row>
9122      <row>
9123       <entry><structfield>fastpath</structfield></entry>
9124       <entry><type>boolean</type></entry>
9125       <entry></entry>
9126       <entry>True if lock was taken via fast path, false if taken via main
9127        lock table</entry>
9128      </row>
9129     </tbody>
9130    </tgroup>
9131   </table>
9132
9133   <para>
9134    <structfield>granted</structfield> is true in a row representing a lock
9135    held by the indicated process.  False indicates that this process is
9136    currently waiting to acquire this lock, which implies that at least one
9137    other process is holding or waiting for a conflicting lock mode on the same
9138    lockable object.  The waiting process will sleep until the other lock is
9139    released (or a deadlock situation is detected).  A single process can be
9140    waiting to acquire at most one lock at a time.
9141   </para>
9142
9143   <para>
9144    Throughout running a transaction, a server process holds an exclusive lock
9145    on the transaction's virtual transaction ID.  If a permanent ID is assigned
9146    to the transaction (which normally happens only if the transaction changes
9147    the state of the database), it also holds an exclusive lock on the
9148    transaction's permanent transaction ID until it ends.  When a process finds
9149    it necessary to wait specifically for another transaction to end, it does
9150    so by attempting to acquire share lock on the other transaction's ID
9151    (either virtual or permanent ID depending on the situation). That will
9152    succeed only when the other transaction terminates and releases its locks.
9153   </para>
9154
9155   <para>
9156    Although tuples are a lockable type of object,
9157    information about row-level locks is stored on disk, not in memory,
9158    and therefore row-level locks normally do not appear in this view.
9159    If a process is waiting for a
9160    row-level lock, it will usually appear in the view as waiting for the
9161    permanent transaction ID of the current holder of that row lock.
9162   </para>
9163
9164   <para>
9165    Advisory locks can be acquired on keys consisting of either a single
9166    <type>bigint</type> value or two integer values.
9167    A <type>bigint</type> key is displayed with its
9168    high-order half in the <structfield>classid</structfield> column, its low-order half
9169    in the <structfield>objid</structfield> column, and <structfield>objsubid</structfield> equal
9170    to 1. The original <type>bigint</type> value can be reassembled with the
9171    expression <literal>(classid::bigint &lt;&lt; 32) |
9172    objid::bigint</literal>. Integer keys are displayed with the
9173    first key in the
9174    <structfield>classid</structfield> column, the second key in the <structfield>objid</structfield>
9175    column, and <structfield>objsubid</structfield> equal to 2.  The actual meaning of
9176    the keys is up to the user.  Advisory locks are local to each database,
9177    so the <structfield>database</structfield> column is meaningful for an advisory lock.
9178   </para>
9179
9180   <para>
9181    <structname>pg_locks</structname> provides a global view of all locks
9182    in the database cluster, not only those relevant to the current database.
9183    Although its <structfield>relation</structfield> column can be joined
9184    against <structname>pg_class</structname>.<structfield>oid</structfield> to identify locked
9185    relations, this will only work correctly for relations in the current
9186    database (those for which the <structfield>database</structfield> column
9187    is either the current database's OID or zero).
9188   </para>
9189
9190   <para>
9191    The <structfield>pid</structfield> column can be joined to the
9192    <structfield>pid</structfield> column of the <link
9193    linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
9194    view to get more
9195    information on the session holding or awaiting each lock,
9196    for example
9197 <programlisting>
9198 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
9199     ON pl.pid = psa.pid;
9200 </programlisting>
9201    Also, if you are using prepared transactions, the
9202    <structfield>virtualtransaction</structfield> column can be joined to the
9203    <structfield>transaction</structfield> column of the <link
9204    linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
9205    view to get more information on prepared transactions that hold locks.
9206    (A prepared transaction can never be waiting for a lock,
9207    but it continues to hold the locks it acquired while running.)
9208    For example:
9209 <programlisting>
9210 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
9211     ON pl.virtualtransaction = '-1/' || ppx.transaction;
9212 </programlisting>
9213   </para>
9214
9215   <para>
9216    While it is possible to obtain information about which processes block
9217    which other processes by joining <structname>pg_locks</structname> against
9218    itself, this is very difficult to get right in detail.  Such a query would
9219    have to encode knowledge about which lock modes conflict with which
9220    others.  Worse, the <structname>pg_locks</structname> view does not expose
9221    information about which processes are ahead of which others in lock wait
9222    queues, nor information about which processes are parallel workers running
9223    on behalf of which other client sessions.  It is better to use
9224    the <function>pg_blocking_pids()</function> function
9225    (see <xref linkend="functions-info-session-table"/>) to identify which
9226    process(es) a waiting process is blocked behind.
9227   </para>
9228
9229   <para>
9230    The <structname>pg_locks</structname> view displays data from both the
9231    regular lock manager and the predicate lock manager, which are
9232    separate systems; in addition, the regular lock manager subdivides its
9233    locks into regular and <firstterm>fast-path</firstterm> locks.
9234    This data is not guaranteed to be entirely consistent.
9235    When the view is queried,
9236    data on fast-path locks (with <structfield>fastpath</structfield> = <literal>true</literal>)
9237    is gathered from each backend one at a time, without freezing the state of
9238    the entire lock manager, so it is possible for locks to be taken or
9239    released while information is gathered.  Note, however, that these locks are
9240    known not to conflict with any other lock currently in place.  After
9241    all backends have been queried for fast-path locks, the remainder of the
9242    regular lock manager is locked as a unit, and a consistent snapshot of all
9243    remaining locks is collected as an atomic action.  After unlocking the
9244    regular lock manager, the predicate lock manager is similarly locked and all
9245    predicate locks are collected as an atomic action.  Thus, with the exception
9246    of fast-path locks, each lock manager will deliver a consistent set of
9247    results, but as we do not lock both lock managers simultaneously, it is
9248    possible for locks to be taken or released after we interrogate the regular
9249    lock manager and before we interrogate the predicate lock manager.
9250   </para>
9251
9252   <para>
9253    Locking the regular and/or predicate lock manager could have some
9254    impact on database performance if this view is very frequently accessed.
9255    The locks are held only for the minimum amount of time necessary to
9256    obtain data from the lock managers, but this does not completely eliminate
9257    the possibility of a performance impact.
9258   </para>
9259
9260  </sect1>
9261
9262  <sect1 id="view-pg-matviews">
9263   <title><structname>pg_matviews</structname></title>
9264
9265   <indexterm zone="view-pg-matviews">
9266    <primary>pg_matviews</primary>
9267   </indexterm>
9268
9269   <indexterm zone="view-pg-matviews">
9270    <primary>materialized views</primary>
9271   </indexterm>
9272
9273   <para>
9274    The view <structname>pg_matviews</structname> provides access to
9275    useful information about each materialized view in the database.
9276   </para>
9277
9278   <table>
9279    <title><structname>pg_matviews</structname> Columns</title>
9280
9281    <tgroup cols="4">
9282     <thead>
9283      <row>
9284       <entry>Name</entry>
9285       <entry>Type</entry>
9286       <entry>References</entry>
9287       <entry>Description</entry>
9288      </row>
9289     </thead>
9290     <tbody>
9291      <row>
9292       <entry><structfield>schemaname</structfield></entry>
9293       <entry><type>name</type></entry>
9294       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9295       <entry>Name of schema containing materialized view</entry>
9296      </row>
9297      <row>
9298       <entry><structfield>matviewname</structfield></entry>
9299       <entry><type>name</type></entry>
9300       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9301       <entry>Name of materialized view</entry>
9302      </row>
9303      <row>
9304       <entry><structfield>matviewowner</structfield></entry>
9305       <entry><type>name</type></entry>
9306       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9307       <entry>Name of materialized view's owner</entry>
9308      </row>
9309      <row>
9310       <entry><structfield>tablespace</structfield></entry>
9311       <entry><type>name</type></entry>
9312       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9313       <entry>Name of tablespace containing materialized view (null if default for database)</entry>
9314      </row>
9315      <row>
9316       <entry><structfield>hasindexes</structfield></entry>
9317       <entry><type>boolean</type></entry>
9318       <entry></entry>
9319       <entry>True if materialized view has (or recently had) any indexes</entry>
9320      </row>
9321      <row>
9322       <entry><structfield>ispopulated</structfield></entry>
9323       <entry><type>boolean</type></entry>
9324       <entry></entry>
9325       <entry>True if materialized view is currently populated</entry>
9326      </row>
9327      <row>
9328       <entry><structfield>definition</structfield></entry>
9329       <entry><type>text</type></entry>
9330       <entry></entry>
9331       <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
9332      </row>
9333     </tbody>
9334    </tgroup>
9335   </table>
9336
9337  </sect1>
9338
9339  <sect1 id="view-pg-policies">
9340   <title><structname>pg_policies</structname></title>
9341
9342   <indexterm zone="view-pg-policies">
9343    <primary>pg_policies</primary>
9344   </indexterm>
9345
9346   <para>
9347    The view <structname>pg_policies</structname> provides access to
9348    useful information about each row-level security policy in the database.
9349   </para>
9350
9351   <table>
9352    <title><structname>pg_policies</structname> Columns</title>
9353
9354    <tgroup cols="4">
9355     <thead>
9356      <row>
9357       <entry>Name</entry>
9358       <entry>Type</entry>
9359       <entry>References</entry>
9360       <entry>Description</entry>
9361      </row>
9362     </thead>
9363     <tbody>
9364      <row>
9365       <entry><structfield>schemaname</structfield></entry>
9366       <entry><type>name</type></entry>
9367       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9368       <entry>Name of schema containing table policy is on</entry>
9369      </row>
9370      <row>
9371       <entry><structfield>tablename</structfield></entry>
9372       <entry><type>name</type></entry>
9373       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9374       <entry>Name of table policy is on</entry>
9375      </row>
9376      <row>
9377       <entry><structfield>policyname</structfield></entry>
9378       <entry><type>name</type></entry>
9379       <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
9380       <entry>Name of policy</entry>
9381      </row>
9382      <row>
9383       <entry><structfield>polpermissive</structfield></entry>
9384       <entry><type>text</type></entry>
9385       <entry></entry>
9386       <entry>Is the policy permissive or restrictive?</entry>
9387      </row>
9388      <row>
9389       <entry><structfield>roles</structfield></entry>
9390       <entry><type>name[]</type></entry>
9391       <entry></entry>
9392       <entry>The roles to which this policy applies</entry>
9393      </row>
9394      <row>
9395       <entry><structfield>cmd</structfield></entry>
9396       <entry><type>text</type></entry>
9397       <entry></entry>
9398       <entry>The command type to which the policy is applied</entry>
9399      </row>
9400      <row>
9401       <entry><structfield>qual</structfield></entry>
9402       <entry><type>text</type></entry>
9403       <entry></entry>
9404       <entry>The expression added to the security barrier qualifications for
9405       queries that this policy applies to</entry>
9406      </row>
9407      <row>
9408       <entry><structfield>with_check</structfield></entry>
9409       <entry><type>text</type></entry>
9410       <entry></entry>
9411       <entry>The expression added to the WITH CHECK qualifications for
9412       queries that attempt to add rows to this table</entry>
9413      </row>
9414     </tbody>
9415    </tgroup>
9416   </table>
9417
9418  </sect1>
9419
9420  <sect1 id="view-pg-prepared-statements">
9421   <title><structname>pg_prepared_statements</structname></title>
9422
9423   <indexterm zone="view-pg-prepared-statements">
9424    <primary>pg_prepared_statements</primary>
9425   </indexterm>
9426
9427   <para>
9428    The <structname>pg_prepared_statements</structname> view displays
9429    all the prepared statements that are available in the current
9430    session. See <xref linkend="sql-prepare"/> for more information about prepared
9431    statements.
9432   </para>
9433
9434   <para>
9435    <structname>pg_prepared_statements</structname> contains one row
9436    for each prepared statement. Rows are added to the view when a new
9437    prepared statement is created and removed when a prepared statement
9438    is released (for example, via the <xref linkend="sql-deallocate"/> command).
9439   </para>
9440
9441   <table>
9442    <title><structname>pg_prepared_statements</structname> Columns</title>
9443
9444    <tgroup cols="3">
9445     <thead>
9446      <row>
9447       <entry>Name</entry>
9448       <entry>Type</entry>
9449       <entry>Description</entry>
9450      </row>
9451     </thead>
9452     <tbody>
9453      <row>
9454       <entry><structfield>name</structfield></entry>
9455       <entry><type>text</type></entry>
9456       <entry>
9457        The identifier of the prepared statement
9458       </entry>
9459      </row>
9460      <row>
9461       <entry><structfield>statement</structfield></entry>
9462       <entry><type>text</type></entry>
9463       <entry>
9464        The query string submitted by the client to create this
9465        prepared statement. For prepared statements created via SQL,
9466        this is the <command>PREPARE</command> statement submitted by
9467        the client. For prepared statements created via the
9468        frontend/backend protocol, this is the text of the prepared
9469        statement itself.
9470       </entry>
9471      </row>
9472      <row>
9473       <entry><structfield>prepare_time</structfield></entry>
9474       <entry><type>timestamptz</type></entry>
9475       <entry>
9476        The time at which the prepared statement was created
9477       </entry>
9478      </row>
9479      <row>
9480       <entry><structfield>parameter_types</structfield></entry>
9481       <entry><type>regtype[]</type></entry>
9482       <entry>
9483        The expected parameter types for the prepared statement in the
9484        form of an array of <type>regtype</type>. The OID corresponding
9485        to an element of this array can be obtained by casting the
9486        <type>regtype</type> value to <type>oid</type>.
9487       </entry>
9488      </row>
9489      <row>
9490       <entry><structfield>from_sql</structfield></entry>
9491       <entry><type>boolean</type></entry>
9492       <entry>
9493        <literal>true</literal> if the prepared statement was created
9494        via the <command>PREPARE</command> SQL command;
9495        <literal>false</literal> if the statement was prepared via the
9496        frontend/backend protocol
9497       </entry>
9498      </row>
9499     </tbody>
9500    </tgroup>
9501   </table>
9502
9503   <para>
9504    The <structname>pg_prepared_statements</structname> view is read only.
9505   </para>
9506  </sect1>
9507
9508  <sect1 id="view-pg-prepared-xacts">
9509   <title><structname>pg_prepared_xacts</structname></title>
9510
9511   <indexterm zone="view-pg-prepared-xacts">
9512    <primary>pg_prepared_xacts</primary>
9513   </indexterm>
9514
9515   <para>
9516    The view <structname>pg_prepared_xacts</structname> displays
9517    information about transactions that are currently prepared for two-phase
9518    commit (see <xref linkend="sql-prepare-transaction"/> for details).
9519   </para>
9520
9521   <para>
9522    <structname>pg_prepared_xacts</structname> contains one row per prepared
9523    transaction.  An entry is removed when the transaction is committed or
9524    rolled back.
9525   </para>
9526
9527   <table>
9528    <title><structname>pg_prepared_xacts</structname> Columns</title>
9529
9530    <tgroup cols="4">
9531     <thead>
9532      <row>
9533       <entry>Name</entry>
9534       <entry>Type</entry>
9535       <entry>References</entry>
9536       <entry>Description</entry>
9537      </row>
9538     </thead>
9539     <tbody>
9540      <row>
9541       <entry><structfield>transaction</structfield></entry>
9542       <entry><type>xid</type></entry>
9543       <entry></entry>
9544       <entry>
9545        Numeric transaction identifier of the prepared transaction
9546       </entry>
9547      </row>
9548      <row>
9549       <entry><structfield>gid</structfield></entry>
9550       <entry><type>text</type></entry>
9551       <entry></entry>
9552       <entry>
9553        Global transaction identifier that was assigned to the transaction
9554       </entry>
9555      </row>
9556      <row>
9557       <entry><structfield>prepared</structfield></entry>
9558       <entry><type>timestamp with time zone</type></entry>
9559       <entry></entry>
9560       <entry>
9561        Time at which the transaction was prepared for commit
9562       </entry>
9563      </row>
9564      <row>
9565       <entry><structfield>owner</structfield></entry>
9566       <entry><type>name</type></entry>
9567       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9568       <entry>
9569        Name of the user that executed the transaction
9570       </entry>
9571      </row>
9572      <row>
9573       <entry><structfield>database</structfield></entry>
9574       <entry><type>name</type></entry>
9575       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9576       <entry>
9577        Name of the database in which the transaction was executed
9578       </entry>
9579      </row>
9580     </tbody>
9581    </tgroup>
9582   </table>
9583
9584   <para>
9585    When the <structname>pg_prepared_xacts</structname> view is accessed, the
9586    internal transaction manager data structures are momentarily locked, and
9587    a copy is made for the view to display.  This ensures that the
9588    view produces a consistent set of results, while not blocking
9589    normal operations longer than necessary.  Nonetheless
9590    there could be some impact on database performance if this view is
9591    frequently accessed.
9592   </para>
9593
9594  </sect1>
9595
9596  <sect1 id="view-pg-publication-tables">
9597   <title><structname>pg_publication_tables</structname></title>
9598
9599   <indexterm zone="view-pg-publication-tables">
9600    <primary>pg_publication_tables</primary>
9601   </indexterm>
9602
9603   <para>
9604    The view <structname>pg_publication_tables</structname> provides
9605    information about the mapping between publications and the tables they
9606    contain.  Unlike the underlying
9607    catalog <structname>pg_publication_rel</structname>, this view expands
9608    publications defined as <literal>FOR ALL TABLES</literal>, so for such
9609    publications there will be a row for each eligible table.
9610   </para>
9611
9612   <table>
9613    <title><structname>pg_publication_tables</structname> Columns</title>
9614
9615    <tgroup cols="4">
9616     <thead>
9617      <row>
9618       <entry>Name</entry>
9619       <entry>Type</entry>
9620       <entry>References</entry>
9621       <entry>Description</entry>
9622      </row>
9623     </thead>
9624
9625     <tbody>
9626      <row>
9627       <entry><structfield>pubname</structfield></entry>
9628       <entry><type>name</type></entry>
9629       <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
9630       <entry>Name of publication</entry>
9631      </row>
9632
9633      <row>
9634       <entry><structfield>schemaname</structfield></entry>
9635       <entry><type>name</type></entry>
9636       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9637       <entry>Name of schema containing table</entry>
9638      </row>
9639
9640      <row>
9641       <entry><structfield>tablename</structfield></entry>
9642       <entry><type>name</type></entry>
9643       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9644       <entry>Name of table</entry>
9645      </row>
9646     </tbody>
9647    </tgroup>
9648   </table>
9649  </sect1>
9650
9651   <sect1 id="view-pg-replication-origin-status">
9652   <title><structname>pg_replication_origin_status</structname></title>
9653
9654   <indexterm zone="view-pg-replication-origin-status">
9655    <primary>pg_replication_origin_status</primary>
9656   </indexterm>
9657
9658   <para>
9659    The <structname>pg_replication_origin_status</structname> view
9660    contains information about how far replay for a certain origin has
9661    progressed.  For more on replication origins
9662    see <xref linkend="replication-origins"/>.
9663   </para>
9664
9665   <table>
9666
9667    <title><structname>pg_replication_origin_status</structname> Columns</title>
9668
9669    <tgroup cols="4">
9670     <thead>
9671      <row>
9672       <entry>Name</entry>
9673       <entry>Type</entry>
9674       <entry>References</entry>
9675       <entry>Description</entry>
9676      </row>
9677     </thead>
9678
9679     <tbody>
9680      <row>
9681       <entry><structfield>local_id</structfield></entry>
9682       <entry><type>Oid</type></entry>
9683       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
9684       <entry>internal node identifier</entry>
9685      </row>
9686
9687      <row>
9688       <entry><structfield>external_id</structfield></entry>
9689       <entry><type>text</type></entry>
9690       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
9691       <entry>external node identifier</entry>
9692      </row>
9693
9694      <row>
9695       <entry><structfield>remote_lsn</structfield></entry>
9696       <entry><type>pg_lsn</type></entry>
9697       <entry></entry>
9698       <entry>The origin node's LSN up to which data has been replicated.</entry>
9699      </row>
9700
9701      <row>
9702       <entry><structfield>local_lsn</structfield></entry>
9703       <entry><type>pg_lsn</type></entry>
9704       <entry></entry>
9705       <entry>
9706        This node's LSN at which <literal>remote_lsn</literal> has
9707        been replicated. Used to flush commit records before persisting
9708        data to disk when using asynchronous commits.
9709       </entry>
9710      </row>
9711     </tbody>
9712    </tgroup>
9713   </table>
9714  </sect1>
9715
9716  <sect1 id="view-pg-replication-slots">
9717   <title><structname>pg_replication_slots</structname></title>
9718
9719   <indexterm zone="view-pg-replication-slots">
9720    <primary>pg_replication_slots</primary>
9721   </indexterm>
9722
9723   <para>
9724    The <structname>pg_replication_slots</structname> view provides a listing
9725    of all replication slots that currently exist on the database cluster,
9726    along with their current state.
9727   </para>
9728
9729   <para>
9730    For more on replication slots,
9731    see <xref linkend="streaming-replication-slots"/> and <xref linkend="logicaldecoding"/>.
9732   </para>
9733
9734   <table>
9735
9736    <title><structname>pg_replication_slots</structname> Columns</title>
9737
9738    <tgroup cols="4">
9739     <thead>
9740      <row>
9741       <entry>Name</entry>
9742       <entry>Type</entry>
9743       <entry>References</entry>
9744       <entry>Description</entry>
9745      </row>
9746     </thead>
9747
9748     <tbody>
9749      <row>
9750       <entry><structfield>slot_name</structfield></entry>
9751       <entry><type>name</type></entry>
9752       <entry></entry>
9753       <entry>A unique, cluster-wide identifier for the replication slot</entry>
9754      </row>
9755
9756      <row>
9757       <entry><structfield>plugin</structfield></entry>
9758       <entry><type>name</type></entry>
9759       <entry></entry>
9760       <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
9761      </row>
9762
9763      <row>
9764       <entry><structfield>slot_type</structfield></entry>
9765       <entry><type>text</type></entry>
9766       <entry></entry>
9767       <entry>The slot type - <literal>physical</literal> or <literal>logical</literal></entry>
9768      </row>
9769
9770      <row>
9771       <entry><structfield>datoid</structfield></entry>
9772       <entry><type>oid</type></entry>
9773       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9774       <entry>The OID of the database this slot is associated with, or
9775       null. Only logical slots have an associated database.</entry>
9776      </row>
9777
9778      <row>
9779       <entry><structfield>database</structfield></entry>
9780       <entry><type>text</type></entry>
9781       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9782       <entry>The name of the database this slot is associated with, or
9783       null. Only logical slots have an associated database.</entry>
9784      </row>
9785
9786      <row>
9787       <entry><structfield>temporary</structfield></entry>
9788       <entry><type>boolean</type></entry>
9789       <entry></entry>
9790       <entry>True if this is a temporary replication slot. Temporary slots are
9791       not saved to disk and are automatically dropped on error or when
9792       the session has finished.</entry>
9793      </row>
9794
9795      <row>
9796       <entry><structfield>active</structfield></entry>
9797       <entry><type>boolean</type></entry>
9798       <entry></entry>
9799       <entry>True if this slot is currently actively being used</entry>
9800      </row>
9801
9802      <row>
9803       <entry><structfield>active_pid</structfield></entry>
9804       <entry><type>integer</type></entry>
9805       <entry></entry>
9806       <entry>The process ID of the session using this slot if the slot
9807        is currently actively being used. <literal>NULL</literal> if
9808        inactive.
9809       </entry>
9810      </row>
9811
9812      <row>
9813       <entry><structfield>xmin</structfield></entry>
9814       <entry><type>xid</type></entry>
9815       <entry></entry>
9816       <entry>The oldest transaction that this slot needs the database to
9817       retain.  <literal>VACUUM</literal> cannot remove tuples deleted
9818       by any later transaction.
9819       </entry>
9820      </row>
9821
9822      <row>
9823       <entry><structfield>catalog_xmin</structfield></entry>
9824       <entry><type>xid</type></entry>
9825       <entry></entry>
9826       <entry>The oldest transaction affecting the system catalogs that this
9827       slot needs the database to retain.  <literal>VACUUM</literal> cannot
9828       remove catalog tuples deleted by any later transaction.
9829       </entry>
9830      </row>
9831
9832      <row>
9833       <entry><structfield>restart_lsn</structfield></entry>
9834       <entry><type>pg_lsn</type></entry>
9835       <entry></entry>
9836       <entry>The address (<literal>LSN</literal>) of oldest WAL which still
9837       might be required by the consumer of this slot and thus won't be
9838       automatically removed during checkpoints.
9839       </entry>
9840      </row>
9841
9842      <row>
9843       <entry><structfield>confirmed_flush_lsn</structfield></entry>
9844       <entry><type>pg_lsn</type></entry>
9845       <entry></entry>
9846       <entry>The address (<literal>LSN</literal>) up to which the logical
9847       slot's consumer has confirmed receiving data. Data older than this is
9848       not available anymore. <literal>NULL</literal> for physical slots.
9849       </entry>
9850      </row>
9851
9852     </tbody>
9853    </tgroup>
9854   </table>
9855  </sect1>
9856
9857  <sect1 id="view-pg-roles">
9858   <title><structname>pg_roles</structname></title>
9859
9860   <indexterm zone="view-pg-roles">
9861    <primary>pg_roles</primary>
9862   </indexterm>
9863
9864   <para>
9865    The view <structname>pg_roles</structname> provides access to
9866    information about database roles.  This is simply a publicly
9867    readable view of
9868    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9869    that blanks out the password field.
9870   </para>
9871
9872   <para>
9873    This view explicitly exposes the OID column of the underlying table,
9874    since that is needed to do joins to other catalogs.
9875   </para>
9876
9877   <table>
9878    <title><structname>pg_roles</structname> Columns</title>
9879
9880    <tgroup cols="4">
9881     <thead>
9882      <row>
9883       <entry>Name</entry>
9884       <entry>Type</entry>
9885       <entry>References</entry>
9886       <entry>Description</entry>
9887      </row>
9888     </thead>
9889
9890     <tbody>
9891      <row>
9892       <entry><structfield>rolname</structfield></entry>
9893       <entry><type>name</type></entry>
9894       <entry></entry>
9895       <entry>Role name</entry>
9896      </row>
9897
9898      <row>
9899       <entry><structfield>rolsuper</structfield></entry>
9900       <entry><type>bool</type></entry>
9901       <entry></entry>
9902       <entry>Role has superuser privileges</entry>
9903      </row>
9904
9905      <row>
9906       <entry><structfield>rolinherit</structfield></entry>
9907       <entry><type>bool</type></entry>
9908       <entry></entry>
9909       <entry>Role automatically inherits privileges of roles it is a
9910        member of</entry>
9911      </row>
9912
9913      <row>
9914       <entry><structfield>rolcreaterole</structfield></entry>
9915       <entry><type>bool</type></entry>
9916       <entry></entry>
9917       <entry>Role can create more roles</entry>
9918      </row>
9919
9920      <row>
9921       <entry><structfield>rolcreatedb</structfield></entry>
9922       <entry><type>bool</type></entry>
9923       <entry></entry>
9924       <entry>Role can create databases</entry>
9925      </row>
9926
9927      <row>
9928       <entry><structfield>rolcanlogin</structfield></entry>
9929       <entry><type>bool</type></entry>
9930       <entry></entry>
9931       <entry>
9932        Role can log in. That is, this role can be given as the initial
9933        session authorization identifier
9934       </entry>
9935      </row>
9936
9937      <row>
9938       <entry><structfield>rolreplication</structfield></entry>
9939       <entry><type>bool</type></entry>
9940       <entry></entry>
9941       <entry>
9942        Role is a replication role. A replication role can initiate replication
9943        connections and create and drop replication slots.
9944       </entry>
9945      </row>
9946
9947      <row>
9948       <entry><structfield>rolconnlimit</structfield></entry>
9949       <entry><type>int4</type></entry>
9950       <entry></entry>
9951       <entry>
9952        For roles that can log in, this sets maximum number of concurrent
9953        connections this role can make.  -1 means no limit.
9954       </entry>
9955      </row>
9956
9957      <row>
9958       <entry><structfield>rolpassword</structfield></entry>
9959       <entry><type>text</type></entry>
9960       <entry></entry>
9961       <entry>Not the password (always reads as <literal>********</literal>)</entry>
9962      </row>
9963
9964      <row>
9965       <entry><structfield>rolvaliduntil</structfield></entry>
9966       <entry><type>timestamptz</type></entry>
9967       <entry></entry>
9968       <entry>Password expiry time (only used for password authentication);
9969        null if no expiration</entry>
9970      </row>
9971
9972      <row>
9973       <entry><structfield>rolbypassrls</structfield></entry>
9974       <entry><type>bool</type></entry>
9975       <entry></entry>
9976       <entry>
9977        Role bypasses every row level security policy, see
9978        <xref linkend="ddl-rowsecurity"/> for more information.
9979       </entry>
9980      </row>
9981
9982      <row>
9983       <entry><structfield>rolconfig</structfield></entry>
9984       <entry><type>text[]</type></entry>
9985       <entry></entry>
9986       <entry>Role-specific defaults for run-time configuration variables</entry>
9987      </row>
9988
9989      <row>
9990       <entry><structfield>oid</structfield></entry>
9991       <entry><type>oid</type></entry>
9992       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9993       <entry>ID of role</entry>
9994      </row>
9995     </tbody>
9996    </tgroup>
9997   </table>
9998
9999  </sect1>
10000
10001  <sect1 id="view-pg-rules">
10002   <title><structname>pg_rules</structname></title>
10003
10004   <indexterm zone="view-pg-rules">
10005    <primary>pg_rules</primary>
10006   </indexterm>
10007
10008   <para>
10009    The view <structname>pg_rules</structname> provides access to
10010    useful information about query rewrite rules.
10011   </para>
10012
10013   <table>
10014    <title><structname>pg_rules</structname> Columns</title>
10015
10016    <tgroup cols="4">
10017     <thead>
10018      <row>
10019       <entry>Name</entry>
10020       <entry>Type</entry>
10021       <entry>References</entry>
10022       <entry>Description</entry>
10023      </row>
10024     </thead>
10025     <tbody>
10026      <row>
10027       <entry><structfield>schemaname</structfield></entry>
10028       <entry><type>name</type></entry>
10029       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10030       <entry>Name of schema containing table</entry>
10031      </row>
10032      <row>
10033       <entry><structfield>tablename</structfield></entry>
10034       <entry><type>name</type></entry>
10035       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10036       <entry>Name of table the rule is for</entry>
10037      </row>
10038      <row>
10039       <entry><structfield>rulename</structfield></entry>
10040       <entry><type>name</type></entry>
10041       <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
10042       <entry>Name of rule</entry>
10043      </row>
10044      <row>
10045       <entry><structfield>definition</structfield></entry>
10046       <entry><type>text</type></entry>
10047       <entry></entry>
10048       <entry>Rule definition (a reconstructed creation command)</entry>
10049      </row>
10050     </tbody>
10051    </tgroup>
10052   </table>
10053
10054   <para>
10055    The <structname>pg_rules</structname> view excludes the <literal>ON SELECT</literal> rules
10056    of views and materialized views; those can be seen in
10057    <structname>pg_views</structname> and <structname>pg_matviews</structname>.
10058   </para>
10059
10060  </sect1>
10061
10062  <sect1 id="view-pg-seclabels">
10063   <title><structname>pg_seclabels</structname></title>
10064
10065   <indexterm zone="view-pg-seclabels">
10066    <primary>pg_seclabels</primary>
10067   </indexterm>
10068
10069   <para>
10070    The view <structname>pg_seclabels</structname> provides information about
10071    security labels.  It as an easier-to-query version of the
10072    <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link> catalog.
10073   </para>
10074
10075   <table>
10076    <title><structname>pg_seclabels</structname> Columns</title>
10077
10078    <tgroup cols="4">
10079     <thead>
10080      <row>
10081       <entry>Name</entry>
10082       <entry>Type</entry>
10083       <entry>References</entry>
10084       <entry>Description</entry>
10085      </row>
10086     </thead>
10087     <tbody>
10088      <row>
10089       <entry><structfield>objoid</structfield></entry>
10090       <entry><type>oid</type></entry>
10091       <entry>any OID column</entry>
10092       <entry>The OID of the object this security label pertains to</entry>
10093      </row>
10094      <row>
10095       <entry><structfield>classoid</structfield></entry>
10096       <entry><type>oid</type></entry>
10097       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
10098       <entry>The OID of the system catalog this object appears in</entry>
10099      </row>
10100      <row>
10101       <entry><structfield>objsubid</structfield></entry>
10102       <entry><type>int4</type></entry>
10103       <entry></entry>
10104       <entry>
10105        For a security label on a table column, this is the column number (the
10106        <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
10107        the table itself).  For all other object types, this column is
10108        zero.
10109       </entry>
10110      </row>
10111      <row>
10112       <entry><structfield>objtype</structfield></entry>
10113       <entry><type>text</type></entry>
10114       <entry></entry>
10115       <entry>
10116          The type of object to which this label applies, as text.
10117       </entry>
10118      </row>
10119      <row>
10120       <entry><structfield>objnamespace</structfield></entry>
10121       <entry><type>oid</type></entry>
10122       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
10123       <entry>
10124        The OID of the namespace for this object, if applicable;
10125        otherwise NULL.
10126       </entry>
10127      </row>
10128      <row>
10129       <entry><structfield>objname</structfield></entry>
10130       <entry><type>text</type></entry>
10131       <entry></entry>
10132       <entry>
10133        The name of the object to which this label applies, as text.
10134       </entry>
10135      </row>
10136      <row>
10137       <entry><structfield>provider</structfield></entry>
10138       <entry><type>text</type></entry>
10139       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
10140       <entry>The label provider associated with this label.</entry>
10141      </row>
10142      <row>
10143       <entry><structfield>label</structfield></entry>
10144       <entry><type>text</type></entry>
10145       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
10146       <entry>The security label applied to this object.</entry>
10147      </row>
10148     </tbody>
10149    </tgroup>
10150   </table>
10151  </sect1>
10152
10153  <sect1 id="view-pg-sequences">
10154   <title><structname>pg_sequences</structname></title>
10155
10156   <indexterm zone="view-pg-sequences">
10157    <primary>pg_sequences</primary>
10158   </indexterm>
10159
10160   <para>
10161    The view <structname>pg_sequences</structname> provides access to
10162    useful information about each sequence in the database.
10163   </para>
10164
10165   <table>
10166    <title><structname>pg_sequences</structname> Columns</title>
10167
10168    <tgroup cols="4">
10169     <thead>
10170      <row>
10171       <entry>Name</entry>
10172       <entry>Type</entry>
10173       <entry>References</entry>
10174       <entry>Description</entry>
10175      </row>
10176     </thead>
10177     <tbody>
10178      <row>
10179       <entry><structfield>schemaname</structfield></entry>
10180       <entry><type>name</type></entry>
10181       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10182       <entry>Name of schema containing sequence</entry>
10183      </row>
10184      <row>
10185       <entry><structfield>sequencename</structfield></entry>
10186       <entry><type>name</type></entry>
10187       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10188       <entry>Name of sequence</entry>
10189      </row>
10190      <row>
10191       <entry><structfield>sequenceowner</structfield></entry>
10192       <entry><type>name</type></entry>
10193       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10194       <entry>Name of sequence's owner</entry>
10195      </row>
10196      <row>
10197       <entry><structfield>data_type</structfield></entry>
10198       <entry><type>regtype</type></entry>
10199       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_type</structname></link>.oid</literal></entry>
10200       <entry>Data type of the sequence</entry>
10201      </row>
10202      <row>
10203       <entry><structfield>start_value</structfield></entry>
10204       <entry><type>bigint</type></entry>
10205       <entry></entry>
10206       <entry>Start value of the sequence</entry>
10207      </row>
10208      <row>
10209       <entry><structfield>min_value</structfield></entry>
10210       <entry><type>bigint</type></entry>
10211       <entry></entry>
10212       <entry>Minimum value of the sequence</entry>
10213      </row>
10214      <row>
10215       <entry><structfield>max_value</structfield></entry>
10216       <entry><type>bigint</type></entry>
10217       <entry></entry>
10218       <entry>Maximum value of the sequence</entry>
10219      </row>
10220      <row>
10221       <entry><structfield>increment_by</structfield></entry>
10222       <entry><type>bigint</type></entry>
10223       <entry></entry>
10224       <entry>Increment value of the sequence</entry>
10225      </row>
10226      <row>
10227       <entry><structfield>cycle</structfield></entry>
10228       <entry><type>boolean</type></entry>
10229       <entry></entry>
10230       <entry>Whether the sequence cycles</entry>
10231      </row>
10232      <row>
10233       <entry><structfield>cache_size</structfield></entry>
10234       <entry><type>bigint</type></entry>
10235       <entry></entry>
10236       <entry>Cache size of the sequence</entry>
10237      </row>
10238      <row>
10239       <entry><structfield>last_value</structfield></entry>
10240       <entry><type>bigint</type></entry>
10241       <entry></entry>
10242       <entry>The last sequence value written to disk.  If caching is used,
10243        this value can be greater than the last value handed out from the
10244        sequence.  Null if the sequence has not been read from yet.  Also, if
10245        the current user does not have <literal>USAGE</literal>
10246        or <literal>SELECT</literal> privilege on the sequence, the value is
10247        null.</entry>
10248      </row>
10249     </tbody>
10250    </tgroup>
10251   </table>
10252  </sect1>
10253
10254  <sect1 id="view-pg-settings">
10255   <title><structname>pg_settings</structname></title>
10256
10257   <indexterm zone="view-pg-settings">
10258    <primary>pg_settings</primary>
10259   </indexterm>
10260
10261   <para>
10262    The view <structname>pg_settings</structname> provides access to
10263    run-time parameters of the server.  It is essentially an alternative
10264    interface to the <xref linkend="sql-show"/>
10265    and <xref linkend="sql-set"/> commands.
10266    It also provides access to some facts about each parameter that are
10267    not directly available from <command>SHOW</command>, such as minimum and
10268    maximum values.
10269   </para>
10270
10271   <table>
10272    <title><structname>pg_settings</structname> Columns</title>
10273
10274    <tgroup cols="3">
10275     <thead>
10276      <row>
10277       <entry>Name</entry>
10278       <entry>Type</entry>
10279       <entry>Description</entry>
10280      </row>
10281     </thead>
10282     <tbody>
10283      <row>
10284       <entry><structfield>name</structfield></entry>
10285       <entry><type>text</type></entry>
10286       <entry>Run-time configuration parameter name</entry>
10287      </row>
10288      <row>
10289       <entry><structfield>setting</structfield></entry>
10290       <entry><type>text</type></entry>
10291       <entry>Current value of the parameter</entry>
10292      </row>
10293      <row>
10294       <entry><structfield>unit</structfield></entry>
10295       <entry><type>text</type></entry>
10296       <entry>Implicit unit of the parameter</entry>
10297      </row>
10298      <row>
10299       <entry><structfield>category</structfield></entry>
10300       <entry><type>text</type></entry>
10301       <entry>Logical group of the parameter</entry>
10302      </row>
10303      <row>
10304       <entry><structfield>short_desc</structfield></entry>
10305       <entry><type>text</type></entry>
10306       <entry>A brief description of the parameter</entry>
10307      </row>
10308      <row>
10309       <entry><structfield>extra_desc</structfield></entry>
10310       <entry><type>text</type></entry>
10311       <entry>Additional, more detailed, description of the parameter</entry>
10312      </row>
10313      <row>
10314       <entry><structfield>context</structfield></entry>
10315       <entry><type>text</type></entry>
10316       <entry>Context required to set the parameter's value (see below)</entry>
10317      </row>
10318      <row>
10319       <entry><structfield>vartype</structfield></entry>
10320       <entry><type>text</type></entry>
10321       <entry>Parameter type (<literal>bool</literal>, <literal>enum</literal>,
10322        <literal>integer</literal>, <literal>real</literal>, or <literal>string</literal>)
10323       </entry>
10324      </row>
10325      <row>
10326       <entry><structfield>source</structfield></entry>
10327       <entry><type>text</type></entry>
10328       <entry>Source of the current parameter value</entry>
10329      </row>
10330      <row>
10331       <entry><structfield>min_val</structfield></entry>
10332       <entry><type>text</type></entry>
10333       <entry>Minimum allowed value of the parameter (null for non-numeric
10334       values)</entry>
10335      </row>
10336      <row>
10337       <entry><structfield>max_val</structfield></entry>
10338       <entry><type>text</type></entry>
10339       <entry>Maximum allowed value of the parameter (null for non-numeric
10340       values)</entry>
10341      </row>
10342      <row>
10343       <entry><structfield>enumvals</structfield></entry>
10344       <entry><type>text[]</type></entry>
10345       <entry>Allowed values of an enum parameter (null for non-enum
10346       values)</entry>
10347      </row>
10348      <row>
10349       <entry><structfield>boot_val</structfield></entry>
10350       <entry><type>text</type></entry>
10351       <entry>Parameter value assumed at server startup if the parameter is
10352       not otherwise set</entry>
10353      </row>
10354      <row>
10355       <entry><structfield>reset_val</structfield></entry>
10356       <entry><type>text</type></entry>
10357       <entry>Value that <command>RESET</command> would reset the parameter to
10358       in the current session</entry>
10359      </row>
10360      <row>
10361       <entry><structfield>sourcefile</structfield></entry>
10362       <entry><type>text</type></entry>
10363       <entry>Configuration file the current value was set in (null for
10364       values set from sources other than configuration files, or when
10365       examined by a user who is neither a superuser or a member of
10366       <literal>pg_read_all_settings</literal>); helpful when using
10367       <literal>include</literal> directives in configuration files</entry>
10368      </row>
10369      <row>
10370       <entry><structfield>sourceline</structfield></entry>
10371       <entry><type>integer</type></entry>
10372       <entry>Line number within the configuration file the current value was
10373       set at (null for values set from sources other than configuration files,
10374       or when examined by a user who is neither a superuser or a member of
10375       <literal>pg_read_all_settings</literal>).
10376       </entry>
10377      </row>
10378      <row>
10379       <entry><structfield>pending_restart</structfield></entry>
10380       <entry><type>boolean</type></entry>
10381       <entry><literal>true</literal> if the value has been changed in the
10382       configuration file but needs a restart; or <literal>false</literal>
10383       otherwise.
10384       </entry>
10385      </row>
10386     </tbody>
10387    </tgroup>
10388   </table>
10389
10390   <para>
10391    There are several possible values of <structfield>context</structfield>.
10392    In order of decreasing difficulty of changing the setting, they are:
10393   </para>
10394
10395   <variablelist>
10396    <varlistentry>
10397     <!-- PGC_INTERNAL -->
10398     <term><literal>internal</literal></term>
10399     <listitem>
10400      <para>
10401       These settings cannot be changed directly; they reflect internally
10402       determined values.  Some of them may be adjustable by rebuilding the
10403       server with different configuration options, or by changing options
10404       supplied to <command>initdb</command>.
10405      </para>
10406     </listitem>
10407    </varlistentry>
10408    <varlistentry>
10409     <!-- PGC_POSTMASTER -->
10410     <term><literal>postmaster</literal></term>
10411     <listitem>
10412      <para>
10413       These settings can only be applied when the server starts, so any change
10414       requires restarting the server.  Values for these settings are typically
10415       stored in the <filename>postgresql.conf</filename> file, or passed on
10416       the command line when starting the server.  Of course, settings with any
10417       of the lower <structfield>context</structfield> types can also be
10418       set at server start time.
10419      </para>
10420     </listitem>
10421    </varlistentry>
10422    <varlistentry>
10423     <!-- PGC_SIGHUP -->
10424     <term><literal>sighup</literal></term>
10425     <listitem>
10426      <para>
10427       Changes to these settings can be made in
10428       <filename>postgresql.conf</filename> without restarting the server.
10429       Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
10430       cause it to re-read <filename>postgresql.conf</filename> and apply
10431       the changes.  The postmaster will also forward the
10432       <systemitem>SIGHUP</systemitem> signal to its child processes so that
10433       they all pick up the new value.
10434      </para>
10435     </listitem>
10436    </varlistentry>
10437    <varlistentry>
10438     <!-- PGC_SU_BACKEND -->
10439     <term><literal>superuser-backend</literal></term>
10440     <listitem>
10441      <para>
10442       Changes to these settings can be made in
10443       <filename>postgresql.conf</filename> without restarting the server.
10444       They can also be set for a particular session in the connection request
10445       packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
10446       environment variable), but only if the connecting user is a superuser.
10447       However, these settings never change in a session after it is started.
10448       If you change them in <filename>postgresql.conf</filename>, send a
10449       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10450       re-read <filename>postgresql.conf</filename>.  The new values will only
10451       affect subsequently-launched sessions.
10452      </para>
10453     </listitem>
10454    </varlistentry>
10455    <varlistentry>
10456     <!-- PGC_BACKEND -->
10457     <term><literal>backend</literal></term>
10458     <listitem>
10459      <para>
10460       Changes to these settings can be made in
10461       <filename>postgresql.conf</filename> without restarting the server.
10462       They can also be set for a particular session in the connection request
10463       packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
10464       environment variable); any user can make such a change for their session.
10465       However, these settings never change in a session after it is started.
10466       If you change them in <filename>postgresql.conf</filename>, send a
10467       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10468       re-read <filename>postgresql.conf</filename>.  The new values will only
10469       affect subsequently-launched sessions.
10470      </para>
10471     </listitem>
10472    </varlistentry>
10473    <varlistentry>
10474     <!-- PGC_SUSET -->
10475     <term><literal>superuser</literal></term>
10476     <listitem>
10477      <para>
10478       These settings can be set from <filename>postgresql.conf</filename>,
10479       or within a session via the <command>SET</command> command; but only superusers
10480       can change them via <command>SET</command>.  Changes in
10481       <filename>postgresql.conf</filename> will affect existing sessions
10482       only if no session-local value has been established with <command>SET</command>.
10483      </para>
10484     </listitem>
10485    </varlistentry>
10486    <varlistentry>
10487     <!-- PGC_USERSET -->
10488     <term><literal>user</literal></term>
10489     <listitem>
10490      <para>
10491       These settings can be set from <filename>postgresql.conf</filename>,
10492       or within a session via the <command>SET</command> command.  Any user is
10493       allowed to change their session-local value.  Changes in
10494       <filename>postgresql.conf</filename> will affect existing sessions
10495       only if no session-local value has been established with <command>SET</command>.
10496      </para>
10497     </listitem>
10498    </varlistentry>
10499   </variablelist>
10500
10501   <para>
10502    See <xref linkend="config-setting"/> for more information about the various
10503    ways to change these parameters.
10504   </para>
10505
10506   <para>
10507    The <structname>pg_settings</structname> view cannot be inserted into or
10508    deleted from, but it can be updated.  An <command>UPDATE</command> applied
10509    to a row of <structname>pg_settings</structname> is equivalent to executing
10510    the <xref linkend="sql-set"/> command on that named
10511    parameter. The change only affects the value used by the current
10512    session. If an <command>UPDATE</command> is issued within a transaction
10513    that is later aborted, the effects of the <command>UPDATE</command> command
10514    disappear when the transaction is rolled back. Once the surrounding
10515    transaction is committed, the effects will persist until the end of the
10516    session, unless overridden by another <command>UPDATE</command> or
10517    <command>SET</command>.
10518   </para>
10519
10520  </sect1>
10521
10522  <sect1 id="view-pg-shadow">
10523   <title><structname>pg_shadow</structname></title>
10524
10525   <indexterm zone="view-pg-shadow">
10526    <primary>pg_shadow</primary>
10527   </indexterm>
10528
10529   <para>
10530    The view <structname>pg_shadow</structname> exists for backwards
10531    compatibility: it emulates a catalog that existed in
10532    <productname>PostgreSQL</productname> before version 8.1.
10533    It shows properties of all roles that are marked as
10534    <structfield>rolcanlogin</structfield> in
10535    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
10536   </para>
10537
10538   <para>
10539    The name stems from the fact that this table
10540    should not be readable by the public since it contains passwords.
10541    <link linkend="view-pg-user"><structname>pg_user</structname></link>
10542    is a publicly readable view on
10543    <structname>pg_shadow</structname> that blanks out the password field.
10544   </para>
10545
10546   <table>
10547    <title><structname>pg_shadow</structname> Columns</title>
10548
10549    <tgroup cols="4">
10550     <thead>
10551      <row>
10552       <entry>Name</entry>
10553       <entry>Type</entry>
10554       <entry>References</entry>
10555       <entry>Description</entry>
10556      </row>
10557     </thead>
10558
10559     <tbody>
10560      <row>
10561       <entry><structfield>usename</structfield></entry>
10562       <entry><type>name</type></entry>
10563       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10564       <entry>User name</entry>
10565      </row>
10566
10567      <row>
10568       <entry><structfield>usesysid</structfield></entry>
10569       <entry><type>oid</type></entry>
10570       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10571       <entry>ID of this user</entry>
10572      </row>
10573
10574      <row>
10575       <entry><structfield>usecreatedb</structfield></entry>
10576       <entry><type>bool</type></entry>
10577       <entry></entry>
10578       <entry>User can create databases</entry>
10579      </row>
10580
10581      <row>
10582       <entry><structfield>usesuper</structfield></entry>
10583       <entry><type>bool</type></entry>
10584       <entry></entry>
10585       <entry>User is a superuser</entry>
10586      </row>
10587
10588      <row>
10589       <entry><structfield>userepl</structfield></entry>
10590       <entry><type>bool</type></entry>
10591       <entry></entry>
10592       <entry>
10593        User can initiate streaming replication and put the system in and
10594        out of backup mode.
10595       </entry>
10596      </row>
10597
10598      <row>
10599       <entry><structfield>usebypassrls</structfield></entry>
10600       <entry><type>bool</type></entry>
10601       <entry></entry>
10602       <entry>
10603        User bypasses every row level security policy, see
10604        <xref linkend="ddl-rowsecurity"/> for more information.
10605       </entry>
10606      </row>
10607
10608      <row>
10609       <entry><structfield>passwd</structfield></entry>
10610       <entry><type>text</type></entry>
10611       <entry></entry>
10612       <entry>Password (possibly encrypted); null if none.  See
10613       <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
10614       for details of how encrypted passwords are stored.</entry>
10615      </row>
10616
10617      <row>
10618       <entry><structfield>valuntil</structfield></entry>
10619       <entry><type>abstime</type></entry>
10620       <entry></entry>
10621       <entry>Password expiry time (only used for password authentication)</entry>
10622      </row>
10623
10624      <row>
10625       <entry><structfield>useconfig</structfield></entry>
10626       <entry><type>text[]</type></entry>
10627       <entry></entry>
10628       <entry>Session defaults for run-time configuration variables</entry>
10629      </row>
10630     </tbody>
10631    </tgroup>
10632   </table>
10633
10634  </sect1>
10635
10636  <sect1 id="view-pg-stats">
10637   <title><structname>pg_stats</structname></title>
10638
10639   <indexterm zone="view-pg-stats">
10640    <primary>pg_stats</primary>
10641   </indexterm>
10642
10643   <para>
10644    The view <structname>pg_stats</structname> provides access to
10645    the information stored in the <link
10646    linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
10647    catalog.  This view allows access only to rows of
10648    <structname>pg_statistic</structname> that correspond to tables the
10649    user has permission to read, and therefore it is safe to allow public
10650    read access to this view.
10651   </para>
10652
10653   <para>
10654    <structname>pg_stats</structname> is also designed to present the
10655    information in a more readable format than the underlying catalog
10656    &mdash; at the cost that its schema must be extended whenever new slot types
10657    are defined for <structname>pg_statistic</structname>.
10658   </para>
10659
10660   <table>
10661    <title><structname>pg_stats</structname> Columns</title>
10662
10663    <tgroup cols="4">
10664     <thead>
10665      <row>
10666       <entry>Name</entry>
10667       <entry>Type</entry>
10668       <entry>References</entry>
10669       <entry>Description</entry>
10670      </row>
10671     </thead>
10672     <tbody>
10673      <row>
10674       <entry><structfield>schemaname</structfield></entry>
10675       <entry><type>name</type></entry>
10676       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10677       <entry>Name of schema containing table</entry>
10678      </row>
10679
10680      <row>
10681       <entry><structfield>tablename</structfield></entry>
10682       <entry><type>name</type></entry>
10683       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10684       <entry>Name of table</entry>
10685      </row>
10686
10687      <row>
10688       <entry><structfield>attname</structfield></entry>
10689       <entry><type>name</type></entry>
10690       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
10691       <entry>Name of the column described by this row</entry>
10692      </row>
10693
10694      <row>
10695       <entry><structfield>inherited</structfield></entry>
10696       <entry><type>bool</type></entry>
10697       <entry></entry>
10698       <entry>If true, this row includes inheritance child columns, not just the
10699        values in the specified table</entry>
10700      </row>
10701
10702      <row>
10703       <entry><structfield>null_frac</structfield></entry>
10704       <entry><type>real</type></entry>
10705       <entry></entry>
10706       <entry>Fraction of column entries that are null</entry>
10707      </row>
10708
10709      <row>
10710       <entry><structfield>avg_width</structfield></entry>
10711       <entry><type>integer</type></entry>
10712       <entry></entry>
10713       <entry>Average width in bytes of column's entries</entry>
10714      </row>
10715
10716      <row>
10717       <entry><structfield>n_distinct</structfield></entry>
10718       <entry><type>real</type></entry>
10719       <entry></entry>
10720       <entry>
10721        If greater than zero, the estimated number of distinct values in the
10722        column.  If less than zero, the negative of the number of distinct
10723        values divided by the number of rows.  (The negated form is used when
10724        <command>ANALYZE</command> believes that the number of distinct values is
10725        likely to increase as the table grows; the positive form is used when
10726        the column seems to have a fixed number of possible values.)  For
10727        example, -1 indicates a unique column in which the number of distinct
10728        values is the same as the number of rows.
10729       </entry>
10730      </row>
10731
10732      <row>
10733       <entry><structfield>most_common_vals</structfield></entry>
10734       <entry><type>anyarray</type></entry>
10735       <entry></entry>
10736       <entry>
10737        A list of the most common values in the column. (Null if
10738        no values seem to be more common than any others.)
10739       </entry>
10740      </row>
10741
10742      <row>
10743       <entry><structfield>most_common_freqs</structfield></entry>
10744       <entry><type>real[]</type></entry>
10745       <entry></entry>
10746       <entry>
10747        A list of the frequencies of the most common values,
10748        i.e., number of occurrences of each divided by total number of rows.
10749        (Null when <structfield>most_common_vals</structfield> is.)
10750       </entry>
10751      </row>
10752
10753      <row>
10754       <entry><structfield>histogram_bounds</structfield></entry>
10755       <entry><type>anyarray</type></entry>
10756       <entry></entry>
10757       <entry>
10758        A list of values that divide the column's values into groups of
10759        approximately equal population.  The values in
10760        <structfield>most_common_vals</structfield>, if present, are omitted from this
10761        histogram calculation.  (This column is null if the column data type
10762        does not have a <literal>&lt;</literal> operator or if the
10763        <structfield>most_common_vals</structfield> list accounts for the entire
10764        population.)
10765       </entry>
10766      </row>
10767
10768      <row>
10769       <entry><structfield>correlation</structfield></entry>
10770       <entry><type>real</type></entry>
10771       <entry></entry>
10772       <entry>
10773        Statistical correlation between physical row ordering and
10774        logical ordering of the column values.  This ranges from -1 to +1.
10775        When the value is near -1 or +1, an index scan on the column will
10776        be estimated to be cheaper than when it is near zero, due to reduction
10777        of random access to the disk.  (This column is null if the column data
10778        type does not have a <literal>&lt;</literal> operator.)
10779       </entry>
10780      </row>
10781
10782      <row>
10783       <entry><structfield>most_common_elems</structfield></entry>
10784       <entry><type>anyarray</type></entry>
10785       <entry></entry>
10786       <entry>
10787        A list of non-null element values most often appearing within values of
10788        the column. (Null for scalar types.)
10789       </entry>
10790      </row>
10791
10792      <row>
10793       <entry><structfield>most_common_elem_freqs</structfield></entry>
10794       <entry><type>real[]</type></entry>
10795       <entry></entry>
10796       <entry>
10797        A list of the frequencies of the most common element values, i.e., the
10798        fraction of rows containing at least one instance of the given value.
10799        Two or three additional values follow the per-element frequencies;
10800        these are the minimum and maximum of the preceding per-element
10801        frequencies, and optionally the frequency of null elements.
10802        (Null when <structfield>most_common_elems</structfield> is.)
10803       </entry>
10804      </row>
10805
10806      <row>
10807       <entry><structfield>elem_count_histogram</structfield></entry>
10808       <entry><type>real[]</type></entry>
10809       <entry></entry>
10810       <entry>
10811        A histogram of the counts of distinct non-null element values within the
10812        values of the column, followed by the average number of distinct
10813        non-null elements.  (Null for scalar types.)
10814       </entry>
10815      </row>
10816     </tbody>
10817    </tgroup>
10818   </table>
10819
10820   <para>
10821    The maximum number of entries in the array fields can be controlled on a
10822    column-by-column basis using the <command>ALTER TABLE SET STATISTICS</command>
10823    command, or globally by setting the
10824    <xref linkend="guc-default-statistics-target"/> run-time parameter.
10825   </para>
10826
10827  </sect1>
10828
10829  <sect1 id="view-pg-tables">
10830   <title><structname>pg_tables</structname></title>
10831
10832   <indexterm zone="view-pg-tables">
10833    <primary>pg_tables</primary>
10834   </indexterm>
10835
10836   <para>
10837    The view <structname>pg_tables</structname> provides access to
10838    useful information about each table in the database.
10839   </para>
10840
10841   <table>
10842    <title><structname>pg_tables</structname> Columns</title>
10843
10844    <tgroup cols="4">
10845     <thead>
10846      <row>
10847       <entry>Name</entry>
10848       <entry>Type</entry>
10849       <entry>References</entry>
10850       <entry>Description</entry>
10851      </row>
10852     </thead>
10853     <tbody>
10854      <row>
10855       <entry><structfield>schemaname</structfield></entry>
10856       <entry><type>name</type></entry>
10857       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10858       <entry>Name of schema containing table</entry>
10859      </row>
10860      <row>
10861       <entry><structfield>tablename</structfield></entry>
10862       <entry><type>name</type></entry>
10863       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10864       <entry>Name of table</entry>
10865      </row>
10866      <row>
10867       <entry><structfield>tableowner</structfield></entry>
10868       <entry><type>name</type></entry>
10869       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10870       <entry>Name of table's owner</entry>
10871      </row>
10872      <row>
10873       <entry><structfield>tablespace</structfield></entry>
10874       <entry><type>name</type></entry>
10875       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
10876       <entry>Name of tablespace containing table (null if default for database)</entry>
10877      </row>
10878      <row>
10879       <entry><structfield>hasindexes</structfield></entry>
10880       <entry><type>boolean</type></entry>
10881       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
10882       <entry>True if table has (or recently had) any indexes</entry>
10883      </row>
10884      <row>
10885       <entry><structfield>hasrules</structfield></entry>
10886       <entry><type>boolean</type></entry>
10887       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
10888       <entry>True if table has (or once had) rules</entry>
10889      </row>
10890      <row>
10891       <entry><structfield>hastriggers</structfield></entry>
10892       <entry><type>boolean</type></entry>
10893       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
10894       <entry>True if table has (or once had) triggers</entry>
10895      </row>
10896      <row>
10897       <entry><structfield>rowsecurity</structfield></entry>
10898       <entry><type>boolean</type></entry>
10899       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
10900       <entry>True if row security is enabled on the table</entry>
10901      </row>
10902     </tbody>
10903    </tgroup>
10904   </table>
10905
10906  </sect1>
10907
10908  <sect1 id="view-pg-timezone-abbrevs">
10909   <title><structname>pg_timezone_abbrevs</structname></title>
10910
10911   <indexterm zone="view-pg-timezone-abbrevs">
10912    <primary>pg_timezone_abbrevs</primary>
10913   </indexterm>
10914
10915   <para>
10916    The view <structname>pg_timezone_abbrevs</structname> provides a list
10917    of time zone abbreviations that are currently recognized by the datetime
10918    input routines.  The contents of this view change when the
10919    <xref linkend="guc-timezone-abbreviations"/> run-time parameter is modified.
10920   </para>
10921
10922   <table>
10923    <title><structname>pg_timezone_abbrevs</structname> Columns</title>
10924
10925    <tgroup cols="3">
10926     <thead>
10927      <row>
10928       <entry>Name</entry>
10929       <entry>Type</entry>
10930       <entry>Description</entry>
10931      </row>
10932     </thead>
10933     <tbody>
10934      <row>
10935       <entry><structfield>abbrev</structfield></entry>
10936       <entry><type>text</type></entry>
10937       <entry>Time zone abbreviation</entry>
10938      </row>
10939      <row>
10940       <entry><structfield>utc_offset</structfield></entry>
10941       <entry><type>interval</type></entry>
10942       <entry>Offset from UTC (positive means east of Greenwich)</entry>
10943      </row>
10944      <row>
10945       <entry><structfield>is_dst</structfield></entry>
10946       <entry><type>boolean</type></entry>
10947       <entry>True if this is a daylight-savings abbreviation</entry>
10948      </row>
10949     </tbody>
10950    </tgroup>
10951   </table>
10952
10953   <para>
10954    While most timezone abbreviations represent fixed offsets from UTC,
10955    there are some that have historically varied in value
10956    (see <xref linkend="datetime-config-files"/> for more information).
10957    In such cases this view presents their current meaning.
10958   </para>
10959
10960  </sect1>
10961
10962  <sect1 id="view-pg-timezone-names">
10963   <title><structname>pg_timezone_names</structname></title>
10964
10965   <indexterm zone="view-pg-timezone-names">
10966    <primary>pg_timezone_names</primary>
10967   </indexterm>
10968
10969   <para>
10970    The view <structname>pg_timezone_names</structname> provides a list
10971    of time zone names that are recognized by <command>SET TIMEZONE</command>,
10972    along with their associated abbreviations, UTC offsets,
10973    and daylight-savings status.  (Technically,
10974    <productname>PostgreSQL</productname> does not use UTC because leap
10975    seconds are not handled.)
10976    Unlike the abbreviations shown in <link
10977    linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
10978    date rules.  Therefore, the associated information changes across local DST
10979    boundaries.  The displayed information is computed based on the current
10980    value of <function>CURRENT_TIMESTAMP</function>.
10981   </para>
10982
10983   <table>
10984    <title><structname>pg_timezone_names</structname> Columns</title>
10985
10986    <tgroup cols="3">
10987     <thead>
10988      <row>
10989       <entry>Name</entry>
10990       <entry>Type</entry>
10991       <entry>Description</entry>
10992      </row>
10993     </thead>
10994     <tbody>
10995      <row>
10996       <entry><structfield>name</structfield></entry>
10997       <entry><type>text</type></entry>
10998       <entry>Time zone name</entry>
10999      </row>
11000      <row>
11001       <entry><structfield>abbrev</structfield></entry>
11002       <entry><type>text</type></entry>
11003       <entry>Time zone abbreviation</entry>
11004      </row>
11005      <row>
11006       <entry><structfield>utc_offset</structfield></entry>
11007       <entry><type>interval</type></entry>
11008       <entry>Offset from UTC (positive means east of Greenwich)</entry>
11009      </row>
11010      <row>
11011       <entry><structfield>is_dst</structfield></entry>
11012       <entry><type>boolean</type></entry>
11013       <entry>True if currently observing daylight savings</entry>
11014      </row>
11015     </tbody>
11016    </tgroup>
11017   </table>
11018
11019  </sect1>
11020
11021  <sect1 id="view-pg-user">
11022   <title><structname>pg_user</structname></title>
11023
11024   <indexterm zone="view-pg-user">
11025    <primary>pg_user</primary>
11026   </indexterm>
11027
11028   <para>
11029    The view <structname>pg_user</structname> provides access to
11030    information about database users.  This is simply a publicly
11031    readable view of
11032    <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
11033    that blanks out the password field.
11034   </para>
11035
11036   <table>
11037    <title><structname>pg_user</structname> Columns</title>
11038
11039    <tgroup cols="3">
11040     <thead>
11041      <row>
11042       <entry>Name</entry>
11043       <entry>Type</entry>
11044       <entry>Description</entry>
11045      </row>
11046     </thead>
11047     <tbody>
11048      <row>
11049       <entry><structfield>usename</structfield></entry>
11050       <entry><type>name</type></entry>
11051       <entry>User name</entry>
11052      </row>
11053
11054      <row>
11055       <entry><structfield>usesysid</structfield></entry>
11056       <entry><type>oid</type></entry>
11057       <entry>ID of this user</entry>
11058      </row>
11059
11060      <row>
11061       <entry><structfield>usecreatedb</structfield></entry>
11062       <entry><type>bool</type></entry>
11063       <entry>User can create databases</entry>
11064      </row>
11065
11066      <row>
11067       <entry><structfield>usesuper</structfield></entry>
11068       <entry><type>bool</type></entry>
11069       <entry>User is a superuser</entry>
11070      </row>
11071
11072      <row>
11073       <entry><structfield>userepl</structfield></entry>
11074       <entry><type>bool</type></entry>
11075       <entry>
11076        User can initiate streaming replication and put the system in and
11077        out of backup mode.
11078       </entry>
11079      </row>
11080
11081      <row>
11082       <entry><structfield>usebypassrls</structfield></entry>
11083       <entry><type>bool</type></entry>
11084       <entry>
11085        User bypasses every row level security policy, see
11086        <xref linkend="ddl-rowsecurity"/> for more information.
11087       </entry>
11088      </row>
11089
11090      <row>
11091       <entry><structfield>passwd</structfield></entry>
11092       <entry><type>text</type></entry>
11093       <entry>Not the password (always reads as <literal>********</literal>)</entry>
11094      </row>
11095
11096      <row>
11097       <entry><structfield>valuntil</structfield></entry>
11098       <entry><type>abstime</type></entry>
11099       <entry>Password expiry time (only used for password authentication)</entry>
11100      </row>
11101
11102      <row>
11103       <entry><structfield>useconfig</structfield></entry>
11104       <entry><type>text[]</type></entry>
11105       <entry>Session defaults for run-time configuration variables</entry>
11106      </row>
11107     </tbody>
11108    </tgroup>
11109   </table>
11110
11111  </sect1>
11112
11113  <sect1 id="view-pg-user-mappings">
11114   <title><structname>pg_user_mappings</structname></title>
11115
11116   <indexterm zone="view-pg-user-mappings">
11117    <primary>pg_user_mappings</primary>
11118   </indexterm>
11119
11120   <para>
11121    The view <structname>pg_user_mappings</structname> provides access
11122    to information about user mappings.  This is essentially a publicly
11123    readable view of
11124    <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
11125    that leaves out the options field if the user has no rights to use
11126    it.
11127   </para>
11128
11129   <table>
11130    <title><structname>pg_user_mappings</structname> Columns</title>
11131
11132    <tgroup cols="4">
11133     <thead>
11134      <row>
11135       <entry>Name</entry>
11136       <entry>Type</entry>
11137       <entry>References</entry>
11138       <entry>Description</entry>
11139      </row>
11140     </thead>
11141
11142     <tbody>
11143      <row>
11144       <entry><structfield>umid</structfield></entry>
11145       <entry><type>oid</type></entry>
11146       <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
11147       <entry>OID of the user mapping</entry>
11148      </row>
11149
11150      <row>
11151       <entry><structfield>srvid</structfield></entry>
11152       <entry><type>oid</type></entry>
11153       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
11154       <entry>
11155        The OID of the foreign server that contains this mapping
11156       </entry>
11157      </row>
11158
11159      <row>
11160       <entry><structfield>srvname</structfield></entry>
11161       <entry><type>name</type></entry>
11162       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
11163       <entry>
11164        Name of the foreign server
11165       </entry>
11166      </row>
11167
11168      <row>
11169       <entry><structfield>umuser</structfield></entry>
11170       <entry><type>oid</type></entry>
11171       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
11172       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
11173      </row>
11174
11175      <row>
11176       <entry><structfield>usename</structfield></entry>
11177       <entry><type>name</type></entry>
11178       <entry></entry>
11179       <entry>Name of the local user to be mapped</entry>
11180      </row>
11181
11182      <row>
11183       <entry><structfield>umoptions</structfield></entry>
11184       <entry><type>text[]</type></entry>
11185       <entry></entry>
11186       <entry>
11187        User mapping specific options, as <quote>keyword=value</quote> strings
11188       </entry>
11189      </row>
11190     </tbody>
11191    </tgroup>
11192   </table>
11193
11194   <para>
11195    To protect password information stored as a user mapping option,
11196    the <structfield>umoptions</structfield> column will read as null
11197    unless one of the following applies:
11198    <itemizedlist>
11199     <listitem>
11200      <para>
11201       current user is the user being mapped, and owns the server or
11202       holds <literal>USAGE</literal> privilege on it
11203      </para>
11204     </listitem>
11205     <listitem>
11206      <para>
11207       current user is the server owner and mapping is for <literal>PUBLIC</literal>
11208      </para>
11209     </listitem>
11210     <listitem>
11211      <para>
11212       current user is a superuser
11213      </para>
11214     </listitem>
11215    </itemizedlist>
11216   </para>
11217
11218  </sect1>
11219
11220
11221  <sect1 id="view-pg-views">
11222   <title><structname>pg_views</structname></title>
11223
11224   <indexterm zone="view-pg-views">
11225    <primary>pg_views</primary>
11226   </indexterm>
11227
11228   <para>
11229    The view <structname>pg_views</structname> provides access to
11230    useful information about each view in the database.
11231   </para>
11232
11233   <table>
11234    <title><structname>pg_views</structname> Columns</title>
11235
11236    <tgroup cols="4">
11237     <thead>
11238      <row>
11239       <entry>Name</entry>
11240       <entry>Type</entry>
11241       <entry>References</entry>
11242       <entry>Description</entry>
11243      </row>
11244     </thead>
11245     <tbody>
11246      <row>
11247       <entry><structfield>schemaname</structfield></entry>
11248       <entry><type>name</type></entry>
11249       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
11250       <entry>Name of schema containing view</entry>
11251      </row>
11252      <row>
11253       <entry><structfield>viewname</structfield></entry>
11254       <entry><type>name</type></entry>
11255       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
11256       <entry>Name of view</entry>
11257      </row>
11258      <row>
11259       <entry><structfield>viewowner</structfield></entry>
11260       <entry><type>name</type></entry>
11261       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
11262       <entry>Name of view's owner</entry>
11263      </row>
11264      <row>
11265       <entry><structfield>definition</structfield></entry>
11266       <entry><type>text</type></entry>
11267       <entry></entry>
11268       <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
11269      </row>
11270     </tbody>
11271    </tgroup>
11272   </table>
11273
11274  </sect1>
11275
11276 </chapter>