]> granicus.if.org Git - postgresql/blob - doc/src/sgml/catalogs.sgml
Rename columns in new pg_statistic_ext catalog
[postgresql] / doc / src / sgml / catalogs.sgml
1 <!-- doc/src/sgml/catalogs.sgml -->
2 <!--
3  Documentation of the system catalogs, directed toward PostgreSQL developers
4  -->
5
6 <chapter id="catalogs">
7  <title>System Catalogs</title>
8
9   <para>
10    The system catalogs are the place where a relational database
11    management system stores schema metadata, such as information about
12    tables and columns, and internal bookkeeping information.
13    <productname>PostgreSQL</productname>'s system catalogs are regular
14    tables.  You can drop and recreate the tables, add columns, insert
15    and update values, and severely mess up your system that way.
16    Normally, one should not change the system catalogs by hand, there
17    are normally SQL commands to do that.  (For example, <command>CREATE
18    DATABASE</command> inserts a row into the
19    <structname>pg_database</structname> catalog &mdash; and actually
20    creates the database on disk.)  There are some exceptions for
21    particularly esoteric operations, but many of those have been made
22    available as SQL commands over time, and so the need for direct manipulation
23    of the system catalogs is ever decreasing.
24   </para>
25
26  <sect1 id="catalogs-overview">
27   <title>Overview</title>
28
29   <para>
30    <xref linkend="catalog-table"> lists the system catalogs.
31    More detailed documentation of each catalog follows below.
32   </para>
33
34   <para>
35    Most system catalogs are copied from the template database during
36    database creation and are thereafter database-specific. A few
37    catalogs are physically shared across all databases in a cluster;
38    these are noted in the descriptions of the individual catalogs.
39   </para>
40
41   <table id="catalog-table">
42    <title>System Catalogs</title>
43
44    <tgroup cols="2">
45     <thead>
46      <row>
47       <entry>Catalog Name</entry>
48       <entry>Purpose</entry>
49      </row>
50     </thead>
51
52     <tbody>
53      <row>
54       <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
55       <entry>aggregate functions</entry>
56      </row>
57
58      <row>
59       <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
60       <entry>index access methods</entry>
61      </row>
62
63      <row>
64       <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
65       <entry>access method operators</entry>
66      </row>
67
68      <row>
69       <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
70       <entry>access method support procedures</entry>
71      </row>
72
73      <row>
74       <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
75       <entry>column default values</entry>
76      </row>
77
78      <row>
79       <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
80       <entry>table columns (<quote>attributes</quote>)</entry>
81      </row>
82
83      <row>
84       <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
85       <entry>authorization identifiers (roles)</entry>
86      </row>
87
88      <row>
89       <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
90       <entry>authorization identifier membership relationships</entry>
91      </row>
92
93      <row>
94       <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
95       <entry>casts (data type conversions)</entry>
96      </row>
97
98      <row>
99       <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
100       <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
101      </row>
102
103      <row>
104       <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
105       <entry>collations (locale information)</entry>
106      </row>
107
108      <row>
109       <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
110       <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
111      </row>
112
113      <row>
114       <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
115       <entry>encoding conversion information</entry>
116      </row>
117
118      <row>
119       <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
120       <entry>databases within this database cluster</entry>
121      </row>
122
123      <row>
124       <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
125       <entry>per-role and per-database settings</entry>
126      </row>
127
128      <row>
129       <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
130       <entry>default privileges for object types</entry>
131      </row>
132
133      <row>
134       <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
135       <entry>dependencies between database objects</entry>
136      </row>
137
138      <row>
139       <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
140       <entry>descriptions or comments on database objects</entry>
141      </row>
142
143      <row>
144       <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
145       <entry>enum label and value definitions</entry>
146      </row>
147
148      <row>
149       <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
150       <entry>event triggers</entry>
151      </row>
152
153      <row>
154       <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
155       <entry>installed extensions</entry>
156      </row>
157
158      <row>
159       <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
160       <entry>foreign-data wrapper definitions</entry>
161      </row>
162
163      <row>
164       <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
165       <entry>foreign server definitions</entry>
166      </row>
167
168      <row>
169       <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
170       <entry>additional foreign table information</entry>
171      </row>
172
173      <row>
174       <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
175       <entry>additional index information</entry>
176      </row>
177
178      <row>
179       <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
180       <entry>table inheritance hierarchy</entry>
181      </row>
182
183      <row>
184       <entry><link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link></entry>
185       <entry>object initial privileges</entry>
186      </row>
187
188      <row>
189       <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
190       <entry>languages for writing functions</entry>
191      </row>
192
193      <row>
194       <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
195       <entry>data pages for large objects</entry>
196      </row>
197
198      <row>
199       <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
200       <entry>metadata for large objects</entry>
201      </row>
202
203      <row>
204       <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
205       <entry>schemas</entry>
206      </row>
207
208      <row>
209       <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
210       <entry>access method operator classes</entry>
211      </row>
212
213      <row>
214       <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
215       <entry>operators</entry>
216      </row>
217
218      <row>
219       <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
220       <entry>access method operator families</entry>
221      </row>
222
223      <row>
224       <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
225       <entry>template data for procedural languages</entry>
226      </row>
227
228      <row>
229       <entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
230       <entry>information about partition key of tables</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</> 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</> aggregates,
414        <literal>o</literal> for <quote>ordered-set</> aggregates, or
415        <literal>h</literal> for <quote>hypothetical-set</> 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</>, 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>aggsortop</structfield></entry>
491       <entry><type>oid</type></entry>
492       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
493       <entry>Associated sort operator (zero if none)</entry>
494      </row>
495      <row>
496       <entry><structfield>aggtranstype</structfield></entry>
497       <entry><type>oid</type></entry>
498       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
499       <entry>Data type of the aggregate function's internal transition (state) data</entry>
500      </row>
501      <row>
502       <entry><structfield>aggtransspace</structfield></entry>
503       <entry><type>int4</type></entry>
504       <entry></entry>
505       <entry>Approximate average size (in bytes) of the transition state
506        data, or zero to use a default estimate</entry>
507      </row>
508      <row>
509       <entry><structfield>aggmtranstype</structfield></entry>
510       <entry><type>oid</type></entry>
511       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
512       <entry>Data type of the aggregate function's internal transition (state)
513        data for moving-aggregate mode (zero if none)</entry>
514      </row>
515      <row>
516       <entry><structfield>aggmtransspace</structfield></entry>
517       <entry><type>int4</type></entry>
518       <entry></entry>
519       <entry>Approximate average size (in bytes) of the transition state data
520        for moving-aggregate mode, or zero to use a default estimate</entry>
521      </row>
522      <row>
523       <entry><structfield>agginitval</structfield></entry>
524       <entry><type>text</type></entry>
525       <entry></entry>
526       <entry>
527        The initial value of the transition state.  This is a text
528        field containing the initial value in its external string
529        representation.  If this field is null, the transition state
530        value starts out null.
531       </entry>
532      </row>
533      <row>
534       <entry><structfield>aggminitval</structfield></entry>
535       <entry><type>text</type></entry>
536       <entry></entry>
537       <entry>
538        The initial value of the transition state for moving-aggregate mode.
539        This is a text field containing the initial value in its external
540        string representation.  If this field is null, the transition state
541        value starts out null.
542       </entry>
543      </row>
544     </tbody>
545    </tgroup>
546   </table>
547
548   <para>
549    New aggregate functions are registered with the <xref
550    linkend="sql-createaggregate">
551    command.  See <xref linkend="xaggr"> for more information about
552    writing aggregate functions and the meaning of the transition
553    functions, etc.
554   </para>
555
556  </sect1>
557
558
559  <sect1 id="catalog-pg-am">
560   <title><structname>pg_am</structname></title>
561
562   <indexterm zone="catalog-pg-am">
563    <primary>pg_am</primary>
564   </indexterm>
565
566   <para>
567    The catalog <structname>pg_am</structname> stores information about
568    relation access methods.  There is one row for each access method supported
569    by the system.
570    Currently, only indexes have access methods.  The requirements for index
571    access methods are discussed in detail in <xref linkend="indexam">.
572   </para>
573
574   <table>
575    <title><structname>pg_am</> Columns</title>
576
577    <tgroup cols="4">
578     <thead>
579      <row>
580       <entry>Name</entry>
581       <entry>Type</entry>
582       <entry>References</entry>
583       <entry>Description</entry>
584      </row>
585     </thead>
586     <tbody>
587
588      <row>
589       <entry><structfield>oid</structfield></entry>
590       <entry><type>oid</type></entry>
591       <entry></entry>
592       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
593      </row>
594
595      <row>
596       <entry><structfield>amname</structfield></entry>
597       <entry><type>name</type></entry>
598       <entry></entry>
599       <entry>Name of the access method</entry>
600      </row>
601
602      <row>
603       <entry><structfield>amhandler</structfield></entry>
604       <entry><type>regproc</type></entry>
605       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
606       <entry>
607        OID of a handler function that is responsible for supplying information
608        about the access method
609       </entry>
610      </row>
611
612      <row>
613       <entry><structfield>amtype</structfield></entry>
614       <entry><type>char</type></entry>
615       <entry></entry>
616       <entry>
617        Currently always <literal>i</literal> to indicate an index access
618        method; other values may be allowed in future
619       </entry>
620      </row>
621     </tbody>
622    </tgroup>
623   </table>
624
625   <note>
626    <para>
627     Before <productname>PostgreSQL</> 9.6, <structname>pg_am</structname>
628     contained many additional columns representing properties of index access
629     methods.  That data is now only directly visible at the C code level.
630     However, <function>pg_index_column_has_property()</function> and related
631     functions have been added to allow SQL queries to inspect index access
632     method properties; see <xref linkend="functions-info-catalog-table">.
633    </para>
634   </note>
635
636  </sect1>
637
638
639  <sect1 id="catalog-pg-amop">
640   <title><structname>pg_amop</structname></title>
641
642   <indexterm zone="catalog-pg-amop">
643    <primary>pg_amop</primary>
644   </indexterm>
645
646   <para>
647    The catalog <structname>pg_amop</structname> stores information about
648    operators associated with access method operator families.  There is one
649    row for each operator that is a member of an operator family.  A family
650    member can be either a <firstterm>search</> operator or an
651    <firstterm>ordering</> operator.  An operator
652    can appear in more than one family, but cannot appear in more than one
653    search position nor more than one ordering position within a family.
654    (It is allowed, though unlikely, for an operator to be used for both
655    search and ordering purposes.)
656   </para>
657
658   <table>
659    <title><structname>pg_amop</> Columns</title>
660
661    <tgroup cols="4">
662     <thead>
663      <row>
664       <entry>Name</entry>
665       <entry>Type</entry>
666       <entry>References</entry>
667       <entry>Description</entry>
668      </row>
669     </thead>
670     <tbody>
671
672      <row>
673       <entry><structfield>oid</structfield></entry>
674       <entry><type>oid</type></entry>
675       <entry></entry>
676       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
677      </row>
678
679      <row>
680       <entry><structfield>amopfamily</structfield></entry>
681       <entry><type>oid</type></entry>
682       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
683       <entry>The operator family this entry is for</entry>
684      </row>
685
686      <row>
687       <entry><structfield>amoplefttype</structfield></entry>
688       <entry><type>oid</type></entry>
689       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
690       <entry>Left-hand input data type of operator</entry>
691      </row>
692
693      <row>
694       <entry><structfield>amoprighttype</structfield></entry>
695       <entry><type>oid</type></entry>
696       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
697       <entry>Right-hand input data type of operator</entry>
698      </row>
699
700      <row>
701       <entry><structfield>amopstrategy</structfield></entry>
702       <entry><type>int2</type></entry>
703       <entry></entry>
704       <entry>Operator strategy number</entry>
705      </row>
706
707      <row>
708       <entry><structfield>amoppurpose</structfield></entry>
709       <entry><type>char</type></entry>
710       <entry></entry>
711       <entry>Operator purpose, either <literal>s</> for search or
712        <literal>o</> for ordering</entry>
713      </row>
714
715      <row>
716       <entry><structfield>amopopr</structfield></entry>
717       <entry><type>oid</type></entry>
718       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
719       <entry>OID of the operator</entry>
720      </row>
721
722      <row>
723       <entry><structfield>amopmethod</structfield></entry>
724       <entry><type>oid</type></entry>
725       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
726       <entry>Index access method operator family is for</entry>
727      </row>
728
729      <row>
730       <entry><structfield>amopsortfamily</structfield></entry>
731       <entry><type>oid</type></entry>
732       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
733       <entry>The B-tree operator family this entry sorts according to, if an
734        ordering operator; zero if a search operator</entry>
735      </row>
736
737     </tbody>
738    </tgroup>
739   </table>
740
741   <para>
742    A <quote>search</> operator entry indicates that an index of this operator
743    family can be searched to find all rows satisfying
744    <literal>WHERE</>
745    <replaceable>indexed_column</>
746    <replaceable>operator</>
747    <replaceable>constant</>.
748    Obviously, such an operator must return <type>boolean</type>, and its left-hand input
749    type must match the index's column data type.
750   </para>
751
752   <para>
753    An <quote>ordering</> operator entry indicates that an index of this
754    operator family can be scanned to return rows in the order represented by
755    <literal>ORDER BY</>
756    <replaceable>indexed_column</>
757    <replaceable>operator</>
758    <replaceable>constant</>.
759    Such an operator could return any sortable data type, though again
760    its left-hand input type must match the index's column data type.
761    The exact semantics of the <literal>ORDER BY</> are specified by the
762    <structfield>amopsortfamily</structfield> column, which must reference
763    a B-tree operator family for the operator's result type.
764   </para>
765
766   <note>
767    <para>
768     At present, it's assumed that the sort order for an ordering operator
769     is the default for the referenced operator family, i.e., <literal>ASC NULLS
770     LAST</>.  This might someday be relaxed by adding additional columns
771     to specify sort options explicitly.
772    </para>
773   </note>
774
775   <para>
776    An entry's <structfield>amopmethod</> must match the
777    <structname>opfmethod</> of its containing operator family (including
778    <structfield>amopmethod</> here is an intentional denormalization of the
779    catalog structure for performance reasons).  Also,
780    <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
781    the <structfield>oprleft</> and <structfield>oprright</> fields of the
782    referenced <structname>pg_operator</> entry.
783   </para>
784
785  </sect1>
786
787
788  <sect1 id="catalog-pg-amproc">
789   <title><structname>pg_amproc</structname></title>
790
791   <indexterm zone="catalog-pg-amproc">
792    <primary>pg_amproc</primary>
793   </indexterm>
794
795   <para>
796    The catalog <structname>pg_amproc</structname> stores information about
797    support procedures associated with access method operator families.  There
798    is one row for each support procedure belonging to an operator family.
799   </para>
800
801   <table>
802    <title><structname>pg_amproc</structname> Columns</title>
803
804    <tgroup cols="4">
805     <thead>
806      <row>
807       <entry>Name</entry>
808       <entry>Type</entry>
809       <entry>References</entry>
810       <entry>Description</entry>
811      </row>
812     </thead>
813     <tbody>
814
815      <row>
816       <entry><structfield>oid</structfield></entry>
817       <entry><type>oid</type></entry>
818       <entry></entry>
819       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
820      </row>
821
822      <row>
823       <entry><structfield>amprocfamily</structfield></entry>
824       <entry><type>oid</type></entry>
825       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
826       <entry>The operator family this entry is for</entry>
827      </row>
828
829      <row>
830       <entry><structfield>amproclefttype</structfield></entry>
831       <entry><type>oid</type></entry>
832       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
833       <entry>Left-hand input data type of associated operator</entry>
834      </row>
835
836      <row>
837       <entry><structfield>amprocrighttype</structfield></entry>
838       <entry><type>oid</type></entry>
839       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
840       <entry>Right-hand input data type of associated operator</entry>
841      </row>
842
843      <row>
844       <entry><structfield>amprocnum</structfield></entry>
845       <entry><type>int2</type></entry>
846       <entry></entry>
847       <entry>Support procedure number</entry>
848      </row>
849
850      <row>
851       <entry><structfield>amproc</structfield></entry>
852       <entry><type>regproc</type></entry>
853       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
854       <entry>OID of the procedure</entry>
855      </row>
856
857     </tbody>
858    </tgroup>
859   </table>
860
861   <para>
862    The usual interpretation of the
863    <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
864    is that they identify the left and right input types of the operator(s)
865    that a particular support procedure supports.  For some access methods
866    these match the input data type(s) of the support procedure itself, for
867    others not.  There is a notion of <quote>default</> support procedures for
868    an index, which are those with <structfield>amproclefttype</> and
869    <structfield>amprocrighttype</> both equal to the index operator class's
870    <structfield>opcintype</>.
871   </para>
872
873  </sect1>
874
875
876  <sect1 id="catalog-pg-attrdef">
877   <title><structname>pg_attrdef</structname></title>
878
879   <indexterm zone="catalog-pg-attrdef">
880    <primary>pg_attrdef</primary>
881   </indexterm>
882
883   <para>
884    The catalog <structname>pg_attrdef</structname> stores column default values.  The main information
885    about columns is stored in <structname>pg_attribute</structname>
886    (see below).  Only columns that explicitly specify a default value
887    (when the table is created or the column is added) will have an
888    entry here.
889   </para>
890
891   <table>
892    <title><structname>pg_attrdef</> Columns</title>
893
894    <tgroup cols="4">
895     <thead>
896      <row>
897       <entry>Name</entry>
898       <entry>Type</entry>
899       <entry>References</entry>
900       <entry>Description</entry>
901      </row>
902     </thead>
903
904     <tbody>
905      <row>
906       <entry><structfield>oid</structfield></entry>
907       <entry><type>oid</type></entry>
908       <entry></entry>
909       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
910      </row>
911
912      <row>
913       <entry><structfield>adrelid</structfield></entry>
914       <entry><type>oid</type></entry>
915       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
916       <entry>The table this column belongs to</entry>
917      </row>
918
919      <row>
920       <entry><structfield>adnum</structfield></entry>
921       <entry><type>int2</type></entry>
922       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
923       <entry>The number of the column</entry>
924      </row>
925
926      <row>
927       <entry><structfield>adbin</structfield></entry>
928       <entry><type>pg_node_tree</type></entry>
929       <entry></entry>
930       <entry>The internal representation of the column default value</entry>
931      </row>
932
933      <row>
934       <entry><structfield>adsrc</structfield></entry>
935       <entry><type>text</type></entry>
936       <entry></entry>
937       <entry>A human-readable representation of the default value</entry>
938      </row>
939     </tbody>
940    </tgroup>
941   </table>
942
943    <para>
944     The <structfield>adsrc</structfield> field is historical, and is best
945     not used, because it does not track outside changes that might affect
946     the representation of the default value.  Reverse-compiling the
947     <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
948     example) is a better way to display the default value.
949    </para>
950
951  </sect1>
952
953
954  <sect1 id="catalog-pg-attribute">
955   <title><structname>pg_attribute</structname></title>
956
957   <indexterm zone="catalog-pg-attribute">
958    <primary>pg_attribute</primary>
959   </indexterm>
960
961   <para>
962    The catalog <structname>pg_attribute</structname> stores information about
963    table columns.  There will be exactly one
964    <structname>pg_attribute</structname> row for every column in every
965    table in the database.  (There will also be attribute entries for
966    indexes, and indeed all objects that have <structname>pg_class</structname>
967    entries.)
968   </para>
969
970   <para>
971    The term attribute is equivalent to column and is used for
972    historical reasons.
973   </para>
974
975   <table>
976    <title><structname>pg_attribute</> Columns</title>
977
978    <tgroup cols="4">
979     <thead>
980      <row>
981       <entry>Name</entry>
982       <entry>Type</entry>
983       <entry>References</entry>
984       <entry>Description</entry>
985      </row>
986     </thead>
987
988     <tbody>
989      <row>
990       <entry><structfield>attrelid</structfield></entry>
991       <entry><type>oid</type></entry>
992       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
993       <entry>The table this column belongs to</entry>
994      </row>
995
996      <row>
997       <entry><structfield>attname</structfield></entry>
998       <entry><type>name</type></entry>
999       <entry></entry>
1000       <entry>The column name</entry>
1001      </row>
1002
1003      <row>
1004       <entry><structfield>atttypid</structfield></entry>
1005       <entry><type>oid</type></entry>
1006       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1007       <entry>The data type of this column</entry>
1008      </row>
1009
1010      <row>
1011       <entry><structfield>attstattarget</structfield></entry>
1012       <entry><type>int4</type></entry>
1013       <entry></entry>
1014       <entry>
1015        <structfield>attstattarget</structfield> controls the level of detail
1016        of statistics accumulated for this column by
1017        <xref linkend="sql-analyze">.
1018        A zero value indicates that no statistics should be collected.
1019        A negative value says to use the system default statistics target.
1020        The exact meaning of positive values is data type-dependent.
1021        For scalar data types, <structfield>attstattarget</structfield>
1022        is both the target number of <quote>most common values</quote>
1023        to collect, and the target number of histogram bins to create.
1024       </entry>
1025      </row>
1026
1027      <row>
1028       <entry><structfield>attlen</structfield></entry>
1029       <entry><type>int2</type></entry>
1030       <entry></entry>
1031       <entry>
1032        A copy of <literal>pg_type.typlen</literal> of this column's
1033        type
1034       </entry>
1035      </row>
1036
1037      <row>
1038       <entry><structfield>attnum</structfield></entry>
1039       <entry><type>int2</type></entry>
1040       <entry></entry>
1041       <entry>
1042        The number of the column.  Ordinary columns are numbered from 1
1043        up.  System columns, such as <structfield>oid</structfield>,
1044        have (arbitrary) negative numbers.
1045       </entry>
1046      </row>
1047
1048      <row>
1049       <entry><structfield>attndims</structfield></entry>
1050       <entry><type>int4</type></entry>
1051       <entry></entry>
1052       <entry>
1053        Number of dimensions, if the column is an array type; otherwise 0.
1054        (Presently, the number of dimensions of an array is not enforced,
1055        so any nonzero value effectively means <quote>it's an array</>.)
1056       </entry>
1057      </row>
1058
1059      <row>
1060       <entry><structfield>attcacheoff</structfield></entry>
1061       <entry><type>int4</type></entry>
1062       <entry></entry>
1063       <entry>
1064        Always -1 in storage, but when loaded into a row descriptor
1065        in memory this might be updated to cache the offset of the attribute
1066        within the row
1067       </entry>
1068      </row>
1069
1070      <row>
1071       <entry><structfield>atttypmod</structfield></entry>
1072       <entry><type>int4</type></entry>
1073       <entry></entry>
1074       <entry>
1075        <structfield>atttypmod</structfield> records type-specific data
1076        supplied at table creation time (for example, the maximum
1077        length of a <type>varchar</type> column).  It is passed to
1078        type-specific input functions and length coercion functions.
1079        The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1080       </entry>
1081      </row>
1082
1083      <row>
1084       <entry><structfield>attbyval</structfield></entry>
1085       <entry><type>bool</type></entry>
1086       <entry></entry>
1087       <entry>
1088        A copy of <literal>pg_type.typbyval</> of this column's type
1089       </entry>
1090      </row>
1091
1092      <row>
1093       <entry><structfield>attstorage</structfield></entry>
1094       <entry><type>char</type></entry>
1095       <entry></entry>
1096       <entry>
1097        Normally a copy of <literal>pg_type.typstorage</> of this
1098        column's type.  For TOAST-able data types, this can be altered
1099        after column creation to control storage policy.
1100       </entry>
1101      </row>
1102
1103      <row>
1104       <entry><structfield>attalign</structfield></entry>
1105       <entry><type>char</type></entry>
1106       <entry></entry>
1107       <entry>
1108        A copy of <literal>pg_type.typalign</> of this column's type
1109       </entry>
1110      </row>
1111
1112      <row>
1113       <entry><structfield>attnotnull</structfield></entry>
1114       <entry><type>bool</type></entry>
1115       <entry></entry>
1116       <entry>
1117        This represents a not-null constraint.
1118       </entry>
1119      </row>
1120
1121      <row>
1122       <entry><structfield>atthasdef</structfield></entry>
1123       <entry><type>bool</type></entry>
1124       <entry></entry>
1125       <entry>
1126        This column has a default value, in which case there will be a
1127        corresponding entry in the <structname>pg_attrdef</structname>
1128        catalog that actually defines the value.
1129       </entry>
1130      </row>
1131
1132      <row>
1133       <entry><structfield>attidentity</structfield></entry>
1134       <entry><type>char</type></entry>
1135       <entry></entry>
1136       <entry>
1137        If a zero byte (<literal>''</literal>), then not an identity column.
1138        Otherwise, <literal>a</literal> = generated
1139        always, <literal>d</literal> = generated by default.
1140       </entry>
1141      </row>
1142
1143      <row>
1144       <entry><structfield>attisdropped</structfield></entry>
1145       <entry><type>bool</type></entry>
1146       <entry></entry>
1147       <entry>
1148        This column has been dropped and is no longer valid.  A dropped
1149        column is still physically present in the table, but is
1150        ignored by the parser and so cannot be accessed via SQL.
1151       </entry>
1152      </row>
1153
1154      <row>
1155       <entry><structfield>attislocal</structfield></entry>
1156       <entry><type>bool</type></entry>
1157       <entry></entry>
1158       <entry>
1159        This column is defined locally in the relation.  Note that a column can
1160        be locally defined and inherited simultaneously.
1161       </entry>
1162      </row>
1163
1164      <row>
1165       <entry><structfield>attinhcount</structfield></entry>
1166       <entry><type>int4</type></entry>
1167       <entry></entry>
1168       <entry>
1169        The number of direct ancestors this column has.  A column with a
1170        nonzero number of ancestors cannot be dropped nor renamed.
1171       </entry>
1172      </row>
1173
1174      <row>
1175       <entry><structfield>attcollation</structfield></entry>
1176       <entry><type>oid</type></entry>
1177       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1178       <entry>
1179        The defined collation of the column, or zero if the column is
1180        not of a collatable data type.
1181       </entry>
1182      </row>
1183
1184      <row>
1185       <entry><structfield>attacl</structfield></entry>
1186       <entry><type>aclitem[]</type></entry>
1187       <entry></entry>
1188       <entry>
1189        Column-level access privileges, if any have been granted specifically
1190        on this column
1191       </entry>
1192      </row>
1193
1194      <row>
1195       <entry><structfield>attoptions</structfield></entry>
1196       <entry><type>text[]</type></entry>
1197       <entry></entry>
1198       <entry>
1199        Attribute-level options, as <quote>keyword=value</> strings
1200       </entry>
1201      </row>
1202
1203      <row>
1204       <entry><structfield>attfdwoptions</structfield></entry>
1205       <entry><type>text[]</type></entry>
1206       <entry></entry>
1207       <entry>
1208        Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1209       </entry>
1210      </row>
1211
1212     </tbody>
1213    </tgroup>
1214   </table>
1215
1216   <para>
1217    In a dropped column's <structname>pg_attribute</structname> entry,
1218    <structfield>atttypid</structfield> is reset to zero, but
1219    <structfield>attlen</structfield> and the other fields copied from
1220    <structname>pg_type</> are still valid.  This arrangement is needed
1221    to cope with the situation where the dropped column's data type was
1222    later dropped, and so there is no <structname>pg_type</> row anymore.
1223    <structfield>attlen</structfield> and the other fields can be used
1224    to interpret the contents of a row of the table.
1225   </para>
1226  </sect1>
1227
1228
1229  <sect1 id="catalog-pg-authid">
1230   <title><structname>pg_authid</structname></title>
1231
1232   <indexterm zone="catalog-pg-authid">
1233    <primary>pg_authid</primary>
1234   </indexterm>
1235
1236   <para>
1237    The catalog <structname>pg_authid</structname> contains information about
1238    database authorization identifiers (roles).  A role subsumes the concepts
1239    of <quote>users</> and <quote>groups</>.  A user is essentially just a
1240    role with the <structfield>rolcanlogin</> flag set.  Any role (with or
1241    without <structfield>rolcanlogin</>) can have other roles as members; see
1242    <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1243   </para>
1244
1245   <para>
1246    Since this catalog contains passwords, it must not be publicly readable.
1247    <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1248    is a publicly readable view on
1249    <structname>pg_authid</structname> that blanks out the password field.
1250   </para>
1251
1252   <para>
1253    <xref linkend="user-manag"> contains detailed information about user and
1254    privilege management.
1255   </para>
1256
1257   <para>
1258    Because user identities are cluster-wide,
1259    <structname>pg_authid</structname>
1260    is shared across all databases of a cluster: there is only one
1261    copy of <structname>pg_authid</structname> per cluster, not
1262    one per database.
1263   </para>
1264
1265   <table>
1266    <title><structname>pg_authid</> Columns</title>
1267
1268    <tgroup cols="3">
1269     <thead>
1270      <row>
1271       <entry>Name</entry>
1272       <entry>Type</entry>
1273       <entry>Description</entry>
1274      </row>
1275     </thead>
1276
1277     <tbody>
1278
1279      <row>
1280       <entry><structfield>oid</structfield></entry>
1281       <entry><type>oid</type></entry>
1282       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1283      </row>
1284
1285      <row>
1286       <entry><structfield>rolname</structfield></entry>
1287       <entry><type>name</type></entry>
1288       <entry>Role name</entry>
1289      </row>
1290
1291      <row>
1292       <entry><structfield>rolsuper</structfield></entry>
1293       <entry><type>bool</type></entry>
1294       <entry>Role has superuser privileges</entry>
1295      </row>
1296
1297      <row>
1298       <entry><structfield>rolinherit</structfield></entry>
1299       <entry><type>bool</type></entry>
1300       <entry>Role automatically inherits privileges of roles it is a
1301        member of</entry>
1302      </row>
1303
1304      <row>
1305       <entry><structfield>rolcreaterole</structfield></entry>
1306       <entry><type>bool</type></entry>
1307       <entry>Role can create more roles</entry>
1308      </row>
1309
1310      <row>
1311       <entry><structfield>rolcreatedb</structfield></entry>
1312       <entry><type>bool</type></entry>
1313       <entry>Role can create databases</entry>
1314      </row>
1315
1316      <row>
1317       <entry><structfield>rolcanlogin</structfield></entry>
1318       <entry><type>bool</type></entry>
1319       <entry>
1320        Role can log in. That is, this role can be given as the initial
1321        session authorization identifier
1322       </entry>
1323      </row>
1324
1325      <row>
1326       <entry><structfield>rolreplication</structfield></entry>
1327       <entry><type>bool</type></entry>
1328       <entry>
1329        Role is a replication role. That is, this role can initiate streaming
1330        replication (see <xref linkend="streaming-replication">) and set/unset
1331        the system backup mode using <function>pg_start_backup</> and
1332        <function>pg_stop_backup</>
1333       </entry>
1334      </row>
1335
1336      <row>
1337       <entry><structfield>rolbypassrls</structfield></entry>
1338       <entry><type>bool</type></entry>
1339       <entry>
1340        Role bypasses every row level security policy, see
1341        <xref linkend="ddl-rowsecurity"> for more information.
1342       </entry>
1343      </row>
1344
1345      <row>
1346       <entry><structfield>rolconnlimit</structfield></entry>
1347       <entry><type>int4</type></entry>
1348       <entry>
1349        For roles that can log in, this sets maximum number of concurrent
1350        connections this role can make.  -1 means no limit.
1351       </entry>
1352      </row>
1353
1354      <row>
1355       <entry><structfield>rolpassword</structfield></entry>
1356       <entry><type>text</type></entry>
1357       <entry>
1358        Password (possibly encrypted); null if none. The format depends
1359        on the form of encryption used.
1360       </entry>
1361      </row>
1362
1363      <row>
1364       <entry><structfield>rolvaliduntil</structfield></entry>
1365       <entry><type>timestamptz</type></entry>
1366       <entry>Password expiry time (only used for password authentication);
1367        null if no expiration</entry>
1368      </row>
1369     </tbody>
1370    </tgroup>
1371   </table>
1372
1373   <para>
1374    For an MD5 encrypted password, <structfield>rolpassword</structfield>
1375    column will begin with the string <literal>md5</> followed by a
1376    32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
1377    password concatenated to their user name. For example, if user
1378    <literal>joe</> has password <literal>xyzzy</>, <productname>PostgreSQL</>
1379    will store the md5 hash of <literal>xyzzyjoe</>.  If the password is
1380    encrypted with SCRAM-SHA-256, it consists of 5 fields separated by colons.
1381    The first field is the constant <literal>scram-sha-256</literal>, to
1382    identify the password as a SCRAM-SHA-256 verifier. The second field is a
1383    salt, Base64-encoded, and the third field is the number of iterations used
1384    to generate the password.  The fourth field and fifth field are the stored
1385    key and server key, respectively, in hexadecimal format. A password that
1386    does not follow either of those formats is assumed to be unencrypted.
1387   </para>
1388  </sect1>
1389
1390
1391  <sect1 id="catalog-pg-auth-members">
1392   <title><structname>pg_auth_members</structname></title>
1393
1394   <indexterm zone="catalog-pg-auth-members">
1395    <primary>pg_auth_members</primary>
1396   </indexterm>
1397
1398   <para>
1399    The catalog <structname>pg_auth_members</structname> shows the membership
1400    relations between roles.  Any non-circular set of relationships is allowed.
1401   </para>
1402
1403   <para>
1404    Because user identities are cluster-wide,
1405    <structname>pg_auth_members</structname>
1406    is shared across all databases of a cluster: there is only one
1407    copy of <structname>pg_auth_members</structname> per cluster, not
1408    one per database.
1409   </para>
1410
1411   <table>
1412    <title><structname>pg_auth_members</> Columns</title>
1413
1414    <tgroup cols="4">
1415     <thead>
1416      <row>
1417       <entry>Name</entry>
1418       <entry>Type</entry>
1419       <entry>References</entry>
1420       <entry>Description</entry>
1421      </row>
1422     </thead>
1423
1424     <tbody>
1425      <row>
1426       <entry><structfield>roleid</structfield></entry>
1427       <entry><type>oid</type></entry>
1428       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1429       <entry>ID of a role that has a member</entry>
1430      </row>
1431
1432      <row>
1433       <entry><structfield>member</structfield></entry>
1434       <entry><type>oid</type></entry>
1435       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1436       <entry>ID of a role that is a member of <structfield>roleid</></entry>
1437      </row>
1438
1439      <row>
1440       <entry><structfield>grantor</structfield></entry>
1441       <entry><type>oid</type></entry>
1442       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1443       <entry>ID of the role that granted this membership</entry>
1444      </row>
1445
1446      <row>
1447       <entry><structfield>admin_option</structfield></entry>
1448       <entry><type>bool</type></entry>
1449       <entry></entry>
1450       <entry>True if <structfield>member</> can grant membership in
1451        <structfield>roleid</> to others</entry>
1452      </row>
1453     </tbody>
1454    </tgroup>
1455   </table>
1456
1457  </sect1>
1458
1459
1460  <sect1 id="catalog-pg-cast">
1461   <title><structname>pg_cast</structname></title>
1462
1463   <indexterm zone="catalog-pg-cast">
1464    <primary>pg_cast</primary>
1465   </indexterm>
1466
1467   <para>
1468    The catalog <structname>pg_cast</structname> stores data type conversion
1469    paths, both built-in and user-defined.
1470   </para>
1471
1472   <para>
1473    It should be noted that <structname>pg_cast</structname> does not represent
1474    every type conversion that the system knows how to perform; only those that
1475    cannot be deduced from some generic rule.  For example, casting between a
1476    domain and its base type is not explicitly represented in
1477    <structname>pg_cast</structname>.  Another important exception is that
1478    <quote>automatic I/O conversion casts</>, those performed using a data
1479    type's own I/O functions to convert to or from <type>text</> or other
1480    string types, are not explicitly represented in
1481    <structname>pg_cast</structname>.
1482   </para>
1483
1484   <table>
1485    <title><structname>pg_cast</> Columns</title>
1486
1487    <tgroup cols="4">
1488     <thead>
1489      <row>
1490       <entry>Name</entry>
1491       <entry>Type</entry>
1492       <entry>References</entry>
1493       <entry>Description</entry>
1494      </row>
1495     </thead>
1496
1497     <tbody>
1498      <row>
1499       <entry><structfield>oid</structfield></entry>
1500       <entry><type>oid</type></entry>
1501       <entry></entry>
1502       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1503      </row>
1504
1505      <row>
1506       <entry><structfield>castsource</structfield></entry>
1507       <entry><type>oid</type></entry>
1508       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1509       <entry>OID of the source data type</entry>
1510      </row>
1511
1512      <row>
1513       <entry><structfield>casttarget</structfield></entry>
1514       <entry><type>oid</type></entry>
1515       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1516       <entry>OID of the target data type</entry>
1517      </row>
1518
1519      <row>
1520       <entry><structfield>castfunc</structfield></entry>
1521       <entry><type>oid</type></entry>
1522       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1523       <entry>
1524        The OID of the function to use to perform this cast.  Zero is
1525        stored if the cast method doesn't require a function.
1526       </entry>
1527      </row>
1528
1529      <row>
1530       <entry><structfield>castcontext</structfield></entry>
1531       <entry><type>char</type></entry>
1532       <entry></entry>
1533       <entry>
1534        Indicates what contexts the cast can be invoked in.
1535        <literal>e</> means only as an explicit cast (using
1536        <literal>CAST</> or <literal>::</> syntax).
1537        <literal>a</> means implicitly in assignment
1538        to a target column, as well as explicitly.
1539        <literal>i</> means implicitly in expressions, as well as the
1540        other cases.
1541       </entry>
1542      </row>
1543      <row>
1544       <entry><structfield>castmethod</structfield></entry>
1545       <entry><type>char</type></entry>
1546       <entry></entry>
1547       <entry>
1548        Indicates how the cast is performed.
1549        <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1550        <literal>i</> means that the input/output functions are used.
1551        <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1552       </entry>
1553      </row>
1554     </tbody>
1555    </tgroup>
1556   </table>
1557
1558   <para>
1559    The cast functions listed in <structname>pg_cast</structname> must
1560    always take the cast source type as their first argument type, and
1561    return the cast destination type as their result type.  A cast
1562    function can have up to three arguments.  The second argument,
1563    if present, must be type <type>integer</>; it receives the type
1564    modifier associated with the destination type, or -1
1565    if there is none.  The third argument,
1566    if present, must be type <type>boolean</>; it receives <literal>true</>
1567    if the cast is an explicit cast, <literal>false</> otherwise.
1568   </para>
1569
1570   <para>
1571    It is legitimate to create a <structname>pg_cast</structname> entry
1572    in which the source and target types are the same, if the associated
1573    function takes more than one argument.  Such entries represent
1574    <quote>length coercion functions</> that coerce values of the type
1575    to be legal for a particular type modifier value.
1576   </para>
1577
1578   <para>
1579    When a <structname>pg_cast</structname> entry has different source and
1580    target types and a function that takes more than one argument, it
1581    represents converting from one type to another and applying a length
1582    coercion in a single step.  When no such entry is available, coercion
1583    to a type that uses a type modifier involves two steps, one to
1584    convert between data types and a second to apply the modifier.
1585   </para>
1586  </sect1>
1587
1588  <sect1 id="catalog-pg-class">
1589   <title><structname>pg_class</structname></title>
1590
1591   <indexterm zone="catalog-pg-class">
1592    <primary>pg_class</primary>
1593   </indexterm>
1594
1595   <para>
1596    The catalog <structname>pg_class</structname> catalogs tables and most
1597    everything else that has columns or is otherwise similar to a
1598    table.  This includes indexes (but see also
1599    <structname>pg_index</structname>), sequences (but see also
1600    <structname>pg_sequence</structname>), views, materialized
1601    views, composite types, and TOAST tables; see <structfield>relkind</>.
1602    Below, when we mean all of these
1603    kinds of objects we speak of <quote>relations</quote>.  Not all
1604    columns are meaningful for all relation types.
1605   </para>
1606
1607   <table>
1608    <title><structname>pg_class</> Columns</title>
1609
1610    <tgroup cols="4">
1611     <thead>
1612      <row>
1613       <entry>Name</entry>
1614       <entry>Type</entry>
1615       <entry>References</entry>
1616       <entry>Description</entry>
1617      </row>
1618     </thead>
1619
1620     <tbody>
1621      <row>
1622       <entry><structfield>oid</structfield></entry>
1623       <entry><type>oid</type></entry>
1624       <entry></entry>
1625       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1626      </row>
1627
1628      <row>
1629       <entry><structfield>relname</structfield></entry>
1630       <entry><type>name</type></entry>
1631       <entry></entry>
1632       <entry>Name of the table, index, view, etc.</entry>
1633      </row>
1634
1635      <row>
1636       <entry><structfield>relnamespace</structfield></entry>
1637       <entry><type>oid</type></entry>
1638       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1639       <entry>
1640        The OID of the namespace that contains this relation
1641       </entry>
1642      </row>
1643
1644      <row>
1645       <entry><structfield>reltype</structfield></entry>
1646       <entry><type>oid</type></entry>
1647       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1648       <entry>
1649        The OID of the data type that corresponds to this table's row type,
1650        if any (zero for indexes, which have no <structname>pg_type</> entry)
1651       </entry>
1652      </row>
1653
1654      <row>
1655       <entry><structfield>reloftype</structfield></entry>
1656       <entry><type>oid</type></entry>
1657       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1658       <entry>
1659        For typed tables, the OID of the underlying composite type,
1660        zero for all other relations
1661       </entry>
1662      </row>
1663
1664      <row>
1665       <entry><structfield>relowner</structfield></entry>
1666       <entry><type>oid</type></entry>
1667       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1668       <entry>Owner of the relation</entry>
1669      </row>
1670
1671      <row>
1672       <entry><structfield>relam</structfield></entry>
1673       <entry><type>oid</type></entry>
1674       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1675       <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1676      </row>
1677
1678      <row>
1679       <entry><structfield>relfilenode</structfield></entry>
1680       <entry><type>oid</type></entry>
1681       <entry></entry>
1682       <entry>Name of the on-disk file of this relation; zero means this
1683        is a <quote>mapped</> relation whose disk file name is determined
1684        by low-level state</entry>
1685      </row>
1686
1687      <row>
1688       <entry><structfield>reltablespace</structfield></entry>
1689       <entry><type>oid</type></entry>
1690       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1691       <entry>
1692        The tablespace in which this relation is stored.  If zero,
1693        the database's default tablespace is implied.  (Not meaningful
1694        if the relation has no on-disk file.)
1695       </entry>
1696      </row>
1697
1698      <row>
1699       <entry><structfield>relpages</structfield></entry>
1700       <entry><type>int4</type></entry>
1701       <entry></entry>
1702       <entry>
1703        Size of the on-disk representation of this table in pages (of size
1704        <symbol>BLCKSZ</symbol>).  This is only an estimate used by the
1705        planner.  It is updated by <command>VACUUM</command>,
1706        <command>ANALYZE</command>, and a few DDL commands such as
1707        <command>CREATE INDEX</command>.
1708       </entry>
1709      </row>
1710
1711      <row>
1712       <entry><structfield>reltuples</structfield></entry>
1713       <entry><type>float4</type></entry>
1714       <entry></entry>
1715       <entry>
1716        Number of rows in the table.  This is only an estimate used by the
1717        planner.  It is updated by <command>VACUUM</command>,
1718        <command>ANALYZE</command>, and a few DDL commands such as
1719        <command>CREATE INDEX</command>.
1720       </entry>
1721      </row>
1722
1723      <row>
1724       <entry><structfield>relallvisible</structfield></entry>
1725       <entry><type>int4</type></entry>
1726       <entry></entry>
1727       <entry>
1728        Number of pages that are marked all-visible in the table's
1729        visibility map.  This is only an estimate used by the
1730        planner.  It is updated by <command>VACUUM</command>,
1731        <command>ANALYZE</command>, and a few DDL commands such as
1732        <command>CREATE INDEX</command>.
1733       </entry>
1734      </row>
1735
1736      <row>
1737       <entry><structfield>reltoastrelid</structfield></entry>
1738       <entry><type>oid</type></entry>
1739       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1740       <entry>
1741        OID of the TOAST table associated with this table, 0 if none.  The
1742        TOAST table stores large attributes <quote>out of line</quote> in a
1743        secondary table.
1744       </entry>
1745      </row>
1746
1747      <row>
1748       <entry><structfield>relhasindex</structfield></entry>
1749       <entry><type>bool</type></entry>
1750       <entry></entry>
1751       <entry>
1752        True if this is a table and it has (or recently had) any indexes
1753       </entry>
1754      </row>
1755
1756      <row>
1757       <entry><structfield>relisshared</structfield></entry>
1758       <entry><type>bool</type></entry>
1759       <entry></entry>
1760       <entry>
1761        True if this table is shared across all databases in the cluster.  Only
1762        certain system catalogs (such as <structname>pg_database</structname>)
1763        are shared.
1764       </entry>
1765      </row>
1766
1767      <row>
1768       <entry><structfield>relpersistence</structfield></entry>
1769       <entry><type>char</type></entry>
1770       <entry></entry>
1771       <entry>
1772        <literal>p</> = permanent table, <literal>u</> = unlogged table,
1773        <literal>t</> = temporary table
1774       </entry>
1775      </row>
1776
1777      <row>
1778       <entry><structfield>relkind</structfield></entry>
1779       <entry><type>char</type></entry>
1780       <entry></entry>
1781       <entry>
1782        <literal>r</> = ordinary table,
1783        <literal>i</> = index,
1784        <literal>S</> = sequence,
1785        <literal>t</> = TOAST table,
1786        <literal>v</> = view,
1787        <literal>m</> = materialized view,
1788        <literal>c</> = composite type,
1789        <literal>f</> = foreign table,
1790        <literal>p</> = partitioned table
1791       </entry>
1792      </row>
1793
1794      <row>
1795       <entry><structfield>relnatts</structfield></entry>
1796       <entry><type>int2</type></entry>
1797       <entry></entry>
1798       <entry>
1799        Number of user columns in the relation (system columns not
1800        counted).  There must be this many corresponding entries in
1801        <structname>pg_attribute</structname>.  See also
1802        <literal>pg_attribute.attnum</literal>.
1803       </entry>
1804      </row>
1805
1806      <row>
1807       <entry><structfield>relchecks</structfield></entry>
1808       <entry><type>int2</type></entry>
1809       <entry></entry>
1810       <entry>
1811        Number of <literal>CHECK</> constraints on the table; see
1812        <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1813       </entry>
1814      </row>
1815
1816      <row>
1817       <entry><structfield>relhasoids</structfield></entry>
1818       <entry><type>bool</type></entry>
1819       <entry></entry>
1820       <entry>
1821        True if we generate an OID for each row of the relation
1822       </entry>
1823      </row>
1824
1825      <row>
1826       <entry><structfield>relhaspkey</structfield></entry>
1827       <entry><type>bool</type></entry>
1828       <entry></entry>
1829       <entry>
1830        True if the table has (or once had) a primary key
1831       </entry>
1832      </row>
1833
1834      <row>
1835       <entry><structfield>relhasrules</structfield></entry>
1836       <entry><type>bool</type></entry>
1837       <entry></entry>
1838       <entry>
1839        True if table has (or once had) rules; see
1840        <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1841       </entry>
1842      </row>
1843
1844      <row>
1845       <entry><structfield>relhastriggers</structfield></entry>
1846       <entry><type>bool</type></entry>
1847       <entry></entry>
1848       <entry>
1849        True if table has (or once had) triggers; see
1850        <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1851       </entry>
1852      </row>
1853
1854      <row>
1855       <entry><structfield>relhassubclass</structfield></entry>
1856       <entry><type>bool</type></entry>
1857       <entry></entry>
1858       <entry>True if table has (or once had) any inheritance children</entry>
1859      </row>
1860
1861      <row>
1862       <entry><structfield>relrowsecurity</structfield></entry>
1863       <entry><type>bool</type></entry>
1864       <entry></entry>
1865       <entry>
1866        True if table has row level security enabled; see
1867        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1868       </entry>
1869      </row>
1870
1871      <row>
1872       <entry><structfield>relforcerowsecurity</structfield></entry>
1873       <entry><type>bool</type></entry>
1874       <entry></entry>
1875       <entry>
1876        True if row level security (when enabled) will also apply to table owner; see
1877        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1878       </entry>
1879      </row>
1880
1881      <row>
1882       <entry><structfield>relispopulated</structfield></entry>
1883       <entry><type>bool</type></entry>
1884       <entry></entry>
1885       <entry>True if relation is populated (this is true for all
1886        relations other than some materialized views)</entry>
1887      </row>
1888
1889      <row>
1890       <entry><structfield>relreplident</structfield></entry>
1891       <entry><type>char</type></entry>
1892       <entry></entry>
1893       <entry>
1894        Columns used to form <quote>replica identity</> for rows:
1895        <literal>d</> = default (primary key, if any),
1896        <literal>n</> = nothing,
1897        <literal>f</> = all columns
1898        <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1899       </entry>
1900      </row>
1901
1902      <row>
1903       <entry><structfield>relispartition</structfield></entry>
1904       <entry><type>bool</type></entry>
1905       <entry></entry>
1906       <entry>True if table is a partition</entry>
1907      </row>
1908
1909      <row>
1910       <entry><structfield>relfrozenxid</structfield></entry>
1911       <entry><type>xid</type></entry>
1912       <entry></entry>
1913       <entry>
1914        All transaction IDs before this one have been replaced with a permanent
1915        (<quote>frozen</>) transaction ID in this table.  This is used to track
1916        whether the table needs to be vacuumed in order to prevent transaction
1917        ID wraparound or to allow <literal>pg_xact</> to be shrunk.  Zero
1918        (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1919       </entry>
1920      </row>
1921
1922      <row>
1923       <entry><structfield>relminmxid</structfield></entry>
1924       <entry><type>xid</type></entry>
1925       <entry></entry>
1926       <entry>
1927        All multixact IDs before this one have been replaced by a
1928        transaction ID in this table.  This is used to track
1929        whether the table needs to be vacuumed in order to prevent multixact ID
1930        wraparound or to allow <literal>pg_multixact</> to be shrunk.  Zero
1931        (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1932       </entry>
1933      </row>
1934
1935      <row>
1936       <entry><structfield>relacl</structfield></entry>
1937       <entry><type>aclitem[]</type></entry>
1938       <entry></entry>
1939       <entry>
1940        Access privileges; see
1941        <xref linkend="sql-grant"> and
1942        <xref linkend="sql-revoke">
1943        for details
1944       </entry>
1945      </row>
1946
1947      <row>
1948       <entry><structfield>reloptions</structfield></entry>
1949       <entry><type>text[]</type></entry>
1950       <entry></entry>
1951       <entry>
1952        Access-method-specific options, as <quote>keyword=value</> strings
1953       </entry>
1954      </row>
1955
1956      <row>
1957       <entry><structfield>relpartbound</structfield></entry>
1958       <entry><type>pg_node_tree</type></entry>
1959       <entry></entry>
1960       <entry>
1961        If table is a partition (see <structfield>relispartition</structfield>),
1962        internal representation of the partition bound
1963       </entry>
1964      </row>
1965     </tbody>
1966    </tgroup>
1967   </table>
1968
1969   <para>
1970    Several of the Boolean flags in <structname>pg_class</> are maintained
1971    lazily: they are guaranteed to be true if that's the correct state, but
1972    may not be reset to false immediately when the condition is no longer
1973    true.  For example, <structfield>relhasindex</> is set by
1974    <command>CREATE INDEX</command>, but it is never cleared by
1975    <command>DROP INDEX</command>.  Instead, <command>VACUUM</command> clears
1976    <structfield>relhasindex</> if it finds the table has no indexes.  This
1977    arrangement avoids race conditions and improves concurrency.
1978   </para>
1979  </sect1>
1980
1981  <sect1 id="catalog-pg-collation">
1982   <title><structname>pg_collation</structname></title>
1983
1984   <indexterm zone="catalog-pg-collation">
1985    <primary>pg_collation</primary>
1986   </indexterm>
1987
1988   <para>
1989    The catalog <structname>pg_collation</structname> describes the
1990    available collations, which are essentially mappings from an SQL
1991    name to operating system locale categories.
1992    See <xref linkend="collation"> for more information.
1993   </para>
1994
1995   <table>
1996    <title><structname>pg_collation</> Columns</title>
1997
1998    <tgroup cols="4">
1999     <thead>
2000      <row>
2001       <entry>Name</entry>
2002       <entry>Type</entry>
2003       <entry>References</entry>
2004       <entry>Description</entry>
2005      </row>
2006     </thead>
2007
2008     <tbody>
2009      <row>
2010       <entry><structfield>oid</structfield></entry>
2011       <entry><type>oid</type></entry>
2012       <entry></entry>
2013       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2014      </row>
2015
2016      <row>
2017       <entry><structfield>collname</structfield></entry>
2018       <entry><type>name</type></entry>
2019       <entry></entry>
2020       <entry>Collation name (unique per namespace and encoding)</entry>
2021      </row>
2022
2023      <row>
2024       <entry><structfield>collnamespace</structfield></entry>
2025       <entry><type>oid</type></entry>
2026       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2027       <entry>
2028        The OID of the namespace that contains this collation
2029       </entry>
2030      </row>
2031
2032      <row>
2033       <entry><structfield>collowner</structfield></entry>
2034       <entry><type>oid</type></entry>
2035       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2036       <entry>Owner of the collation</entry>
2037      </row>
2038
2039      <row>
2040       <entry><structfield>collprovider</structfield></entry>
2041       <entry><type>char</type></entry>
2042       <entry></entry>
2043       <entry>Provider of the collation: <literal>d</literal> = database
2044        default, <literal>c</literal> = libc, <literal>i</literal> = icu</entry>
2045      </row>
2046
2047      <row>
2048       <entry><structfield>collencoding</structfield></entry>
2049       <entry><type>int4</type></entry>
2050       <entry></entry>
2051       <entry>Encoding in which the collation is applicable, or -1 if it
2052        works for any encoding</entry>
2053      </row>
2054
2055      <row>
2056       <entry><structfield>collcollate</structfield></entry>
2057       <entry><type>name</type></entry>
2058       <entry></entry>
2059       <entry><symbol>LC_COLLATE</> for this collation object</entry>
2060      </row>
2061
2062      <row>
2063       <entry><structfield>collctype</structfield></entry>
2064       <entry><type>name</type></entry>
2065       <entry></entry>
2066       <entry><symbol>LC_CTYPE</> for this collation object</entry>
2067      </row>
2068
2069      <row>
2070       <entry><structfield>collversion</structfield></entry>
2071       <entry><type>text</type></entry>
2072       <entry></entry>
2073       <entry>
2074        Provider-specific version of the collation.  This is recorded when the
2075        collation is created and then checked when it is used, to detect
2076        changes in the collation definition that could lead to data corruption.
2077       </entry>
2078      </row>
2079     </tbody>
2080    </tgroup>
2081   </table>
2082
2083   <para>
2084    Note that the unique key on this catalog is (<structfield>collname</>,
2085    <structfield>collencoding</>, <structfield>collnamespace</>) not just
2086    (<structfield>collname</>, <structfield>collnamespace</>).
2087    <productname>PostgreSQL</productname> generally ignores all
2088    collations that do not have <structfield>collencoding</> equal to
2089    either the current database's encoding or -1, and creation of new entries
2090    with the same name as an entry with <structfield>collencoding</> = -1
2091    is forbidden.  Therefore it is sufficient to use a qualified SQL name
2092    (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2093    even though this is not unique according to the catalog definition.
2094    The reason for defining the catalog this way is that
2095    <application>initdb</> fills it in at cluster initialization time with
2096    entries for all locales available on the system, so it must be able to
2097    hold entries for all encodings that might ever be used in the cluster.
2098   </para>
2099
2100   <para>
2101    In the <literal>template0</> database, it could be useful to create
2102    collations whose encoding does not match the database encoding,
2103    since they could match the encodings of databases later cloned from
2104    <literal>template0</>.  This would currently have to be done manually.
2105   </para>
2106  </sect1>
2107
2108  <sect1 id="catalog-pg-constraint">
2109   <title><structname>pg_constraint</structname></title>
2110
2111   <indexterm zone="catalog-pg-constraint">
2112    <primary>pg_constraint</primary>
2113   </indexterm>
2114
2115   <para>
2116    The catalog <structname>pg_constraint</structname> stores check, primary
2117    key, unique, foreign key, and exclusion constraints on tables.
2118    (Column constraints are not treated specially.  Every column constraint is
2119    equivalent to some table constraint.)
2120    Not-null constraints are represented in the <structname>pg_attribute</>
2121    catalog, not here.
2122   </para>
2123
2124   <para>
2125    User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2126    TRIGGER</>) also give rise to an entry in this table.
2127   </para>
2128
2129   <para>
2130    Check constraints on domains are stored here, too.
2131   </para>
2132
2133   <table>
2134    <title><structname>pg_constraint</> Columns</title>
2135
2136    <tgroup cols="4">
2137     <thead>
2138      <row>
2139       <entry>Name</entry>
2140       <entry>Type</entry>
2141       <entry>References</entry>
2142       <entry>Description</entry>
2143      </row>
2144     </thead>
2145
2146     <tbody>
2147      <row>
2148       <entry><structfield>oid</structfield></entry>
2149       <entry><type>oid</type></entry>
2150       <entry></entry>
2151       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2152      </row>
2153
2154      <row>
2155       <entry><structfield>conname</structfield></entry>
2156       <entry><type>name</type></entry>
2157       <entry></entry>
2158       <entry>Constraint name (not necessarily unique!)</entry>
2159      </row>
2160
2161      <row>
2162       <entry><structfield>connamespace</structfield></entry>
2163       <entry><type>oid</type></entry>
2164       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2165       <entry>
2166        The OID of the namespace that contains this constraint
2167       </entry>
2168      </row>
2169
2170      <row>
2171       <entry><structfield>contype</structfield></entry>
2172       <entry><type>char</type></entry>
2173       <entry></entry>
2174       <entry>
2175         <literal>c</> = check constraint,
2176         <literal>f</> = foreign key constraint,
2177         <literal>p</> = primary key constraint,
2178         <literal>u</> = unique constraint,
2179         <literal>t</> = constraint trigger,
2180         <literal>x</> = exclusion constraint
2181       </entry>
2182      </row>
2183
2184      <row>
2185       <entry><structfield>condeferrable</structfield></entry>
2186       <entry><type>bool</type></entry>
2187       <entry></entry>
2188       <entry>Is the constraint deferrable?</entry>
2189      </row>
2190
2191      <row>
2192       <entry><structfield>condeferred</structfield></entry>
2193       <entry><type>bool</type></entry>
2194       <entry></entry>
2195       <entry>Is the constraint deferred by default?</entry>
2196      </row>
2197
2198      <row>
2199       <entry><structfield>convalidated</structfield></entry>
2200       <entry><type>bool</type></entry>
2201       <entry></entry>
2202       <entry>Has the constraint been validated?
2203        Currently, can only be false for foreign keys and CHECK constraints</entry>
2204      </row>
2205
2206      <row>
2207       <entry><structfield>conrelid</structfield></entry>
2208       <entry><type>oid</type></entry>
2209       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2210       <entry>The table this constraint is on; 0 if not a table constraint</entry>
2211      </row>
2212
2213      <row>
2214       <entry><structfield>contypid</structfield></entry>
2215       <entry><type>oid</type></entry>
2216       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2217       <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2218      </row>
2219
2220      <row>
2221       <entry><structfield>conindid</structfield></entry>
2222       <entry><type>oid</type></entry>
2223       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2224       <entry>The index supporting this constraint, if it's a unique, primary
2225        key, foreign key, or exclusion constraint; else 0</entry>
2226      </row>
2227
2228      <row>
2229       <entry><structfield>confrelid</structfield></entry>
2230       <entry><type>oid</type></entry>
2231       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2232       <entry>If a foreign key, the referenced table; else 0</entry>
2233      </row>
2234
2235      <row>
2236       <entry><structfield>confupdtype</structfield></entry>
2237       <entry><type>char</type></entry>
2238       <entry></entry>
2239       <entry>Foreign key update action code:
2240             <literal>a</> = no action,
2241             <literal>r</> = restrict,
2242             <literal>c</> = cascade,
2243             <literal>n</> = set null,
2244             <literal>d</> = set default
2245           </entry>
2246      </row>
2247
2248      <row>
2249       <entry><structfield>confdeltype</structfield></entry>
2250       <entry><type>char</type></entry>
2251       <entry></entry>
2252       <entry>Foreign key deletion action code:
2253             <literal>a</> = no action,
2254             <literal>r</> = restrict,
2255             <literal>c</> = cascade,
2256             <literal>n</> = set null,
2257             <literal>d</> = set default
2258           </entry>
2259      </row>
2260
2261      <row>
2262       <entry><structfield>confmatchtype</structfield></entry>
2263       <entry><type>char</type></entry>
2264       <entry></entry>
2265       <entry>Foreign key match type:
2266             <literal>f</> = full,
2267             <literal>p</> = partial,
2268             <literal>s</> = simple
2269           </entry>
2270      </row>
2271
2272      <row>
2273       <entry><structfield>conislocal</structfield></entry>
2274       <entry><type>bool</type></entry>
2275       <entry></entry>
2276       <entry>
2277        This constraint is defined locally for the relation.  Note that a
2278        constraint can be locally defined and inherited simultaneously.
2279       </entry>
2280      </row>
2281
2282      <row>
2283       <entry><structfield>coninhcount</structfield></entry>
2284       <entry><type>int4</type></entry>
2285       <entry></entry>
2286       <entry>
2287        The number of direct inheritance ancestors this constraint has.
2288        A constraint with
2289        a nonzero number of ancestors cannot be dropped nor renamed.
2290       </entry>
2291      </row>
2292
2293      <row>
2294       <entry><structfield>connoinherit</structfield></entry>
2295       <entry><type>bool</type></entry>
2296       <entry></entry>
2297       <entry>
2298        This constraint is defined locally for the relation.  It is a
2299        non-inheritable constraint.
2300       </entry>
2301      </row>
2302
2303      <row>
2304       <entry><structfield>conkey</structfield></entry>
2305       <entry><type>int2[]</type></entry>
2306       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2307       <entry>If a table constraint (including foreign keys, but not constraint
2308        triggers), list of the constrained columns</entry>
2309      </row>
2310
2311      <row>
2312       <entry><structfield>confkey</structfield></entry>
2313       <entry><type>int2[]</type></entry>
2314       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2315       <entry>If a foreign key, list of the referenced columns</entry>
2316      </row>
2317
2318      <row>
2319       <entry><structfield>conpfeqop</structfield></entry>
2320       <entry><type>oid[]</type></entry>
2321       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2322       <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2323      </row>
2324
2325      <row>
2326       <entry><structfield>conppeqop</structfield></entry>
2327       <entry><type>oid[]</type></entry>
2328       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2329       <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2330      </row>
2331
2332      <row>
2333       <entry><structfield>conffeqop</structfield></entry>
2334       <entry><type>oid[]</type></entry>
2335       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2336       <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2337      </row>
2338
2339      <row>
2340       <entry><structfield>conexclop</structfield></entry>
2341       <entry><type>oid[]</type></entry>
2342       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2343       <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2344      </row>
2345
2346      <row>
2347       <entry><structfield>conbin</structfield></entry>
2348       <entry><type>pg_node_tree</type></entry>
2349       <entry></entry>
2350       <entry>If a check constraint, an internal representation of the expression</entry>
2351      </row>
2352
2353      <row>
2354       <entry><structfield>consrc</structfield></entry>
2355       <entry><type>text</type></entry>
2356       <entry></entry>
2357       <entry>If a check constraint, a human-readable representation of the expression</entry>
2358      </row>
2359     </tbody>
2360    </tgroup>
2361   </table>
2362
2363   <para>
2364    In the case of an exclusion constraint, <structfield>conkey</structfield>
2365    is only useful for constraint elements that are simple column references.
2366    For other cases, a zero appears in <structfield>conkey</structfield>
2367    and the associated index must be consulted to discover the expression
2368    that is constrained.  (<structfield>conkey</structfield> thus has the
2369    same contents as <structname>pg_index</>.<structfield>indkey</> for the
2370    index.)
2371   </para>
2372
2373   <note>
2374    <para>
2375     <structfield>consrc</structfield> is not updated when referenced objects
2376     change; for example, it won't track renaming of columns.  Rather than
2377     relying on this field, it's best to use <function>pg_get_constraintdef()</>
2378     to extract the definition of a check constraint.
2379    </para>
2380   </note>
2381
2382   <note>
2383    <para>
2384     <literal>pg_class.relchecks</literal> needs to agree with the
2385     number of check-constraint entries found in this table for each
2386     relation.
2387    </para>
2388   </note>
2389  </sect1>
2390
2391
2392  <sect1 id="catalog-pg-conversion">
2393   <title><structname>pg_conversion</structname></title>
2394
2395   <indexterm zone="catalog-pg-conversion">
2396    <primary>pg_conversion</primary>
2397   </indexterm>
2398
2399   <para>
2400    The catalog <structname>pg_conversion</structname> describes
2401    encoding conversion procedures.  See <xref linkend="sql-createconversion">
2402    for more information.
2403   </para>
2404
2405   <table>
2406    <title><structname>pg_conversion</> Columns</title>
2407
2408    <tgroup cols="4">
2409     <thead>
2410      <row>
2411       <entry>Name</entry>
2412       <entry>Type</entry>
2413       <entry>References</entry>
2414       <entry>Description</entry>
2415      </row>
2416     </thead>
2417
2418     <tbody>
2419      <row>
2420       <entry><structfield>oid</structfield></entry>
2421       <entry><type>oid</type></entry>
2422       <entry></entry>
2423       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2424      </row>
2425
2426      <row>
2427       <entry><structfield>conname</structfield></entry>
2428       <entry><type>name</type></entry>
2429       <entry></entry>
2430       <entry>Conversion name (unique within a namespace)</entry>
2431      </row>
2432
2433      <row>
2434       <entry><structfield>connamespace</structfield></entry>
2435       <entry><type>oid</type></entry>
2436       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2437       <entry>
2438        The OID of the namespace that contains this conversion
2439       </entry>
2440      </row>
2441
2442      <row>
2443       <entry><structfield>conowner</structfield></entry>
2444       <entry><type>oid</type></entry>
2445       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2446       <entry>Owner of the conversion</entry>
2447      </row>
2448
2449      <row>
2450       <entry><structfield>conforencoding</structfield></entry>
2451       <entry><type>int4</type></entry>
2452       <entry></entry>
2453       <entry>Source encoding ID</entry>
2454      </row>
2455
2456      <row>
2457       <entry><structfield>contoencoding</structfield></entry>
2458       <entry><type>int4</type></entry>
2459       <entry></entry>
2460       <entry>Destination encoding ID</entry>
2461      </row>
2462
2463      <row>
2464       <entry><structfield>conproc</structfield></entry>
2465       <entry><type>regproc</type></entry>
2466       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2467       <entry>Conversion procedure</entry>
2468      </row>
2469
2470      <row>
2471       <entry><structfield>condefault</structfield></entry>
2472       <entry><type>bool</type></entry>
2473       <entry></entry>
2474       <entry>True if this is the default conversion</entry>
2475      </row>
2476
2477     </tbody>
2478    </tgroup>
2479   </table>
2480
2481  </sect1>
2482
2483  <sect1 id="catalog-pg-database">
2484   <title><structname>pg_database</structname></title>
2485
2486   <indexterm zone="catalog-pg-database">
2487    <primary>pg_database</primary>
2488   </indexterm>
2489
2490   <para>
2491    The catalog <structname>pg_database</structname> stores information about
2492    the available databases.  Databases are created with the <xref
2493    linkend="sql-createdatabase"> command.
2494    Consult <xref linkend="managing-databases"> for details about the meaning
2495    of some of the parameters.
2496   </para>
2497
2498   <para>
2499    Unlike most system catalogs, <structname>pg_database</structname>
2500    is shared across all databases of a cluster: there is only one
2501    copy of <structname>pg_database</structname> per cluster, not
2502    one per database.
2503   </para>
2504
2505   <table>
2506    <title><structname>pg_database</> Columns</title>
2507
2508    <tgroup cols="4">
2509     <thead>
2510      <row>
2511       <entry>Name</entry>
2512       <entry>Type</entry>
2513       <entry>References</entry>
2514       <entry>Description</entry>
2515      </row>
2516     </thead>
2517
2518     <tbody>
2519      <row>
2520       <entry><structfield>oid</structfield></entry>
2521       <entry><type>oid</type></entry>
2522       <entry></entry>
2523       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2524      </row>
2525
2526      <row>
2527       <entry><structfield>datname</structfield></entry>
2528       <entry><type>name</type></entry>
2529       <entry></entry>
2530       <entry>Database name</entry>
2531      </row>
2532
2533      <row>
2534       <entry><structfield>datdba</structfield></entry>
2535       <entry><type>oid</type></entry>
2536       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2537       <entry>Owner of the database, usually the user who created it</entry>
2538      </row>
2539
2540      <row>
2541       <entry><structfield>encoding</structfield></entry>
2542       <entry><type>int4</type></entry>
2543       <entry></entry>
2544       <entry>Character encoding for this database
2545           (<function>pg_encoding_to_char()</function> can translate
2546            this number to the encoding name)</entry>
2547      </row>
2548
2549      <row>
2550       <entry><structfield>datcollate</structfield></entry>
2551       <entry><type>name</type></entry>
2552       <entry></entry>
2553       <entry>LC_COLLATE for this database</entry>
2554      </row>
2555
2556      <row>
2557       <entry><structfield>datctype</structfield></entry>
2558       <entry><type>name</type></entry>
2559       <entry></entry>
2560       <entry>LC_CTYPE for this database</entry>
2561      </row>
2562
2563      <row>
2564       <entry><structfield>datistemplate</structfield></entry>
2565       <entry><type>bool</type></entry>
2566       <entry></entry>
2567       <entry>
2568        If true, then this database can be cloned by
2569        any user with <literal>CREATEDB</> privileges;
2570        if false, then only superusers or the owner of
2571        the database can clone it.
2572       </entry>
2573      </row>
2574
2575      <row>
2576       <entry><structfield>datallowconn</structfield></entry>
2577       <entry><type>bool</type></entry>
2578       <entry></entry>
2579       <entry>
2580        If false then no one can connect to this database.  This is
2581        used to protect the <literal>template0</> database from being altered.
2582       </entry>
2583      </row>
2584
2585      <row>
2586       <entry><structfield>datconnlimit</structfield></entry>
2587       <entry><type>int4</type></entry>
2588       <entry></entry>
2589       <entry>
2590        Sets maximum number of concurrent connections that can be made
2591        to this database.  -1 means no limit.
2592       </entry>
2593      </row>
2594
2595      <row>
2596       <entry><structfield>datlastsysoid</structfield></entry>
2597       <entry><type>oid</type></entry>
2598       <entry></entry>
2599       <entry>
2600        Last system OID in the database; useful
2601        particularly to <application>pg_dump</application>
2602       </entry>
2603      </row>
2604
2605      <row>
2606       <entry><structfield>datfrozenxid</structfield></entry>
2607       <entry><type>xid</type></entry>
2608       <entry></entry>
2609       <entry>
2610        All transaction IDs before this one have been replaced with a permanent
2611        (<quote>frozen</>) transaction ID in this database.  This is used to
2612        track whether the database needs to be vacuumed in order to prevent
2613        transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
2614        It is the minimum of the per-table
2615        <structname>pg_class</>.<structfield>relfrozenxid</> values.
2616       </entry>
2617      </row>
2618
2619      <row>
2620       <entry><structfield>datminmxid</structfield></entry>
2621       <entry><type>xid</type></entry>
2622       <entry></entry>
2623       <entry>
2624        All multixact IDs before this one have been replaced with a
2625        transaction ID in this database.  This is used to
2626        track whether the database needs to be vacuumed in order to prevent
2627        multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2628        It is the minimum of the per-table
2629        <structname>pg_class</>.<structfield>relminmxid</> values.
2630       </entry>
2631      </row>
2632
2633      <row>
2634       <entry><structfield>dattablespace</structfield></entry>
2635       <entry><type>oid</type></entry>
2636       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2637       <entry>
2638        The default tablespace for the database.
2639        Within this database, all tables for which
2640        <structname>pg_class</>.<structfield>reltablespace</> is zero
2641        will be stored in this tablespace; in particular, all the non-shared
2642        system catalogs will be there.
2643       </entry>
2644      </row>
2645
2646      <row>
2647       <entry><structfield>datacl</structfield></entry>
2648       <entry><type>aclitem[]</type></entry>
2649       <entry></entry>
2650       <entry>
2651        Access privileges; see
2652        <xref linkend="sql-grant"> and
2653        <xref linkend="sql-revoke">
2654        for details
2655       </entry>
2656      </row>
2657     </tbody>
2658    </tgroup>
2659   </table>
2660  </sect1>
2661
2662
2663  <sect1 id="catalog-pg-db-role-setting">
2664   <title><structname>pg_db_role_setting</structname></title>
2665
2666   <indexterm zone="catalog-pg-db-role-setting">
2667    <primary>pg_db_role_setting</primary>
2668   </indexterm>
2669
2670   <para>
2671    The catalog <structname>pg_db_role_setting</structname> records the default
2672    values that have been set for run-time configuration variables,
2673    for each role and database combination.
2674   </para>
2675
2676   <para>
2677    Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2678    is shared across all databases of a cluster: there is only one
2679    copy of <structname>pg_db_role_setting</structname> per cluster, not
2680    one per database.
2681   </para>
2682
2683   <table>
2684    <title><structname>pg_db_role_setting</> Columns</title>
2685
2686    <tgroup cols="4">
2687     <thead>
2688      <row>
2689       <entry>Name</entry>
2690       <entry>Type</entry>
2691       <entry>References</entry>
2692       <entry>Description</entry>
2693      </row>
2694     </thead>
2695
2696     <tbody>
2697      <row>
2698       <entry><structfield>setdatabase</structfield></entry>
2699       <entry><type>oid</type></entry>
2700       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2701       <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2702      </row>
2703
2704      <row>
2705       <entry><structfield>setrole</structfield></entry>
2706       <entry><type>oid</type></entry>
2707       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2708       <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2709      </row>
2710
2711      <row>
2712       <entry><structfield>setconfig</structfield></entry>
2713       <entry><type>text[]</type></entry>
2714       <entry></entry>
2715       <entry>Defaults for run-time configuration variables</entry>
2716      </row>
2717     </tbody>
2718    </tgroup>
2719   </table>
2720  </sect1>
2721
2722
2723  <sect1 id="catalog-pg-default-acl">
2724   <title><structname>pg_default_acl</structname></title>
2725
2726   <indexterm zone="catalog-pg-default-acl">
2727    <primary>pg_default_acl</primary>
2728   </indexterm>
2729
2730   <para>
2731    The catalog <structname>pg_default_acl</> stores initial
2732    privileges to be assigned to newly created objects.
2733   </para>
2734
2735   <table>
2736    <title><structname>pg_default_acl</> Columns</title>
2737
2738    <tgroup cols="4">
2739     <thead>
2740      <row>
2741       <entry>Name</entry>
2742       <entry>Type</entry>
2743       <entry>References</entry>
2744       <entry>Description</entry>
2745      </row>
2746     </thead>
2747
2748     <tbody>
2749      <row>
2750       <entry><structfield>oid</structfield></entry>
2751       <entry><type>oid</type></entry>
2752       <entry></entry>
2753       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2754      </row>
2755
2756      <row>
2757       <entry><structfield>defaclrole</structfield></entry>
2758       <entry><type>oid</type></entry>
2759       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2760       <entry>The OID of the role associated with this entry</entry>
2761      </row>
2762
2763      <row>
2764       <entry><structfield>defaclnamespace</structfield></entry>
2765       <entry><type>oid</type></entry>
2766       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2767       <entry>The OID of the namespace associated with this entry,
2768        or 0 if none</entry>
2769      </row>
2770
2771      <row>
2772       <entry><structfield>defaclobjtype</structfield></entry>
2773       <entry><type>char</type></entry>
2774       <entry></entry>
2775       <entry>
2776        Type of object this entry is for:
2777        <literal>r</> = relation (table, view),
2778        <literal>S</> = sequence,
2779        <literal>f</> = function,
2780        <literal>T</> = type
2781       </entry>
2782      </row>
2783
2784      <row>
2785       <entry><structfield>defaclacl</structfield></entry>
2786       <entry><type>aclitem[]</type></entry>
2787       <entry></entry>
2788       <entry>
2789        Access privileges that this type of object should have on creation
2790       </entry>
2791      </row>
2792     </tbody>
2793    </tgroup>
2794   </table>
2795
2796   <para>
2797    A <structname>pg_default_acl</> entry shows the initial privileges to
2798    be assigned to an object belonging to the indicated user.  There are
2799    currently two types of entry: <quote>global</> entries with
2800    <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2801    that reference a particular schema.  If a global entry is present then
2802    it <emphasis>overrides</> the normal hard-wired default privileges
2803    for the object type.  A per-schema entry, if present, represents privileges
2804    to be <emphasis>added to</> the global or hard-wired default privileges.
2805   </para>
2806
2807   <para>
2808    Note that when an ACL entry in another catalog is null, it is taken
2809    to represent the hard-wired default privileges for its object,
2810    <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2811    at the moment.  <structname>pg_default_acl</> is only consulted during
2812    object creation.
2813   </para>
2814
2815  </sect1>
2816
2817
2818  <sect1 id="catalog-pg-depend">
2819   <title><structname>pg_depend</structname></title>
2820
2821   <indexterm zone="catalog-pg-depend">
2822    <primary>pg_depend</primary>
2823   </indexterm>
2824
2825   <para>
2826    The catalog <structname>pg_depend</structname> records the dependency
2827    relationships between database objects.  This information allows
2828    <command>DROP</> commands to find which other objects must be dropped
2829    by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2830    RESTRICT</> case.
2831   </para>
2832
2833   <para>
2834    See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2835    which performs a similar function for dependencies involving objects
2836    that are shared across a database cluster.
2837   </para>
2838
2839   <table>
2840    <title><structname>pg_depend</> Columns</title>
2841
2842    <tgroup cols="4">
2843     <thead>
2844      <row>
2845       <entry>Name</entry>
2846       <entry>Type</entry>
2847       <entry>References</entry>
2848       <entry>Description</entry>
2849      </row>
2850     </thead>
2851
2852     <tbody>
2853      <row>
2854       <entry><structfield>classid</structfield></entry>
2855       <entry><type>oid</type></entry>
2856       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2857       <entry>The OID of the system catalog the dependent object is in</entry>
2858      </row>
2859
2860      <row>
2861       <entry><structfield>objid</structfield></entry>
2862       <entry><type>oid</type></entry>
2863       <entry>any OID column</entry>
2864       <entry>The OID of the specific dependent object</entry>
2865      </row>
2866
2867      <row>
2868       <entry><structfield>objsubid</structfield></entry>
2869       <entry><type>int4</type></entry>
2870       <entry></entry>
2871       <entry>
2872        For a table column, this is the column number (the
2873        <structfield>objid</> and <structfield>classid</> refer to the
2874        table itself).  For all other object types, this column is
2875        zero.
2876       </entry>
2877      </row>
2878
2879      <row>
2880       <entry><structfield>refclassid</structfield></entry>
2881       <entry><type>oid</type></entry>
2882       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2883       <entry>The OID of the system catalog the referenced object is in</entry>
2884      </row>
2885
2886      <row>
2887       <entry><structfield>refobjid</structfield></entry>
2888       <entry><type>oid</type></entry>
2889       <entry>any OID column</entry>
2890       <entry>The OID of the specific referenced object</entry>
2891      </row>
2892
2893      <row>
2894       <entry><structfield>refobjsubid</structfield></entry>
2895       <entry><type>int4</type></entry>
2896       <entry></entry>
2897       <entry>
2898        For a table column, this is the column number (the
2899        <structfield>refobjid</> and <structfield>refclassid</> refer
2900        to the table itself).  For all other object types, this column
2901        is zero.
2902       </entry>
2903      </row>
2904
2905      <row>
2906       <entry><structfield>deptype</structfield></entry>
2907       <entry><type>char</type></entry>
2908       <entry></entry>
2909       <entry>
2910        A code defining the specific semantics of this dependency relationship; see text
2911       </entry>
2912      </row>
2913
2914     </tbody>
2915    </tgroup>
2916   </table>
2917
2918   <para>
2919    In all cases, a <structname>pg_depend</structname> entry indicates that the
2920    referenced object cannot be dropped without also dropping the dependent
2921    object.  However, there are several subflavors identified by
2922    <structfield>deptype</>:
2923
2924    <variablelist>
2925     <varlistentry>
2926      <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2927      <listitem>
2928       <para>
2929        A normal relationship between separately-created objects.  The
2930        dependent object can be dropped without affecting the
2931        referenced object.  The referenced object can only be dropped
2932        by specifying <literal>CASCADE</>, in which case the dependent
2933        object is dropped, too.  Example: a table column has a normal
2934        dependency on its data type.
2935       </para>
2936      </listitem>
2937     </varlistentry>
2938
2939     <varlistentry>
2940      <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2941      <listitem>
2942       <para>
2943        The dependent object can be dropped separately from the
2944        referenced object, and should be automatically dropped
2945        (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2946        mode) if the referenced object is dropped.  Example: a named
2947        constraint on a table is made autodependent on the table, so
2948        that it will go away if the table is dropped.
2949       </para>
2950      </listitem>
2951     </varlistentry>
2952
2953     <varlistentry>
2954      <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2955      <listitem>
2956       <para>
2957        The dependent object was created as part of creation of the
2958        referenced object, and is really just a part of its internal
2959        implementation.  A <command>DROP</> of the dependent object
2960        will be disallowed outright (we'll tell the user to issue a
2961        <command>DROP</> against the referenced object, instead).  A
2962        <command>DROP</> of the referenced object will be propagated
2963        through to drop the dependent object whether
2964        <command>CASCADE</> is specified or not.  Example: a trigger
2965        that's created to enforce a foreign-key constraint is made
2966        internally dependent on the constraint's
2967        <structname>pg_constraint</> entry.
2968       </para>
2969      </listitem>
2970     </varlistentry>
2971
2972     <varlistentry>
2973      <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2974      <listitem>
2975       <para>
2976        The dependent object is a member of the <firstterm>extension</> that is
2977        the referenced object (see
2978        <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2979        The dependent object can be dropped only via
2980        <command>DROP EXTENSION</> on the referenced object.  Functionally
2981        this dependency type acts the same as an internal dependency, but
2982        it's kept separate for clarity and to simplify <application>pg_dump</>.
2983       </para>
2984      </listitem>
2985     </varlistentry>
2986
2987     <varlistentry>
2988      <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2989      <listitem>
2990       <para>
2991        The dependent object is not a member of the extension that is the
2992        referenced object (and so should not be ignored by pg_dump), but
2993        cannot function without it and should be dropped when the
2994        extension itself is. The dependent object may be dropped on its
2995        own as well.
2996       </para>
2997      </listitem>
2998     </varlistentry>
2999
3000     <varlistentry>
3001      <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3002      <listitem>
3003       <para>
3004        There is no dependent object; this type of entry is a signal
3005        that the system itself depends on the referenced object, and so
3006        that object must never be deleted.  Entries of this type are
3007        created only by <command>initdb</command>.  The columns for the
3008        dependent object contain zeroes.
3009       </para>
3010      </listitem>
3011     </varlistentry>
3012    </variablelist>
3013
3014    Other dependency flavors might be needed in future.
3015   </para>
3016
3017  </sect1>
3018
3019
3020  <sect1 id="catalog-pg-description">
3021   <title><structname>pg_description</structname></title>
3022
3023   <indexterm zone="catalog-pg-description">
3024    <primary>pg_description</primary>
3025   </indexterm>
3026
3027   <para>
3028    The catalog <structname>pg_description</> stores optional descriptions
3029    (comments) for each database object.  Descriptions can be manipulated
3030    with the <xref linkend="sql-comment"> command and viewed with
3031    <application>psql</application>'s <literal>\d</literal> commands.
3032    Descriptions of many built-in system objects are provided in the initial
3033    contents of <structname>pg_description</structname>.
3034   </para>
3035
3036   <para>
3037    See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3038    which performs a similar function for descriptions involving objects that
3039    are shared across a database cluster.
3040   </para>
3041
3042   <table>
3043    <title><structname>pg_description</> Columns</title>
3044
3045    <tgroup cols="4">
3046     <thead>
3047      <row>
3048       <entry>Name</entry>
3049       <entry>Type</entry>
3050       <entry>References</entry>
3051       <entry>Description</entry>
3052      </row>
3053     </thead>
3054
3055     <tbody>
3056      <row>
3057       <entry><structfield>objoid</structfield></entry>
3058       <entry><type>oid</type></entry>
3059       <entry>any OID column</entry>
3060       <entry>The OID of the object this description pertains to</entry>
3061      </row>
3062
3063      <row>
3064       <entry><structfield>classoid</structfield></entry>
3065       <entry><type>oid</type></entry>
3066       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3067       <entry>The OID of the system catalog this object appears in</entry>
3068      </row>
3069
3070      <row>
3071       <entry><structfield>objsubid</structfield></entry>
3072       <entry><type>int4</type></entry>
3073       <entry></entry>
3074       <entry>
3075        For a comment on a table column, this is the column number (the
3076        <structfield>objoid</> and <structfield>classoid</> refer to
3077        the table itself).  For all other object types, this column is
3078        zero.
3079       </entry>
3080      </row>
3081
3082      <row>
3083       <entry><structfield>description</structfield></entry>
3084       <entry><type>text</type></entry>
3085       <entry></entry>
3086       <entry>Arbitrary text that serves as the description of this object</entry>
3087      </row>
3088     </tbody>
3089    </tgroup>
3090   </table>
3091
3092  </sect1>
3093
3094
3095  <sect1 id="catalog-pg-enum">
3096   <title><structname>pg_enum</structname></title>
3097
3098   <indexterm zone="catalog-pg-enum">
3099    <primary>pg_enum</primary>
3100   </indexterm>
3101
3102   <para>
3103    The <structname>pg_enum</structname> catalog contains entries
3104    showing the values and labels for each enum type. The
3105    internal representation of a given enum value is actually the OID
3106    of its associated row in <structname>pg_enum</structname>.
3107   </para>
3108
3109   <table>
3110    <title><structname>pg_enum</> Columns</title>
3111
3112    <tgroup cols="4">
3113     <thead>
3114      <row>
3115       <entry>Name</entry>
3116       <entry>Type</entry>
3117       <entry>References</entry>
3118       <entry>Description</entry>
3119      </row>
3120     </thead>
3121
3122     <tbody>
3123      <row>
3124       <entry><structfield>oid</structfield></entry>
3125       <entry><type>oid</type></entry>
3126       <entry></entry>
3127       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3128      </row>
3129
3130      <row>
3131       <entry><structfield>enumtypid</structfield></entry>
3132       <entry><type>oid</type></entry>
3133       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3134       <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3135      </row>
3136
3137      <row>
3138       <entry><structfield>enumsortorder</structfield></entry>
3139       <entry><type>float4</type></entry>
3140       <entry></entry>
3141       <entry>The sort position of this enum value within its enum type</entry>
3142      </row>
3143
3144      <row>
3145       <entry><structfield>enumlabel</structfield></entry>
3146       <entry><type>name</type></entry>
3147       <entry></entry>
3148       <entry>The textual label for this enum value</entry>
3149      </row>
3150     </tbody>
3151    </tgroup>
3152   </table>
3153
3154   <para>
3155    The OIDs for <structname>pg_enum</structname> rows follow a special
3156    rule: even-numbered OIDs are guaranteed to be ordered in the same way
3157    as the sort ordering of their enum type.  That is, if two even OIDs
3158    belong to the same enum type, the smaller OID must have the smaller
3159    <structfield>enumsortorder</structfield> value.  Odd-numbered OID values
3160    need bear no relationship to the sort order.  This rule allows the
3161    enum comparison routines to avoid catalog lookups in many common cases.
3162    The routines that create and alter enum types attempt to assign even
3163    OIDs to enum values whenever possible.
3164   </para>
3165
3166   <para>
3167    When an enum type is created, its members are assigned sort-order
3168    positions 1..<replaceable>n</>.  But members added later might be given
3169    negative or fractional values of <structfield>enumsortorder</structfield>.
3170    The only requirement on these values is that they be correctly
3171    ordered and unique within each enum type.
3172   </para>
3173  </sect1>
3174
3175
3176  <sect1 id="catalog-pg-event-trigger">
3177   <title><structname>pg_event_trigger</structname></title>
3178
3179   <indexterm zone="catalog-pg-event-trigger">
3180    <primary>pg_event_trigger</primary>
3181   </indexterm>
3182
3183   <para>
3184    The catalog <structname>pg_event_trigger</structname> stores event triggers.
3185    See <xref linkend="event-triggers"> for more information.
3186   </para>
3187
3188   <table>
3189    <title><structname>pg_event_trigger</> Columns</title>
3190
3191    <tgroup cols="4">
3192     <thead>
3193      <row>
3194       <entry>Name</entry>
3195       <entry>Type</entry>
3196       <entry>References</entry>
3197       <entry>Description</entry>
3198      </row>
3199     </thead>
3200
3201     <tbody>
3202      <row>
3203       <entry><structfield>evtname</structfield></entry>
3204       <entry><type>name</type></entry>
3205       <entry></entry>
3206       <entry>Trigger name (must be unique)</entry>
3207      </row>
3208
3209      <row>
3210       <entry><structfield>evtevent</structfield></entry>
3211       <entry><type>name</type></entry>
3212       <entry></entry>
3213       <entry>Identifies the event for which this trigger fires</entry>
3214      </row>
3215
3216      <row>
3217       <entry><structfield>evtowner</structfield></entry>
3218       <entry><type>oid</type></entry>
3219       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3220       <entry>Owner of the event trigger</entry>
3221      </row>
3222
3223      <row>
3224       <entry><structfield>evtfoid</structfield></entry>
3225       <entry><type>oid</type></entry>
3226       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3227       <entry>The function to be called</entry>
3228      </row>
3229
3230      <row>
3231       <entry><structfield>evtenabled</structfield></entry>
3232       <entry><type>char</type></entry>
3233       <entry></entry>
3234       <entry>
3235        Controls in which <xref linkend="guc-session-replication-role"> modes
3236        the event trigger fires.
3237        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3238        <literal>D</> = trigger is disabled,
3239        <literal>R</> = trigger fires in <quote>replica</> mode,
3240        <literal>A</> = trigger fires always.
3241       </entry>
3242      </row>
3243
3244      <row>
3245       <entry><structfield>evttags</structfield></entry>
3246       <entry><type>text[]</type></entry>
3247       <entry></entry>
3248       <entry>
3249         Command tags for which this trigger will fire.  If NULL, the firing
3250         of this trigger is not restricted on the basis of the command tag.
3251       </entry>
3252      </row>
3253     </tbody>
3254    </tgroup>
3255   </table>
3256  </sect1>
3257
3258
3259  <sect1 id="catalog-pg-extension">
3260   <title><structname>pg_extension</structname></title>
3261
3262   <indexterm zone="catalog-pg-extension">
3263    <primary>pg_extension</primary>
3264   </indexterm>
3265
3266   <para>
3267    The catalog <structname>pg_extension</structname> stores information
3268    about the installed extensions.  See <xref linkend="extend-extensions">
3269    for details about extensions.
3270   </para>
3271
3272   <table>
3273    <title><structname>pg_extension</> Columns</title>
3274
3275    <tgroup cols="4">
3276     <thead>
3277      <row>
3278       <entry>Name</entry>
3279       <entry>Type</entry>
3280       <entry>References</entry>
3281       <entry>Description</entry>
3282      </row>
3283     </thead>
3284
3285     <tbody>
3286      <row>
3287       <entry><structfield>oid</structfield></entry>
3288       <entry><type>oid</type></entry>
3289       <entry></entry>
3290       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3291      </row>
3292
3293      <row>
3294       <entry><structfield>extname</structfield></entry>
3295       <entry><type>name</type></entry>
3296       <entry></entry>
3297       <entry>Name of the extension</entry>
3298      </row>
3299
3300      <row>
3301       <entry><structfield>extowner</structfield></entry>
3302       <entry><type>oid</type></entry>
3303       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3304       <entry>Owner of the extension</entry>
3305      </row>
3306
3307      <row>
3308       <entry><structfield>extnamespace</structfield></entry>
3309       <entry><type>oid</type></entry>
3310       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3311       <entry>Schema containing the extension's exported objects</entry>
3312      </row>
3313
3314      <row>
3315       <entry><structfield>extrelocatable</structfield></entry>
3316       <entry><type>bool</type></entry>
3317       <entry></entry>
3318       <entry>True if extension can be relocated to another schema</entry>
3319      </row>
3320
3321      <row>
3322       <entry><structfield>extversion</structfield></entry>
3323       <entry><type>text</type></entry>
3324       <entry></entry>
3325       <entry>Version name for the extension</entry>
3326      </row>
3327
3328      <row>
3329       <entry><structfield>extconfig</structfield></entry>
3330       <entry><type>oid[]</type></entry>
3331       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3332       <entry>Array of <type>regclass</> OIDs for the extension's configuration
3333        table(s), or <literal>NULL</> if none</entry>
3334      </row>
3335
3336      <row>
3337       <entry><structfield>extcondition</structfield></entry>
3338       <entry><type>text[]</type></entry>
3339       <entry></entry>
3340       <entry>Array of <literal>WHERE</>-clause filter conditions for the
3341        extension's configuration table(s), or <literal>NULL</> if none</entry>
3342      </row>
3343
3344     </tbody>
3345    </tgroup>
3346   </table>
3347
3348   <para>
3349    Note that unlike most catalogs with a <quote>namespace</> column,
3350    <structfield>extnamespace</structfield> is not meant to imply
3351    that the extension belongs to that schema.  Extension names are never
3352    schema-qualified.  Rather, <structfield>extnamespace</structfield>
3353    indicates the schema that contains most or all of the extension's
3354    objects.  If <structfield>extrelocatable</structfield> is true, then
3355    this schema must in fact contain all schema-qualifiable objects
3356    belonging to the extension.
3357   </para>
3358  </sect1>
3359
3360
3361  <sect1 id="catalog-pg-foreign-data-wrapper">
3362   <title><structname>pg_foreign_data_wrapper</structname></title>
3363
3364   <indexterm zone="catalog-pg-foreign-data-wrapper">
3365    <primary>pg_foreign_data_wrapper</primary>
3366   </indexterm>
3367
3368   <para>
3369    The catalog <structname>pg_foreign_data_wrapper</structname> stores
3370    foreign-data wrapper definitions.  A foreign-data wrapper is the
3371    mechanism by which external data, residing on foreign servers, is
3372    accessed.
3373   </para>
3374
3375   <table>
3376    <title><structname>pg_foreign_data_wrapper</> Columns</title>
3377
3378    <tgroup cols="4">
3379     <thead>
3380      <row>
3381       <entry>Name</entry>
3382       <entry>Type</entry>
3383       <entry>References</entry>
3384       <entry>Description</entry>
3385      </row>
3386     </thead>
3387
3388     <tbody>
3389      <row>
3390       <entry><structfield>oid</structfield></entry>
3391       <entry><type>oid</type></entry>
3392       <entry></entry>
3393       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3394      </row>
3395
3396      <row>
3397       <entry><structfield>fdwname</structfield></entry>
3398       <entry><type>name</type></entry>
3399       <entry></entry>
3400       <entry>Name of the foreign-data wrapper</entry>
3401      </row>
3402
3403      <row>
3404       <entry><structfield>fdwowner</structfield></entry>
3405       <entry><type>oid</type></entry>
3406       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3407       <entry>Owner of the foreign-data wrapper</entry>
3408      </row>
3409
3410      <row>
3411       <entry><structfield>fdwhandler</structfield></entry>
3412       <entry><type>oid</type></entry>
3413       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3414       <entry>
3415        References a handler function that is responsible for
3416        supplying execution routines for the foreign-data wrapper.
3417        Zero if no handler is provided
3418       </entry>
3419      </row>
3420
3421      <row>
3422       <entry><structfield>fdwvalidator</structfield></entry>
3423       <entry><type>oid</type></entry>
3424       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3425       <entry>
3426        References a validator function that is responsible for
3427        checking the validity of the options given to the
3428        foreign-data wrapper, as well as options for foreign servers and user
3429        mappings using the foreign-data wrapper.  Zero if no validator
3430        is provided
3431       </entry>
3432      </row>
3433
3434      <row>
3435       <entry><structfield>fdwacl</structfield></entry>
3436       <entry><type>aclitem[]</type></entry>
3437       <entry></entry>
3438       <entry>
3439        Access privileges; see
3440        <xref linkend="sql-grant"> and
3441        <xref linkend="sql-revoke">
3442        for details
3443       </entry>
3444      </row>
3445
3446      <row>
3447       <entry><structfield>fdwoptions</structfield></entry>
3448       <entry><type>text[]</type></entry>
3449       <entry></entry>
3450       <entry>
3451        Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3452       </entry>
3453      </row>
3454     </tbody>
3455    </tgroup>
3456   </table>
3457  </sect1>
3458
3459
3460  <sect1 id="catalog-pg-foreign-server">
3461   <title><structname>pg_foreign_server</structname></title>
3462
3463   <indexterm zone="catalog-pg-foreign-server">
3464    <primary>pg_foreign_server</primary>
3465   </indexterm>
3466
3467   <para>
3468    The catalog <structname>pg_foreign_server</structname> stores
3469    foreign server definitions.  A foreign server describes a source
3470    of external data, such as a remote server.  Foreign
3471    servers are accessed via foreign-data wrappers.
3472   </para>
3473
3474   <table>
3475    <title><structname>pg_foreign_server</> Columns</title>
3476
3477    <tgroup cols="4">
3478     <thead>
3479      <row>
3480       <entry>Name</entry>
3481       <entry>Type</entry>
3482       <entry>References</entry>
3483       <entry>Description</entry>
3484      </row>
3485     </thead>
3486
3487     <tbody>
3488      <row>
3489       <entry><structfield>oid</structfield></entry>
3490       <entry><type>oid</type></entry>
3491       <entry></entry>
3492       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3493      </row>
3494
3495      <row>
3496       <entry><structfield>srvname</structfield></entry>
3497       <entry><type>name</type></entry>
3498       <entry></entry>
3499       <entry>Name of the foreign server</entry>
3500      </row>
3501
3502      <row>
3503       <entry><structfield>srvowner</structfield></entry>
3504       <entry><type>oid</type></entry>
3505       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3506       <entry>Owner of the foreign server</entry>
3507      </row>
3508
3509      <row>
3510       <entry><structfield>srvfdw</structfield></entry>
3511       <entry><type>oid</type></entry>
3512       <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3513       <entry>OID of the foreign-data wrapper of this foreign server</entry>
3514      </row>
3515
3516      <row>
3517       <entry><structfield>srvtype</structfield></entry>
3518       <entry><type>text</type></entry>
3519       <entry></entry>
3520       <entry>Type of the server (optional)</entry>
3521      </row>
3522
3523      <row>
3524       <entry><structfield>srvversion</structfield></entry>
3525       <entry><type>text</type></entry>
3526       <entry></entry>
3527       <entry>Version of the server (optional)</entry>
3528      </row>
3529
3530      <row>
3531       <entry><structfield>srvacl</structfield></entry>
3532       <entry><type>aclitem[]</type></entry>
3533       <entry></entry>
3534       <entry>
3535        Access privileges; see
3536        <xref linkend="sql-grant"> and
3537        <xref linkend="sql-revoke">
3538        for details
3539       </entry>
3540      </row>
3541
3542      <row>
3543       <entry><structfield>srvoptions</structfield></entry>
3544       <entry><type>text[]</type></entry>
3545       <entry></entry>
3546       <entry>
3547        Foreign server specific options, as <quote>keyword=value</> strings
3548       </entry>
3549      </row>
3550     </tbody>
3551    </tgroup>
3552   </table>
3553  </sect1>
3554
3555
3556  <sect1 id="catalog-pg-foreign-table">
3557   <title><structname>pg_foreign_table</structname></title>
3558
3559   <indexterm zone="catalog-pg-foreign-table">
3560    <primary>pg_foreign_table</primary>
3561   </indexterm>
3562
3563   <para>
3564    The catalog <structname>pg_foreign_table</structname> contains
3565    auxiliary information about foreign tables.  A foreign table is
3566    primarily represented by a <structname>pg_class</structname> entry,
3567    just like a regular table.  Its <structname>pg_foreign_table</structname>
3568    entry contains the information that is pertinent only to foreign tables
3569    and not any other kind of relation.
3570   </para>
3571
3572   <table>
3573    <title><structname>pg_foreign_table</> Columns</title>
3574
3575    <tgroup cols="4">
3576     <thead>
3577      <row>
3578       <entry>Name</entry>
3579       <entry>Type</entry>
3580       <entry>References</entry>
3581       <entry>Description</entry>
3582      </row>
3583     </thead>
3584
3585     <tbody>
3586      <row>
3587       <entry><structfield>ftrelid</structfield></entry>
3588       <entry><type>oid</type></entry>
3589       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3590       <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3591      </row>
3592
3593      <row>
3594       <entry><structfield>ftserver</structfield></entry>
3595       <entry><type>oid</type></entry>
3596       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3597       <entry>OID of the foreign server for this foreign table</entry>
3598      </row>
3599
3600      <row>
3601       <entry><structfield>ftoptions</structfield></entry>
3602       <entry><type>text[]</type></entry>
3603       <entry></entry>
3604       <entry>
3605        Foreign table options, as <quote>keyword=value</> strings
3606       </entry>
3607      </row>
3608     </tbody>
3609    </tgroup>
3610   </table>
3611  </sect1>
3612
3613
3614  <sect1 id="catalog-pg-index">
3615   <title><structname>pg_index</structname></title>
3616
3617   <indexterm zone="catalog-pg-index">
3618    <primary>pg_index</primary>
3619   </indexterm>
3620
3621   <para>
3622    The catalog <structname>pg_index</structname> contains part of the information
3623    about indexes.  The rest is mostly in
3624    <structname>pg_class</structname>.
3625   </para>
3626
3627   <table>
3628    <title><structname>pg_index</> Columns</title>
3629
3630    <tgroup cols="4">
3631     <thead>
3632      <row>
3633       <entry>Name</entry>
3634       <entry>Type</entry>
3635       <entry>References</entry>
3636       <entry>Description</entry>
3637      </row>
3638     </thead>
3639
3640     <tbody>
3641      <row>
3642       <entry><structfield>indexrelid</structfield></entry>
3643       <entry><type>oid</type></entry>
3644       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3645       <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3646      </row>
3647
3648      <row>
3649       <entry><structfield>indrelid</structfield></entry>
3650       <entry><type>oid</type></entry>
3651       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3652       <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3653      </row>
3654
3655      <row>
3656       <entry><structfield>indnatts</structfield></entry>
3657       <entry><type>int2</type></entry>
3658       <entry></entry>
3659       <entry>The number of columns in the index (duplicates
3660       <literal>pg_class.relnatts</literal>)</entry>
3661      </row>
3662
3663      <row>
3664       <entry><structfield>indisunique</structfield></entry>
3665       <entry><type>bool</type></entry>
3666       <entry></entry>
3667       <entry>If true, this is a unique index</entry>
3668      </row>
3669
3670      <row>
3671       <entry><structfield>indisprimary</structfield></entry>
3672       <entry><type>bool</type></entry>
3673       <entry></entry>
3674       <entry>If true, this index represents the primary key of the table
3675       (<structfield>indisunique</> should always be true when this is true)</entry>
3676      </row>
3677
3678      <row>
3679       <entry><structfield>indisexclusion</structfield></entry>
3680       <entry><type>bool</type></entry>
3681       <entry></entry>
3682       <entry>If true, this index supports an exclusion constraint</entry>
3683      </row>
3684
3685      <row>
3686       <entry><structfield>indimmediate</structfield></entry>
3687       <entry><type>bool</type></entry>
3688       <entry></entry>
3689       <entry>If true, the uniqueness check is enforced immediately on
3690        insertion
3691        (irrelevant if <structfield>indisunique</> is not true)</entry>
3692      </row>
3693
3694      <row>
3695       <entry><structfield>indisclustered</structfield></entry>
3696       <entry><type>bool</type></entry>
3697       <entry></entry>
3698       <entry>If true, the table was last clustered on this index</entry>
3699      </row>
3700
3701      <row>
3702       <entry><structfield>indisvalid</structfield></entry>
3703       <entry><type>bool</type></entry>
3704       <entry></entry>
3705       <entry>
3706        If true, the index is currently valid for queries.  False means the
3707        index is possibly incomplete: it must still be modified by
3708        <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3709        be used for queries. If it is unique, the uniqueness property is not
3710        guaranteed true either.
3711       </entry>
3712      </row>
3713
3714      <row>
3715       <entry><structfield>indcheckxmin</structfield></entry>
3716       <entry><type>bool</type></entry>
3717       <entry></entry>
3718       <entry>
3719        If true, queries must not use the index until the <structfield>xmin</>
3720        of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3721        event horizon, because the table may contain broken HOT chains with
3722        incompatible rows that they can see
3723       </entry>
3724      </row>
3725
3726      <row>
3727       <entry><structfield>indisready</structfield></entry>
3728       <entry><type>bool</type></entry>
3729       <entry></entry>
3730       <entry>
3731        If true, the index is currently ready for inserts.  False means the
3732        index must be ignored by <command>INSERT</>/<command>UPDATE</>
3733        operations.
3734       </entry>
3735      </row>
3736
3737      <row>
3738       <entry><structfield>indislive</structfield></entry>
3739       <entry><type>bool</type></entry>
3740       <entry></entry>
3741       <entry>
3742        If false, the index is in process of being dropped, and should be
3743        ignored for all purposes (including HOT-safety decisions)
3744       </entry>
3745      </row>
3746
3747      <row>
3748       <entry><structfield>indisreplident</structfield></entry>
3749       <entry><type>bool</type></entry>
3750       <entry></entry>
3751       <entry>
3752        If true this index has been chosen as <quote>replica identity</>
3753        using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3754        ...</>
3755       </entry>
3756      </row>
3757
3758      <row>
3759       <entry><structfield>indkey</structfield></entry>
3760       <entry><type>int2vector</type></entry>
3761       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3762       <entry>
3763        This is an array of <structfield>indnatts</structfield> values that
3764        indicate which table columns this index indexes.  For example a value
3765        of <literal>1 3</literal> would mean that the first and the third table
3766        columns make up the index key.  A zero in this array indicates that the
3767        corresponding index attribute is an expression over the table columns,
3768        rather than a simple column reference.
3769       </entry>
3770      </row>
3771
3772      <row>
3773       <entry><structfield>indcollation</structfield></entry>
3774       <entry><type>oidvector</type></entry>
3775       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3776       <entry>
3777        For each column in the index key, this contains the OID of the
3778        collation to use for the index.
3779       </entry>
3780      </row>
3781
3782      <row>
3783       <entry><structfield>indclass</structfield></entry>
3784       <entry><type>oidvector</type></entry>
3785       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3786       <entry>
3787        For each column in the index key, this contains the OID of
3788        the operator class to use.  See
3789        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3790       </entry>
3791      </row>
3792
3793      <row>
3794       <entry><structfield>indoption</structfield></entry>
3795       <entry><type>int2vector</type></entry>
3796       <entry></entry>
3797       <entry>
3798        This is an array of <structfield>indnatts</structfield> values that
3799        store per-column flag bits.  The meaning of the bits is defined by
3800        the index's access method.
3801       </entry>
3802      </row>
3803
3804      <row>
3805       <entry><structfield>indexprs</structfield></entry>
3806       <entry><type>pg_node_tree</type></entry>
3807       <entry></entry>
3808       <entry>
3809        Expression trees (in <function>nodeToString()</function>
3810        representation) for index attributes that are not simple column
3811        references.  This is a list with one element for each zero
3812        entry in <structfield>indkey</>.  Null if all index attributes
3813        are simple references.
3814       </entry>
3815      </row>
3816
3817      <row>
3818       <entry><structfield>indpred</structfield></entry>
3819       <entry><type>pg_node_tree</type></entry>
3820       <entry></entry>
3821       <entry>
3822        Expression tree (in <function>nodeToString()</function>
3823        representation) for partial index predicate.  Null if not a
3824        partial index.
3825       </entry>
3826      </row>
3827     </tbody>
3828    </tgroup>
3829   </table>
3830
3831  </sect1>
3832
3833
3834  <sect1 id="catalog-pg-inherits">
3835   <title><structname>pg_inherits</structname></title>
3836
3837   <indexterm zone="catalog-pg-inherits">
3838    <primary>pg_inherits</primary>
3839   </indexterm>
3840
3841   <para>
3842    The catalog <structname>pg_inherits</> records information about
3843    table inheritance hierarchies.  There is one entry for each direct
3844    child table in the database.  (Indirect inheritance can be determined
3845    by following chains of entries.)
3846   </para>
3847
3848   <table>
3849    <title><structname>pg_inherits</> Columns</title>
3850
3851    <tgroup cols="4">
3852     <thead>
3853      <row>
3854       <entry>Name</entry>
3855       <entry>Type</entry>
3856       <entry>References</entry>
3857       <entry>Description</entry>
3858      </row>
3859     </thead>
3860
3861     <tbody>
3862      <row>
3863       <entry><structfield>inhrelid</structfield></entry>
3864       <entry><type>oid</type></entry>
3865       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3866       <entry>
3867        The OID of the child table
3868       </entry>
3869      </row>
3870
3871      <row>
3872       <entry><structfield>inhparent</structfield></entry>
3873       <entry><type>oid</type></entry>
3874       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3875       <entry>
3876        The OID of the parent table
3877       </entry>
3878      </row>
3879
3880      <row>
3881       <entry><structfield>inhseqno</structfield></entry>
3882       <entry><type>int4</type></entry>
3883       <entry></entry>
3884       <entry>
3885        If there is more than one direct parent for a child table (multiple
3886        inheritance), this number tells the order in which the
3887        inherited columns are to be arranged.  The count starts at 1.
3888       </entry>
3889      </row>
3890     </tbody>
3891    </tgroup>
3892   </table>
3893
3894  </sect1>
3895
3896  <sect1 id="catalog-pg-init-privs">
3897   <title><structname>pg_init_privs</structname></title>
3898
3899   <indexterm zone="catalog-pg-init-privs">
3900    <primary>pg_init_privs</primary>
3901   </indexterm>
3902
3903   <para>
3904    The catalog <structname>pg_init_privs</> records information about
3905    the initial privileges of objects in the system.  There is one entry
3906    for each object in the database which has a non-default (non-NULL)
3907    initial set of privileges.
3908   </para>
3909
3910   <para>
3911    Objects can have initial privileges either by having those privileges set
3912    when the system is initialized (by <application>initdb</>) or when the
3913    object is created during a <command>CREATE EXTENSION</command> and the
3914    extension script sets initial privileges using the <command>GRANT</command>
3915    system.  Note that the system will automatically handle recording of the
3916    privileges during the extension script and that extension authors need
3917    only use the <command>GRANT</command> and <command>REVOKE</command>
3918    statements in their script to have the privileges recorded.  The
3919    <literal>privtype</literal> column indicates if the initial privilege was
3920    set by <application>initdb</> or during a
3921    <command>CREATE EXTENSION</command> command.
3922   </para>
3923
3924   <para>
3925    Objects which have initial privileges set by <application>initdb</> will
3926    have entries where <literal>privtype</literal> is
3927    <literal>'i'</literal>, while objects which have initial privileges set
3928    by <command>CREATE EXTENSION</command> will have entries where
3929    <literal>privtype</literal> is <literal>'e'</literal>.
3930   </para>
3931
3932   <table>
3933    <title><structname>pg_init_privs</> Columns</title>
3934
3935    <tgroup cols="4">
3936     <thead>
3937      <row>
3938       <entry>Name</entry>
3939       <entry>Type</entry>
3940       <entry>References</entry>
3941       <entry>Description</entry>
3942      </row>
3943     </thead>
3944
3945     <tbody>
3946      <row>
3947       <entry><structfield>objoid</structfield></entry>
3948       <entry><type>oid</type></entry>
3949       <entry>any OID column</entry>
3950       <entry>The OID of the specific object</entry>
3951      </row>
3952
3953      <row>
3954       <entry><structfield>classoid</structfield></entry>
3955       <entry><type>oid</type></entry>
3956       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3957       <entry>The OID of the system catalog the object is in</entry>
3958      </row>
3959
3960      <row>
3961       <entry><structfield>objsubid</structfield></entry>
3962       <entry><type>int4</type></entry>
3963       <entry></entry>
3964       <entry>
3965        For a table column, this is the column number (the
3966        <structfield>objoid</> and <structfield>classoid</> refer to the
3967        table itself).  For all other object types, this column is
3968        zero.
3969       </entry>
3970      </row>
3971
3972      <row>
3973       <entry><structfield>privtype</structfield></entry>
3974       <entry><type>char</type></entry>
3975       <entry></entry>
3976       <entry>
3977        A code defining the type of initial privilege of this object; see text
3978       </entry>
3979      </row>
3980
3981      <row>
3982       <entry><structfield>initprivs</structfield></entry>
3983       <entry><type>aclitem[]</type></entry>
3984       <entry></entry>
3985       <entry>
3986        The initial access privileges; see
3987        <xref linkend="sql-grant"> and
3988        <xref linkend="sql-revoke">
3989        for details
3990       </entry>
3991      </row>
3992
3993     </tbody>
3994    </tgroup>
3995   </table>
3996
3997  </sect1>
3998
3999
4000  <sect1 id="catalog-pg-language">
4001   <title><structname>pg_language</structname></title>
4002
4003   <indexterm zone="catalog-pg-language">
4004    <primary>pg_language</primary>
4005   </indexterm>
4006
4007   <para>
4008    The catalog <structname>pg_language</structname> registers
4009    languages in which you can write functions or stored procedures.
4010    See <xref linkend="sql-createlanguage">
4011    and <xref linkend="xplang"> for more information about language handlers.
4012   </para>
4013
4014   <table>
4015    <title><structname>pg_language</> Columns</title>
4016
4017    <tgroup cols="4">
4018     <thead>
4019      <row>
4020       <entry>Name</entry>
4021       <entry>Type</entry>
4022       <entry>References</entry>
4023       <entry>Description</entry>
4024      </row>
4025     </thead>
4026
4027     <tbody>
4028      <row>
4029       <entry><structfield>oid</structfield></entry>
4030       <entry><type>oid</type></entry>
4031       <entry></entry>
4032       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4033      </row>
4034
4035      <row>
4036       <entry><structfield>lanname</structfield></entry>
4037       <entry><type>name</type></entry>
4038       <entry></entry>
4039       <entry>Name of the language</entry>
4040      </row>
4041
4042      <row>
4043       <entry><structfield>lanowner</structfield></entry>
4044       <entry><type>oid</type></entry>
4045       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4046       <entry>Owner of the language</entry>
4047      </row>
4048
4049      <row>
4050       <entry><structfield>lanispl</structfield></entry>
4051       <entry><type>bool</type></entry>
4052       <entry></entry>
4053       <entry>
4054        This is false for internal languages (such as
4055        <acronym>SQL</acronym>) and true for user-defined languages.
4056        Currently, <application>pg_dump</application> still uses this
4057        to determine which languages need to be dumped, but this might be
4058        replaced by a different mechanism in the future.
4059       </entry>
4060      </row>
4061
4062      <row>
4063       <entry><structfield>lanpltrusted</structfield></entry>
4064       <entry><type>bool</type></entry>
4065       <entry></entry>
4066       <entry>
4067        True if this is a trusted language, which means that it is believed
4068        not to grant access to anything outside the normal SQL execution
4069        environment.  Only superusers can create functions in untrusted
4070        languages.
4071       </entry>
4072      </row>
4073
4074      <row>
4075       <entry><structfield>lanplcallfoid</structfield></entry>
4076       <entry><type>oid</type></entry>
4077       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4078       <entry>
4079        For noninternal languages this references the language
4080        handler, which is a special function that is responsible for
4081        executing all functions that are written in the particular
4082        language
4083       </entry>
4084      </row>
4085
4086      <row>
4087       <entry><structfield>laninline</structfield></entry>
4088       <entry><type>oid</type></entry>
4089       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4090       <entry>
4091        This references a function that is responsible for executing
4092        <quote>inline</> anonymous code blocks
4093        (<xref linkend="sql-do"> blocks).
4094        Zero if inline blocks are not supported.
4095       </entry>
4096      </row>
4097
4098      <row>
4099       <entry><structfield>lanvalidator</structfield></entry>
4100       <entry><type>oid</type></entry>
4101       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4102       <entry>
4103        This references a language validator function that is responsible
4104        for checking the syntax and validity of new functions when they
4105        are created.  Zero if no validator is provided.
4106       </entry>
4107      </row>
4108
4109      <row>
4110       <entry><structfield>lanacl</structfield></entry>
4111       <entry><type>aclitem[]</type></entry>
4112       <entry></entry>
4113       <entry>
4114        Access privileges; see
4115        <xref linkend="sql-grant"> and
4116        <xref linkend="sql-revoke">
4117        for details
4118       </entry>
4119      </row>
4120     </tbody>
4121    </tgroup>
4122   </table>
4123
4124  </sect1>
4125
4126
4127  <sect1 id="catalog-pg-largeobject">
4128   <title><structname>pg_largeobject</structname></title>
4129
4130   <indexterm zone="catalog-pg-largeobject">
4131    <primary>pg_largeobject</primary>
4132   </indexterm>
4133
4134   <para>
4135    The catalog <structname>pg_largeobject</structname> holds the data making up
4136    <quote>large objects</quote>.  A large object is identified by an OID
4137    assigned when it is created.  Each large object is broken into
4138    segments or <quote>pages</> small enough to be conveniently stored as rows
4139    in <structname>pg_largeobject</structname>.
4140    The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4141    <literal>BLCKSZ/4</>, or typically 2 kB).
4142   </para>
4143
4144   <para>
4145    Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4146    associated with large objects.  As a result,
4147    <structname>pg_largeobject</structname> was publicly readable and could be
4148    used to obtain the OIDs (and contents) of all large objects in the system.
4149    This is no longer the case; use
4150    <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4151    to obtain a list of large object OIDs.
4152   </para>
4153
4154   <table>
4155    <title><structname>pg_largeobject</> Columns</title>
4156
4157    <tgroup cols="4">
4158     <thead>
4159      <row>
4160       <entry>Name</entry>
4161       <entry>Type</entry>
4162       <entry>References</entry>
4163       <entry>Description</entry>
4164      </row>
4165     </thead>
4166
4167     <tbody>
4168      <row>
4169       <entry><structfield>loid</structfield></entry>
4170       <entry><type>oid</type></entry>
4171       <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4172       <entry>Identifier of the large object that includes this page</entry>
4173      </row>
4174
4175      <row>
4176       <entry><structfield>pageno</structfield></entry>
4177       <entry><type>int4</type></entry>
4178       <entry></entry>
4179       <entry>Page number of this page within its large object
4180       (counting from zero)</entry>
4181      </row>
4182
4183      <row>
4184       <entry><structfield>data</structfield></entry>
4185       <entry><type>bytea</type></entry>
4186       <entry></entry>
4187       <entry>
4188        Actual data stored in the large object.
4189        This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4190       </entry>
4191      </row>
4192     </tbody>
4193    </tgroup>
4194   </table>
4195
4196   <para>
4197    Each row of <structname>pg_largeobject</structname> holds data
4198    for one page of a large object, beginning at
4199    byte offset (<literal>pageno * LOBLKSIZE</>) within the object.  The implementation
4200    allows sparse storage: pages might be missing, and might be shorter than
4201    <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4202    Missing regions within a large object read as zeroes.
4203   </para>
4204
4205  </sect1>
4206
4207  <sect1 id="catalog-pg-largeobject-metadata">
4208   <title><structname>pg_largeobject_metadata</structname></title>
4209
4210   <indexterm zone="catalog-pg-largeobject-metadata">
4211    <primary>pg_largeobject_metadata</primary>
4212   </indexterm>
4213
4214   <para>
4215    The catalog <structname>pg_largeobject_metadata</structname>
4216    holds metadata associated with large objects.  The actual large object
4217    data is stored in
4218    <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4219   </para>
4220
4221   <table>
4222    <title><structname>pg_largeobject_metadata</> Columns</title>
4223
4224    <tgroup cols="4">
4225     <thead>
4226      <row>
4227       <entry>Name</entry>
4228       <entry>Type</entry>
4229       <entry>References</entry>
4230       <entry>Description</entry>
4231      </row>
4232     </thead>
4233
4234     <tbody>
4235      <row>
4236       <entry><structfield>oid</structfield></entry>
4237       <entry><type>oid</type></entry>
4238       <entry></entry>
4239       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4240      </row>
4241
4242      <row>
4243       <entry><structfield>lomowner</structfield></entry>
4244       <entry><type>oid</type></entry>
4245       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4246       <entry>Owner of the large object</entry>
4247      </row>
4248
4249      <row>
4250       <entry><structfield>lomacl</structfield></entry>
4251       <entry><type>aclitem[]</type></entry>
4252       <entry></entry>
4253       <entry>
4254        Access privileges; see
4255        <xref linkend="sql-grant"> and
4256        <xref linkend="sql-revoke">
4257        for details
4258       </entry>
4259      </row>
4260
4261     </tbody>
4262    </tgroup>
4263   </table>
4264  </sect1>
4265
4266  <sect1 id="catalog-pg-statistic-ext">
4267   <title><structname>pg_statistic_ext</structname></title>
4268
4269   <indexterm zone="catalog-pg-statistic-ext">
4270    <primary>pg_statistic_ext</primary>
4271   </indexterm>
4272
4273   <para>
4274    The catalog <structname>pg_statistic_ext</structname>
4275    holds extended planner statistics.
4276   </para>
4277
4278   <table>
4279    <title><structname>pg_statistic_ext</> Columns</title>
4280
4281    <tgroup cols="4">
4282     <thead>
4283      <row>
4284       <entry>Name</entry>
4285       <entry>Type</entry>
4286       <entry>References</entry>
4287       <entry>Description</entry>
4288      </row>
4289     </thead>
4290
4291     <tbody>
4292
4293      <row>
4294       <entry><structfield>stxrelid</structfield></entry>
4295       <entry><type>oid</type></entry>
4296       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4297       <entry>The table that the described columns belongs to</entry>
4298      </row>
4299
4300      <row>
4301       <entry><structfield>stxname</structfield></entry>
4302       <entry><type>name</type></entry>
4303       <entry></entry>
4304       <entry>Name of the statistic.</entry>
4305      </row>
4306
4307      <row>
4308       <entry><structfield>stxnamespace</structfield></entry>
4309       <entry><type>oid</type></entry>
4310       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4311       <entry>
4312        The OID of the namespace that contains this statistic
4313       </entry>
4314      </row>
4315
4316      <row>
4317       <entry><structfield>stxowner</structfield></entry>
4318       <entry><type>oid</type></entry>
4319       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4320       <entry>Owner of the statistic</entry>
4321      </row>
4322
4323      <row>
4324       <entry><structfield>stxkind</structfield></entry>
4325       <entry><type>char[]</type></entry>
4326       <entry></entry>
4327       <entry>
4328         An array with the modes of the enabled statistic types.  Valid values
4329         are:
4330         <literal>d</literal> for ndistinct coefficients,
4331         <literal>f</literal> for functional dependencies.
4332       </entry>
4333      </row>
4334
4335      <row>
4336       <entry><structfield>stxkeys</structfield></entry>
4337       <entry><type>int2vector</type></entry>
4338       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4339       <entry>
4340        This is an array of values that indicate which table columns this
4341        statistic covers. For example a value of <literal>1 3</literal> would
4342        mean that the first and the third table columns make up the statistic key.
4343       </entry>
4344      </row>
4345
4346      <row>
4347       <entry><structfield>stxndistinct</structfield></entry>
4348       <entry><type>pg_ndistinct</type></entry>
4349       <entry></entry>
4350       <entry>
4351        N-distinct coefficients, serialized as <structname>pg_ndistinct</> type.
4352       </entry>
4353      </row>
4354
4355      <row>
4356       <entry><structfield>stxdependencies</structfield></entry>
4357       <entry><type>pg_dependencies</type></entry>
4358       <entry></entry>
4359       <entry>
4360        Functional dependencies, serialized as <structname>pg_dependencies</> type.
4361       </entry>
4362      </row>
4363
4364     </tbody>
4365    </tgroup>
4366   </table>
4367  </sect1>
4368
4369  <sect1 id="catalog-pg-namespace">
4370   <title><structname>pg_namespace</structname></title>
4371
4372   <indexterm zone="catalog-pg-namespace">
4373    <primary>pg_namespace</primary>
4374   </indexterm>
4375
4376   <para>
4377    The catalog <structname>pg_namespace</> stores namespaces.
4378    A namespace is the structure underlying SQL schemas: each namespace
4379    can have a separate collection of relations, types, etc. without name
4380    conflicts.
4381   </para>
4382
4383   <table>
4384    <title><structname>pg_namespace</> Columns</title>
4385
4386    <tgroup cols="4">
4387     <thead>
4388      <row>
4389       <entry>Name</entry>
4390       <entry>Type</entry>
4391       <entry>References</entry>
4392       <entry>Description</entry>
4393      </row>
4394     </thead>
4395
4396     <tbody>
4397      <row>
4398       <entry><structfield>oid</structfield></entry>
4399       <entry><type>oid</type></entry>
4400       <entry></entry>
4401       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4402      </row>
4403
4404      <row>
4405       <entry><structfield>nspname</structfield></entry>
4406       <entry><type>name</type></entry>
4407       <entry></entry>
4408       <entry>Name of the namespace</entry>
4409      </row>
4410
4411      <row>
4412       <entry><structfield>nspowner</structfield></entry>
4413       <entry><type>oid</type></entry>
4414       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4415       <entry>Owner of the namespace</entry>
4416      </row>
4417
4418      <row>
4419       <entry><structfield>nspacl</structfield></entry>
4420       <entry><type>aclitem[]</type></entry>
4421       <entry></entry>
4422       <entry>
4423        Access privileges; see
4424        <xref linkend="sql-grant"> and
4425        <xref linkend="sql-revoke">
4426        for details
4427       </entry>
4428      </row>
4429     </tbody>
4430    </tgroup>
4431   </table>
4432
4433  </sect1>
4434
4435
4436  <sect1 id="catalog-pg-opclass">
4437   <title><structname>pg_opclass</structname></title>
4438
4439   <indexterm zone="catalog-pg-opclass">
4440    <primary>pg_opclass</primary>
4441   </indexterm>
4442
4443   <para>
4444    The catalog <structname>pg_opclass</structname> defines
4445    index access method operator classes.  Each operator class defines
4446    semantics for index columns of a particular data type and a particular
4447    index access method.  An operator class essentially specifies that a
4448    particular operator family is applicable to a particular indexable column
4449    data type.  The set of operators from the family that are actually usable
4450    with the indexed column are whichever ones accept the column's data type
4451    as their left-hand input.
4452   </para>
4453
4454   <para>
4455    Operator classes are described at length in <xref linkend="xindex">.
4456   </para>
4457
4458   <table>
4459    <title><structname>pg_opclass</> Columns</title>
4460
4461    <tgroup cols="4">
4462     <thead>
4463      <row>
4464       <entry>Name</entry>
4465       <entry>Type</entry>
4466       <entry>References</entry>
4467       <entry>Description</entry>
4468      </row>
4469     </thead>
4470     <tbody>
4471
4472      <row>
4473       <entry><structfield>oid</structfield></entry>
4474       <entry><type>oid</type></entry>
4475       <entry></entry>
4476       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4477      </row>
4478
4479      <row>
4480       <entry><structfield>opcmethod</structfield></entry>
4481       <entry><type>oid</type></entry>
4482       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4483       <entry>Index access method operator class is for</entry>
4484      </row>
4485
4486      <row>
4487       <entry><structfield>opcname</structfield></entry>
4488       <entry><type>name</type></entry>
4489       <entry></entry>
4490       <entry>Name of this operator class</entry>
4491      </row>
4492
4493      <row>
4494       <entry><structfield>opcnamespace</structfield></entry>
4495       <entry><type>oid</type></entry>
4496       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4497       <entry>Namespace of this operator class</entry>
4498      </row>
4499
4500      <row>
4501       <entry><structfield>opcowner</structfield></entry>
4502       <entry><type>oid</type></entry>
4503       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4504       <entry>Owner of the operator class</entry>
4505      </row>
4506
4507      <row>
4508       <entry><structfield>opcfamily</structfield></entry>
4509       <entry><type>oid</type></entry>
4510       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4511       <entry>Operator family containing the operator class</entry>
4512      </row>
4513
4514      <row>
4515       <entry><structfield>opcintype</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>Data type that the operator class indexes</entry>
4519      </row>
4520
4521      <row>
4522       <entry><structfield>opcdefault</structfield></entry>
4523       <entry><type>bool</type></entry>
4524       <entry></entry>
4525       <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4526      </row>
4527
4528      <row>
4529       <entry><structfield>opckeytype</structfield></entry>
4530       <entry><type>oid</type></entry>
4531       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4532       <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4533      </row>
4534
4535     </tbody>
4536    </tgroup>
4537   </table>
4538
4539   <para>
4540    An operator class's <structfield>opcmethod</> must match the
4541    <structname>opfmethod</> of its containing operator family.
4542    Also, there must be no more than one <structname>pg_opclass</structname>
4543    row having <structname>opcdefault</> true for any given combination of
4544    <structname>opcmethod</> and <structname>opcintype</>.
4545   </para>
4546
4547  </sect1>
4548
4549
4550  <sect1 id="catalog-pg-operator">
4551   <title><structname>pg_operator</structname></title>
4552
4553   <indexterm zone="catalog-pg-operator">
4554    <primary>pg_operator</primary>
4555   </indexterm>
4556
4557   <para>
4558    The catalog <structname>pg_operator</> stores information about operators.
4559    See <xref linkend="sql-createoperator">
4560    and <xref linkend="xoper"> for more information.
4561   </para>
4562
4563   <table>
4564    <title><structname>pg_operator</> Columns</title>
4565
4566    <tgroup cols="4">
4567     <thead>
4568      <row>
4569       <entry>Name</entry>
4570       <entry>Type</entry>
4571       <entry>References</entry>
4572       <entry>Description</entry>
4573      </row>
4574     </thead>
4575
4576     <tbody>
4577      <row>
4578       <entry><structfield>oid</structfield></entry>
4579       <entry><type>oid</type></entry>
4580       <entry></entry>
4581       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4582      </row>
4583
4584      <row>
4585       <entry><structfield>oprname</structfield></entry>
4586       <entry><type>name</type></entry>
4587       <entry></entry>
4588       <entry>Name of the operator</entry>
4589      </row>
4590
4591      <row>
4592       <entry><structfield>oprnamespace</structfield></entry>
4593       <entry><type>oid</type></entry>
4594       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4595       <entry>
4596        The OID of the namespace that contains this operator
4597       </entry>
4598      </row>
4599
4600      <row>
4601       <entry><structfield>oprowner</structfield></entry>
4602       <entry><type>oid</type></entry>
4603       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4604       <entry>Owner of the operator</entry>
4605      </row>
4606
4607      <row>
4608       <entry><structfield>oprkind</structfield></entry>
4609       <entry><type>char</type></entry>
4610       <entry></entry>
4611       <entry>
4612        <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4613        (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4614       </entry>
4615      </row>
4616
4617      <row>
4618       <entry><structfield>oprcanmerge</structfield></entry>
4619       <entry><type>bool</type></entry>
4620       <entry></entry>
4621       <entry>This operator supports merge joins</entry>
4622      </row>
4623
4624      <row>
4625       <entry><structfield>oprcanhash</structfield></entry>
4626       <entry><type>bool</type></entry>
4627       <entry></entry>
4628       <entry>This operator supports hash joins</entry>
4629      </row>
4630
4631      <row>
4632       <entry><structfield>oprleft</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 left operand</entry>
4636      </row>
4637
4638      <row>
4639       <entry><structfield>oprright</structfield></entry>
4640       <entry><type>oid</type></entry>
4641       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4642       <entry>Type of the right operand</entry>
4643      </row>
4644
4645      <row>
4646       <entry><structfield>oprresult</structfield></entry>
4647       <entry><type>oid</type></entry>
4648       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4649       <entry>Type of the result</entry>
4650      </row>
4651
4652      <row>
4653       <entry><structfield>oprcom</structfield></entry>
4654       <entry><type>oid</type></entry>
4655       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4656       <entry>Commutator of this operator, if any</entry>
4657      </row>
4658
4659      <row>
4660       <entry><structfield>oprnegate</structfield></entry>
4661       <entry><type>oid</type></entry>
4662       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4663       <entry>Negator of this operator, if any</entry>
4664      </row>
4665
4666      <row>
4667       <entry><structfield>oprcode</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>Function that implements this operator</entry>
4671      </row>
4672
4673      <row>
4674       <entry><structfield>oprrest</structfield></entry>
4675       <entry><type>regproc</type></entry>
4676       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4677       <entry>Restriction selectivity estimation function for this operator</entry>
4678      </row>
4679
4680      <row>
4681       <entry><structfield>oprjoin</structfield></entry>
4682       <entry><type>regproc</type></entry>
4683       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4684       <entry>Join selectivity estimation function for this operator</entry>
4685      </row>
4686     </tbody>
4687    </tgroup>
4688   </table>
4689
4690   <para>
4691    Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4692    is zero for a prefix operator.
4693   </para>
4694
4695  </sect1>
4696
4697
4698  <sect1 id="catalog-pg-opfamily">
4699   <title><structname>pg_opfamily</structname></title>
4700
4701   <indexterm zone="catalog-pg-opfamily">
4702    <primary>pg_opfamily</primary>
4703   </indexterm>
4704
4705   <para>
4706    The catalog <structname>pg_opfamily</structname> defines operator families.
4707    Each operator family is a collection of operators and associated
4708    support routines that implement the semantics specified for a particular
4709    index access method.  Furthermore, the operators in a family are all
4710    <quote>compatible</>, in a way that is specified by the access method.
4711    The operator family concept allows cross-data-type operators to be used
4712    with indexes and to be reasoned about using knowledge of access method
4713    semantics.
4714   </para>
4715
4716   <para>
4717    Operator families are described at length in <xref linkend="xindex">.
4718   </para>
4719
4720   <table>
4721    <title><structname>pg_opfamily</> Columns</title>
4722
4723    <tgroup cols="4">
4724     <thead>
4725      <row>
4726       <entry>Name</entry>
4727       <entry>Type</entry>
4728       <entry>References</entry>
4729       <entry>Description</entry>
4730      </row>
4731     </thead>
4732     <tbody>
4733
4734      <row>
4735       <entry><structfield>oid</structfield></entry>
4736       <entry><type>oid</type></entry>
4737       <entry></entry>
4738       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4739      </row>
4740
4741      <row>
4742       <entry><structfield>opfmethod</structfield></entry>
4743       <entry><type>oid</type></entry>
4744       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4745       <entry>Index access method operator family is for</entry>
4746      </row>
4747
4748      <row>
4749       <entry><structfield>opfname</structfield></entry>
4750       <entry><type>name</type></entry>
4751       <entry></entry>
4752       <entry>Name of this operator family</entry>
4753      </row>
4754
4755      <row>
4756       <entry><structfield>opfnamespace</structfield></entry>
4757       <entry><type>oid</type></entry>
4758       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4759       <entry>Namespace of this operator family</entry>
4760      </row>
4761
4762      <row>
4763       <entry><structfield>opfowner</structfield></entry>
4764       <entry><type>oid</type></entry>
4765       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4766       <entry>Owner of the operator family</entry>
4767      </row>
4768
4769     </tbody>
4770    </tgroup>
4771   </table>
4772
4773   <para>
4774    The majority of the information defining an operator family is not in its
4775    <structname>pg_opfamily</structname> row, but in the associated rows in
4776    <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4777    <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4778    and
4779    <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4780   </para>
4781
4782  </sect1>
4783
4784
4785  <sect1 id="catalog-pg-pltemplate">
4786   <title><structname>pg_pltemplate</structname></title>
4787
4788   <indexterm zone="catalog-pg-pltemplate">
4789    <primary>pg_pltemplate</primary>
4790   </indexterm>
4791
4792   <para>
4793    The catalog <structname>pg_pltemplate</structname> stores
4794    <quote>template</> information for procedural languages.
4795    A template for a language allows the language to be created in a
4796    particular database by a simple <command>CREATE LANGUAGE</> command,
4797    with no need to specify implementation details.
4798   </para>
4799
4800   <para>
4801    Unlike most system catalogs, <structname>pg_pltemplate</structname>
4802    is shared across all databases of a cluster: there is only one
4803    copy of <structname>pg_pltemplate</structname> per cluster, not
4804    one per database.  This allows the information to be accessible in
4805    each database as it is needed.
4806   </para>
4807
4808   <table>
4809    <title><structname>pg_pltemplate</> Columns</title>
4810
4811    <tgroup cols="3">
4812     <thead>
4813      <row>
4814       <entry>Name</entry>
4815       <entry>Type</entry>
4816       <entry>Description</entry>
4817      </row>
4818     </thead>
4819
4820     <tbody>
4821      <row>
4822       <entry><structfield>tmplname</structfield></entry>
4823       <entry><type>name</type></entry>
4824       <entry>Name of the language this template is for</entry>
4825      </row>
4826
4827      <row>
4828       <entry><structfield>tmpltrusted</structfield></entry>
4829       <entry><type>boolean</type></entry>
4830       <entry>True if language is considered trusted</entry>
4831      </row>
4832
4833      <row>
4834       <entry><structfield>tmpldbacreate</structfield></entry>
4835       <entry><type>boolean</type></entry>
4836       <entry>True if language may be created by a database owner</entry>
4837      </row>
4838
4839      <row>
4840       <entry><structfield>tmplhandler</structfield></entry>
4841       <entry><type>text</type></entry>
4842       <entry>Name of call handler function</entry>
4843      </row>
4844
4845      <row>
4846       <entry><structfield>tmplinline</structfield></entry>
4847       <entry><type>text</type></entry>
4848       <entry>Name of anonymous-block handler function, or null if none</entry>
4849      </row>
4850
4851      <row>
4852       <entry><structfield>tmplvalidator</structfield></entry>
4853       <entry><type>text</type></entry>
4854       <entry>Name of validator function, or null if none</entry>
4855      </row>
4856
4857      <row>
4858       <entry><structfield>tmpllibrary</structfield></entry>
4859       <entry><type>text</type></entry>
4860       <entry>Path of shared library that implements language</entry>
4861      </row>
4862
4863      <row>
4864       <entry><structfield>tmplacl</structfield></entry>
4865       <entry><type>aclitem[]</type></entry>
4866       <entry>Access privileges for template (not actually used)</entry>
4867      </row>
4868
4869     </tbody>
4870    </tgroup>
4871   </table>
4872
4873   <para>
4874    There are not currently any commands that manipulate procedural language
4875    templates; to change the built-in information, a superuser must modify
4876    the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4877    or <command>UPDATE</command> commands.
4878   </para>
4879
4880   <note>
4881    <para>
4882     It is likely that <structname>pg_pltemplate</> will be removed in some
4883     future release of <productname>PostgreSQL</productname>, in favor of
4884     keeping this knowledge about procedural languages in their respective
4885     extension installation scripts.
4886    </para>
4887   </note>
4888
4889  </sect1>
4890
4891  <sect1 id="catalog-pg-partitioned-table">
4892   <title><structname>pg_partitioned_table</structname></title>
4893
4894   <indexterm zone="catalog-pg-partitioned-table">
4895    <primary>pg_partitioned_table</primary>
4896   </indexterm>
4897
4898   <para>
4899    The catalog <structname>pg_partitioned_table</structname> stores
4900    information about how tables are partitioned.
4901   </para>
4902
4903   <table>
4904    <title><structname>pg_partitioned_table</> Columns</title>
4905
4906    <tgroup cols="4">
4907     <thead>
4908      <row>
4909       <entry>Name</entry>
4910       <entry>Type</entry>
4911       <entry>References</entry>
4912       <entry>Description</entry>
4913      </row>
4914     </thead>
4915
4916     <tbody>
4917
4918      <row>
4919       <entry><structfield>partrelid</structfield></entry>
4920       <entry><type>oid</type></entry>
4921       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4922       <entry>The OID of the <structname>pg_class</> entry for this partitioned table</entry>
4923      </row>
4924
4925      <row>
4926       <entry><structfield>partstrat</structfield></entry>
4927       <entry><type>char</type></entry>
4928       <entry></entry>
4929       <entry>
4930        Partitioning strategy; <literal>l</> = list partitioned table,
4931        <literal>r</> = range partitioned table
4932       </entry>
4933      </row>
4934
4935      <row>
4936       <entry><structfield>partnatts</structfield></entry>
4937       <entry><type>int2</type></entry>
4938       <entry></entry>
4939       <entry>The number of columns in partition key</entry>
4940      </row>
4941
4942      <row>
4943       <entry><structfield>partattrs</structfield></entry>
4944       <entry><type>int2vector</type></entry>
4945       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4946       <entry>
4947        This is an array of <structfield>partnatts</structfield> values that
4948        indicate which table columns are part of the partition key.  For
4949        example, a value of <literal>1 3</literal> would mean that the first
4950        and the third table columns make up the partition key.  A zero in this
4951        array indicates that the corresponding partition key column is an
4952        expression, rather than a simple column reference.
4953       </entry>
4954      </row>
4955
4956      <row>
4957       <entry><structfield>partclass</structfield></entry>
4958       <entry><type>oidvector</type></entry>
4959       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4960       <entry>
4961        For each column in the partition key, this contains the OID of the
4962        operator class to use.  See
4963        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4964       </entry>
4965      </row>
4966
4967      <row>
4968       <entry><structfield>partcollation</structfield></entry>
4969       <entry><type>oidvector</type></entry>
4970       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4971       <entry>
4972        For each column in the partition key, this contains the OID of the
4973        the collation to use for partitioning.
4974       </entry>
4975      </row>
4976
4977      <row>
4978       <entry><structfield>partexprs</structfield></entry>
4979       <entry><type>pg_node_tree</type></entry>
4980       <entry></entry>
4981       <entry>
4982        Expression trees (in <function>nodeToString()</function>
4983        representation) for partition key columns that are not simple column
4984        references.  This is a list with one element for each zero
4985        entry in <structfield>partattrs</>.  Null if all partition key columns
4986        are simple references.
4987       </entry>
4988      </row>
4989
4990     </tbody>
4991    </tgroup>
4992   </table>
4993  </sect1>
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</> 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</> for <command>SELECT</>,
5047        <literal>a</> for <command>INSERT</>,
5048        <literal>w</> for <command>UPDATE</>,
5049        <literal>d</> for <command>DELETE</>,
5050        or <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</> are applied only when
5088     <structname>pg_class</>.<structfield>relrowsecurity</> 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</> stores information about functions (or procedures).
5104    See <xref linkend="sql-createfunction">
5105    and <xref linkend="xfunc"> for more information.
5106   </para>
5107
5108   <para>
5109    The table contains data for aggregate functions as well as plain functions.
5110    If <structfield>proisagg</structfield> is true, there should be a matching
5111    row in <structfield>pg_aggregate</structfield>.
5112   </para>
5113
5114   <table>
5115    <title><structname>pg_proc</> Columns</title>
5116
5117    <tgroup cols="4">
5118     <thead>
5119      <row>
5120       <entry>Name</entry>
5121       <entry>Type</entry>
5122       <entry>References</entry>
5123       <entry>Description</entry>
5124      </row>
5125     </thead>
5126
5127     <tbody>
5128      <row>
5129       <entry><structfield>oid</structfield></entry>
5130       <entry><type>oid</type></entry>
5131       <entry></entry>
5132       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5133      </row>
5134
5135      <row>
5136       <entry><structfield>proname</structfield></entry>
5137       <entry><type>name</type></entry>
5138       <entry></entry>
5139       <entry>Name of the function</entry>
5140      </row>
5141
5142      <row>
5143       <entry><structfield>pronamespace</structfield></entry>
5144       <entry><type>oid</type></entry>
5145       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5146       <entry>
5147        The OID of the namespace that contains this function
5148       </entry>
5149      </row>
5150
5151      <row>
5152       <entry><structfield>proowner</structfield></entry>
5153       <entry><type>oid</type></entry>
5154       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5155       <entry>Owner of the function</entry>
5156      </row>
5157
5158      <row>
5159       <entry><structfield>prolang</structfield></entry>
5160       <entry><type>oid</type></entry>
5161       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
5162       <entry>Implementation language or call interface of this function</entry>
5163      </row>
5164
5165      <row>
5166       <entry><structfield>procost</structfield></entry>
5167       <entry><type>float4</type></entry>
5168       <entry></entry>
5169       <entry>Estimated execution cost (in units of
5170        <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
5171        this is cost per row returned</entry>
5172      </row>
5173
5174      <row>
5175       <entry><structfield>prorows</structfield></entry>
5176       <entry><type>float4</type></entry>
5177       <entry></entry>
5178       <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
5179      </row>
5180
5181      <row>
5182       <entry><structfield>provariadic</structfield></entry>
5183       <entry><type>oid</type></entry>
5184       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5185       <entry>Data type of the variadic array parameter's elements,
5186        or zero if the function does not have a variadic parameter</entry>
5187      </row>
5188
5189      <row>
5190       <entry><structfield>protransform</structfield></entry>
5191       <entry><type>regproc</type></entry>
5192       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5193       <entry>Calls to this function can be simplified by this other function
5194        (see <xref linkend="xfunc-transform-functions">)</entry>
5195      </row>
5196
5197      <row>
5198       <entry><structfield>proisagg</structfield></entry>
5199       <entry><type>bool</type></entry>
5200       <entry></entry>
5201       <entry>Function is an aggregate function</entry>
5202      </row>
5203
5204      <row>
5205       <entry><structfield>proiswindow</structfield></entry>
5206       <entry><type>bool</type></entry>
5207       <entry></entry>
5208       <entry>Function is a window function</entry>
5209      </row>
5210
5211      <row>
5212       <entry><structfield>prosecdef</structfield></entry>
5213       <entry><type>bool</type></entry>
5214       <entry></entry>
5215       <entry>Function is a security definer (i.e., a <quote>setuid</>
5216       function)</entry>
5217      </row>
5218
5219      <row>
5220       <entry><structfield>proleakproof</structfield></entry>
5221       <entry><type>bool</type></entry>
5222       <entry></entry>
5223       <entry>
5224        The function has no side effects.  No information about the
5225        arguments is conveyed except via the return value.  Any function
5226        that might throw an error depending on the values of its arguments
5227        is not leak-proof.
5228       </entry>
5229      </row>
5230
5231      <row>
5232       <entry><structfield>proisstrict</structfield></entry>
5233       <entry><type>bool</type></entry>
5234       <entry></entry>
5235       <entry>
5236        Function returns null if any call argument is null.  In that
5237        case the function won't actually be called at all.  Functions
5238        that are not <quote>strict</quote> must be prepared to handle
5239        null inputs.
5240       </entry>
5241      </row>
5242
5243      <row>
5244       <entry><structfield>proretset</structfield></entry>
5245       <entry><type>bool</type></entry>
5246       <entry></entry>
5247       <entry>Function returns a set (i.e., multiple values of the specified
5248       data type)</entry>
5249      </row>
5250
5251      <row>
5252       <entry><structfield>provolatile</structfield></entry>
5253       <entry><type>char</type></entry>
5254       <entry></entry>
5255       <entry>
5256        <structfield>provolatile</structfield> tells whether the function's
5257        result depends only on its input arguments, or is affected by outside
5258        factors.
5259        It is <literal>i</literal> for <quote>immutable</> functions,
5260        which always deliver the same result for the same inputs.
5261        It is <literal>s</literal> for <quote>stable</> functions,
5262        whose results (for fixed inputs) do not change within a scan.
5263        It is <literal>v</literal> for <quote>volatile</> functions,
5264        whose results might change at any time.  (Use <literal>v</literal> also
5265        for functions with side-effects, so that calls to them cannot get
5266        optimized away.)
5267       </entry>
5268      </row>
5269
5270      <row>
5271       <entry><structfield>proparallel</structfield></entry>
5272       <entry><type>char</type></entry>
5273       <entry></entry>
5274       <entry>
5275        <structfield>proparallel</structfield> tells whether the function
5276        can be safely run in parallel mode.
5277        It is <literal>s</literal> for functions which are safe to run in
5278        parallel mode without restriction.
5279        It is <literal>r</literal> for functions which can be run in parallel
5280        mode, but their execution is restricted to the parallel group leader;
5281        parallel worker processes cannot invoke these functions.
5282        It is <literal>u</literal> for functions which are unsafe in parallel
5283        mode; the presence of such a function forces a serial execution plan.
5284       </entry>
5285      </row>
5286
5287      <row>
5288       <entry><structfield>pronargs</structfield></entry>
5289       <entry><type>int2</type></entry>
5290       <entry></entry>
5291       <entry>Number of input arguments</entry>
5292      </row>
5293
5294      <row>
5295       <entry><structfield>pronargdefaults</structfield></entry>
5296       <entry><type>int2</type></entry>
5297       <entry></entry>
5298       <entry>Number of arguments that have defaults</entry>
5299      </row>
5300
5301      <row>
5302       <entry><structfield>prorettype</structfield></entry>
5303       <entry><type>oid</type></entry>
5304       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5305       <entry>Data type of the return value</entry>
5306      </row>
5307
5308      <row>
5309       <entry><structfield>proargtypes</structfield></entry>
5310       <entry><type>oidvector</type></entry>
5311       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5312       <entry>
5313        An array with the data types of the function arguments.  This includes
5314        only input arguments (including <literal>INOUT</literal> and
5315        <literal>VARIADIC</> arguments), and thus represents
5316        the call signature of the function.
5317       </entry>
5318      </row>
5319
5320      <row>
5321       <entry><structfield>proallargtypes</structfield></entry>
5322       <entry><type>oid[]</type></entry>
5323       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5324       <entry>
5325        An array with the data types of the function arguments.  This includes
5326        all arguments (including <literal>OUT</literal> and
5327        <literal>INOUT</literal> arguments); however, if all the
5328        arguments are <literal>IN</literal> arguments, this field will be null.
5329        Note that subscripting is 1-based, whereas for historical reasons
5330        <structfield>proargtypes</> is subscripted from 0.
5331       </entry>
5332      </row>
5333
5334      <row>
5335       <entry><structfield>proargmodes</structfield></entry>
5336       <entry><type>char[]</type></entry>
5337       <entry></entry>
5338       <entry>
5339         An array with the modes of the function arguments, encoded as
5340         <literal>i</literal> for <literal>IN</> arguments,
5341         <literal>o</literal> for <literal>OUT</> arguments,
5342         <literal>b</literal> for <literal>INOUT</> arguments,
5343         <literal>v</literal> for <literal>VARIADIC</> arguments,
5344         <literal>t</literal> for <literal>TABLE</> arguments.
5345         If all the arguments are <literal>IN</literal> arguments,
5346         this field will be null.
5347         Note that subscripts correspond to positions of
5348         <structfield>proallargtypes</> not <structfield>proargtypes</>.
5349       </entry>
5350      </row>
5351
5352      <row>
5353       <entry><structfield>proargnames</structfield></entry>
5354       <entry><type>text[]</type></entry>
5355       <entry></entry>
5356       <entry>
5357         An array with the names of the function arguments.
5358         Arguments without a name are set to empty strings in the array.
5359         If none of the arguments have a name, this field will be null.
5360         Note that subscripts correspond to positions of
5361         <structfield>proallargtypes</> not <structfield>proargtypes</>.
5362       </entry>
5363      </row>
5364
5365      <row>
5366       <entry><structfield>proargdefaults</structfield></entry>
5367       <entry><type>pg_node_tree</type></entry>
5368       <entry></entry>
5369       <entry>
5370        Expression trees (in <function>nodeToString()</function> representation)
5371        for default values.  This is a list with
5372        <structfield>pronargdefaults</> elements, corresponding to the last
5373        <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5374        <replaceable>N</> <structfield>proargtypes</> positions).
5375        If none of the arguments have defaults, this field will be null.
5376       </entry>
5377      </row>
5378
5379      <row>
5380       <entry><structfield>protrftypes</structfield></entry>
5381       <entry><type>oid[]</type></entry>
5382       <entry></entry>
5383       <entry>
5384        Data type OIDs for which to apply transforms.
5385       </entry>
5386      </row>
5387
5388      <row>
5389       <entry><structfield>prosrc</structfield></entry>
5390       <entry><type>text</type></entry>
5391       <entry></entry>
5392       <entry>
5393        This tells the function handler how to invoke the function.  It
5394        might be the actual source code of the function for interpreted
5395        languages, a link symbol, a file name, or just about anything
5396        else, depending on the implementation language/call convention.
5397       </entry>
5398      </row>
5399
5400      <row>
5401       <entry><structfield>probin</structfield></entry>
5402       <entry><type>text</type></entry>
5403       <entry></entry>
5404       <entry>
5405        Additional information about how to invoke the function.
5406        Again, the interpretation is language-specific.
5407       </entry>
5408      </row>
5409
5410      <row>
5411       <entry><structfield>proconfig</structfield></entry>
5412       <entry><type>text[]</type></entry>
5413       <entry></entry>
5414       <entry>Function's local settings for run-time configuration variables</entry>
5415      </row>
5416
5417      <row>
5418       <entry><structfield>proacl</structfield></entry>
5419       <entry><type>aclitem[]</type></entry>
5420       <entry></entry>
5421       <entry>
5422        Access privileges; see
5423        <xref linkend="sql-grant"> and
5424        <xref linkend="sql-revoke">
5425        for details
5426       </entry>
5427      </row>
5428     </tbody>
5429    </tgroup>
5430   </table>
5431
5432   <para>
5433    For compiled functions, both built-in and dynamically loaded,
5434    <structfield>prosrc</structfield> contains the function's C-language
5435    name (link symbol).  For all other currently-known language types,
5436    <structfield>prosrc</structfield> contains the function's source
5437    text.  <structfield>probin</structfield> is unused except for
5438    dynamically-loaded C functions, for which it gives the name of the
5439    shared library file containing the function.
5440   </para>
5441
5442  </sect1>
5443
5444  <sect1 id="catalog-pg-publication">
5445   <title><structname>pg_publication</structname></title>
5446
5447   <indexterm zone="catalog-pg-publication">
5448    <primary>pg_publication</primary>
5449   </indexterm>
5450
5451   <para>
5452    The catalog <structname>pg_publication</structname> contains all
5453    publications created in the database.  For more on publications see
5454    <xref linkend="logical-replication-publication">.
5455   </para>
5456
5457   <table>
5458    <title><structname>pg_publication</structname> Columns</title>
5459
5460    <tgroup cols="4">
5461     <thead>
5462      <row>
5463       <entry>Name</entry>
5464       <entry>Type</entry>
5465       <entry>References</entry>
5466       <entry>Description</entry>
5467      </row>
5468     </thead>
5469
5470     <tbody>
5471      <row>
5472       <entry><structfield>oid</structfield></entry>
5473       <entry><type>oid</type></entry>
5474       <entry></entry>
5475       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5476      </row>
5477
5478      <row>
5479       <entry><structfield>pubname</structfield></entry>
5480       <entry><type>Name</type></entry>
5481       <entry></entry>
5482       <entry>Name of the publication</entry>
5483      </row>
5484
5485      <row>
5486       <entry><structfield>pubowner</structfield></entry>
5487       <entry><type>oid</type></entry>
5488       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5489       <entry>Owner of the publication</entry>
5490      </row>
5491
5492      <row>
5493       <entry><structfield>puballtables</structfield></entry>
5494       <entry><type>bool</type></entry>
5495       <entry></entry>
5496       <entry>If true, this publication automatically includes all tables
5497        in the database, including any that will be created in the future.
5498       </entry>
5499      </row>
5500
5501      <row>
5502       <entry><structfield>pubinsert</structfield></entry>
5503       <entry><type>bool</type></entry>
5504       <entry></entry>
5505       <entry>If true, <command>INSERT</command> operations are replicated for
5506        tables in the publication.</entry>
5507      </row>
5508
5509      <row>
5510       <entry><structfield>pubupdate</structfield></entry>
5511       <entry><type>bool</type></entry>
5512       <entry></entry>
5513       <entry>If true, <command>UPDATE</command> operations are replicated for
5514        tables in the publication.</entry>
5515      </row>
5516
5517      <row>
5518       <entry><structfield>pubdelete</structfield></entry>
5519       <entry><type>bool</type></entry>
5520       <entry></entry>
5521       <entry>If true, <command>DELETE</command> operations are replicated for
5522        tables in the publication.</entry>
5523      </row>
5524     </tbody>
5525    </tgroup>
5526   </table>
5527  </sect1>
5528
5529  <sect1 id="catalog-pg-publication-rel">
5530   <title><structname>pg_publication_rel</structname></title>
5531
5532   <indexterm zone="catalog-pg-publication-rel">
5533    <primary>pg_publication_rel</primary>
5534   </indexterm>
5535
5536   <para>
5537    The catalog <structname>pg_publication_rel</structname> contains the
5538    mapping between relations and publications in the database.  This is a
5539    many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
5540    for a more user-friendly view of this information.
5541   </para>
5542
5543   <table>
5544    <title><structname>pg_publication_rel</structname> Columns</title>
5545
5546    <tgroup cols="4">
5547     <thead>
5548      <row>
5549       <entry>Name</entry>
5550       <entry>Type</entry>
5551       <entry>References</entry>
5552       <entry>Description</entry>
5553      </row>
5554     </thead>
5555
5556     <tbody>
5557      <row>
5558       <entry><structfield>prpubid</structfield></entry>
5559       <entry><type>oid</type></entry>
5560       <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
5561       <entry>Reference to publication</entry>
5562      </row>
5563
5564      <row>
5565       <entry><structfield>prrelid</structfield></entry>
5566       <entry><type>oid</type></entry>
5567       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5568       <entry>Reference to relation</entry>
5569      </row>
5570     </tbody>
5571    </tgroup>
5572   </table>
5573  </sect1>
5574
5575  <sect1 id="catalog-pg-range">
5576   <title><structname>pg_range</structname></title>
5577
5578   <indexterm zone="catalog-pg-range">
5579    <primary>pg_range</primary>
5580   </indexterm>
5581
5582   <para>
5583    The catalog <structname>pg_range</structname> stores information about
5584    range types.  This is in addition to the types' entries in
5585    <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5586   </para>
5587
5588   <table>
5589    <title><structname>pg_range</> Columns</title>
5590
5591    <tgroup cols="4">
5592     <thead>
5593      <row>
5594       <entry>Name</entry>
5595       <entry>Type</entry>
5596       <entry>References</entry>
5597       <entry>Description</entry>
5598      </row>
5599     </thead>
5600
5601     <tbody>
5602      <row>
5603       <entry><structfield>rngtypid</structfield></entry>
5604       <entry><type>oid</type></entry>
5605       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5606       <entry>OID of the range type</entry>
5607      </row>
5608
5609      <row>
5610       <entry><structfield>rngsubtype</structfield></entry>
5611       <entry><type>oid</type></entry>
5612       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5613       <entry>OID of the element type (subtype) of this range type</entry>
5614      </row>
5615
5616      <row>
5617       <entry><structfield>rngcollation</structfield></entry>
5618       <entry><type>oid</type></entry>
5619       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5620       <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5621      </row>
5622
5623      <row>
5624       <entry><structfield>rngsubopc</structfield></entry>
5625       <entry><type>oid</type></entry>
5626       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5627       <entry>OID of the subtype's operator class used for range comparisons</entry>
5628      </row>
5629
5630      <row>
5631       <entry><structfield>rngcanonical</structfield></entry>
5632       <entry><type>regproc</type></entry>
5633       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5634       <entry>OID of the function to convert a range value into canonical form,
5635       or 0 if none</entry>
5636      </row>
5637
5638      <row>
5639       <entry><structfield>rngsubdiff</structfield></entry>
5640       <entry><type>regproc</type></entry>
5641       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5642       <entry>OID of the function to return the difference between two element
5643       values as <type>double precision</type>, or 0 if none</entry>
5644      </row>
5645     </tbody>
5646    </tgroup>
5647   </table>
5648
5649   <para>
5650    <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5651    element type is collatable) determines the sort ordering used by the range
5652    type.  <structfield>rngcanonical</> is used when the element type is
5653    discrete.  <structfield>rngsubdiff</> is optional but should be supplied to
5654    improve performance of GiST indexes on the range type.
5655   </para>
5656
5657  </sect1>
5658
5659  <sect1 id="catalog-pg-replication-origin">
5660   <title><structname>pg_replication_origin</structname></title>
5661
5662   <indexterm zone="catalog-pg-replication-origin">
5663    <primary>pg_replication_origin</primary>
5664   </indexterm>
5665
5666   <para>
5667    The <structname>pg_replication_origin</structname> catalog contains
5668    all replication origins created.  For more on replication origins
5669    see <xref linkend="replication-origins">.
5670   </para>
5671
5672   <table>
5673
5674    <title><structname>pg_replication_origin</structname> Columns</title>
5675
5676    <tgroup cols="4">
5677     <thead>
5678      <row>
5679       <entry>Name</entry>
5680       <entry>Type</entry>
5681       <entry>References</entry>
5682       <entry>Description</entry>
5683      </row>
5684     </thead>
5685
5686     <tbody>
5687      <row>
5688       <entry><structfield>roident</structfield></entry>
5689       <entry><type>Oid</type></entry>
5690       <entry></entry>
5691       <entry>A unique, cluster-wide identifier for the replication
5692       origin. Should never leave the system.</entry>
5693      </row>
5694
5695      <row>
5696       <entry><structfield>roname</structfield></entry>
5697       <entry><type>text</type></entry>
5698       <entry></entry>
5699       <entry>The external, user defined, name of a replication
5700       origin.</entry>
5701      </row>
5702     </tbody>
5703    </tgroup>
5704   </table>
5705  </sect1>
5706
5707  <sect1 id="catalog-pg-rewrite">
5708   <title><structname>pg_rewrite</structname></title>
5709
5710   <indexterm zone="catalog-pg-rewrite">
5711    <primary>pg_rewrite</primary>
5712   </indexterm>
5713
5714   <para>
5715    The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5716   </para>
5717
5718   <table>
5719    <title><structname>pg_rewrite</> Columns</title>
5720
5721    <tgroup cols="4">
5722     <thead>
5723      <row>
5724       <entry>Name</entry>
5725       <entry>Type</entry>
5726       <entry>References</entry>
5727       <entry>Description</entry>
5728      </row>
5729     </thead>
5730
5731     <tbody>
5732      <row>
5733       <entry><structfield>oid</structfield></entry>
5734       <entry><type>oid</type></entry>
5735       <entry></entry>
5736       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5737      </row>
5738
5739      <row>
5740       <entry><structfield>rulename</structfield></entry>
5741       <entry><type>name</type></entry>
5742       <entry></entry>
5743       <entry>Rule name</entry>
5744      </row>
5745
5746      <row>
5747       <entry><structfield>ev_class</structfield></entry>
5748       <entry><type>oid</type></entry>
5749       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5750       <entry>The table this rule is for</entry>
5751      </row>
5752
5753      <row>
5754       <entry><structfield>ev_type</structfield></entry>
5755       <entry><type>char</type></entry>
5756       <entry></entry>
5757       <entry>
5758        Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5759        <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5760        <command>DELETE</>
5761       </entry>
5762      </row>
5763
5764      <row>
5765       <entry><structfield>ev_enabled</structfield></entry>
5766       <entry><type>char</type></entry>
5767       <entry></entry>
5768       <entry>
5769        Controls in which <xref linkend="guc-session-replication-role"> modes
5770        the rule fires.
5771        <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5772        <literal>D</> = rule is disabled,
5773        <literal>R</> = rule fires in <quote>replica</> mode,
5774        <literal>A</> = rule fires always.
5775       </entry>
5776      </row>
5777
5778      <row>
5779       <entry><structfield>is_instead</structfield></entry>
5780       <entry><type>bool</type></entry>
5781       <entry></entry>
5782       <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5783      </row>
5784
5785      <row>
5786       <entry><structfield>ev_qual</structfield></entry>
5787       <entry><type>pg_node_tree</type></entry>
5788       <entry></entry>
5789       <entry>
5790        Expression tree (in the form of a
5791        <function>nodeToString()</function> representation) for the
5792        rule's qualifying condition
5793       </entry>
5794      </row>
5795
5796      <row>
5797       <entry><structfield>ev_action</structfield></entry>
5798       <entry><type>pg_node_tree</type></entry>
5799       <entry></entry>
5800       <entry>
5801        Query tree (in the form of a
5802        <function>nodeToString()</function> representation) for the
5803        rule's action
5804       </entry>
5805      </row>
5806     </tbody>
5807    </tgroup>
5808   </table>
5809
5810   <note>
5811    <para>
5812     <literal>pg_class.relhasrules</literal>
5813     must be true if a table has any rules in this catalog.
5814    </para>
5815   </note>
5816
5817  </sect1>
5818
5819  <sect1 id="catalog-pg-seclabel">
5820   <title><structname>pg_seclabel</structname></title>
5821
5822   <indexterm zone="catalog-pg-seclabel">
5823    <primary>pg_seclabel</primary>
5824   </indexterm>
5825
5826   <para>
5827    The catalog <structname>pg_seclabel</structname> stores security
5828    labels on database objects.  Security labels can be manipulated
5829    with the <xref linkend="sql-security-label"> command.  For an easier
5830    way to view security labels, see <xref linkend="view-pg-seclabels">.
5831   </para>
5832
5833   <para>
5834    See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5835    which performs a similar function for security labels of database objects
5836    that are shared across a database cluster.
5837   </para>
5838
5839   <table>
5840    <title><structname>pg_seclabel</structname> Columns</title>
5841
5842    <tgroup cols="4">
5843     <thead>
5844      <row>
5845       <entry>Name</entry>
5846       <entry>Type</entry>
5847       <entry>References</entry>
5848       <entry>Description</entry>
5849      </row>
5850     </thead>
5851
5852     <tbody>
5853      <row>
5854       <entry><structfield>objoid</structfield></entry>
5855       <entry><type>oid</type></entry>
5856       <entry>any OID column</entry>
5857       <entry>The OID of the object this security label pertains to</entry>
5858      </row>
5859
5860      <row>
5861       <entry><structfield>classoid</structfield></entry>
5862       <entry><type>oid</type></entry>
5863       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5864       <entry>The OID of the system catalog this object appears in</entry>
5865      </row>
5866
5867      <row>
5868       <entry><structfield>objsubid</structfield></entry>
5869       <entry><type>int4</type></entry>
5870       <entry></entry>
5871       <entry>
5872        For a security label on a table column, this is the column number (the
5873        <structfield>objoid</> and <structfield>classoid</> refer to
5874        the table itself).  For all other object types, this column is
5875        zero.
5876       </entry>
5877      </row>
5878
5879      <row>
5880       <entry><structfield>provider</structfield></entry>
5881       <entry><type>text</type></entry>
5882       <entry></entry>
5883       <entry>The label provider associated with this label.</entry>
5884      </row>
5885
5886      <row>
5887       <entry><structfield>label</structfield></entry>
5888       <entry><type>text</type></entry>
5889       <entry></entry>
5890       <entry>The security label applied to this object.</entry>
5891      </row>
5892     </tbody>
5893    </tgroup>
5894   </table>
5895  </sect1>
5896
5897  <sect1 id="catalog-pg-sequence">
5898   <title><structname>pg_sequence</structname></title>
5899
5900   <indexterm zone="catalog-pg-sequence">
5901    <primary>pg_sequence</primary>
5902   </indexterm>
5903
5904   <para>
5905    The catalog <structname>pg_sequence</structname> contains information about
5906    sequences.  Some of the information about sequences, such as the name and
5907    the schema, is in <structname>pg_class</structname>.
5908   </para>
5909
5910   <table>
5911    <title><structname>pg_sequence</> Columns</title>
5912
5913    <tgroup cols="4">
5914     <thead>
5915      <row>
5916       <entry>Name</entry>
5917       <entry>Type</entry>
5918       <entry>References</entry>
5919       <entry>Description</entry>
5920      </row>
5921     </thead>
5922
5923     <tbody>
5924      <row>
5925       <entry><structfield>seqrelid</structfield></entry>
5926       <entry><type>oid</type></entry>
5927       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5928       <entry>The OID of the <structname>pg_class</> entry for this sequence</entry>
5929      </row>
5930
5931      <row>
5932       <entry><structfield>seqtypid</structfield></entry>
5933       <entry><type>oid</type></entry>
5934       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5935       <entry>Data type of the sequence</entry>
5936      </row>
5937
5938      <row>
5939       <entry><structfield>seqstart</structfield></entry>
5940       <entry><type>int8</type></entry>
5941       <entry></entry>
5942       <entry>Start value of the sequence</entry>
5943      </row>
5944
5945      <row>
5946       <entry><structfield>seqincrement</structfield></entry>
5947       <entry><type>int8</type></entry>
5948       <entry></entry>
5949       <entry>Increment value of the sequence</entry>
5950      </row>
5951
5952      <row>
5953       <entry><structfield>seqmax</structfield></entry>
5954       <entry><type>int8</type></entry>
5955       <entry></entry>
5956       <entry>Maximum value of the sequence</entry>
5957      </row>
5958
5959      <row>
5960       <entry><structfield>seqmin</structfield></entry>
5961       <entry><type>int8</type></entry>
5962       <entry></entry>
5963       <entry>Minimum value of the sequence</entry>
5964      </row>
5965
5966      <row>
5967       <entry><structfield>seqcache</structfield></entry>
5968       <entry><type>int8</type></entry>
5969       <entry></entry>
5970       <entry>Cache size of the sequence</entry>
5971      </row>
5972
5973      <row>
5974       <entry><structfield>seqcycle</structfield></entry>
5975       <entry><type>bool</type></entry>
5976       <entry></entry>
5977       <entry>Whether the sequence cycles</entry>
5978      </row>
5979     </tbody>
5980    </tgroup>
5981   </table>
5982  </sect1>
5983
5984  <sect1 id="catalog-pg-shdepend">
5985   <title><structname>pg_shdepend</structname></title>
5986
5987   <indexterm zone="catalog-pg-shdepend">
5988    <primary>pg_shdepend</primary>
5989   </indexterm>
5990
5991   <para>
5992    The catalog <structname>pg_shdepend</structname> records the
5993    dependency relationships between database objects and shared objects,
5994    such as roles.  This information allows
5995    <productname>PostgreSQL</productname> to ensure that those objects are
5996    unreferenced before attempting to delete them.
5997   </para>
5998
5999   <para>
6000    See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
6001    which performs a similar function for dependencies involving objects
6002    within a single database.
6003   </para>
6004
6005   <para>
6006    Unlike most system catalogs, <structname>pg_shdepend</structname>
6007    is shared across all databases of a cluster: there is only one
6008    copy of <structname>pg_shdepend</structname> per cluster, not
6009    one per database.
6010   </para>
6011
6012   <table>
6013    <title><structname>pg_shdepend</> Columns</title>
6014
6015    <tgroup cols="4">
6016     <thead>
6017      <row>
6018       <entry>Name</entry>
6019       <entry>Type</entry>
6020       <entry>References</entry>
6021       <entry>Description</entry>
6022      </row>
6023     </thead>
6024
6025     <tbody>
6026      <row>
6027       <entry><structfield>dbid</structfield></entry>
6028       <entry><type>oid</type></entry>
6029       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6030       <entry>The OID of the database the dependent object is in,
6031        or zero for a shared object</entry>
6032      </row>
6033
6034      <row>
6035       <entry><structfield>classid</structfield></entry>
6036       <entry><type>oid</type></entry>
6037       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6038       <entry>The OID of the system catalog the dependent object is in</entry>
6039      </row>
6040
6041      <row>
6042       <entry><structfield>objid</structfield></entry>
6043       <entry><type>oid</type></entry>
6044       <entry>any OID column</entry>
6045       <entry>The OID of the specific dependent object</entry>
6046      </row>
6047
6048      <row>
6049       <entry><structfield>objsubid</structfield></entry>
6050       <entry><type>int4</type></entry>
6051       <entry></entry>
6052       <entry>
6053        For a table column, this is the column number (the
6054        <structfield>objid</> and <structfield>classid</> refer to the
6055        table itself).  For all other object types, this column is zero.
6056       </entry>
6057      </row>
6058
6059      <row>
6060       <entry><structfield>refclassid</structfield></entry>
6061       <entry><type>oid</type></entry>
6062       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6063       <entry>The OID of the system catalog the referenced object is in
6064        (must be a shared catalog)</entry>
6065      </row>
6066
6067      <row>
6068       <entry><structfield>refobjid</structfield></entry>
6069       <entry><type>oid</type></entry>
6070       <entry>any OID column</entry>
6071       <entry>The OID of the specific referenced object</entry>
6072      </row>
6073
6074      <row>
6075       <entry><structfield>deptype</structfield></entry>
6076       <entry><type>char</type></entry>
6077       <entry></entry>
6078       <entry>
6079        A code defining the specific semantics of this dependency relationship; see text
6080       </entry>
6081      </row>
6082
6083     </tbody>
6084    </tgroup>
6085   </table>
6086
6087   <para>
6088    In all cases, a <structname>pg_shdepend</structname> entry indicates that
6089    the referenced object cannot be dropped without also dropping the dependent
6090    object.  However, there are several subflavors identified by
6091    <structfield>deptype</>:
6092
6093    <variablelist>
6094     <varlistentry>
6095      <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
6096      <listitem>
6097       <para>
6098        The referenced object (which must be a role) is the owner of the
6099        dependent object.
6100       </para>
6101      </listitem>
6102     </varlistentry>
6103
6104     <varlistentry>
6105      <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
6106      <listitem>
6107       <para>
6108        The referenced object (which must be a role) is mentioned in the
6109        ACL (access control list, i.e., privileges list) of the
6110        dependent object.  (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
6111        not made for the owner of the object, since the owner will have
6112        a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
6113       </para>
6114      </listitem>
6115     </varlistentry>
6116
6117     <varlistentry>
6118      <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
6119      <listitem>
6120       <para>
6121        The referenced object (which must be a role) is mentioned as the
6122        target of a dependent policy object.
6123       </para>
6124      </listitem>
6125     </varlistentry>
6126
6127     <varlistentry>
6128      <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
6129      <listitem>
6130       <para>
6131        There is no dependent object; this type of entry is a signal
6132        that the system itself depends on the referenced object, and so
6133        that object must never be deleted.  Entries of this type are
6134        created only by <command>initdb</command>.  The columns for the
6135        dependent object contain zeroes.
6136       </para>
6137      </listitem>
6138     </varlistentry>
6139    </variablelist>
6140
6141    Other dependency flavors might be needed in future.  Note in particular
6142    that the current definition only supports roles as referenced objects.
6143   </para>
6144
6145  </sect1>
6146
6147  <sect1 id="catalog-pg-shdescription">
6148   <title><structname>pg_shdescription</structname></title>
6149
6150   <indexterm zone="catalog-pg-shdescription">
6151    <primary>pg_shdescription</primary>
6152   </indexterm>
6153
6154   <para>
6155    The catalog <structname>pg_shdescription</structname> stores optional
6156    descriptions (comments) for shared database objects.  Descriptions can be
6157    manipulated with the <xref linkend="sql-comment"> command and viewed with
6158    <application>psql</application>'s <literal>\d</literal> commands.
6159   </para>
6160
6161   <para>
6162    See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6163    which performs a similar function for descriptions involving objects
6164    within a single database.
6165   </para>
6166
6167   <para>
6168    Unlike most system catalogs, <structname>pg_shdescription</structname>
6169    is shared across all databases of a cluster: there is only one
6170    copy of <structname>pg_shdescription</structname> per cluster, not
6171    one per database.
6172   </para>
6173
6174   <table>
6175    <title><structname>pg_shdescription</> Columns</title>
6176
6177    <tgroup cols="4">
6178     <thead>
6179      <row>
6180       <entry>Name</entry>
6181       <entry>Type</entry>
6182       <entry>References</entry>
6183       <entry>Description</entry>
6184      </row>
6185     </thead>
6186
6187     <tbody>
6188      <row>
6189       <entry><structfield>objoid</structfield></entry>
6190       <entry><type>oid</type></entry>
6191       <entry>any OID column</entry>
6192       <entry>The OID of the object this description pertains to</entry>
6193      </row>
6194
6195      <row>
6196       <entry><structfield>classoid</structfield></entry>
6197       <entry><type>oid</type></entry>
6198       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6199       <entry>The OID of the system catalog this object appears in</entry>
6200      </row>
6201
6202      <row>
6203       <entry><structfield>description</structfield></entry>
6204       <entry><type>text</type></entry>
6205       <entry></entry>
6206       <entry>Arbitrary text that serves as the description of this object</entry>
6207      </row>
6208     </tbody>
6209    </tgroup>
6210   </table>
6211
6212  </sect1>
6213
6214  <sect1 id="catalog-pg-shseclabel">
6215   <title><structname>pg_shseclabel</structname></title>
6216
6217   <indexterm zone="catalog-pg-shseclabel">
6218    <primary>pg_shseclabel</primary>
6219   </indexterm>
6220
6221   <para>
6222    The catalog <structname>pg_shseclabel</structname> stores security
6223    labels on shared database objects.  Security labels can be manipulated
6224    with the <xref linkend="sql-security-label"> command.  For an easier
6225    way to view security labels, see <xref linkend="view-pg-seclabels">.
6226   </para>
6227
6228   <para>
6229    See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6230    which performs a similar function for security labels involving objects
6231    within a single database.
6232   </para>
6233
6234   <para>
6235    Unlike most system catalogs, <structname>pg_shseclabel</structname>
6236    is shared across all databases of a cluster: there is only one
6237    copy of <structname>pg_shseclabel</structname> per cluster, not
6238    one per database.
6239   </para>
6240
6241   <table>
6242    <title><structname>pg_shseclabel</structname> Columns</title>
6243    <tgroup cols="4">
6244     <thead>
6245      <row>
6246       <entry>Name</entry>
6247       <entry>Type</entry>
6248       <entry>References</entry>
6249       <entry>Description</entry>
6250      </row>
6251     </thead>
6252     <tbody>
6253      <row>
6254       <entry><structfield>objoid</structfield></entry>
6255       <entry><type>oid</type></entry>
6256       <entry>any OID column</entry>
6257       <entry>The OID of the object this security label pertains to</entry>
6258      </row>
6259      <row>
6260       <entry><structfield>classoid</structfield></entry>
6261       <entry><type>oid</type></entry>
6262       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6263       <entry>The OID of the system catalog this object appears in</entry>
6264      </row>
6265      <row>
6266       <entry><structfield>provider</structfield></entry>
6267       <entry><type>text</type></entry>
6268       <entry></entry>
6269       <entry>The label provider associated with this label.</entry>
6270      </row>
6271      <row>
6272       <entry><structfield>label</structfield></entry>
6273       <entry><type>text</type></entry>
6274       <entry></entry>
6275       <entry>The security label applied to this object.</entry>
6276      </row>
6277     </tbody>
6278    </tgroup>
6279   </table>
6280  </sect1>
6281
6282  <sect1 id="catalog-pg-statistic">
6283   <title><structname>pg_statistic</structname></title>
6284
6285   <indexterm zone="catalog-pg-statistic">
6286    <primary>pg_statistic</primary>
6287   </indexterm>
6288
6289   <para>
6290    The catalog <structname>pg_statistic</structname> stores
6291    statistical data about the contents of the database.  Entries are
6292    created by <xref linkend="sql-analyze">
6293    and subsequently used by the query planner.  Note that all the
6294    statistical data is inherently approximate, even assuming that it
6295    is up-to-date.
6296   </para>
6297
6298   <para>
6299    Normally there is one entry, with <structfield>stainherit</> =
6300    <literal>false</>, for each table column that has been analyzed.
6301    If the table has inheritance children, a second entry with
6302    <structfield>stainherit</> = <literal>true</> is also created.  This row
6303    represents the column's statistics over the inheritance tree, i.e.,
6304    statistics for the data you'd see with
6305    <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
6306    whereas the <structfield>stainherit</> = <literal>false</> row represents
6307    the results of
6308    <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
6309   </para>
6310
6311   <para>
6312    <structname>pg_statistic</structname> also stores statistical data about
6313    the values of index expressions.  These are described as if they were
6314    actual data columns; in particular, <structfield>starelid</structfield>
6315    references the index.  No entry is made for an ordinary non-expression
6316    index column, however, since it would be redundant with the entry
6317    for the underlying table column.  Currently, entries for index expressions
6318    always have <structfield>stainherit</> = <literal>false</>.
6319   </para>
6320
6321   <para>
6322    Since different kinds of statistics might be appropriate for different
6323    kinds of data, <structname>pg_statistic</structname> is designed not
6324    to assume very much about what sort of statistics it stores.  Only
6325    extremely general statistics (such as nullness) are given dedicated
6326    columns in <structname>pg_statistic</structname>.  Everything else
6327    is stored in <quote>slots</quote>, which are groups of associated columns
6328    whose content is identified by a code number in one of the slot's columns.
6329    For more information see
6330    <filename>src/include/catalog/pg_statistic.h</filename>.
6331   </para>
6332
6333   <para>
6334    <structname>pg_statistic</structname> should not be readable by the
6335    public, since even statistical information about a table's contents
6336    might be considered sensitive.  (Example: minimum and maximum values
6337    of a salary column might be quite interesting.)
6338    <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6339    is a publicly readable view on
6340    <structname>pg_statistic</structname> that only exposes information
6341    about those tables that are readable by the current user.
6342   </para>
6343
6344   <table>
6345    <title><structname>pg_statistic</> Columns</title>
6346
6347    <tgroup cols="4">
6348     <thead>
6349      <row>
6350       <entry>Name</entry>
6351       <entry>Type</entry>
6352       <entry>References</entry>
6353       <entry>Description</entry>
6354      </row>
6355     </thead>
6356
6357     <tbody>
6358      <row>
6359       <entry><structfield>starelid</structfield></entry>
6360       <entry><type>oid</type></entry>
6361       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6362       <entry>The table or index that the described column belongs to</entry>
6363      </row>
6364
6365      <row>
6366       <entry><structfield>staattnum</structfield></entry>
6367       <entry><type>int2</type></entry>
6368       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6369       <entry>The number of the described column</entry>
6370      </row>
6371
6372      <row>
6373       <entry><structfield>stainherit</structfield></entry>
6374       <entry><type>bool</type></entry>
6375       <entry></entry>
6376       <entry>If true, the stats include inheritance child columns, not just the
6377        values in the specified relation</entry>
6378      </row>
6379
6380      <row>
6381       <entry><structfield>stanullfrac</structfield></entry>
6382       <entry><type>float4</type></entry>
6383       <entry></entry>
6384       <entry>The fraction of the column's entries that are null</entry>
6385      </row>
6386
6387      <row>
6388       <entry><structfield>stawidth</structfield></entry>
6389       <entry><type>int4</type></entry>
6390       <entry></entry>
6391       <entry>The average stored width, in bytes, of nonnull entries</entry>
6392      </row>
6393
6394      <row>
6395       <entry><structfield>stadistinct</structfield></entry>
6396       <entry><type>float4</type></entry>
6397       <entry></entry>
6398       <entry>The number of distinct nonnull data values in the column.
6399       A value greater than zero is the actual number of distinct values.
6400       A value less than zero is the negative of a multiplier for the number
6401       of rows in the table; for example, a column in which about 80% of the
6402       values are nonnull and each nonnull value appears about twice on
6403       average could be represented by <structfield>stadistinct</> = -0.4.
6404       A zero value means the number of distinct values is unknown.
6405       </entry>
6406      </row>
6407
6408      <row>
6409       <entry><structfield>stakind<replaceable>N</></structfield></entry>
6410       <entry><type>int2</type></entry>
6411       <entry></entry>
6412       <entry>
6413        A code number indicating the kind of statistics stored in the
6414        <replaceable>N</>th <quote>slot</quote> of the
6415        <structname>pg_statistic</structname> row.
6416       </entry>
6417      </row>
6418
6419      <row>
6420       <entry><structfield>staop<replaceable>N</></structfield></entry>
6421       <entry><type>oid</type></entry>
6422       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6423       <entry>
6424        An operator used to derive the statistics stored in the
6425        <replaceable>N</>th <quote>slot</quote>.  For example, a
6426        histogram slot would show the <literal>&lt;</literal> operator
6427        that defines the sort order of the data.
6428       </entry>
6429      </row>
6430
6431      <row>
6432       <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6433       <entry><type>float4[]</type></entry>
6434       <entry></entry>
6435       <entry>
6436        Numerical statistics of the appropriate kind for the
6437        <replaceable>N</>th <quote>slot</quote>, or null if the slot
6438        kind does not involve numerical values
6439       </entry>
6440      </row>
6441
6442      <row>
6443       <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6444       <entry><type>anyarray</type></entry>
6445       <entry></entry>
6446       <entry>
6447        Column data values of the appropriate kind for the
6448        <replaceable>N</>th <quote>slot</quote>, or null if the slot
6449        kind does not store any data values.  Each array's element
6450        values are actually of the specific column's data type, or a related
6451        type such as an array's element type, so there is no way to define
6452        these columns' type more specifically than <type>anyarray</>.
6453       </entry>
6454      </row>
6455     </tbody>
6456    </tgroup>
6457   </table>
6458
6459  </sect1>
6460
6461  <sect1 id="catalog-pg-subscription">
6462   <title><structname>pg_subscription</structname></title>
6463
6464   <indexterm zone="catalog-pg-subscription">
6465    <primary>pg_subscription</primary>
6466   </indexterm>
6467
6468   <para>
6469    The catalog <structname>pg_subscription</structname> contains all existing
6470    logical replication subscriptions.  For more information about logical
6471    replication see <xref linkend="logical-replication">.
6472   </para>
6473
6474   <para>
6475    Unlike most system catalogs, <structname>pg_subscription</structname> is
6476    shared across all databases of a cluster: There is only one copy
6477    of <structname>pg_subscription</structname> per cluster, not one per
6478    database.
6479   </para>
6480
6481   <para>
6482    Access to the column <structfield>subconninfo</structfield> is revoked from
6483    normal users, because it could contain plain-text passwords.
6484   </para>
6485
6486   <table>
6487    <title><structname>pg_subscription</structname> Columns</title>
6488
6489    <tgroup cols="4">
6490     <thead>
6491      <row>
6492       <entry>Name</entry>
6493       <entry>Type</entry>
6494       <entry>References</entry>
6495       <entry>Description</entry>
6496      </row>
6497     </thead>
6498
6499     <tbody>
6500      <row>
6501       <entry><structfield>oid</structfield></entry>
6502       <entry><type>oid</type></entry>
6503       <entry></entry>
6504       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6505      </row>
6506
6507      <row>
6508       <entry><structfield>subdbid</structfield></entry>
6509       <entry><type>oid</type></entry>
6510       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6511       <entry>OID of the database which the subscription resides in</entry>
6512      </row>
6513
6514      <row>
6515       <entry><structfield>subname</structfield></entry>
6516       <entry><type>name</type></entry>
6517       <entry></entry>
6518       <entry>Name of the subscription</entry>
6519      </row>
6520
6521      <row>
6522       <entry><structfield>subowner</structfield></entry>
6523       <entry><type>oid</type></entry>
6524       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6525       <entry>Owner of the subscription</entry>
6526      </row>
6527
6528      <row>
6529       <entry><structfield>subenabled</structfield></entry>
6530       <entry><type>bool</type></entry>
6531       <entry></entry>
6532       <entry>If true, the subscription is enabled and should be replicating.</entry>
6533      </row>
6534
6535      <row>
6536       <entry><structfield>subsynccommit</structfield></entry>
6537       <entry><type>text</type></entry>
6538       <entry></entry>
6539       <entry>
6540        Contains the value of the <varname>synchronous_commit</varname>
6541        setting for the subscription workers.
6542       </entry>
6543      </row>
6544
6545      <row>
6546       <entry><structfield>subconninfo</structfield></entry>
6547       <entry><type>text</type></entry>
6548       <entry></entry>
6549       <entry>Connection string to the upstream database</entry>
6550      </row>
6551
6552      <row>
6553       <entry><structfield>subslotname</structfield></entry>
6554       <entry><type>name</type></entry>
6555       <entry></entry>
6556       <entry>Name of the replication slot in the upstream database. Also used
6557        for local replication origin name.</entry>
6558      </row>
6559
6560      <row>
6561       <entry><structfield>subpublications</structfield></entry>
6562       <entry><type>text[]</type></entry>
6563       <entry></entry>
6564       <entry>Array of subscribed publication names. These reference the
6565        publications on the publisher server. For more on publications
6566        see <xref linkend="logical-replication-publication">.
6567       </entry>
6568      </row>
6569     </tbody>
6570    </tgroup>
6571   </table>
6572  </sect1>
6573
6574  <sect1 id="catalog-pg-subscription-rel">
6575   <title><structname>pg_subscription_rel</structname></title>
6576
6577   <indexterm zone="catalog-pg-subscription-rel">
6578    <primary>pg_subscription_rel</primary>
6579   </indexterm>
6580
6581   <para>
6582    The catalog <structname>pg_subscription_rel</structname> contains the
6583    state for each replicated relation in each subscription.  This is a
6584    many-to-many mapping.
6585   </para>
6586
6587   <para>
6588    This catalog only contains tables known to the subscription after running
6589    either <command>CREATE SUBSCRIPTION</command> or
6590    <command>ALTER SUBSCRIPTION ... REFRESH</command>.
6591   </para>
6592
6593   <table>
6594    <title><structname>pg_subscription_rel</structname> Columns</title>
6595
6596    <tgroup cols="4">
6597     <thead>
6598      <row>
6599       <entry>Name</entry>
6600       <entry>Type</entry>
6601       <entry>References</entry>
6602       <entry>Description</entry>
6603      </row>
6604     </thead>
6605
6606     <tbody>
6607      <row>
6608       <entry><structfield>srsubid</structfield></entry>
6609       <entry><type>oid</type></entry>
6610       <entry><literal><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.oid</literal></entry>
6611       <entry>Reference to subscription</entry>
6612      </row>
6613
6614      <row>
6615       <entry><structfield>srrelid</structfield></entry>
6616       <entry><type>oid</type></entry>
6617       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6618       <entry>Reference to relation</entry>
6619      </row>
6620
6621      <row>
6622       <entry><structfield>srsubstate</structfield></entry>
6623       <entry><type>char</type></entry>
6624       <entry></entry>
6625       <entry>
6626        State code:
6627        <literal>i</> = initialize,
6628        <literal>d</> = data is being copied,
6629        <literal>s</> = synchronized,
6630        <literal>r</> = ready (normal replication)
6631       </entry>
6632      </row>
6633
6634      <row>
6635       <entry><structfield>srsublsn</structfield></entry>
6636       <entry><type>pg_lsn</type></entry>
6637       <entry></entry>
6638       <entry>
6639        End LSN for <literal>s</> and <literal>r</> states.
6640       </entry>
6641      </row>
6642     </tbody>
6643    </tgroup>
6644   </table>
6645  </sect1>
6646
6647  <sect1 id="catalog-pg-tablespace">
6648   <title><structname>pg_tablespace</structname></title>
6649
6650   <indexterm zone="catalog-pg-tablespace">
6651    <primary>pg_tablespace</primary>
6652   </indexterm>
6653
6654   <para>
6655    The catalog <structname>pg_tablespace</structname> stores information
6656    about the available tablespaces.  Tables can be placed in particular
6657    tablespaces to aid administration of disk layout.
6658   </para>
6659
6660   <para>
6661    Unlike most system catalogs, <structname>pg_tablespace</structname>
6662    is shared across all databases of a cluster: there is only one
6663    copy of <structname>pg_tablespace</structname> per cluster, not
6664    one per database.
6665   </para>
6666
6667   <table>
6668    <title><structname>pg_tablespace</> Columns</title>
6669
6670    <tgroup cols="4">
6671     <thead>
6672      <row>
6673       <entry>Name</entry>
6674       <entry>Type</entry>
6675       <entry>References</entry>
6676       <entry>Description</entry>
6677      </row>
6678     </thead>
6679
6680     <tbody>
6681      <row>
6682       <entry><structfield>oid</structfield></entry>
6683       <entry><type>oid</type></entry>
6684       <entry></entry>
6685       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6686      </row>
6687
6688      <row>
6689       <entry><structfield>spcname</structfield></entry>
6690       <entry><type>name</type></entry>
6691       <entry></entry>
6692       <entry>Tablespace name</entry>
6693      </row>
6694
6695      <row>
6696       <entry><structfield>spcowner</structfield></entry>
6697       <entry><type>oid</type></entry>
6698       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6699       <entry>Owner of the tablespace, usually the user who created it</entry>
6700      </row>
6701
6702      <row>
6703       <entry><structfield>spcacl</structfield></entry>
6704       <entry><type>aclitem[]</type></entry>
6705       <entry></entry>
6706       <entry>
6707        Access privileges; see
6708        <xref linkend="sql-grant"> and
6709        <xref linkend="sql-revoke">
6710        for details
6711       </entry>
6712      </row>
6713
6714      <row>
6715       <entry><structfield>spcoptions</structfield></entry>
6716       <entry><type>text[]</type></entry>
6717       <entry></entry>
6718       <entry>
6719        Tablespace-level options, as <quote>keyword=value</> strings
6720       </entry>
6721      </row>
6722     </tbody>
6723    </tgroup>
6724   </table>
6725  </sect1>
6726
6727
6728  <sect1 id="catalog-pg-transform">
6729   <title><structname>pg_transform</structname></title>
6730
6731   <indexterm zone="catalog-pg-transform">
6732    <primary>pg_transform</primary>
6733   </indexterm>
6734
6735   <para>
6736    The catalog <structname>pg_transform</structname> stores information about
6737    transforms, which are a mechanism to adapt data types to procedural
6738    languages.  See <xref linkend="sql-createtransform"> for more information.
6739   </para>
6740
6741   <table>
6742    <title><structname>pg_transform</> Columns</title>
6743
6744    <tgroup cols="4">
6745     <thead>
6746      <row>
6747       <entry>Name</entry>
6748       <entry>Type</entry>
6749       <entry>References</entry>
6750       <entry>Description</entry>
6751      </row>
6752     </thead>
6753
6754     <tbody>
6755      <row>
6756       <entry><structfield>trftype</structfield></entry>
6757       <entry><type>oid</type></entry>
6758       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6759       <entry>OID of the data type this transform is for</entry>
6760      </row>
6761
6762      <row>
6763       <entry><structfield>trflang</structfield></entry>
6764       <entry><type>oid</type></entry>
6765       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6766       <entry>OID of the language this transform is for</entry>
6767      </row>
6768
6769      <row>
6770       <entry><structfield>trffromsql</structfield></entry>
6771       <entry><type>regproc</type></entry>
6772       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6773       <entry>
6774        The OID of the function to use when converting the data type for input
6775        to the procedural language (e.g., function parameters).  Zero is stored
6776        if this operation is not supported.
6777       </entry>
6778      </row>
6779
6780      <row>
6781       <entry><structfield>trftosql</structfield></entry>
6782       <entry><type>regproc</type></entry>
6783       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6784       <entry>
6785        The OID of the function to use when converting output from the
6786        procedural language (e.g., return values) to the data type.  Zero is
6787        stored if this operation is not supported.
6788       </entry>
6789      </row>
6790     </tbody>
6791    </tgroup>
6792   </table>
6793  </sect1>
6794
6795
6796  <sect1 id="catalog-pg-trigger">
6797   <title><structname>pg_trigger</structname></title>
6798
6799   <indexterm zone="catalog-pg-trigger">
6800    <primary>pg_trigger</primary>
6801   </indexterm>
6802
6803   <para>
6804    The catalog <structname>pg_trigger</structname> stores triggers on tables
6805    and views.
6806    See <xref linkend="sql-createtrigger">
6807    for more information.
6808   </para>
6809
6810   <table>
6811    <title><structname>pg_trigger</> Columns</title>
6812
6813    <tgroup cols="4">
6814     <thead>
6815      <row>
6816       <entry>Name</entry>
6817       <entry>Type</entry>
6818       <entry>References</entry>
6819       <entry>Description</entry>
6820      </row>
6821     </thead>
6822
6823     <tbody>
6824      <row>
6825       <entry><structfield>oid</structfield></entry>
6826       <entry><type>oid</type></entry>
6827       <entry></entry>
6828       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6829      </row>
6830
6831      <row>
6832       <entry><structfield>tgrelid</structfield></entry>
6833       <entry><type>oid</type></entry>
6834       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6835       <entry>The table this trigger is on</entry>
6836      </row>
6837
6838      <row>
6839       <entry><structfield>tgname</structfield></entry>
6840       <entry><type>name</type></entry>
6841       <entry></entry>
6842       <entry>Trigger name (must be unique among triggers of same table)</entry>
6843      </row>
6844
6845      <row>
6846       <entry><structfield>tgfoid</structfield></entry>
6847       <entry><type>oid</type></entry>
6848       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6849       <entry>The function to be called</entry>
6850      </row>
6851
6852      <row>
6853       <entry><structfield>tgtype</structfield></entry>
6854       <entry><type>int2</type></entry>
6855       <entry></entry>
6856       <entry>Bit mask identifying trigger firing conditions</entry>
6857      </row>
6858
6859      <row>
6860       <entry><structfield>tgenabled</structfield></entry>
6861       <entry><type>char</type></entry>
6862       <entry></entry>
6863       <entry>
6864        Controls in which <xref linkend="guc-session-replication-role"> modes
6865        the trigger fires.
6866        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6867        <literal>D</> = trigger is disabled,
6868        <literal>R</> = trigger fires in <quote>replica</> mode,
6869        <literal>A</> = trigger fires always.
6870       </entry>
6871      </row>
6872
6873      <row>
6874       <entry><structfield>tgisinternal</structfield></entry>
6875       <entry><type>bool</type></entry>
6876       <entry></entry>
6877       <entry>True if trigger is internally generated (usually, to enforce
6878        the constraint identified by <structfield>tgconstraint</>)</entry>
6879      </row>
6880
6881      <row>
6882       <entry><structfield>tgconstrrelid</structfield></entry>
6883       <entry><type>oid</type></entry>
6884       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6885       <entry>The table referenced by a referential integrity constraint</entry>
6886      </row>
6887
6888      <row>
6889       <entry><structfield>tgconstrindid</structfield></entry>
6890       <entry><type>oid</type></entry>
6891       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6892       <entry>The index supporting a unique, primary key, referential integrity,
6893        or exclusion constraint</entry>
6894      </row>
6895
6896      <row>
6897       <entry><structfield>tgconstraint</structfield></entry>
6898       <entry><type>oid</type></entry>
6899       <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6900       <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6901      </row>
6902
6903      <row>
6904       <entry><structfield>tgdeferrable</structfield></entry>
6905       <entry><type>bool</type></entry>
6906       <entry></entry>
6907       <entry>True if constraint trigger is deferrable</entry>
6908      </row>
6909
6910      <row>
6911       <entry><structfield>tginitdeferred</structfield></entry>
6912       <entry><type>bool</type></entry>
6913       <entry></entry>
6914       <entry>True if constraint trigger is initially deferred</entry>
6915      </row>
6916
6917      <row>
6918       <entry><structfield>tgnargs</structfield></entry>
6919       <entry><type>int2</type></entry>
6920       <entry></entry>
6921       <entry>Number of argument strings passed to trigger function</entry>
6922      </row>
6923
6924      <row>
6925       <entry><structfield>tgattr</structfield></entry>
6926       <entry><type>int2vector</type></entry>
6927       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6928       <entry>Column numbers, if trigger is column-specific; otherwise an
6929        empty array</entry>
6930      </row>
6931
6932      <row>
6933       <entry><structfield>tgargs</structfield></entry>
6934       <entry><type>bytea</type></entry>
6935       <entry></entry>
6936       <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6937      </row>
6938
6939      <row>
6940       <entry><structfield>tgqual</structfield></entry>
6941       <entry><type>pg_node_tree</type></entry>
6942       <entry></entry>
6943       <entry>Expression tree (in <function>nodeToString()</function>
6944        representation) for the trigger's <literal>WHEN</> condition, or null
6945        if none</entry>
6946      </row>
6947
6948      <row>
6949       <entry><structfield>tgoldtable</structfield></entry>
6950       <entry><type>name</type></entry>
6951       <entry></entry>
6952       <entry><literal>REFERENCING</> clause name for <literal>OLD TABLE</>,
6953        or null if none</entry>
6954      </row>
6955
6956      <row>
6957       <entry><structfield>tgnewtable</structfield></entry>
6958       <entry><type>name</type></entry>
6959       <entry></entry>
6960       <entry><literal>REFERENCING</> clause name for <literal>NEW TABLE</>,
6961        or null if none</entry>
6962      </row>
6963     </tbody>
6964    </tgroup>
6965   </table>
6966
6967   <para>
6968    Currently, column-specific triggering is supported only for
6969    <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6970    only for that event type.  <structfield>tgtype</structfield> might
6971    contain bits for other event types as well, but those are presumed
6972    to be table-wide regardless of what is in <structfield>tgattr</>.
6973   </para>
6974
6975   <note>
6976    <para>
6977     When <structfield>tgconstraint</> is nonzero,
6978     <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6979     <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6980     largely redundant with the referenced <structname>pg_constraint</> entry.
6981     However, it is possible for a non-deferrable trigger to be associated
6982     with a deferrable constraint: foreign key constraints can have some
6983     deferrable and some non-deferrable triggers.
6984    </para>
6985   </note>
6986
6987   <note>
6988    <para>
6989     <literal>pg_class.relhastriggers</literal>
6990     must be true if a relation has any triggers in this catalog.
6991    </para>
6992   </note>
6993
6994  </sect1>
6995
6996
6997  <sect1 id="catalog-pg-ts-config">
6998   <title><structname>pg_ts_config</structname></title>
6999
7000   <indexterm zone="catalog-pg-ts-config">
7001    <primary>pg_ts_config</primary>
7002   </indexterm>
7003
7004   <para>
7005    The <structname>pg_ts_config</structname> catalog contains entries
7006    representing text search configurations.  A configuration specifies
7007    a particular text search parser and a list of dictionaries to use
7008    for each of the parser's output token types.  The parser is shown
7009    in the <structname>pg_ts_config</structname> entry, but the
7010    token-to-dictionary mapping is defined by subsidiary entries in <link
7011    linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
7012   </para>
7013
7014   <para>
7015    <productname>PostgreSQL</productname>'s text search features are
7016    described at length in <xref linkend="textsearch">.
7017   </para>
7018
7019   <table>
7020    <title><structname>pg_ts_config</> Columns</title>
7021
7022    <tgroup cols="4">
7023     <thead>
7024      <row>
7025       <entry>Name</entry>
7026       <entry>Type</entry>
7027       <entry>References</entry>
7028       <entry>Description</entry>
7029      </row>
7030     </thead>
7031
7032     <tbody>
7033      <row>
7034       <entry><structfield>oid</structfield></entry>
7035       <entry><type>oid</type></entry>
7036       <entry></entry>
7037       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7038      </row>
7039
7040      <row>
7041       <entry><structfield>cfgname</structfield></entry>
7042       <entry><type>name</type></entry>
7043       <entry></entry>
7044       <entry>Text search configuration name</entry>
7045      </row>
7046
7047      <row>
7048       <entry><structfield>cfgnamespace</structfield></entry>
7049       <entry><type>oid</type></entry>
7050       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7051       <entry>
7052        The OID of the namespace that contains this configuration
7053       </entry>
7054      </row>
7055
7056      <row>
7057       <entry><structfield>cfgowner</structfield></entry>
7058       <entry><type>oid</type></entry>
7059       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7060       <entry>Owner of the configuration</entry>
7061      </row>
7062
7063      <row>
7064       <entry><structfield>cfgparser</structfield></entry>
7065       <entry><type>oid</type></entry>
7066       <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
7067       <entry>The OID of the text search parser for this configuration</entry>
7068      </row>
7069     </tbody>
7070    </tgroup>
7071   </table>
7072  </sect1>
7073
7074
7075  <sect1 id="catalog-pg-ts-config-map">
7076   <title><structname>pg_ts_config_map</structname></title>
7077
7078   <indexterm zone="catalog-pg-ts-config-map">
7079    <primary>pg_ts_config_map</primary>
7080   </indexterm>
7081
7082   <para>
7083    The <structname>pg_ts_config_map</structname> catalog contains entries
7084    showing which text search dictionaries should be consulted, and in
7085    what order, for each output token type of each text search configuration's
7086    parser.
7087   </para>
7088
7089   <para>
7090    <productname>PostgreSQL</productname>'s text search features are
7091    described at length in <xref linkend="textsearch">.
7092   </para>
7093
7094   <table>
7095    <title><structname>pg_ts_config_map</> Columns</title>
7096
7097    <tgroup cols="4">
7098     <thead>
7099      <row>
7100       <entry>Name</entry>
7101       <entry>Type</entry>
7102       <entry>References</entry>
7103       <entry>Description</entry>
7104      </row>
7105     </thead>
7106
7107     <tbody>
7108      <row>
7109       <entry><structfield>mapcfg</structfield></entry>
7110       <entry><type>oid</type></entry>
7111       <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
7112       <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
7113      </row>
7114
7115      <row>
7116       <entry><structfield>maptokentype</structfield></entry>
7117       <entry><type>integer</type></entry>
7118       <entry></entry>
7119       <entry>A token type emitted by the configuration's parser</entry>
7120      </row>
7121
7122      <row>
7123       <entry><structfield>mapseqno</structfield></entry>
7124       <entry><type>integer</type></entry>
7125       <entry></entry>
7126       <entry>Order in which to consult this entry (lower
7127        <structfield>mapseqno</>s first)</entry>
7128      </row>
7129
7130      <row>
7131       <entry><structfield>mapdict</structfield></entry>
7132       <entry><type>oid</type></entry>
7133       <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
7134       <entry>The OID of the text search dictionary to consult</entry>
7135      </row>
7136     </tbody>
7137    </tgroup>
7138   </table>
7139  </sect1>
7140
7141
7142  <sect1 id="catalog-pg-ts-dict">
7143   <title><structname>pg_ts_dict</structname></title>
7144
7145   <indexterm zone="catalog-pg-ts-dict">
7146    <primary>pg_ts_dict</primary>
7147   </indexterm>
7148
7149   <para>
7150    The <structname>pg_ts_dict</structname> catalog contains entries
7151    defining text search dictionaries.  A dictionary depends on a text
7152    search template, which specifies all the implementation functions
7153    needed; the dictionary itself provides values for the user-settable
7154    parameters supported by the template.  This division of labor allows
7155    dictionaries to be created by unprivileged users.  The parameters
7156    are specified by a text string <structfield>dictinitoption</>,
7157    whose format and meaning vary depending on the template.
7158   </para>
7159
7160   <para>
7161    <productname>PostgreSQL</productname>'s text search features are
7162    described at length in <xref linkend="textsearch">.
7163   </para>
7164
7165   <table>
7166    <title><structname>pg_ts_dict</> Columns</title>
7167
7168    <tgroup cols="4">
7169     <thead>
7170      <row>
7171       <entry>Name</entry>
7172       <entry>Type</entry>
7173       <entry>References</entry>
7174       <entry>Description</entry>
7175      </row>
7176     </thead>
7177
7178     <tbody>
7179      <row>
7180       <entry><structfield>oid</structfield></entry>
7181       <entry><type>oid</type></entry>
7182       <entry></entry>
7183       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7184      </row>
7185
7186      <row>
7187       <entry><structfield>dictname</structfield></entry>
7188       <entry><type>name</type></entry>
7189       <entry></entry>
7190       <entry>Text search dictionary name</entry>
7191      </row>
7192
7193      <row>
7194       <entry><structfield>dictnamespace</structfield></entry>
7195       <entry><type>oid</type></entry>
7196       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7197       <entry>
7198        The OID of the namespace that contains this dictionary
7199       </entry>
7200      </row>
7201
7202      <row>
7203       <entry><structfield>dictowner</structfield></entry>
7204       <entry><type>oid</type></entry>
7205       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7206       <entry>Owner of the dictionary</entry>
7207      </row>
7208
7209      <row>
7210       <entry><structfield>dicttemplate</structfield></entry>
7211       <entry><type>oid</type></entry>
7212       <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
7213       <entry>The OID of the text search template for this dictionary</entry>
7214      </row>
7215
7216      <row>
7217       <entry><structfield>dictinitoption</structfield></entry>
7218       <entry><type>text</type></entry>
7219       <entry></entry>
7220       <entry>Initialization option string for the template</entry>
7221      </row>
7222     </tbody>
7223    </tgroup>
7224   </table>
7225  </sect1>
7226
7227
7228  <sect1 id="catalog-pg-ts-parser">
7229   <title><structname>pg_ts_parser</structname></title>
7230
7231   <indexterm zone="catalog-pg-ts-parser">
7232    <primary>pg_ts_parser</primary>
7233   </indexterm>
7234
7235   <para>
7236    The <structname>pg_ts_parser</structname> catalog contains entries
7237    defining text search parsers.  A parser is responsible for splitting
7238    input text into lexemes and assigning a token type to each lexeme.
7239    Since a parser must be implemented by C-language-level functions,
7240    creation of new parsers is restricted to database superusers.
7241   </para>
7242
7243   <para>
7244    <productname>PostgreSQL</productname>'s text search features are
7245    described at length in <xref linkend="textsearch">.
7246   </para>
7247
7248   <table>
7249    <title><structname>pg_ts_parser</> Columns</title>
7250
7251    <tgroup cols="4">
7252     <thead>
7253      <row>
7254       <entry>Name</entry>
7255       <entry>Type</entry>
7256       <entry>References</entry>
7257       <entry>Description</entry>
7258      </row>
7259     </thead>
7260
7261     <tbody>
7262      <row>
7263       <entry><structfield>oid</structfield></entry>
7264       <entry><type>oid</type></entry>
7265       <entry></entry>
7266       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7267      </row>
7268
7269      <row>
7270       <entry><structfield>prsname</structfield></entry>
7271       <entry><type>name</type></entry>
7272       <entry></entry>
7273       <entry>Text search parser name</entry>
7274      </row>
7275
7276      <row>
7277       <entry><structfield>prsnamespace</structfield></entry>
7278       <entry><type>oid</type></entry>
7279       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7280       <entry>
7281        The OID of the namespace that contains this parser
7282       </entry>
7283      </row>
7284
7285      <row>
7286       <entry><structfield>prsstart</structfield></entry>
7287       <entry><type>regproc</type></entry>
7288       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7289       <entry>OID of the parser's startup function</entry>
7290      </row>
7291
7292      <row>
7293       <entry><structfield>prstoken</structfield></entry>
7294       <entry><type>regproc</type></entry>
7295       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7296       <entry>OID of the parser's next-token function</entry>
7297      </row>
7298
7299      <row>
7300       <entry><structfield>prsend</structfield></entry>
7301       <entry><type>regproc</type></entry>
7302       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7303       <entry>OID of the parser's shutdown function</entry>
7304      </row>
7305
7306      <row>
7307       <entry><structfield>prsheadline</structfield></entry>
7308       <entry><type>regproc</type></entry>
7309       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7310       <entry>OID of the parser's headline function</entry>
7311      </row>
7312
7313      <row>
7314       <entry><structfield>prslextype</structfield></entry>
7315       <entry><type>regproc</type></entry>
7316       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7317       <entry>OID of the parser's lextype function</entry>
7318      </row>
7319     </tbody>
7320    </tgroup>
7321   </table>
7322  </sect1>
7323
7324
7325  <sect1 id="catalog-pg-ts-template">
7326   <title><structname>pg_ts_template</structname></title>
7327
7328   <indexterm zone="catalog-pg-ts-template">
7329    <primary>pg_ts_template</primary>
7330   </indexterm>
7331
7332   <para>
7333    The <structname>pg_ts_template</structname> catalog contains entries
7334    defining text search templates.  A template is the implementation
7335    skeleton for a class of text search dictionaries.
7336    Since a template must be implemented by C-language-level functions,
7337    creation of new templates is restricted to database superusers.
7338   </para>
7339
7340   <para>
7341    <productname>PostgreSQL</productname>'s text search features are
7342    described at length in <xref linkend="textsearch">.
7343   </para>
7344
7345   <table>
7346    <title><structname>pg_ts_template</> Columns</title>
7347
7348    <tgroup cols="4">
7349     <thead>
7350      <row>
7351       <entry>Name</entry>
7352       <entry>Type</entry>
7353       <entry>References</entry>
7354       <entry>Description</entry>
7355      </row>
7356     </thead>
7357
7358     <tbody>
7359      <row>
7360       <entry><structfield>oid</structfield></entry>
7361       <entry><type>oid</type></entry>
7362       <entry></entry>
7363       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7364      </row>
7365
7366      <row>
7367       <entry><structfield>tmplname</structfield></entry>
7368       <entry><type>name</type></entry>
7369       <entry></entry>
7370       <entry>Text search template name</entry>
7371      </row>
7372
7373      <row>
7374       <entry><structfield>tmplnamespace</structfield></entry>
7375       <entry><type>oid</type></entry>
7376       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7377       <entry>
7378        The OID of the namespace that contains this template
7379       </entry>
7380      </row>
7381
7382      <row>
7383       <entry><structfield>tmplinit</structfield></entry>
7384       <entry><type>regproc</type></entry>
7385       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7386       <entry>OID of the template's initialization function</entry>
7387      </row>
7388
7389      <row>
7390       <entry><structfield>tmpllexize</structfield></entry>
7391       <entry><type>regproc</type></entry>
7392       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7393       <entry>OID of the template's lexize function</entry>
7394      </row>
7395     </tbody>
7396    </tgroup>
7397   </table>
7398  </sect1>
7399
7400
7401  <sect1 id="catalog-pg-type">
7402   <title><structname>pg_type</structname></title>
7403
7404   <indexterm zone="catalog-pg-type">
7405    <primary>pg_type</primary>
7406   </indexterm>
7407
7408   <para>
7409    The catalog <structname>pg_type</structname> stores information about data
7410    types.  Base types and enum types (scalar types) are created with
7411    <xref linkend="sql-createtype">, and
7412    domains with
7413    <xref linkend="sql-createdomain">.
7414    A composite type is automatically created for each table in the database, to
7415    represent the row structure of the table.  It is also possible to create
7416    composite types with <command>CREATE TYPE AS</command>.
7417   </para>
7418
7419   <table>
7420    <title><structname>pg_type</> Columns</title>
7421
7422    <tgroup cols="4">
7423     <thead>
7424      <row>
7425       <entry>Name</entry>
7426       <entry>Type</entry>
7427       <entry>References</entry>
7428       <entry>Description</entry>
7429      </row>
7430     </thead>
7431
7432     <tbody>
7433      <row>
7434       <entry><structfield>oid</structfield></entry>
7435       <entry><type>oid</type></entry>
7436       <entry></entry>
7437       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7438      </row>
7439
7440      <row>
7441       <entry><structfield>typname</structfield></entry>
7442       <entry><type>name</type></entry>
7443       <entry></entry>
7444       <entry>Data type name</entry>
7445      </row>
7446
7447      <row>
7448       <entry><structfield>typnamespace</structfield></entry>
7449       <entry><type>oid</type></entry>
7450       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7451       <entry>
7452        The OID of the namespace that contains this type
7453       </entry>
7454      </row>
7455
7456      <row>
7457       <entry><structfield>typowner</structfield></entry>
7458       <entry><type>oid</type></entry>
7459       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7460       <entry>Owner of the type</entry>
7461      </row>
7462
7463      <row>
7464       <entry><structfield>typlen</structfield></entry>
7465       <entry><type>int2</type></entry>
7466       <entry></entry>
7467       <entry>
7468        For a fixed-size type, <structfield>typlen</structfield> is the number
7469        of bytes in the internal representation of the type.  But for a
7470        variable-length type, <structfield>typlen</structfield> is negative.
7471        -1 indicates a <quote>varlena</> type (one that has a length word),
7472        -2 indicates a null-terminated C string.
7473       </entry>
7474      </row>
7475
7476      <row>
7477       <entry><structfield>typbyval</structfield></entry>
7478       <entry><type>bool</type></entry>
7479       <entry></entry>
7480       <entry>
7481        <structfield>typbyval</structfield> determines whether internal
7482        routines pass a value of this type by value or by reference.
7483        <structfield>typbyval</structfield> had better be false if
7484        <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7485        where Datum is 8 bytes).
7486        Variable-length types are always passed by reference. Note that
7487        <structfield>typbyval</structfield> can be false even if the
7488        length would allow pass-by-value.
7489       </entry>
7490      </row>
7491
7492      <row>
7493       <entry><structfield>typtype</structfield></entry>
7494       <entry><type>char</type></entry>
7495       <entry></entry>
7496       <entry>
7497        <structfield>typtype</structfield> is
7498        <literal>b</literal> for a base type,
7499        <literal>c</literal> for a composite type (e.g., a table's row type),
7500        <literal>d</literal> for a domain,
7501        <literal>e</literal> for an enum type,
7502        <literal>p</literal> for a pseudo-type, or
7503        <literal>r</literal> for a range type.
7504        See also <structfield>typrelid</structfield> and
7505        <structfield>typbasetype</structfield>.
7506       </entry>
7507      </row>
7508
7509      <row>
7510       <entry><structfield>typcategory</structfield></entry>
7511       <entry><type>char</type></entry>
7512       <entry></entry>
7513       <entry>
7514        <structfield>typcategory</structfield> is an arbitrary classification
7515        of data types that is used by the parser to determine which implicit
7516        casts should be <quote>preferred</>.
7517        See <xref linkend="catalog-typcategory-table">.
7518       </entry>
7519      </row>
7520
7521      <row>
7522       <entry><structfield>typispreferred</structfield></entry>
7523       <entry><type>bool</type></entry>
7524       <entry></entry>
7525       <entry>
7526        True if the type is a preferred cast target within its
7527        <structfield>typcategory</structfield>
7528       </entry>
7529      </row>
7530
7531      <row>
7532       <entry><structfield>typisdefined</structfield></entry>
7533       <entry><type>bool</type></entry>
7534       <entry></entry>
7535       <entry>
7536        True if the type is defined, false if this is a placeholder
7537        entry for a not-yet-defined type.  When
7538        <structfield>typisdefined</structfield> is false, nothing
7539        except the type name, namespace, and OID can be relied on.
7540       </entry>
7541      </row>
7542
7543      <row>
7544       <entry><structfield>typdelim</structfield></entry>
7545       <entry><type>char</type></entry>
7546       <entry></entry>
7547       <entry>
7548        Character that separates two values of this type when parsing
7549        array input.  Note that the delimiter is associated with the array
7550        element data type, not the array data type.
7551       </entry>
7552      </row>
7553
7554      <row>
7555       <entry><structfield>typrelid</structfield></entry>
7556       <entry><type>oid</type></entry>
7557       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7558       <entry>
7559        If this is a composite type (see
7560        <structfield>typtype</structfield>), then this column points to
7561        the <structname>pg_class</structname> entry that defines the
7562        corresponding table.  (For a free-standing composite type, the
7563        <structname>pg_class</structname> entry doesn't really represent
7564        a table, but it is needed anyway for the type's
7565        <structname>pg_attribute</structname> entries to link to.)
7566        Zero for non-composite types.
7567       </entry>
7568      </row>
7569
7570      <row>
7571       <entry><structfield>typelem</structfield></entry>
7572       <entry><type>oid</type></entry>
7573       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7574       <entry>
7575        If <structfield>typelem</structfield> is not 0 then it
7576        identifies another row in <structname>pg_type</structname>.
7577        The current type can then be subscripted like an array yielding
7578        values of type <structfield>typelem</structfield>.  A
7579        <quote>true</quote> array type is variable length
7580        (<structfield>typlen</structfield> = -1),
7581        but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
7582        also have nonzero <structfield>typelem</structfield>, for example
7583        <type>name</type> and <type>point</type>.
7584        If a fixed-length type has a <structfield>typelem</structfield> then
7585        its internal representation must be some number of values of the
7586        <structfield>typelem</structfield> data type with no other data.
7587        Variable-length array types have a header defined by the array
7588        subroutines.
7589       </entry>
7590      </row>
7591
7592      <row>
7593       <entry><structfield>typarray</structfield></entry>
7594       <entry><type>oid</type></entry>
7595       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7596       <entry>
7597        If <structfield>typarray</structfield> is not 0 then it
7598        identifies another row in <structname>pg_type</structname>, which
7599        is the <quote>true</quote> array type having this type as element
7600       </entry>
7601      </row>
7602
7603      <row>
7604       <entry><structfield>typinput</structfield></entry>
7605       <entry><type>regproc</type></entry>
7606       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7607       <entry>Input conversion function (text format)</entry>
7608      </row>
7609
7610      <row>
7611       <entry><structfield>typoutput</structfield></entry>
7612       <entry><type>regproc</type></entry>
7613       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7614       <entry>Output conversion function (text format)</entry>
7615      </row>
7616
7617      <row>
7618       <entry><structfield>typreceive</structfield></entry>
7619       <entry><type>regproc</type></entry>
7620       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7621       <entry>Input conversion function (binary format), or 0 if none</entry>
7622      </row>
7623
7624      <row>
7625       <entry><structfield>typsend</structfield></entry>
7626       <entry><type>regproc</type></entry>
7627       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7628       <entry>Output conversion function (binary format), or 0 if none</entry>
7629      </row>
7630
7631      <row>
7632       <entry><structfield>typmodin</structfield></entry>
7633       <entry><type>regproc</type></entry>
7634       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7635       <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7636      </row>
7637
7638      <row>
7639       <entry><structfield>typmodout</structfield></entry>
7640       <entry><type>regproc</type></entry>
7641       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7642       <entry>Type modifier output function, or 0 to use the standard format</entry>
7643      </row>
7644
7645      <row>
7646       <entry><structfield>typanalyze</structfield></entry>
7647       <entry><type>regproc</type></entry>
7648       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7649       <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7650      </row>
7651
7652      <row>
7653       <entry><structfield>typalign</structfield></entry>
7654       <entry><type>char</type></entry>
7655       <entry></entry>
7656       <entry><para>
7657
7658        <structfield>typalign</structfield> is the alignment required
7659        when storing a value of this type.  It applies to storage on
7660        disk as well as most representations of the value inside
7661        <productname>PostgreSQL</>.
7662        When multiple values are stored consecutively, such
7663        as in the representation of a complete row on disk, padding is
7664        inserted before a datum of this type so that it begins on the
7665        specified boundary.  The alignment reference is the beginning
7666        of the first datum in the sequence.
7667       </para>
7668
7669       <para>
7670        Possible values are:
7671        <itemizedlist>
7672         <listitem>
7673          <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7674         </listitem>
7675         <listitem>
7676          <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7677         </listitem>
7678         <listitem>
7679          <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7680         </listitem>
7681         <listitem>
7682          <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7683         </listitem>
7684        </itemizedlist>
7685       </para><note>
7686        <para>
7687         For types used in system tables, it is critical that the size
7688         and alignment defined in <structname>pg_type</structname>
7689         agree with the way that the compiler will lay out the column in
7690         a structure representing a table row.
7691        </para>
7692       </note></entry>
7693      </row>
7694
7695      <row>
7696       <entry><structfield>typstorage</structfield></entry>
7697       <entry><type>char</type></entry>
7698       <entry></entry>
7699       <entry><para>
7700        <structfield>typstorage</structfield> tells for varlena
7701        types (those with <structfield>typlen</structfield> = -1) if
7702        the type is prepared for toasting and what the default strategy
7703        for attributes of this type should be.
7704        Possible values are
7705        <itemizedlist>
7706         <listitem>
7707          <para><literal>p</>: Value must always be stored plain.</para>
7708         </listitem>
7709         <listitem>
7710          <para>
7711           <literal>e</>: Value can be stored in a <quote>secondary</quote>
7712           relation (if relation has one, see
7713           <literal>pg_class.reltoastrelid</literal>).
7714          </para>
7715         </listitem>
7716         <listitem>
7717          <para><literal>m</>: Value can be stored compressed inline.</para>
7718         </listitem>
7719         <listitem>
7720          <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7721         </listitem>
7722        </itemizedlist>
7723        Note that <literal>m</> columns can also be moved out to secondary
7724        storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7725        moved first).
7726       </para></entry>
7727      </row>
7728
7729      <row>
7730       <entry><structfield>typnotnull</structfield></entry>
7731       <entry><type>bool</type></entry>
7732       <entry></entry>
7733       <entry><para>
7734        <structfield>typnotnull</structfield> represents a not-null
7735        constraint on a type.  Used for domains only.
7736       </para></entry>
7737      </row>
7738
7739      <row>
7740       <entry><structfield>typbasetype</structfield></entry>
7741       <entry><type>oid</type></entry>
7742       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7743       <entry><para>
7744        If this is a domain (see <structfield>typtype</structfield>), then
7745        <structfield>typbasetype</structfield> identifies the type that this
7746        one is based on.  Zero if this type is not a domain.
7747       </para></entry>
7748      </row>
7749
7750      <row>
7751       <entry><structfield>typtypmod</structfield></entry>
7752       <entry><type>int4</type></entry>
7753       <entry></entry>
7754       <entry><para>
7755        Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7756        to be applied to their base type (-1 if base type does not use a
7757        <literal>typmod</>).  -1 if this type is not a domain.
7758       </para></entry>
7759      </row>
7760
7761      <row>
7762       <entry><structfield>typndims</structfield></entry>
7763       <entry><type>int4</type></entry>
7764       <entry></entry>
7765       <entry><para>
7766        <structfield>typndims</structfield> is the number of array dimensions
7767        for a domain over an array (that is, <structfield>typbasetype</> is
7768        an array type).
7769        Zero for types other than domains over array types.
7770        </para></entry>
7771      </row>
7772
7773      <row>
7774       <entry><structfield>typcollation</structfield></entry>
7775       <entry><type>oid</type></entry>
7776       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7777       <entry><para>
7778        <structfield>typcollation</structfield> specifies the collation
7779        of the type.  If the type does not support collations, this will
7780        be zero.  A base type that supports collations will have
7781        <symbol>DEFAULT_COLLATION_OID</symbol> here.  A domain over a
7782        collatable type can have some other collation OID, if one was
7783        specified for the domain.
7784       </para></entry>
7785      </row>
7786
7787      <row>
7788       <entry><structfield>typdefaultbin</structfield></entry>
7789       <entry><type>pg_node_tree</type></entry>
7790       <entry></entry>
7791       <entry><para>
7792        If <structfield>typdefaultbin</> is not null, it is the
7793        <function>nodeToString()</function>
7794        representation of a default expression for the type.  This is
7795        only used for domains.
7796       </para></entry>
7797      </row>
7798
7799      <row>
7800       <entry><structfield>typdefault</structfield></entry>
7801       <entry><type>text</type></entry>
7802       <entry></entry>
7803       <entry><para>
7804        <structfield>typdefault</> is null if the type has no associated
7805        default value. If <structfield>typdefaultbin</> is not null,
7806        <structfield>typdefault</> must contain a human-readable version of the
7807        default expression represented by <structfield>typdefaultbin</>.  If
7808        <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7809        not, then <structfield>typdefault</> is the external representation of
7810        the type's default value, which can be fed to the type's input
7811        converter to produce a constant.
7812       </para></entry>
7813      </row>
7814
7815      <row>
7816       <entry><structfield>typacl</structfield></entry>
7817       <entry><type>aclitem[]</type></entry>
7818       <entry></entry>
7819       <entry>
7820        Access privileges; see
7821        <xref linkend="sql-grant"> and
7822        <xref linkend="sql-revoke">
7823        for details
7824       </entry>
7825      </row>
7826     </tbody>
7827    </tgroup>
7828   </table>
7829
7830   <para>
7831    <xref linkend="catalog-typcategory-table"> lists the system-defined values
7832    of <structfield>typcategory</>.  Any future additions to this list will
7833    also be upper-case ASCII letters.  All other ASCII characters are reserved
7834    for user-defined categories.
7835   </para>
7836
7837   <table id="catalog-typcategory-table">
7838    <title><structfield>typcategory</> Codes</title>
7839
7840    <tgroup cols="2">
7841     <thead>
7842      <row>
7843       <entry>Code</entry>
7844       <entry>Category</entry>
7845      </row>
7846     </thead>
7847
7848     <tbody>
7849      <row>
7850       <entry><literal>A</literal></entry>
7851       <entry>Array types</entry>
7852      </row>
7853      <row>
7854       <entry><literal>B</literal></entry>
7855       <entry>Boolean types</entry>
7856      </row>
7857      <row>
7858       <entry><literal>C</literal></entry>
7859       <entry>Composite types</entry>
7860      </row>
7861      <row>
7862       <entry><literal>D</literal></entry>
7863       <entry>Date/time types</entry>
7864      </row>
7865      <row>
7866       <entry><literal>E</literal></entry>
7867       <entry>Enum types</entry>
7868      </row>
7869      <row>
7870       <entry><literal>G</literal></entry>
7871       <entry>Geometric types</entry>
7872      </row>
7873      <row>
7874       <entry><literal>I</literal></entry>
7875       <entry>Network address types</entry>
7876      </row>
7877      <row>
7878       <entry><literal>N</literal></entry>
7879       <entry>Numeric types</entry>
7880      </row>
7881      <row>
7882       <entry><literal>P</literal></entry>
7883       <entry>Pseudo-types</entry>
7884      </row>
7885      <row>
7886       <entry><literal>R</literal></entry>
7887       <entry>Range types</entry>
7888      </row>
7889      <row>
7890       <entry><literal>S</literal></entry>
7891       <entry>String types</entry>
7892      </row>
7893      <row>
7894       <entry><literal>T</literal></entry>
7895       <entry>Timespan types</entry>
7896      </row>
7897      <row>
7898       <entry><literal>U</literal></entry>
7899       <entry>User-defined types</entry>
7900      </row>
7901      <row>
7902       <entry><literal>V</literal></entry>
7903       <entry>Bit-string types</entry>
7904      </row>
7905      <row>
7906       <entry><literal>X</literal></entry>
7907       <entry><type>unknown</> type</entry>
7908      </row>
7909     </tbody>
7910    </tgroup>
7911   </table>
7912
7913  </sect1>
7914
7915
7916  <sect1 id="catalog-pg-user-mapping">
7917   <title><structname>pg_user_mapping</structname></title>
7918
7919   <indexterm zone="catalog-pg-user-mapping">
7920    <primary>pg_user_mapping</primary>
7921   </indexterm>
7922
7923   <para>
7924    The catalog <structname>pg_user_mapping</structname> stores
7925    the mappings from local user to remote.  Access to this catalog is
7926    restricted from normal users, use the view
7927    <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7928    instead.
7929   </para>
7930
7931   <table>
7932    <title><structname>pg_user_mapping</> Columns</title>
7933
7934    <tgroup cols="4">
7935     <thead>
7936      <row>
7937       <entry>Name</entry>
7938       <entry>Type</entry>
7939       <entry>References</entry>
7940       <entry>Description</entry>
7941      </row>
7942     </thead>
7943
7944     <tbody>
7945      <row>
7946       <entry><structfield>oid</structfield></entry>
7947       <entry><type>oid</type></entry>
7948       <entry></entry>
7949       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7950      </row>
7951
7952      <row>
7953       <entry><structfield>umuser</structfield></entry>
7954       <entry><type>oid</type></entry>
7955       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7956       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7957      </row>
7958
7959      <row>
7960       <entry><structfield>umserver</structfield></entry>
7961       <entry><type>oid</type></entry>
7962       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7963       <entry>
7964        The OID of the foreign server that contains this mapping
7965       </entry>
7966      </row>
7967
7968      <row>
7969       <entry><structfield>umoptions</structfield></entry>
7970       <entry><type>text[]</type></entry>
7971       <entry></entry>
7972       <entry>
7973        User mapping specific options, as <quote>keyword=value</> strings
7974       </entry>
7975      </row>
7976     </tbody>
7977    </tgroup>
7978   </table>
7979  </sect1>
7980
7981
7982  <sect1 id="views-overview">
7983   <title>System Views</title>
7984
7985   <para>
7986    In addition to the system catalogs, <productname>PostgreSQL</productname>
7987    provides a number of built-in views.  Some system views provide convenient
7988    access to some commonly used queries on the system catalogs.  Other views
7989    provide access to internal server state.
7990   </para>
7991
7992   <para>
7993    The information schema (<xref linkend="information-schema">) provides
7994    an alternative set of views which overlap the functionality of the system
7995    views.  Since the information schema is SQL-standard whereas the views
7996    described here are <productname>PostgreSQL</productname>-specific,
7997    it's usually better to use the information schema if it provides all
7998    the information you need.
7999   </para>
8000
8001   <para>
8002    <xref linkend="view-table"> lists the system views described here.
8003    More detailed documentation of each view follows below.
8004    There are some additional views that provide access to the results of
8005    the statistics collector; they are described in <xref
8006    linkend="monitoring-stats-views-table">.
8007   </para>
8008
8009   <para>
8010    Except where noted, all the views described here are read-only.
8011   </para>
8012
8013   <table id="view-table">
8014    <title>System Views</title>
8015
8016    <tgroup cols="2">
8017     <thead>
8018      <row>
8019       <entry>View Name</entry>
8020       <entry>Purpose</entry>
8021      </row>
8022     </thead>
8023
8024     <tbody>
8025      <row>
8026       <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
8027       <entry>available extensions</entry>
8028      </row>
8029
8030      <row>
8031       <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
8032       <entry>available versions of extensions</entry>
8033      </row>
8034
8035      <row>
8036       <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
8037       <entry>compile-time configuration parameters</entry>
8038      </row>
8039
8040      <row>
8041       <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
8042       <entry>open cursors</entry>
8043      </row>
8044
8045      <row>
8046       <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
8047       <entry>summary of configuration file contents</entry>
8048      </row>
8049
8050      <row>
8051       <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
8052       <entry>groups of database users</entry>
8053      </row>
8054
8055      <row>
8056       <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
8057       <entry>summary of client authentication configuration file contents</entry>
8058      </row>
8059
8060      <row>
8061       <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
8062       <entry>indexes</entry>
8063      </row>
8064
8065      <row>
8066       <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
8067       <entry>locks currently held or awaited</entry>
8068      </row>
8069
8070      <row>
8071       <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
8072       <entry>materialized views</entry>
8073      </row>
8074
8075      <row>
8076       <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
8077       <entry>policies</entry>
8078      </row>
8079
8080      <row>
8081       <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
8082       <entry>prepared statements</entry>
8083      </row>
8084
8085      <row>
8086       <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
8087       <entry>prepared transactions</entry>
8088      </row>
8089
8090      <row>
8091       <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
8092       <entry>publications and their associated tables</entry>
8093      </row>
8094
8095      <row>
8096       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
8097       <entry>information about replication origins, including replication progress</entry>
8098      </row>
8099
8100      <row>
8101       <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
8102       <entry>replication slot information</entry>
8103      </row>
8104
8105      <row>
8106       <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
8107       <entry>database roles</entry>
8108      </row>
8109
8110      <row>
8111       <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
8112       <entry>rules</entry>
8113      </row>
8114
8115      <row>
8116       <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
8117       <entry>security labels</entry>
8118      </row>
8119
8120      <row>
8121       <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
8122       <entry>sequences</entry>
8123      </row>
8124
8125      <row>
8126       <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
8127       <entry>parameter settings</entry>
8128      </row>
8129
8130      <row>
8131       <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
8132       <entry>database users</entry>
8133      </row>
8134
8135      <row>
8136       <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
8137       <entry>planner statistics</entry>
8138      </row>
8139
8140      <row>
8141       <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
8142       <entry>tables</entry>
8143      </row>
8144
8145      <row>
8146       <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
8147       <entry>time zone abbreviations</entry>
8148      </row>
8149
8150      <row>
8151       <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
8152       <entry>time zone names</entry>
8153      </row>
8154
8155      <row>
8156       <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
8157       <entry>database users</entry>
8158      </row>
8159
8160      <row>
8161       <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
8162       <entry>user mappings</entry>
8163      </row>
8164
8165      <row>
8166       <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
8167       <entry>views</entry>
8168      </row>
8169
8170     </tbody>
8171    </tgroup>
8172   </table>
8173  </sect1>
8174
8175  <sect1 id="view-pg-available-extensions">
8176   <title><structname>pg_available_extensions</structname></title>
8177
8178   <indexterm zone="view-pg-available-extensions">
8179    <primary>pg_available_extensions</primary>
8180   </indexterm>
8181
8182   <para>
8183    The <structname>pg_available_extensions</structname> view lists the
8184    extensions that are available for installation.
8185    See also the
8186    <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8187    catalog, which shows the extensions currently installed.
8188   </para>
8189
8190   <table>
8191    <title><structname>pg_available_extensions</> Columns</title>
8192
8193    <tgroup cols="3">
8194     <thead>
8195      <row>
8196       <entry>Name</entry>
8197       <entry>Type</entry>
8198       <entry>Description</entry>
8199      </row>
8200     </thead>
8201
8202     <tbody>
8203      <row>
8204       <entry><structfield>name</structfield></entry>
8205       <entry><type>name</type></entry>
8206       <entry>Extension name</entry>
8207      </row>
8208
8209      <row>
8210       <entry><structfield>default_version</structfield></entry>
8211       <entry><type>text</type></entry>
8212       <entry>Name of default version, or <literal>NULL</literal> if none is
8213        specified</entry>
8214      </row>
8215
8216      <row>
8217       <entry><structfield>installed_version</structfield></entry>
8218       <entry><type>text</type></entry>
8219       <entry>Currently installed version of the extension,
8220        or <literal>NULL</literal> if not installed</entry>
8221      </row>
8222
8223      <row>
8224       <entry><structfield>comment</structfield></entry>
8225       <entry><type>text</type></entry>
8226       <entry>Comment string from the extension's control file</entry>
8227      </row>
8228     </tbody>
8229    </tgroup>
8230   </table>
8231
8232   <para>
8233    The <structname>pg_available_extensions</structname> view is read only.
8234   </para>
8235  </sect1>
8236
8237  <sect1 id="view-pg-available-extension-versions">
8238   <title><structname>pg_available_extension_versions</structname></title>
8239
8240   <indexterm zone="view-pg-available-extension-versions">
8241    <primary>pg_available_extension_versions</primary>
8242   </indexterm>
8243
8244   <para>
8245    The <structname>pg_available_extension_versions</structname> view lists the
8246    specific extension versions that are available for installation.
8247    See also the <link
8248    linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8249    catalog, which shows the extensions currently installed.
8250   </para>
8251
8252   <table>
8253    <title><structname>pg_available_extension_versions</> Columns</title>
8254
8255    <tgroup cols="3">
8256     <thead>
8257      <row>
8258       <entry>Name</entry>
8259       <entry>Type</entry>
8260       <entry>Description</entry>
8261      </row>
8262     </thead>
8263
8264     <tbody>
8265      <row>
8266       <entry><structfield>name</structfield></entry>
8267       <entry><type>name</type></entry>
8268       <entry>Extension name</entry>
8269      </row>
8270
8271      <row>
8272       <entry><structfield>version</structfield></entry>
8273       <entry><type>text</type></entry>
8274       <entry>Version name</entry>
8275      </row>
8276
8277      <row>
8278       <entry><structfield>installed</structfield></entry>
8279       <entry><type>bool</type></entry>
8280       <entry>True if this version of this extension is currently
8281        installed</entry>
8282      </row>
8283
8284      <row>
8285       <entry><structfield>superuser</structfield></entry>
8286       <entry><type>bool</type></entry>
8287       <entry>True if only superusers are allowed to install this extension</entry>
8288      </row>
8289
8290      <row>
8291       <entry><structfield>relocatable</structfield></entry>
8292       <entry><type>bool</type></entry>
8293       <entry>True if extension can be relocated to another schema</entry>
8294      </row>
8295
8296      <row>
8297       <entry><structfield>schema</structfield></entry>
8298       <entry><type>name</type></entry>
8299       <entry>Name of the schema that the extension must be installed into,
8300        or <literal>NULL</literal> if partially or fully relocatable</entry>
8301      </row>
8302
8303      <row>
8304       <entry><structfield>requires</structfield></entry>
8305       <entry><type>name[]</type></entry>
8306       <entry>Names of prerequisite extensions,
8307        or <literal>NULL</literal> if none</entry>
8308      </row>
8309
8310      <row>
8311       <entry><structfield>comment</structfield></entry>
8312       <entry><type>text</type></entry>
8313       <entry>Comment string from the extension's control file</entry>
8314      </row>
8315     </tbody>
8316    </tgroup>
8317   </table>
8318
8319   <para>
8320    The <structname>pg_available_extension_versions</structname> view is read
8321    only.
8322   </para>
8323  </sect1>
8324
8325  <sect1 id="view-pg-config">
8326   <title><structname>pg_config</structname></title>
8327
8328   <indexterm zone="view-pg-config">
8329    <primary>pg_config</primary>
8330   </indexterm>
8331
8332   <para>
8333    The view <structname>pg_config</structname> describes the
8334    compile-time configuration parameters of the currently installed
8335    version of <productname>PostgreSQL</>. It is intended, for example, to
8336    be used by software packages that want to interface to
8337    <productname>PostgreSQL</> to facilitate finding the required header
8338    files and libraries. It provides the same basic information as the
8339    <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
8340    application.
8341   </para>
8342
8343   <para>
8344    By default, the <structname>pg_config</structname> view can be read
8345    only by superusers.
8346   </para>
8347
8348   <table>
8349    <title><structname>pg_config</> Columns</title>
8350    <tgroup cols="3">
8351     <thead>
8352      <row>
8353       <entry>Name</entry>
8354       <entry>Type</entry>
8355       <entry>Description</entry>
8356      </row>
8357     </thead>
8358
8359     <tbody>
8360      <row>
8361       <entry><structfield>name</structfield></entry>
8362       <entry><type>text</type></entry>
8363       <entry>The parameter name</entry>
8364      </row>
8365
8366      <row>
8367       <entry><structfield>setting</structfield></entry>
8368       <entry><type>text</type></entry>
8369       <entry>The parameter value</entry>
8370      </row>
8371     </tbody>
8372    </tgroup>
8373   </table>
8374
8375  </sect1>
8376
8377  <sect1 id="view-pg-cursors">
8378   <title><structname>pg_cursors</structname></title>
8379
8380   <indexterm zone="view-pg-cursors">
8381    <primary>pg_cursors</primary>
8382   </indexterm>
8383
8384   <para>
8385    The <structname>pg_cursors</structname> view lists the cursors that
8386    are currently available. Cursors can be defined in several ways:
8387    <itemizedlist>
8388     <listitem>
8389      <para>
8390       via the <xref linkend="sql-declare">
8391       statement in SQL
8392      </para>
8393     </listitem>
8394
8395     <listitem>
8396      <para>
8397       via the Bind message in the frontend/backend protocol, as
8398       described in <xref linkend="protocol-flow-ext-query">
8399      </para>
8400     </listitem>
8401
8402     <listitem>
8403      <para>
8404       via the Server Programming Interface (SPI), as described in
8405       <xref linkend="spi-interface">
8406      </para>
8407     </listitem>
8408    </itemizedlist>
8409
8410    The <structname>pg_cursors</structname> view displays cursors
8411    created by any of these means. Cursors only exist for the duration
8412    of the transaction that defines them, unless they have been
8413    declared <literal>WITH HOLD</literal>. Therefore non-holdable
8414    cursors are only present in the view until the end of their
8415    creating transaction.
8416
8417    <note>
8418     <para>
8419      Cursors are used internally to implement some of the components
8420      of <productname>PostgreSQL</>, such as procedural languages.
8421      Therefore, the <structname>pg_cursors</> view might include cursors
8422      that have not been explicitly created by the user.
8423     </para>
8424    </note>
8425   </para>
8426
8427   <table>
8428    <title><structname>pg_cursors</> Columns</title>
8429
8430    <tgroup cols="3">
8431     <thead>
8432      <row>
8433       <entry>Name</entry>
8434       <entry>Type</entry>
8435       <entry>Description</entry>
8436      </row>
8437     </thead>
8438
8439     <tbody>
8440      <row>
8441       <entry><structfield>name</structfield></entry>
8442       <entry><type>text</type></entry>
8443       <entry>The name of the cursor</entry>
8444      </row>
8445
8446      <row>
8447       <entry><structfield>statement</structfield></entry>
8448       <entry><type>text</type></entry>
8449       <entry>The verbatim query string submitted to declare this cursor</entry>
8450      </row>
8451
8452      <row>
8453       <entry><structfield>is_holdable</structfield></entry>
8454       <entry><type>boolean</type></entry>
8455       <entry>
8456        <literal>true</literal> if the cursor is holdable (that is, it
8457        can be accessed after the transaction that declared the cursor
8458        has committed); <literal>false</literal> otherwise
8459        </entry>
8460      </row>
8461
8462      <row>
8463       <entry><structfield>is_binary</structfield></entry>
8464       <entry><type>boolean</type></entry>
8465       <entry>
8466        <literal>true</literal> if the cursor was declared
8467        <literal>BINARY</literal>; <literal>false</literal>
8468        otherwise
8469        </entry>
8470      </row>
8471
8472      <row>
8473       <entry><structfield>is_scrollable</structfield></entry>
8474       <entry><type>boolean</type></entry>
8475       <entry>
8476        <literal>true</> if the cursor is scrollable (that is, it
8477        allows rows to be retrieved in a nonsequential manner);
8478        <literal>false</literal> otherwise
8479        </entry>
8480      </row>
8481
8482      <row>
8483       <entry><structfield>creation_time</structfield></entry>
8484       <entry><type>timestamptz</type></entry>
8485       <entry>The time at which the cursor was declared</entry>
8486      </row>
8487     </tbody>
8488    </tgroup>
8489   </table>
8490
8491   <para>
8492    The <structname>pg_cursors</structname> view is read only.
8493   </para>
8494
8495  </sect1>
8496
8497  <sect1 id="view-pg-file-settings">
8498   <title><structname>pg_file_settings</structname></title>
8499
8500   <indexterm zone="view-pg-file-settings">
8501    <primary>pg_file_settings</primary>
8502   </indexterm>
8503
8504   <para>
8505    The view <structname>pg_file_settings</structname> provides a summary of
8506    the contents of the server's configuration file(s).  A row appears in
8507    this view for each <quote>name = value</> entry appearing in the files,
8508    with annotations indicating whether the value could be applied
8509    successfully.  Additional row(s) may appear for problems not linked to
8510    a <quote>name = value</> entry, such as syntax errors in the files.
8511   </para>
8512
8513   <para>
8514    This view is helpful for checking whether planned changes in the
8515    configuration files will work, or for diagnosing a previous failure.
8516    Note that this view reports on the <emphasis>current</> contents of the
8517    files, not on what was last applied by the server.  (The
8518    <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
8519    view is usually sufficient to determine that.)
8520   </para>
8521
8522   <para>
8523    By default, the <structname>pg_file_settings</structname> view can be read
8524    only by superusers.
8525   </para>
8526
8527   <table>
8528    <title><structname>pg_file_settings</> Columns</title>
8529
8530   <tgroup cols="3">
8531    <thead>
8532     <row>
8533      <entry>Name</entry>
8534      <entry>Type</entry>
8535      <entry>Description</entry>
8536     </row>
8537    </thead>
8538    <tbody>
8539     <row>
8540      <entry><structfield>sourcefile</structfield></entry>
8541      <entry><structfield>text</structfield></entry>
8542      <entry>Full path name of the configuration file</entry>
8543     </row>
8544     <row>
8545      <entry><structfield>sourceline</structfield></entry>
8546      <entry><structfield>integer</structfield></entry>
8547      <entry>
8548       Line number within the configuration file where the entry appears
8549      </entry>
8550     </row>
8551     <row>
8552      <entry><structfield>seqno</structfield></entry>
8553      <entry><structfield>integer</structfield></entry>
8554      <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
8555     </row>
8556     <row>
8557      <entry><structfield>name</structfield></entry>
8558      <entry><structfield>text</structfield></entry>
8559      <entry>Configuration parameter name</entry>
8560     </row>
8561     <row>
8562      <entry><structfield>setting</structfield></entry>
8563      <entry><structfield>text</structfield></entry>
8564      <entry>Value to be assigned to the parameter</entry>
8565     </row>
8566     <row>
8567      <entry><structfield>applied</structfield></entry>
8568      <entry><structfield>boolean</structfield></entry>
8569      <entry>True if the value can be applied successfully</entry>
8570     </row>
8571     <row>
8572      <entry><structfield>error</structfield></entry>
8573      <entry><structfield>text</structfield></entry>
8574      <entry>If not null, an error message indicating why this entry could
8575       not be applied</entry>
8576     </row>
8577    </tbody>
8578   </tgroup>
8579   </table>
8580
8581   <para>
8582    If the configuration file contains syntax errors or invalid parameter
8583    names, the server will not attempt to apply any settings from it, and
8584    therefore all the <structfield>applied</> fields will read as false.
8585    In such a case there will be one or more rows with
8586    non-null <structfield>error</structfield> fields indicating the
8587    problem(s).  Otherwise, individual settings will be applied if possible.
8588    If an individual setting cannot be applied (e.g., invalid value, or the
8589    setting cannot be changed after server start) it will have an appropriate
8590    message in the <structfield>error</structfield> field.  Another way that
8591    an entry might have <structfield>applied</> = false is that it is
8592    overridden by a later entry for the same parameter name; this case is not
8593    considered an error so nothing appears in
8594    the <structfield>error</structfield> field.
8595   </para>
8596
8597   <para>
8598    See <xref linkend="config-setting"> for more information about the various
8599    ways to change run-time parameters.
8600   </para>
8601
8602 </sect1>
8603
8604  <sect1 id="view-pg-group">
8605   <title><structname>pg_group</structname></title>
8606
8607   <indexterm zone="view-pg-group">
8608    <primary>pg_group</primary>
8609   </indexterm>
8610
8611   <para>
8612    The view <structname>pg_group</structname> exists for backwards
8613    compatibility: it emulates a catalog that existed in
8614    <productname>PostgreSQL</productname> before version 8.1.
8615    It shows the names and members of all roles that are marked as not
8616    <structfield>rolcanlogin</>, which is an approximation to the set
8617    of roles that are being used as groups.
8618   </para>
8619
8620   <table>
8621    <title><structname>pg_group</> Columns</title>
8622
8623    <tgroup cols="4">
8624     <thead>
8625      <row>
8626       <entry>Name</entry>
8627       <entry>Type</entry>
8628       <entry>References</entry>
8629       <entry>Description</entry>
8630      </row>
8631     </thead>
8632
8633     <tbody>
8634      <row>
8635       <entry><structfield>groname</structfield></entry>
8636       <entry><type>name</type></entry>
8637       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8638       <entry>Name of the group</entry>
8639      </row>
8640
8641      <row>
8642       <entry><structfield>grosysid</structfield></entry>
8643       <entry><type>oid</type></entry>
8644       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8645       <entry>ID of this group</entry>
8646      </row>
8647
8648      <row>
8649       <entry><structfield>grolist</structfield></entry>
8650       <entry><type>oid[]</type></entry>
8651       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8652       <entry>An array containing the IDs of the roles in this group</entry>
8653      </row>
8654     </tbody>
8655    </tgroup>
8656   </table>
8657
8658  </sect1>
8659
8660  <sect1 id="view-pg-hba-file-rules">
8661   <title><structname>pg_hba_file_rules</structname></title>
8662
8663   <indexterm zone="view-pg-hba-file-rules">
8664    <primary>pg_hba_file_rules</primary>
8665   </indexterm>
8666
8667   <para>
8668    The view <structname>pg_hba_file_rules</structname> provides a summary of
8669    the contents of the client authentication configuration
8670    file, <filename>pg_hba.conf</>.  A row appears in this view for each
8671    non-empty, non-comment line in the file, with annotations indicating
8672    whether the rule could be applied successfully.
8673   </para>
8674
8675   <para>
8676    This view can be helpful for checking whether planned changes in the
8677    authentication configuration file will work, or for diagnosing a previous
8678    failure.  Note that this view reports on the <emphasis>current</> contents
8679    of the file, not on what was last loaded by the server.
8680   </para>
8681
8682   <para>
8683    By default, the <structname>pg_hba_file_rules</structname> view can be read
8684    only by superusers.
8685   </para>
8686
8687   <table>
8688    <title><structname>pg_hba_file_rules</> Columns</title>
8689
8690   <tgroup cols="3">
8691    <thead>
8692     <row>
8693      <entry>Name</entry>
8694      <entry>Type</entry>
8695      <entry>Description</entry>
8696     </row>
8697    </thead>
8698    <tbody>
8699     <row>
8700      <entry><structfield>line_number</structfield></entry>
8701      <entry><structfield>integer</structfield></entry>
8702      <entry>
8703       Line number of this rule in <filename>pg_hba.conf</>
8704      </entry>
8705     </row>
8706     <row>
8707      <entry><structfield>type</structfield></entry>
8708      <entry><structfield>text</structfield></entry>
8709      <entry>Type of connection</entry>
8710     </row>
8711     <row>
8712      <entry><structfield>database</structfield></entry>
8713      <entry><structfield>text[]</structfield></entry>
8714      <entry>List of database name(s) to which this rule applies</entry>
8715     </row>
8716     <row>
8717      <entry><structfield>user_name</structfield></entry>
8718      <entry><structfield>text[]</structfield></entry>
8719      <entry>List of user and group name(s) to which this rule applies</entry>
8720     </row>
8721     <row>
8722      <entry><structfield>address</structfield></entry>
8723      <entry><structfield>text</structfield></entry>
8724      <entry>
8725       Host name or IP address, or one
8726       of <literal>all</literal>, <literal>samehost</literal>,
8727       or <literal>samenet</literal>, or null for local connections
8728      </entry>
8729     </row>
8730     <row>
8731      <entry><structfield>netmask</structfield></entry>
8732      <entry><structfield>text</structfield></entry>
8733      <entry>IP address mask, or null if not applicable</entry>
8734     </row>
8735     <row>
8736      <entry><structfield>auth_method</structfield></entry>
8737      <entry><type>text</type></entry>
8738      <entry>Authentication method</entry>
8739     </row>
8740     <row>
8741      <entry><structfield>options</structfield></entry>
8742      <entry><type>text[]</type></entry>
8743      <entry>Options specified for authentication method, if any</entry>
8744     </row>
8745     <row>
8746      <entry><structfield>error</structfield></entry>
8747      <entry><structfield>text</structfield></entry>
8748      <entry>
8749       If not null, an error message indicating why this
8750       line could not be processed
8751      </entry>
8752     </row>
8753    </tbody>
8754   </tgroup>
8755   </table>
8756
8757   <para>
8758    Usually, a row reflecting an incorrect entry will have values for only
8759    the <structfield>line_number</> and <structfield>error</> fields.
8760   </para>
8761
8762   <para>
8763    See <xref linkend="client-authentication"> for more information about
8764    client authentication configuration.
8765   </para>
8766  </sect1>
8767
8768  <sect1 id="view-pg-indexes">
8769   <title><structname>pg_indexes</structname></title>
8770
8771   <indexterm zone="view-pg-indexes">
8772    <primary>pg_indexes</primary>
8773   </indexterm>
8774
8775   <para>
8776    The view <structname>pg_indexes</structname> provides access to
8777    useful information about each index in the database.
8778   </para>
8779
8780   <table>
8781    <title><structname>pg_indexes</> Columns</title>
8782
8783    <tgroup cols="4">
8784     <thead>
8785      <row>
8786       <entry>Name</entry>
8787       <entry>Type</entry>
8788       <entry>References</entry>
8789       <entry>Description</entry>
8790      </row>
8791     </thead>
8792     <tbody>
8793      <row>
8794       <entry><structfield>schemaname</structfield></entry>
8795       <entry><type>name</type></entry>
8796       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8797       <entry>Name of schema containing table and index</entry>
8798      </row>
8799      <row>
8800       <entry><structfield>tablename</structfield></entry>
8801       <entry><type>name</type></entry>
8802       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8803       <entry>Name of table the index is for</entry>
8804      </row>
8805      <row>
8806       <entry><structfield>indexname</structfield></entry>
8807       <entry><type>name</type></entry>
8808       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8809       <entry>Name of index</entry>
8810      </row>
8811      <row>
8812       <entry><structfield>tablespace</structfield></entry>
8813       <entry><type>name</type></entry>
8814       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8815       <entry>Name of tablespace containing index (null if default for database)</entry>
8816      </row>
8817      <row>
8818       <entry><structfield>indexdef</structfield></entry>
8819       <entry><type>text</type></entry>
8820       <entry></entry>
8821       <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8822       command)</entry>
8823      </row>
8824     </tbody>
8825    </tgroup>
8826   </table>
8827
8828  </sect1>
8829
8830  <sect1 id="view-pg-locks">
8831   <title><structname>pg_locks</structname></title>
8832
8833   <indexterm zone="view-pg-locks">
8834    <primary>pg_locks</primary>
8835   </indexterm>
8836
8837   <para>
8838    The view <structname>pg_locks</structname> provides access to
8839    information about the locks held by active processes within the
8840    database server.  See <xref linkend="mvcc"> for more discussion
8841    of locking.
8842   </para>
8843
8844   <para>
8845    <structname>pg_locks</structname> contains one row per active lockable
8846    object, requested lock mode, and relevant process.  Thus, the same
8847    lockable object might
8848    appear many times, if multiple processes are holding or waiting
8849    for locks on it.  However, an object that currently has no locks on it
8850    will not appear at all.
8851   </para>
8852
8853   <para>
8854    There are several distinct types of lockable objects:
8855    whole relations (e.g., tables), individual pages of relations,
8856    individual tuples of relations,
8857    transaction IDs (both virtual and permanent IDs),
8858    and general database objects (identified by class OID and object OID,
8859    in the same way as in <structname>pg_description</structname> or
8860    <structname>pg_depend</structname>).  Also, the right to extend a
8861    relation is represented as a separate lockable object.
8862    Also, <quote>advisory</> locks can be taken on numbers that have
8863    user-defined meanings.
8864   </para>
8865
8866   <table>
8867    <title><structname>pg_locks</> Columns</title>
8868
8869    <tgroup cols="4">
8870     <thead>
8871      <row>
8872       <entry>Name</entry>
8873       <entry>Type</entry>
8874       <entry>References</entry>
8875       <entry>Description</entry>
8876      </row>
8877     </thead>
8878     <tbody>
8879      <row>
8880       <entry><structfield>locktype</structfield></entry>
8881       <entry><type>text</type></entry>
8882       <entry></entry>
8883       <entry>
8884        Type of the lockable object:
8885        <literal>relation</>,
8886        <literal>extend</>,
8887        <literal>page</>,
8888        <literal>tuple</>,
8889        <literal>transactionid</>,
8890        <literal>virtualxid</>,
8891        <literal>object</>,
8892        <literal>userlock</>, or
8893        <literal>advisory</>
8894       </entry>
8895      </row>
8896      <row>
8897       <entry><structfield>database</structfield></entry>
8898       <entry><type>oid</type></entry>
8899       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8900       <entry>
8901        OID of the database in which the lock target exists, or
8902        zero if the target is a shared object, or
8903        null if the target is a transaction ID
8904       </entry>
8905      </row>
8906      <row>
8907       <entry><structfield>relation</structfield></entry>
8908       <entry><type>oid</type></entry>
8909       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8910       <entry>
8911        OID of the relation targeted by the lock, or null if the target is not
8912        a relation or part of a relation
8913       </entry>
8914      </row>
8915      <row>
8916       <entry><structfield>page</structfield></entry>
8917       <entry><type>integer</type></entry>
8918       <entry></entry>
8919       <entry>
8920        Page number targeted by the lock within the relation,
8921        or null if the target is not a relation page or tuple
8922       </entry>
8923      </row>
8924      <row>
8925       <entry><structfield>tuple</structfield></entry>
8926       <entry><type>smallint</type></entry>
8927       <entry></entry>
8928       <entry>
8929        Tuple number targeted by the lock within the page,
8930        or null if the target is not a tuple
8931       </entry>
8932      </row>
8933      <row>
8934       <entry><structfield>virtualxid</structfield></entry>
8935       <entry><type>text</type></entry>
8936       <entry></entry>
8937       <entry>
8938        Virtual ID of the transaction targeted by the lock,
8939        or null if the target is not a virtual transaction ID
8940       </entry>
8941      </row>
8942      <row>
8943       <entry><structfield>transactionid</structfield></entry>
8944       <entry><type>xid</type></entry>
8945       <entry></entry>
8946       <entry>
8947        ID of the transaction targeted by the lock,
8948        or null if the target is not a transaction ID
8949       </entry>
8950      </row>
8951      <row>
8952       <entry><structfield>classid</structfield></entry>
8953       <entry><type>oid</type></entry>
8954       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8955       <entry>
8956        OID of the system catalog containing the lock target, or null if the
8957        target is not a general database object
8958       </entry>
8959      </row>
8960      <row>
8961       <entry><structfield>objid</structfield></entry>
8962       <entry><type>oid</type></entry>
8963       <entry>any OID column</entry>
8964       <entry>
8965        OID of the lock target within its system catalog, or null if the
8966        target is not a general database object
8967       </entry>
8968      </row>
8969      <row>
8970       <entry><structfield>objsubid</structfield></entry>
8971       <entry><type>smallint</type></entry>
8972       <entry></entry>
8973       <entry>
8974        Column number targeted by the lock (the
8975        <structfield>classid</> and <structfield>objid</> refer to the
8976        table itself),
8977        or zero if the target is some other general database object,
8978        or null if the target is not a general database object
8979       </entry>
8980      </row>
8981      <row>
8982       <entry><structfield>virtualtransaction</structfield></entry>
8983       <entry><type>text</type></entry>
8984       <entry></entry>
8985       <entry>
8986        Virtual ID of the transaction that is holding or awaiting this lock
8987       </entry>
8988      </row>
8989      <row>
8990       <entry><structfield>pid</structfield></entry>
8991       <entry><type>integer</type></entry>
8992       <entry></entry>
8993       <entry>
8994        Process ID of the server process holding or awaiting this
8995        lock, or null if the lock is held by a prepared transaction
8996       </entry>
8997      </row>
8998      <row>
8999       <entry><structfield>mode</structfield></entry>
9000       <entry><type>text</type></entry>
9001       <entry></entry>
9002       <entry>Name of the lock mode held or desired by this process (see <xref
9003       linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
9004      </row>
9005      <row>
9006       <entry><structfield>granted</structfield></entry>
9007       <entry><type>boolean</type></entry>
9008       <entry></entry>
9009       <entry>True if lock is held, false if lock is awaited</entry>
9010      </row>
9011      <row>
9012       <entry><structfield>fastpath</structfield></entry>
9013       <entry><type>boolean</type></entry>
9014       <entry></entry>
9015       <entry>True if lock was taken via fast path, false if taken via main
9016        lock table</entry>
9017      </row>
9018     </tbody>
9019    </tgroup>
9020   </table>
9021
9022   <para>
9023    <structfield>granted</structfield> is true in a row representing a lock
9024    held by the indicated process.  False indicates that this process is
9025    currently waiting to acquire this lock, which implies that at least one
9026    other process is holding or waiting for a conflicting lock mode on the same
9027    lockable object.  The waiting process will sleep until the other lock is
9028    released (or a deadlock situation is detected).  A single process can be
9029    waiting to acquire at most one lock at a time.
9030   </para>
9031
9032   <para>
9033    Throughout running a transaction, a server process holds an exclusive lock
9034    on the transaction's virtual transaction ID.  If a permanent ID is assigned
9035    to the transaction (which normally happens only if the transaction changes
9036    the state of the database), it also holds an exclusive lock on the
9037    transaction's permanent transaction ID until it ends.  When a process finds
9038    it necessary to wait specifically for another transaction to end, it does
9039    so by attempting to acquire share lock on the other transaction's ID
9040    (either virtual or permanent ID depending on the situation). That will
9041    succeed only when the other transaction terminates and releases its locks.
9042   </para>
9043
9044   <para>
9045    Although tuples are a lockable type of object,
9046    information about row-level locks is stored on disk, not in memory,
9047    and therefore row-level locks normally do not appear in this view.
9048    If a process is waiting for a
9049    row-level lock, it will usually appear in the view as waiting for the
9050    permanent transaction ID of the current holder of that row lock.
9051   </para>
9052
9053   <para>
9054    Advisory locks can be acquired on keys consisting of either a single
9055    <type>bigint</type> value or two integer values.
9056    A <type>bigint</type> key is displayed with its
9057    high-order half in the <structfield>classid</> column, its low-order half
9058    in the <structfield>objid</> column, and <structfield>objsubid</> equal
9059    to 1. The original <type>bigint</type> value can be reassembled with the
9060    expression <literal>(classid::bigint &lt;&lt; 32) |
9061    objid::bigint</literal>. Integer keys are displayed with the
9062    first key in the
9063    <structfield>classid</> column, the second key in the <structfield>objid</>
9064    column, and <structfield>objsubid</> equal to 2.  The actual meaning of
9065    the keys is up to the user.  Advisory locks are local to each database,
9066    so the <structfield>database</> column is meaningful for an advisory lock.
9067   </para>
9068
9069   <para>
9070    <structname>pg_locks</structname> provides a global view of all locks
9071    in the database cluster, not only those relevant to the current database.
9072    Although its <structfield>relation</structfield> column can be joined
9073    against <structname>pg_class</>.<structfield>oid</> to identify locked
9074    relations, this will only work correctly for relations in the current
9075    database (those for which the <structfield>database</structfield> column
9076    is either the current database's OID or zero).
9077   </para>
9078
9079   <para>
9080    The <structfield>pid</structfield> column can be joined to the
9081    <structfield>pid</structfield> column of the <link
9082    linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
9083    view to get more
9084    information on the session holding or awaiting each lock,
9085    for example
9086 <programlisting>
9087 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
9088     ON pl.pid = psa.pid;
9089 </programlisting>
9090    Also, if you are using prepared transactions, the
9091    <structfield>virtualtransaction</> column can be joined to the
9092    <structfield>transaction</structfield> column of the <link
9093    linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
9094    view to get more information on prepared transactions that hold locks.
9095    (A prepared transaction can never be waiting for a lock,
9096    but it continues to hold the locks it acquired while running.)
9097    For example:
9098 <programlisting>
9099 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
9100     ON pl.virtualtransaction = '-1/' || ppx.transaction;
9101 </programlisting>
9102   </para>
9103
9104   <para>
9105    While it is possible to obtain information about which processes block
9106    which other processes by joining <structname>pg_locks</structname> against
9107    itself, this is very difficult to get right in detail.  Such a query would
9108    have to encode knowledge about which lock modes conflict with which
9109    others.  Worse, the <structname>pg_locks</structname> view does not expose
9110    information about which processes are ahead of which others in lock wait
9111    queues, nor information about which processes are parallel workers running
9112    on behalf of which other client sessions.  It is better to use
9113    the <function>pg_blocking_pids()</> function
9114    (see <xref linkend="functions-info-session-table">) to identify which
9115    process(es) a waiting process is blocked behind.
9116   </para>
9117
9118   <para>
9119    The <structname>pg_locks</structname> view displays data from both the
9120    regular lock manager and the predicate lock manager, which are
9121    separate systems; in addition, the regular lock manager subdivides its
9122    locks into regular and <firstterm>fast-path</> locks.
9123    This data is not guaranteed to be entirely consistent.
9124    When the view is queried,
9125    data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
9126    is gathered from each backend one at a time, without freezing the state of
9127    the entire lock manager, so it is possible for locks to be taken or
9128    released while information is gathered.  Note, however, that these locks are
9129    known not to conflict with any other lock currently in place.  After
9130    all backends have been queried for fast-path locks, the remainder of the
9131    regular lock manager is locked as a unit, and a consistent snapshot of all
9132    remaining locks is collected as an atomic action.  After unlocking the
9133    regular lock manager, the predicate lock manager is similarly locked and all
9134    predicate locks are collected as an atomic action.  Thus, with the exception
9135    of fast-path locks, each lock manager will deliver a consistent set of
9136    results, but as we do not lock both lock managers simultaneously, it is
9137    possible for locks to be taken or released after we interrogate the regular
9138    lock manager and before we interrogate the predicate lock manager.
9139   </para>
9140
9141   <para>
9142    Locking the regular and/or predicate lock manager could have some
9143    impact on database performance if this view is very frequently accessed.
9144    The locks are held only for the minimum amount of time necessary to
9145    obtain data from the lock managers, but this does not completely eliminate
9146    the possibility of a performance impact.
9147   </para>
9148
9149  </sect1>
9150
9151  <sect1 id="view-pg-matviews">
9152   <title><structname>pg_matviews</structname></title>
9153
9154   <indexterm zone="view-pg-matviews">
9155    <primary>pg_matviews</primary>
9156   </indexterm>
9157
9158   <indexterm zone="view-pg-matviews">
9159    <primary>materialized views</primary>
9160   </indexterm>
9161
9162   <para>
9163    The view <structname>pg_matviews</structname> provides access to
9164    useful information about each materialized view in the database.
9165   </para>
9166
9167   <table>
9168    <title><structname>pg_matviews</> Columns</title>
9169
9170    <tgroup cols="4">
9171     <thead>
9172      <row>
9173       <entry>Name</entry>
9174       <entry>Type</entry>
9175       <entry>References</entry>
9176       <entry>Description</entry>
9177      </row>
9178     </thead>
9179     <tbody>
9180      <row>
9181       <entry><structfield>schemaname</structfield></entry>
9182       <entry><type>name</type></entry>
9183       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9184       <entry>Name of schema containing materialized view</entry>
9185      </row>
9186      <row>
9187       <entry><structfield>matviewname</structfield></entry>
9188       <entry><type>name</type></entry>
9189       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9190       <entry>Name of materialized view</entry>
9191      </row>
9192      <row>
9193       <entry><structfield>matviewowner</structfield></entry>
9194       <entry><type>name</type></entry>
9195       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9196       <entry>Name of materialized view's owner</entry>
9197      </row>
9198      <row>
9199       <entry><structfield>tablespace</structfield></entry>
9200       <entry><type>name</type></entry>
9201       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9202       <entry>Name of tablespace containing materialized view (null if default for database)</entry>
9203      </row>
9204      <row>
9205       <entry><structfield>hasindexes</structfield></entry>
9206       <entry><type>boolean</type></entry>
9207       <entry></entry>
9208       <entry>True if materialized view has (or recently had) any indexes</entry>
9209      </row>
9210      <row>
9211       <entry><structfield>ispopulated</structfield></entry>
9212       <entry><type>boolean</type></entry>
9213       <entry></entry>
9214       <entry>True if materialized view is currently populated</entry>
9215      </row>
9216      <row>
9217       <entry><structfield>definition</structfield></entry>
9218       <entry><type>text</type></entry>
9219       <entry></entry>
9220       <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
9221      </row>
9222     </tbody>
9223    </tgroup>
9224   </table>
9225
9226  </sect1>
9227
9228  <sect1 id="view-pg-policies">
9229   <title><structname>pg_policies</structname></title>
9230
9231   <indexterm zone="view-pg-policies">
9232    <primary>pg_policies</primary>
9233   </indexterm>
9234
9235   <para>
9236    The view <structname>pg_policies</structname> provides access to
9237    useful information about each row-level security policy in the database.
9238   </para>
9239
9240   <table>
9241    <title><structname>pg_policies</> Columns</title>
9242
9243    <tgroup cols="4">
9244     <thead>
9245      <row>
9246       <entry>Name</entry>
9247       <entry>Type</entry>
9248       <entry>References</entry>
9249       <entry>Description</entry>
9250      </row>
9251     </thead>
9252     <tbody>
9253      <row>
9254       <entry><structfield>schemaname</structfield></entry>
9255       <entry><type>name</type></entry>
9256       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9257       <entry>Name of schema containing table policy is on</entry>
9258      </row>
9259      <row>
9260       <entry><structfield>tablename</structfield></entry>
9261       <entry><type>name</type></entry>
9262       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9263       <entry>Name of table policy is on</entry>
9264      </row>
9265      <row>
9266       <entry><structfield>policyname</structfield></entry>
9267       <entry><type>name</type></entry>
9268       <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
9269       <entry>Name of policy</entry>
9270      </row>
9271      <row>
9272       <entry><structfield>polpermissive</structfield></entry>
9273       <entry><type>text</type></entry>
9274       <entry></entry>
9275       <entry>Is the policy permissive or restrictive?</entry>
9276      </row>
9277      <row>
9278       <entry><structfield>roles</structfield></entry>
9279       <entry><type>name[]</type></entry>
9280       <entry></entry>
9281       <entry>The roles to which this policy applies</entry>
9282      </row>
9283      <row>
9284       <entry><structfield>cmd</structfield></entry>
9285       <entry><type>text</type></entry>
9286       <entry></entry>
9287       <entry>The command type to which the policy is applied</entry>
9288      </row>
9289      <row>
9290       <entry><structfield>qual</structfield></entry>
9291       <entry><type>text</type></entry>
9292       <entry></entry>
9293       <entry>The expression added to the security barrier qualifications for
9294       queries that this policy applies to</entry>
9295      </row>
9296      <row>
9297       <entry><structfield>with_check</structfield></entry>
9298       <entry><type>text</type></entry>
9299       <entry></entry>
9300       <entry>The expression added to the WITH CHECK qualifications for
9301       queries that attempt to add rows to this table</entry>
9302      </row>
9303     </tbody>
9304    </tgroup>
9305   </table>
9306
9307  </sect1>
9308
9309  <sect1 id="view-pg-prepared-statements">
9310   <title><structname>pg_prepared_statements</structname></title>
9311
9312   <indexterm zone="view-pg-prepared-statements">
9313    <primary>pg_prepared_statements</primary>
9314   </indexterm>
9315
9316   <para>
9317    The <structname>pg_prepared_statements</structname> view displays
9318    all the prepared statements that are available in the current
9319    session. See <xref linkend="sql-prepare"> for more information about prepared
9320    statements.
9321   </para>
9322
9323   <para>
9324    <structname>pg_prepared_statements</structname> contains one row
9325    for each prepared statement. Rows are added to the view when a new
9326    prepared statement is created and removed when a prepared statement
9327    is released (for example, via the <xref linkend="sql-deallocate"> command).
9328   </para>
9329
9330   <table>
9331    <title><structname>pg_prepared_statements</> Columns</title>
9332
9333    <tgroup cols="3">
9334     <thead>
9335      <row>
9336       <entry>Name</entry>
9337       <entry>Type</entry>
9338       <entry>Description</entry>
9339      </row>
9340     </thead>
9341     <tbody>
9342      <row>
9343       <entry><structfield>name</structfield></entry>
9344       <entry><type>text</type></entry>
9345       <entry>
9346        The identifier of the prepared statement
9347       </entry>
9348      </row>
9349      <row>
9350       <entry><structfield>statement</structfield></entry>
9351       <entry><type>text</type></entry>
9352       <entry>
9353        The query string submitted by the client to create this
9354        prepared statement. For prepared statements created via SQL,
9355        this is the <command>PREPARE</command> statement submitted by
9356        the client. For prepared statements created via the
9357        frontend/backend protocol, this is the text of the prepared
9358        statement itself.
9359       </entry>
9360      </row>
9361      <row>
9362       <entry><structfield>prepare_time</structfield></entry>
9363       <entry><type>timestamptz</type></entry>
9364       <entry>
9365        The time at which the prepared statement was created
9366       </entry>
9367      </row>
9368      <row>
9369       <entry><structfield>parameter_types</structfield></entry>
9370       <entry><type>regtype[]</type></entry>
9371       <entry>
9372        The expected parameter types for the prepared statement in the
9373        form of an array of <type>regtype</type>. The OID corresponding
9374        to an element of this array can be obtained by casting the
9375        <type>regtype</type> value to <type>oid</type>.
9376       </entry>
9377      </row>
9378      <row>
9379       <entry><structfield>from_sql</structfield></entry>
9380       <entry><type>boolean</type></entry>
9381       <entry>
9382        <literal>true</literal> if the prepared statement was created
9383        via the <command>PREPARE</command> SQL command;
9384        <literal>false</literal> if the statement was prepared via the
9385        frontend/backend protocol
9386       </entry>
9387      </row>
9388     </tbody>
9389    </tgroup>
9390   </table>
9391
9392   <para>
9393    The <structname>pg_prepared_statements</structname> view is read only.
9394   </para>
9395  </sect1>
9396
9397  <sect1 id="view-pg-prepared-xacts">
9398   <title><structname>pg_prepared_xacts</structname></title>
9399
9400   <indexterm zone="view-pg-prepared-xacts">
9401    <primary>pg_prepared_xacts</primary>
9402   </indexterm>
9403
9404   <para>
9405    The view <structname>pg_prepared_xacts</structname> displays
9406    information about transactions that are currently prepared for two-phase
9407    commit (see <xref linkend="sql-prepare-transaction"> for details).
9408   </para>
9409
9410   <para>
9411    <structname>pg_prepared_xacts</structname> contains one row per prepared
9412    transaction.  An entry is removed when the transaction is committed or
9413    rolled back.
9414   </para>
9415
9416   <table>
9417    <title><structname>pg_prepared_xacts</> Columns</title>
9418
9419    <tgroup cols="4">
9420     <thead>
9421      <row>
9422       <entry>Name</entry>
9423       <entry>Type</entry>
9424       <entry>References</entry>
9425       <entry>Description</entry>
9426      </row>
9427     </thead>
9428     <tbody>
9429      <row>
9430       <entry><structfield>transaction</structfield></entry>
9431       <entry><type>xid</type></entry>
9432       <entry></entry>
9433       <entry>
9434        Numeric transaction identifier of the prepared transaction
9435       </entry>
9436      </row>
9437      <row>
9438       <entry><structfield>gid</structfield></entry>
9439       <entry><type>text</type></entry>
9440       <entry></entry>
9441       <entry>
9442        Global transaction identifier that was assigned to the transaction
9443       </entry>
9444      </row>
9445      <row>
9446       <entry><structfield>prepared</structfield></entry>
9447       <entry><type>timestamp with time zone</type></entry>
9448       <entry></entry>
9449       <entry>
9450        Time at which the transaction was prepared for commit
9451       </entry>
9452      </row>
9453      <row>
9454       <entry><structfield>owner</structfield></entry>
9455       <entry><type>name</type></entry>
9456       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9457       <entry>
9458        Name of the user that executed the transaction
9459       </entry>
9460      </row>
9461      <row>
9462       <entry><structfield>database</structfield></entry>
9463       <entry><type>name</type></entry>
9464       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9465       <entry>
9466        Name of the database in which the transaction was executed
9467       </entry>
9468      </row>
9469     </tbody>
9470    </tgroup>
9471   </table>
9472
9473   <para>
9474    When the <structname>pg_prepared_xacts</structname> view is accessed, the
9475    internal transaction manager data structures are momentarily locked, and
9476    a copy is made for the view to display.  This ensures that the
9477    view produces a consistent set of results, while not blocking
9478    normal operations longer than necessary.  Nonetheless
9479    there could be some impact on database performance if this view is
9480    frequently accessed.
9481   </para>
9482
9483  </sect1>
9484
9485  <sect1 id="view-pg-publication-tables">
9486   <title><structname>pg_publication_tables</structname></title>
9487
9488   <indexterm zone="view-pg-publication-tables">
9489    <primary>pg_publication_tables</primary>
9490   </indexterm>
9491
9492   <para>
9493    The view <structname>pg_publication_tables</structname> provides
9494    information about the mapping between publications and the tables they
9495    contain.  Unlike the underlying
9496    catalog <structname>pg_publication_rel</structname>, this view expands
9497    publications defined as <literal>FOR ALL TABLES</literal>, so for such
9498    publications there will be a row for each eligible table.
9499   </para>
9500
9501   <table>
9502    <title><structname>pg_publication_tables</structname> Columns</title>
9503
9504    <tgroup cols="4">
9505     <thead>
9506      <row>
9507       <entry>Name</entry>
9508       <entry>Type</entry>
9509       <entry>References</entry>
9510       <entry>Description</entry>
9511      </row>
9512     </thead>
9513
9514     <tbody>
9515      <row>
9516       <entry><structfield>pubname</structfield></entry>
9517       <entry><type>name</type></entry>
9518       <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
9519       <entry>Name of publication</entry>
9520      </row>
9521
9522      <row>
9523       <entry><structfield>schemaname</structfield></entry>
9524       <entry><type>name</type></entry>
9525       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9526       <entry>Name of schema containing table</entry>
9527      </row>
9528
9529      <row>
9530       <entry><structfield>tablename</structfield></entry>
9531       <entry><type>name</type></entry>
9532       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9533       <entry>Name of table</entry>
9534      </row>
9535     </tbody>
9536    </tgroup>
9537   </table>
9538  </sect1>
9539
9540   <sect1 id="view-pg-replication-origin-status">
9541   <title><structname>pg_replication_origin_status</structname></title>
9542
9543   <indexterm zone="view-pg-replication-origin-status">
9544    <primary>pg_replication_origin_status</primary>
9545   </indexterm>
9546
9547   <para>
9548    The <structname>pg_replication_origin_status</structname> view
9549    contains information about how far replay for a certain origin has
9550    progressed.  For more on replication origins
9551    see <xref linkend="replication-origins">.
9552   </para>
9553
9554   <table>
9555
9556    <title><structname>pg_replication_origin_status</structname> Columns</title>
9557
9558    <tgroup cols="4">
9559     <thead>
9560      <row>
9561       <entry>Name</entry>
9562       <entry>Type</entry>
9563       <entry>References</entry>
9564       <entry>Description</entry>
9565      </row>
9566     </thead>
9567
9568     <tbody>
9569      <row>
9570       <entry><structfield>local_id</structfield></entry>
9571       <entry><type>Oid</type></entry>
9572       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
9573       <entry>internal node identifier</entry>
9574      </row>
9575
9576      <row>
9577       <entry><structfield>external_id</structfield></entry>
9578       <entry><type>text</type></entry>
9579       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
9580       <entry>external node identifier</entry>
9581      </row>
9582
9583      <row>
9584       <entry><structfield>remote_lsn</structfield></entry>
9585       <entry><type>pg_lsn</type></entry>
9586       <entry></entry>
9587       <entry>The origin node's LSN up to which data has been replicated.</entry>
9588      </row>
9589
9590      <row>
9591       <entry><structfield>local_lsn</structfield></entry>
9592       <entry><type>pg_lsn</type></entry>
9593       <entry></entry>
9594       <entry>
9595        This node's LSN at which <literal>remote_lsn</literal> has
9596        been replicated. Used to flush commit records before persisting
9597        data to disk when using asynchronous commits.
9598       </entry>
9599      </row>
9600     </tbody>
9601    </tgroup>
9602   </table>
9603  </sect1>
9604
9605  <sect1 id="view-pg-replication-slots">
9606   <title><structname>pg_replication_slots</structname></title>
9607
9608   <indexterm zone="view-pg-replication-slots">
9609    <primary>pg_replication_slots</primary>
9610   </indexterm>
9611
9612   <para>
9613    The <structname>pg_replication_slots</structname> view provides a listing
9614    of all replication slots that currently exist on the database cluster,
9615    along with their current state.
9616   </para>
9617
9618   <para>
9619    For more on replication slots,
9620    see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
9621   </para>
9622
9623   <table>
9624
9625    <title><structname>pg_replication_slots</structname> Columns</title>
9626
9627    <tgroup cols="4">
9628     <thead>
9629      <row>
9630       <entry>Name</entry>
9631       <entry>Type</entry>
9632       <entry>References</entry>
9633       <entry>Description</entry>
9634      </row>
9635     </thead>
9636
9637     <tbody>
9638      <row>
9639       <entry><structfield>slot_name</structfield></entry>
9640       <entry><type>name</type></entry>
9641       <entry></entry>
9642       <entry>A unique, cluster-wide identifier for the replication slot</entry>
9643      </row>
9644
9645      <row>
9646       <entry><structfield>plugin</structfield></entry>
9647       <entry><type>name</type></entry>
9648       <entry></entry>
9649       <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
9650      </row>
9651
9652      <row>
9653       <entry><structfield>slot_type</structfield></entry>
9654       <entry><type>text</type></entry>
9655       <entry></entry>
9656       <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
9657      </row>
9658
9659      <row>
9660       <entry><structfield>datoid</structfield></entry>
9661       <entry><type>oid</type></entry>
9662       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9663       <entry>The OID of the database this slot is associated with, or
9664       null. Only logical slots have an associated database.</entry>
9665      </row>
9666
9667      <row>
9668       <entry><structfield>database</structfield></entry>
9669       <entry><type>text</type></entry>
9670       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9671       <entry>The name of the database this slot is associated with, or
9672       null. Only logical slots have an associated database.</entry>
9673      </row>
9674
9675      <row>
9676       <entry><structfield>temporary</structfield></entry>
9677       <entry><type>boolean</type></entry>
9678       <entry></entry>
9679       <entry>True if this is a temporary replication slot. Temporary slots are
9680       not saved to disk and are automatically dropped on error or when
9681       the session has finished.</entry>
9682      </row>
9683
9684      <row>
9685       <entry><structfield>active</structfield></entry>
9686       <entry><type>boolean</type></entry>
9687       <entry></entry>
9688       <entry>True if this slot is currently actively being used</entry>
9689      </row>
9690
9691      <row>
9692       <entry><structfield>active_pid</structfield></entry>
9693       <entry><type>integer</type></entry>
9694       <entry></entry>
9695       <entry>The process ID of the session using this slot if the slot
9696        is currently actively being used. <literal>NULL</literal> if
9697        inactive.
9698       </entry>
9699      </row>
9700
9701      <row>
9702       <entry><structfield>xmin</structfield></entry>
9703       <entry><type>xid</type></entry>
9704       <entry></entry>
9705       <entry>The oldest transaction that this slot needs the database to
9706       retain.  <literal>VACUUM</literal> cannot remove tuples deleted
9707       by any later transaction.
9708       </entry>
9709      </row>
9710
9711      <row>
9712       <entry><structfield>catalog_xmin</structfield></entry>
9713       <entry><type>xid</type></entry>
9714       <entry></entry>
9715       <entry>The oldest transaction affecting the system catalogs that this
9716       slot needs the database to retain.  <literal>VACUUM</literal> cannot
9717       remove catalog tuples deleted by any later transaction.
9718       </entry>
9719      </row>
9720
9721      <row>
9722       <entry><structfield>restart_lsn</structfield></entry>
9723       <entry><type>pg_lsn</type></entry>
9724       <entry></entry>
9725       <entry>The address (<literal>LSN</literal>) of oldest WAL which still
9726       might be required by the consumer of this slot and thus won't be
9727       automatically removed during checkpoints.
9728       </entry>
9729      </row>
9730
9731      <row>
9732       <entry><structfield>confirmed_flush_lsn</structfield></entry>
9733       <entry><type>pg_lsn</type></entry>
9734       <entry></entry>
9735       <entry>The address (<literal>LSN</literal>) up to which the logical
9736       slot's consumer has confirmed receiving data. Data older than this is
9737       not available anymore. <literal>NULL</> for physical slots.
9738       </entry>
9739      </row>
9740
9741     </tbody>
9742    </tgroup>
9743   </table>
9744  </sect1>
9745
9746  <sect1 id="view-pg-roles">
9747   <title><structname>pg_roles</structname></title>
9748
9749   <indexterm zone="view-pg-roles">
9750    <primary>pg_roles</primary>
9751   </indexterm>
9752
9753   <para>
9754    The view <structname>pg_roles</structname> provides access to
9755    information about database roles.  This is simply a publicly
9756    readable view of
9757    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9758    that blanks out the password field.
9759   </para>
9760
9761   <para>
9762    This view explicitly exposes the OID column of the underlying table,
9763    since that is needed to do joins to other catalogs.
9764   </para>
9765
9766   <table>
9767    <title><structname>pg_roles</> Columns</title>
9768
9769    <tgroup cols="4">
9770     <thead>
9771      <row>
9772       <entry>Name</entry>
9773       <entry>Type</entry>
9774       <entry>References</entry>
9775       <entry>Description</entry>
9776      </row>
9777     </thead>
9778
9779     <tbody>
9780      <row>
9781       <entry><structfield>rolname</structfield></entry>
9782       <entry><type>name</type></entry>
9783       <entry></entry>
9784       <entry>Role name</entry>
9785      </row>
9786
9787      <row>
9788       <entry><structfield>rolsuper</structfield></entry>
9789       <entry><type>bool</type></entry>
9790       <entry></entry>
9791       <entry>Role has superuser privileges</entry>
9792      </row>
9793
9794      <row>
9795       <entry><structfield>rolinherit</structfield></entry>
9796       <entry><type>bool</type></entry>
9797       <entry></entry>
9798       <entry>Role automatically inherits privileges of roles it is a
9799        member of</entry>
9800      </row>
9801
9802      <row>
9803       <entry><structfield>rolcreaterole</structfield></entry>
9804       <entry><type>bool</type></entry>
9805       <entry></entry>
9806       <entry>Role can create more roles</entry>
9807      </row>
9808
9809      <row>
9810       <entry><structfield>rolcreatedb</structfield></entry>
9811       <entry><type>bool</type></entry>
9812       <entry></entry>
9813       <entry>Role can create databases</entry>
9814      </row>
9815
9816      <row>
9817       <entry><structfield>rolcanlogin</structfield></entry>
9818       <entry><type>bool</type></entry>
9819       <entry></entry>
9820       <entry>
9821        Role can log in. That is, this role can be given as the initial
9822        session authorization identifier
9823       </entry>
9824      </row>
9825
9826      <row>
9827       <entry><structfield>rolreplication</structfield></entry>
9828       <entry><type>bool</type></entry>
9829       <entry></entry>
9830       <entry>
9831        Role is a replication role. That is, this role can initiate streaming
9832        replication (see <xref linkend="streaming-replication">) and set/unset
9833        the system backup mode using <function>pg_start_backup</> and
9834        <function>pg_stop_backup</>
9835       </entry>
9836      </row>
9837
9838      <row>
9839       <entry><structfield>rolconnlimit</structfield></entry>
9840       <entry><type>int4</type></entry>
9841       <entry></entry>
9842       <entry>
9843        For roles that can log in, this sets maximum number of concurrent
9844        connections this role can make.  -1 means no limit.
9845       </entry>
9846      </row>
9847
9848      <row>
9849       <entry><structfield>rolpassword</structfield></entry>
9850       <entry><type>text</type></entry>
9851       <entry></entry>
9852       <entry>Not the password (always reads as <literal>********</>)</entry>
9853      </row>
9854
9855      <row>
9856       <entry><structfield>rolvaliduntil</structfield></entry>
9857       <entry><type>timestamptz</type></entry>
9858       <entry></entry>
9859       <entry>Password expiry time (only used for password authentication);
9860        null if no expiration</entry>
9861      </row>
9862
9863      <row>
9864       <entry><structfield>rolbypassrls</structfield></entry>
9865       <entry><type>bool</type></entry>
9866       <entry></entry>
9867       <entry>
9868        Role bypasses every row level security policy, see
9869        <xref linkend="ddl-rowsecurity"> for more information.
9870       </entry>
9871      </row>
9872
9873      <row>
9874       <entry><structfield>rolconfig</structfield></entry>
9875       <entry><type>text[]</type></entry>
9876       <entry></entry>
9877       <entry>Role-specific defaults for run-time configuration variables</entry>
9878      </row>
9879
9880      <row>
9881       <entry><structfield>oid</structfield></entry>
9882       <entry><type>oid</type></entry>
9883       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9884       <entry>ID of role</entry>
9885      </row>
9886     </tbody>
9887    </tgroup>
9888   </table>
9889
9890  </sect1>
9891
9892  <sect1 id="view-pg-rules">
9893   <title><structname>pg_rules</structname></title>
9894
9895   <indexterm zone="view-pg-rules">
9896    <primary>pg_rules</primary>
9897   </indexterm>
9898
9899   <para>
9900    The view <structname>pg_rules</structname> provides access to
9901    useful information about query rewrite rules.
9902   </para>
9903
9904   <table>
9905    <title><structname>pg_rules</> Columns</title>
9906
9907    <tgroup cols="4">
9908     <thead>
9909      <row>
9910       <entry>Name</entry>
9911       <entry>Type</entry>
9912       <entry>References</entry>
9913       <entry>Description</entry>
9914      </row>
9915     </thead>
9916     <tbody>
9917      <row>
9918       <entry><structfield>schemaname</structfield></entry>
9919       <entry><type>name</type></entry>
9920       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9921       <entry>Name of schema containing table</entry>
9922      </row>
9923      <row>
9924       <entry><structfield>tablename</structfield></entry>
9925       <entry><type>name</type></entry>
9926       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9927       <entry>Name of table the rule is for</entry>
9928      </row>
9929      <row>
9930       <entry><structfield>rulename</structfield></entry>
9931       <entry><type>name</type></entry>
9932       <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
9933       <entry>Name of rule</entry>
9934      </row>
9935      <row>
9936       <entry><structfield>definition</structfield></entry>
9937       <entry><type>text</type></entry>
9938       <entry></entry>
9939       <entry>Rule definition (a reconstructed creation command)</entry>
9940      </row>
9941     </tbody>
9942    </tgroup>
9943   </table>
9944
9945   <para>
9946    The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
9947    of views and materialized views; those can be seen in
9948    <structname>pg_views</> and <structname>pg_matviews</>.
9949   </para>
9950
9951  </sect1>
9952
9953  <sect1 id="view-pg-seclabels">
9954   <title><structname>pg_seclabels</structname></title>
9955
9956   <indexterm zone="view-pg-seclabels">
9957    <primary>pg_seclabels</primary>
9958   </indexterm>
9959
9960   <para>
9961    The view <structname>pg_seclabels</structname> provides information about
9962    security labels.  It as an easier-to-query version of the
9963    <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9964   </para>
9965
9966   <table>
9967    <title><structname>pg_seclabels</> Columns</title>
9968
9969    <tgroup cols="4">
9970     <thead>
9971      <row>
9972       <entry>Name</entry>
9973       <entry>Type</entry>
9974       <entry>References</entry>
9975       <entry>Description</entry>
9976      </row>
9977     </thead>
9978     <tbody>
9979      <row>
9980       <entry><structfield>objoid</structfield></entry>
9981       <entry><type>oid</type></entry>
9982       <entry>any OID column</entry>
9983       <entry>The OID of the object this security label pertains to</entry>
9984      </row>
9985      <row>
9986       <entry><structfield>classoid</structfield></entry>
9987       <entry><type>oid</type></entry>
9988       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9989       <entry>The OID of the system catalog this object appears in</entry>
9990      </row>
9991      <row>
9992       <entry><structfield>objsubid</structfield></entry>
9993       <entry><type>int4</type></entry>
9994       <entry></entry>
9995       <entry>
9996        For a security label on a table column, this is the column number (the
9997        <structfield>objoid</> and <structfield>classoid</> refer to
9998        the table itself).  For all other object types, this column is
9999        zero.
10000       </entry>
10001      </row>
10002      <row>
10003       <entry><structfield>objtype</structfield></entry>
10004       <entry><type>text</type></entry>
10005       <entry></entry>
10006       <entry>
10007          The type of object to which this label applies, as text.
10008       </entry>
10009      </row>
10010      <row>
10011       <entry><structfield>objnamespace</structfield></entry>
10012       <entry><type>oid</type></entry>
10013       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
10014       <entry>
10015        The OID of the namespace for this object, if applicable;
10016        otherwise NULL.
10017       </entry>
10018      </row>
10019      <row>
10020       <entry><structfield>objname</structfield></entry>
10021       <entry><type>text</type></entry>
10022       <entry></entry>
10023       <entry>
10024        The name of the object to which this label applies, as text.
10025       </entry>
10026      </row>
10027      <row>
10028       <entry><structfield>provider</structfield></entry>
10029       <entry><type>text</type></entry>
10030       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
10031       <entry>The label provider associated with this label.</entry>
10032      </row>
10033      <row>
10034       <entry><structfield>label</structfield></entry>
10035       <entry><type>text</type></entry>
10036       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
10037       <entry>The security label applied to this object.</entry>
10038      </row>
10039     </tbody>
10040    </tgroup>
10041   </table>
10042  </sect1>
10043
10044  <sect1 id="view-pg-sequences">
10045   <title><structname>pg_sequences</structname></title>
10046
10047   <indexterm zone="view-pg-sequences">
10048    <primary>pg_sequences</primary>
10049   </indexterm>
10050
10051   <para>
10052    The view <structname>pg_sequences</structname> provides access to
10053    useful information about each sequence in the database.
10054   </para>
10055
10056   <table>
10057    <title><structname>pg_sequences</> Columns</title>
10058
10059    <tgroup cols="4">
10060     <thead>
10061      <row>
10062       <entry>Name</entry>
10063       <entry>Type</entry>
10064       <entry>References</entry>
10065       <entry>Description</entry>
10066      </row>
10067     </thead>
10068     <tbody>
10069      <row>
10070       <entry><structfield>schemaname</structfield></entry>
10071       <entry><type>name</type></entry>
10072       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10073       <entry>Name of schema containing sequence</entry>
10074      </row>
10075      <row>
10076       <entry><structfield>sequencename</structfield></entry>
10077       <entry><type>name</type></entry>
10078       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10079       <entry>Name of sequence</entry>
10080      </row>
10081      <row>
10082       <entry><structfield>sequenceowner</structfield></entry>
10083       <entry><type>name</type></entry>
10084       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10085       <entry>Name of sequence's owner</entry>
10086      </row>
10087      <row>
10088       <entry><structfield>data_type</structfield></entry>
10089       <entry><type>regtype</type></entry>
10090       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_type</structname></link>.oid</literal></entry>
10091       <entry>Data type of the sequence</entry>
10092      </row>
10093      <row>
10094       <entry><structfield>start_value</structfield></entry>
10095       <entry><type>bigint</type></entry>
10096       <entry></entry>
10097       <entry>Start value of the sequence</entry>
10098      </row>
10099      <row>
10100       <entry><structfield>min_value</structfield></entry>
10101       <entry><type>bigint</type></entry>
10102       <entry></entry>
10103       <entry>Minimum value of the sequence</entry>
10104      </row>
10105      <row>
10106       <entry><structfield>max_value</structfield></entry>
10107       <entry><type>bigint</type></entry>
10108       <entry></entry>
10109       <entry>Maximum value of the sequence</entry>
10110      </row>
10111      <row>
10112       <entry><structfield>increment_by</structfield></entry>
10113       <entry><type>bigint</type></entry>
10114       <entry></entry>
10115       <entry>Increment value of the sequence</entry>
10116      </row>
10117      <row>
10118       <entry><structfield>cycle</structfield></entry>
10119       <entry><type>boolean</type></entry>
10120       <entry></entry>
10121       <entry>Whether the sequence cycles</entry>
10122      </row>
10123      <row>
10124       <entry><structfield>cache_size</structfield></entry>
10125       <entry><type>bigint</type></entry>
10126       <entry></entry>
10127       <entry>Cache size of the sequence</entry>
10128      </row>
10129      <row>
10130       <entry><structfield>last_value</structfield></entry>
10131       <entry><type>bigint</type></entry>
10132       <entry></entry>
10133       <entry>The last sequence value written to disk.  If caching is used,
10134        this value can be greater than the last value handed out from the
10135        sequence.  Null if the sequence has not been read from yet.  Also, if
10136        the current user does not have <literal>USAGE</literal>
10137        or <literal>SELECT</literal> privilege on the sequence, the value is
10138        null.</entry>
10139      </row>
10140     </tbody>
10141    </tgroup>
10142   </table>
10143  </sect1>
10144
10145  <sect1 id="view-pg-settings">
10146   <title><structname>pg_settings</structname></title>
10147
10148   <indexterm zone="view-pg-settings">
10149    <primary>pg_settings</primary>
10150   </indexterm>
10151
10152   <para>
10153    The view <structname>pg_settings</structname> provides access to
10154    run-time parameters of the server.  It is essentially an alternative
10155    interface to the <xref linkend="sql-show">
10156    and <xref linkend="sql-set"> commands.
10157    It also provides access to some facts about each parameter that are
10158    not directly available from <command>SHOW</>, such as minimum and
10159    maximum values.
10160   </para>
10161
10162   <table>
10163    <title><structname>pg_settings</> Columns</title>
10164
10165    <tgroup cols="3">
10166     <thead>
10167      <row>
10168       <entry>Name</entry>
10169       <entry>Type</entry>
10170       <entry>Description</entry>
10171      </row>
10172     </thead>
10173     <tbody>
10174      <row>
10175       <entry><structfield>name</structfield></entry>
10176       <entry><type>text</type></entry>
10177       <entry>Run-time configuration parameter name</entry>
10178      </row>
10179      <row>
10180       <entry><structfield>setting</structfield></entry>
10181       <entry><type>text</type></entry>
10182       <entry>Current value of the parameter</entry>
10183      </row>
10184      <row>
10185       <entry><structfield>unit</structfield></entry>
10186       <entry><type>text</type></entry>
10187       <entry>Implicit unit of the parameter</entry>
10188      </row>
10189      <row>
10190       <entry><structfield>category</structfield></entry>
10191       <entry><type>text</type></entry>
10192       <entry>Logical group of the parameter</entry>
10193      </row>
10194      <row>
10195       <entry><structfield>short_desc</structfield></entry>
10196       <entry><type>text</type></entry>
10197       <entry>A brief description of the parameter</entry>
10198      </row>
10199      <row>
10200       <entry><structfield>extra_desc</structfield></entry>
10201       <entry><type>text</type></entry>
10202       <entry>Additional, more detailed, description of the parameter</entry>
10203      </row>
10204      <row>
10205       <entry><structfield>context</structfield></entry>
10206       <entry><type>text</type></entry>
10207       <entry>Context required to set the parameter's value (see below)</entry>
10208      </row>
10209      <row>
10210       <entry><structfield>vartype</structfield></entry>
10211       <entry><type>text</type></entry>
10212       <entry>Parameter type (<literal>bool</>, <literal>enum</>,
10213        <literal>integer</>, <literal>real</>, or <literal>string</>)
10214       </entry>
10215      </row>
10216      <row>
10217       <entry><structfield>source</structfield></entry>
10218       <entry><type>text</type></entry>
10219       <entry>Source of the current parameter value</entry>
10220      </row>
10221      <row>
10222       <entry><structfield>min_val</structfield></entry>
10223       <entry><type>text</type></entry>
10224       <entry>Minimum allowed value of the parameter (null for non-numeric
10225       values)</entry>
10226      </row>
10227      <row>
10228       <entry><structfield>max_val</structfield></entry>
10229       <entry><type>text</type></entry>
10230       <entry>Maximum allowed value of the parameter (null for non-numeric
10231       values)</entry>
10232      </row>
10233      <row>
10234       <entry><structfield>enumvals</structfield></entry>
10235       <entry><type>text[]</type></entry>
10236       <entry>Allowed values of an enum parameter (null for non-enum
10237       values)</entry>
10238      </row>
10239      <row>
10240       <entry><structfield>boot_val</structfield></entry>
10241       <entry><type>text</type></entry>
10242       <entry>Parameter value assumed at server startup if the parameter is
10243       not otherwise set</entry>
10244      </row>
10245      <row>
10246       <entry><structfield>reset_val</structfield></entry>
10247       <entry><type>text</type></entry>
10248       <entry>Value that <command>RESET</command> would reset the parameter to
10249       in the current session</entry>
10250      </row>
10251      <row>
10252       <entry><structfield>sourcefile</structfield></entry>
10253       <entry><type>text</type></entry>
10254       <entry>Configuration file the current value was set in (null for
10255       values set from sources other than configuration files, or when
10256       examined by a user who is neither a superuser or a member of
10257       <literal>pg_read_all_settings</literal>); helpful when using
10258       <literal>include</> directives in configuration files</entry>
10259      </row>
10260      <row>
10261       <entry><structfield>sourceline</structfield></entry>
10262       <entry><type>integer</type></entry>
10263       <entry>Line number within the configuration file the current value was
10264       set at (null for values set from sources other than configuration files,
10265       or when examined by a user who is neither a superuser or a member of
10266       <literal>pg_read_all_settings</literal>).
10267       </entry>
10268      </row>
10269      <row>
10270       <entry><structfield>pending_restart</structfield></entry>
10271       <entry><type>boolean</type></entry>
10272       <entry><literal>true</literal> if the value has been changed in the
10273       configuration file but needs a restart; or <literal>false</literal>
10274       otherwise.
10275       </entry>
10276      </row>
10277     </tbody>
10278    </tgroup>
10279   </table>
10280
10281   <para>
10282    There are several possible values of <structfield>context</structfield>.
10283    In order of decreasing difficulty of changing the setting, they are:
10284   </para>
10285
10286   <variablelist>
10287    <varlistentry>
10288     <!-- PGC_INTERNAL -->
10289     <term><literal>internal</literal></term>
10290     <listitem>
10291      <para>
10292       These settings cannot be changed directly; they reflect internally
10293       determined values.  Some of them may be adjustable by rebuilding the
10294       server with different configuration options, or by changing options
10295       supplied to <command>initdb</command>.
10296      </para>
10297     </listitem>
10298    </varlistentry>
10299    <varlistentry>
10300     <!-- PGC_POSTMASTER -->
10301     <term><literal>postmaster</literal></term>
10302     <listitem>
10303      <para>
10304       These settings can only be applied when the server starts, so any change
10305       requires restarting the server.  Values for these settings are typically
10306       stored in the <filename>postgresql.conf</filename> file, or passed on
10307       the command line when starting the server.  Of course, settings with any
10308       of the lower <structfield>context</structfield> types can also be
10309       set at server start time.
10310      </para>
10311     </listitem>
10312    </varlistentry>
10313    <varlistentry>
10314     <!-- PGC_SIGHUP -->
10315     <term><literal>sighup</literal></term>
10316     <listitem>
10317      <para>
10318       Changes to these settings can be made in
10319       <filename>postgresql.conf</filename> without restarting the server.
10320       Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
10321       cause it to re-read <filename>postgresql.conf</filename> and apply
10322       the changes.  The postmaster will also forward the
10323       <systemitem>SIGHUP</systemitem> signal to its child processes so that
10324       they all pick up the new value.
10325      </para>
10326     </listitem>
10327    </varlistentry>
10328    <varlistentry>
10329     <!-- PGC_SU_BACKEND -->
10330     <term><literal>superuser-backend</literal></term>
10331     <listitem>
10332      <para>
10333       Changes to these settings can be made in
10334       <filename>postgresql.conf</filename> without restarting the server.
10335       They can also be set for a particular session in the connection request
10336       packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10337       environment variable), but only if the connecting user is a superuser.
10338       However, these settings never change in a session after it is started.
10339       If you change them in <filename>postgresql.conf</filename>, send a
10340       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10341       re-read <filename>postgresql.conf</filename>.  The new values will only
10342       affect subsequently-launched sessions.
10343      </para>
10344     </listitem>
10345    </varlistentry>
10346    <varlistentry>
10347     <!-- PGC_BACKEND -->
10348     <term><literal>backend</literal></term>
10349     <listitem>
10350      <para>
10351       Changes to these settings can be made in
10352       <filename>postgresql.conf</filename> without restarting the server.
10353       They can also be set for a particular session in the connection request
10354       packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10355       environment variable); any user can make such a change for their session.
10356       However, these settings never change in a session after it is started.
10357       If you change them in <filename>postgresql.conf</filename>, send a
10358       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10359       re-read <filename>postgresql.conf</filename>.  The new values will only
10360       affect subsequently-launched sessions.
10361      </para>
10362     </listitem>
10363    </varlistentry>
10364    <varlistentry>
10365     <!-- PGC_SUSET -->
10366     <term><literal>superuser</literal></term>
10367     <listitem>
10368      <para>
10369       These settings can be set from <filename>postgresql.conf</filename>,
10370       or within a session via the <command>SET</> command; but only superusers
10371       can change them via <command>SET</>.  Changes in
10372       <filename>postgresql.conf</filename> will affect existing sessions
10373       only if no session-local value has been established with <command>SET</>.
10374      </para>
10375     </listitem>
10376    </varlistentry>
10377    <varlistentry>
10378     <!-- PGC_USERSET -->
10379     <term><literal>user</literal></term>
10380     <listitem>
10381      <para>
10382       These settings can be set from <filename>postgresql.conf</filename>,
10383       or within a session via the <command>SET</> command.  Any user is
10384       allowed to change their session-local value.  Changes in
10385       <filename>postgresql.conf</filename> will affect existing sessions
10386       only if no session-local value has been established with <command>SET</>.
10387      </para>
10388     </listitem>
10389    </varlistentry>
10390   </variablelist>
10391
10392   <para>
10393    See <xref linkend="config-setting"> for more information about the various
10394    ways to change these parameters.
10395   </para>
10396
10397   <para>
10398    The <structname>pg_settings</structname> view cannot be inserted into or
10399    deleted from, but it can be updated.  An <command>UPDATE</command> applied
10400    to a row of <structname>pg_settings</structname> is equivalent to executing
10401    the <xref linkend="sql-set"> command on that named
10402    parameter. The change only affects the value used by the current
10403    session. If an <command>UPDATE</command> is issued within a transaction
10404    that is later aborted, the effects of the <command>UPDATE</command> command
10405    disappear when the transaction is rolled back. Once the surrounding
10406    transaction is committed, the effects will persist until the end of the
10407    session, unless overridden by another <command>UPDATE</command> or
10408    <command>SET</command>.
10409   </para>
10410
10411  </sect1>
10412
10413  <sect1 id="view-pg-shadow">
10414   <title><structname>pg_shadow</structname></title>
10415
10416   <indexterm zone="view-pg-shadow">
10417    <primary>pg_shadow</primary>
10418   </indexterm>
10419
10420   <para>
10421    The view <structname>pg_shadow</structname> exists for backwards
10422    compatibility: it emulates a catalog that existed in
10423    <productname>PostgreSQL</productname> before version 8.1.
10424    It shows properties of all roles that are marked as
10425    <structfield>rolcanlogin</> in
10426    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
10427   </para>
10428
10429   <para>
10430    The name stems from the fact that this table
10431    should not be readable by the public since it contains passwords.
10432    <link linkend="view-pg-user"><structname>pg_user</structname></link>
10433    is a publicly readable view on
10434    <structname>pg_shadow</structname> that blanks out the password field.
10435   </para>
10436
10437   <table>
10438    <title><structname>pg_shadow</> Columns</title>
10439
10440    <tgroup cols="4">
10441     <thead>
10442      <row>
10443       <entry>Name</entry>
10444       <entry>Type</entry>
10445       <entry>References</entry>
10446       <entry>Description</entry>
10447      </row>
10448     </thead>
10449
10450     <tbody>
10451      <row>
10452       <entry><structfield>usename</structfield></entry>
10453       <entry><type>name</type></entry>
10454       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10455       <entry>User name</entry>
10456      </row>
10457
10458      <row>
10459       <entry><structfield>usesysid</structfield></entry>
10460       <entry><type>oid</type></entry>
10461       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10462       <entry>ID of this user</entry>
10463      </row>
10464
10465      <row>
10466       <entry><structfield>usecreatedb</structfield></entry>
10467       <entry><type>bool</type></entry>
10468       <entry></entry>
10469       <entry>User can create databases</entry>
10470      </row>
10471
10472      <row>
10473       <entry><structfield>usesuper</structfield></entry>
10474       <entry><type>bool</type></entry>
10475       <entry></entry>
10476       <entry>User is a superuser</entry>
10477      </row>
10478
10479      <row>
10480       <entry><structfield>userepl</structfield></entry>
10481       <entry><type>bool</type></entry>
10482       <entry></entry>
10483       <entry>
10484        User can initiate streaming replication and put the system in and
10485        out of backup mode.
10486       </entry>
10487      </row>
10488
10489      <row>
10490       <entry><structfield>usebypassrls</structfield></entry>
10491       <entry><type>bool</type></entry>
10492       <entry></entry>
10493       <entry>
10494        User bypasses every row level security policy, see
10495        <xref linkend="ddl-rowsecurity"> for more information.
10496       </entry>
10497      </row>
10498
10499      <row>
10500       <entry><structfield>passwd</structfield></entry>
10501       <entry><type>text</type></entry>
10502       <entry></entry>
10503       <entry>Password (possibly encrypted); null if none.  See
10504       <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
10505       for details of how encrypted passwords are stored.</entry>
10506      </row>
10507
10508      <row>
10509       <entry><structfield>valuntil</structfield></entry>
10510       <entry><type>abstime</type></entry>
10511       <entry></entry>
10512       <entry>Password expiry time (only used for password authentication)</entry>
10513      </row>
10514
10515      <row>
10516       <entry><structfield>useconfig</structfield></entry>
10517       <entry><type>text[]</type></entry>
10518       <entry></entry>
10519       <entry>Session defaults for run-time configuration variables</entry>
10520      </row>
10521     </tbody>
10522    </tgroup>
10523   </table>
10524
10525  </sect1>
10526
10527  <sect1 id="view-pg-stats">
10528   <title><structname>pg_stats</structname></title>
10529
10530   <indexterm zone="view-pg-stats">
10531    <primary>pg_stats</primary>
10532   </indexterm>
10533
10534   <para>
10535    The view <structname>pg_stats</structname> provides access to
10536    the information stored in the <link
10537    linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
10538    catalog.  This view allows access only to rows of
10539    <structname>pg_statistic</structname> that correspond to tables the
10540    user has permission to read, and therefore it is safe to allow public
10541    read access to this view.
10542   </para>
10543
10544   <para>
10545    <structname>pg_stats</structname> is also designed to present the
10546    information in a more readable format than the underlying catalog
10547    &mdash; at the cost that its schema must be extended whenever new slot types
10548    are defined for <structname>pg_statistic</structname>.
10549   </para>
10550
10551   <table>
10552    <title><structname>pg_stats</> Columns</title>
10553
10554    <tgroup cols="4">
10555     <thead>
10556      <row>
10557       <entry>Name</entry>
10558       <entry>Type</entry>
10559       <entry>References</entry>
10560       <entry>Description</entry>
10561      </row>
10562     </thead>
10563     <tbody>
10564      <row>
10565       <entry><structfield>schemaname</structfield></entry>
10566       <entry><type>name</type></entry>
10567       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10568       <entry>Name of schema containing table</entry>
10569      </row>
10570
10571      <row>
10572       <entry><structfield>tablename</structfield></entry>
10573       <entry><type>name</type></entry>
10574       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10575       <entry>Name of table</entry>
10576      </row>
10577
10578      <row>
10579       <entry><structfield>attname</structfield></entry>
10580       <entry><type>name</type></entry>
10581       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
10582       <entry>Name of the column described by this row</entry>
10583      </row>
10584
10585      <row>
10586       <entry><structfield>inherited</structfield></entry>
10587       <entry><type>bool</type></entry>
10588       <entry></entry>
10589       <entry>If true, this row includes inheritance child columns, not just the
10590        values in the specified table</entry>
10591      </row>
10592
10593      <row>
10594       <entry><structfield>null_frac</structfield></entry>
10595       <entry><type>real</type></entry>
10596       <entry></entry>
10597       <entry>Fraction of column entries that are null</entry>
10598      </row>
10599
10600      <row>
10601       <entry><structfield>avg_width</structfield></entry>
10602       <entry><type>integer</type></entry>
10603       <entry></entry>
10604       <entry>Average width in bytes of column's entries</entry>
10605      </row>
10606
10607      <row>
10608       <entry><structfield>n_distinct</structfield></entry>
10609       <entry><type>real</type></entry>
10610       <entry></entry>
10611       <entry>
10612        If greater than zero, the estimated number of distinct values in the
10613        column.  If less than zero, the negative of the number of distinct
10614        values divided by the number of rows.  (The negated form is used when
10615        <command>ANALYZE</> believes that the number of distinct values is
10616        likely to increase as the table grows; the positive form is used when
10617        the column seems to have a fixed number of possible values.)  For
10618        example, -1 indicates a unique column in which the number of distinct
10619        values is the same as the number of rows.
10620       </entry>
10621      </row>
10622
10623      <row>
10624       <entry><structfield>most_common_vals</structfield></entry>
10625       <entry><type>anyarray</type></entry>
10626       <entry></entry>
10627       <entry>
10628        A list of the most common values in the column. (Null if
10629        no values seem to be more common than any others.)
10630       </entry>
10631      </row>
10632
10633      <row>
10634       <entry><structfield>most_common_freqs</structfield></entry>
10635       <entry><type>real[]</type></entry>
10636       <entry></entry>
10637       <entry>
10638        A list of the frequencies of the most common values,
10639        i.e., number of occurrences of each divided by total number of rows.
10640        (Null when <structfield>most_common_vals</structfield> is.)
10641       </entry>
10642      </row>
10643
10644      <row>
10645       <entry><structfield>histogram_bounds</structfield></entry>
10646       <entry><type>anyarray</type></entry>
10647       <entry></entry>
10648       <entry>
10649        A list of values that divide the column's values into groups of
10650        approximately equal population.  The values in
10651        <structfield>most_common_vals</>, if present, are omitted from this
10652        histogram calculation.  (This column is null if the column data type
10653        does not have a <literal>&lt;</> operator or if the
10654        <structfield>most_common_vals</> list accounts for the entire
10655        population.)
10656       </entry>
10657      </row>
10658
10659      <row>
10660       <entry><structfield>correlation</structfield></entry>
10661       <entry><type>real</type></entry>
10662       <entry></entry>
10663       <entry>
10664        Statistical correlation between physical row ordering and
10665        logical ordering of the column values.  This ranges from -1 to +1.
10666        When the value is near -1 or +1, an index scan on the column will
10667        be estimated to be cheaper than when it is near zero, due to reduction
10668        of random access to the disk.  (This column is null if the column data
10669        type does not have a <literal>&lt;</> operator.)
10670       </entry>
10671      </row>
10672
10673      <row>
10674       <entry><structfield>most_common_elems</structfield></entry>
10675       <entry><type>anyarray</type></entry>
10676       <entry></entry>
10677       <entry>
10678        A list of non-null element values most often appearing within values of
10679        the column. (Null for scalar types.)
10680       </entry>
10681      </row>
10682
10683      <row>
10684       <entry><structfield>most_common_elem_freqs</structfield></entry>
10685       <entry><type>real[]</type></entry>
10686       <entry></entry>
10687       <entry>
10688        A list of the frequencies of the most common element values, i.e., the
10689        fraction of rows containing at least one instance of the given value.
10690        Two or three additional values follow the per-element frequencies;
10691        these are the minimum and maximum of the preceding per-element
10692        frequencies, and optionally the frequency of null elements.
10693        (Null when <structfield>most_common_elems</structfield> is.)
10694       </entry>
10695      </row>
10696
10697      <row>
10698       <entry><structfield>elem_count_histogram</structfield></entry>
10699       <entry><type>real[]</type></entry>
10700       <entry></entry>
10701       <entry>
10702        A histogram of the counts of distinct non-null element values within the
10703        values of the column, followed by the average number of distinct
10704        non-null elements.  (Null for scalar types.)
10705       </entry>
10706      </row>
10707     </tbody>
10708    </tgroup>
10709   </table>
10710
10711   <para>
10712    The maximum number of entries in the array fields can be controlled on a
10713    column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
10714    command, or globally by setting the
10715    <xref linkend="guc-default-statistics-target"> run-time parameter.
10716   </para>
10717
10718  </sect1>
10719
10720  <sect1 id="view-pg-tables">
10721   <title><structname>pg_tables</structname></title>
10722
10723   <indexterm zone="view-pg-tables">
10724    <primary>pg_tables</primary>
10725   </indexterm>
10726
10727   <para>
10728    The view <structname>pg_tables</structname> provides access to
10729    useful information about each table in the database.
10730   </para>
10731
10732   <table>
10733    <title><structname>pg_tables</> Columns</title>
10734
10735    <tgroup cols="4">
10736     <thead>
10737      <row>
10738       <entry>Name</entry>
10739       <entry>Type</entry>
10740       <entry>References</entry>
10741       <entry>Description</entry>
10742      </row>
10743     </thead>
10744     <tbody>
10745      <row>
10746       <entry><structfield>schemaname</structfield></entry>
10747       <entry><type>name</type></entry>
10748       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10749       <entry>Name of schema containing table</entry>
10750      </row>
10751      <row>
10752       <entry><structfield>tablename</structfield></entry>
10753       <entry><type>name</type></entry>
10754       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10755       <entry>Name of table</entry>
10756      </row>
10757      <row>
10758       <entry><structfield>tableowner</structfield></entry>
10759       <entry><type>name</type></entry>
10760       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10761       <entry>Name of table's owner</entry>
10762      </row>
10763      <row>
10764       <entry><structfield>tablespace</structfield></entry>
10765       <entry><type>name</type></entry>
10766       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
10767       <entry>Name of tablespace containing table (null if default for database)</entry>
10768      </row>
10769      <row>
10770       <entry><structfield>hasindexes</structfield></entry>
10771       <entry><type>boolean</type></entry>
10772       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
10773       <entry>True if table has (or recently had) any indexes</entry>
10774      </row>
10775      <row>
10776       <entry><structfield>hasrules</structfield></entry>
10777       <entry><type>boolean</type></entry>
10778       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
10779       <entry>True if table has (or once had) rules</entry>
10780      </row>
10781      <row>
10782       <entry><structfield>hastriggers</structfield></entry>
10783       <entry><type>boolean</type></entry>
10784       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
10785       <entry>True if table has (or once had) triggers</entry>
10786      </row>
10787      <row>
10788       <entry><structfield>rowsecurity</structfield></entry>
10789       <entry><type>boolean</type></entry>
10790       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
10791       <entry>True if row security is enabled on the table</entry>
10792      </row>
10793     </tbody>
10794    </tgroup>
10795   </table>
10796
10797  </sect1>
10798
10799  <sect1 id="view-pg-timezone-abbrevs">
10800   <title><structname>pg_timezone_abbrevs</structname></title>
10801
10802   <indexterm zone="view-pg-timezone-abbrevs">
10803    <primary>pg_timezone_abbrevs</primary>
10804   </indexterm>
10805
10806   <para>
10807    The view <structname>pg_timezone_abbrevs</structname> provides a list
10808    of time zone abbreviations that are currently recognized by the datetime
10809    input routines.  The contents of this view change when the
10810    <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
10811   </para>
10812
10813   <table>
10814    <title><structname>pg_timezone_abbrevs</> Columns</title>
10815
10816    <tgroup cols="3">
10817     <thead>
10818      <row>
10819       <entry>Name</entry>
10820       <entry>Type</entry>
10821       <entry>Description</entry>
10822      </row>
10823     </thead>
10824     <tbody>
10825      <row>
10826       <entry><structfield>abbrev</structfield></entry>
10827       <entry><type>text</type></entry>
10828       <entry>Time zone abbreviation</entry>
10829      </row>
10830      <row>
10831       <entry><structfield>utc_offset</structfield></entry>
10832       <entry><type>interval</type></entry>
10833       <entry>Offset from UTC (positive means east of Greenwich)</entry>
10834      </row>
10835      <row>
10836       <entry><structfield>is_dst</structfield></entry>
10837       <entry><type>boolean</type></entry>
10838       <entry>True if this is a daylight-savings abbreviation</entry>
10839      </row>
10840     </tbody>
10841    </tgroup>
10842   </table>
10843
10844   <para>
10845    While most timezone abbreviations represent fixed offsets from UTC,
10846    there are some that have historically varied in value
10847    (see <xref linkend="datetime-config-files"> for more information).
10848    In such cases this view presents their current meaning.
10849   </para>
10850
10851  </sect1>
10852
10853  <sect1 id="view-pg-timezone-names">
10854   <title><structname>pg_timezone_names</structname></title>
10855
10856   <indexterm zone="view-pg-timezone-names">
10857    <primary>pg_timezone_names</primary>
10858   </indexterm>
10859
10860   <para>
10861    The view <structname>pg_timezone_names</structname> provides a list
10862    of time zone names that are recognized by <command>SET TIMEZONE</>,
10863    along with their associated abbreviations, UTC offsets,
10864    and daylight-savings status.  (Technically,
10865    <productname>PostgreSQL</productname> does not use UTC because leap
10866    seconds are not handled.)
10867    Unlike the abbreviations shown in <link
10868    linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
10869    date rules.  Therefore, the associated information changes across local DST
10870    boundaries.  The displayed information is computed based on the current
10871    value of <function>CURRENT_TIMESTAMP</>.
10872   </para>
10873
10874   <table>
10875    <title><structname>pg_timezone_names</> Columns</title>
10876
10877    <tgroup cols="3">
10878     <thead>
10879      <row>
10880       <entry>Name</entry>
10881       <entry>Type</entry>
10882       <entry>Description</entry>
10883      </row>
10884     </thead>
10885     <tbody>
10886      <row>
10887       <entry><structfield>name</structfield></entry>
10888       <entry><type>text</type></entry>
10889       <entry>Time zone name</entry>
10890      </row>
10891      <row>
10892       <entry><structfield>abbrev</structfield></entry>
10893       <entry><type>text</type></entry>
10894       <entry>Time zone abbreviation</entry>
10895      </row>
10896      <row>
10897       <entry><structfield>utc_offset</structfield></entry>
10898       <entry><type>interval</type></entry>
10899       <entry>Offset from UTC (positive means east of Greenwich)</entry>
10900      </row>
10901      <row>
10902       <entry><structfield>is_dst</structfield></entry>
10903       <entry><type>boolean</type></entry>
10904       <entry>True if currently observing daylight savings</entry>
10905      </row>
10906     </tbody>
10907    </tgroup>
10908   </table>
10909
10910  </sect1>
10911
10912  <sect1 id="view-pg-user">
10913   <title><structname>pg_user</structname></title>
10914
10915   <indexterm zone="view-pg-user">
10916    <primary>pg_user</primary>
10917   </indexterm>
10918
10919   <para>
10920    The view <structname>pg_user</structname> provides access to
10921    information about database users.  This is simply a publicly
10922    readable view of
10923    <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
10924    that blanks out the password field.
10925   </para>
10926
10927   <table>
10928    <title><structname>pg_user</> Columns</title>
10929
10930    <tgroup cols="3">
10931     <thead>
10932      <row>
10933       <entry>Name</entry>
10934       <entry>Type</entry>
10935       <entry>Description</entry>
10936      </row>
10937     </thead>
10938     <tbody>
10939      <row>
10940       <entry><structfield>usename</structfield></entry>
10941       <entry><type>name</type></entry>
10942       <entry>User name</entry>
10943      </row>
10944
10945      <row>
10946       <entry><structfield>usesysid</structfield></entry>
10947       <entry><type>oid</type></entry>
10948       <entry>ID of this user</entry>
10949      </row>
10950
10951      <row>
10952       <entry><structfield>usecreatedb</structfield></entry>
10953       <entry><type>bool</type></entry>
10954       <entry>User can create databases</entry>
10955      </row>
10956
10957      <row>
10958       <entry><structfield>usesuper</structfield></entry>
10959       <entry><type>bool</type></entry>
10960       <entry>User is a superuser</entry>
10961      </row>
10962
10963      <row>
10964       <entry><structfield>userepl</structfield></entry>
10965       <entry><type>bool</type></entry>
10966       <entry>
10967        User can initiate streaming replication and put the system in and
10968        out of backup mode.
10969       </entry>
10970      </row>
10971
10972      <row>
10973       <entry><structfield>usebypassrls</structfield></entry>
10974       <entry><type>bool</type></entry>
10975       <entry>
10976        User bypasses every row level security policy, see
10977        <xref linkend="ddl-rowsecurity"> for more information.
10978       </entry>
10979      </row>
10980
10981      <row>
10982       <entry><structfield>passwd</structfield></entry>
10983       <entry><type>text</type></entry>
10984       <entry>Not the password (always reads as <literal>********</>)</entry>
10985      </row>
10986
10987      <row>
10988       <entry><structfield>valuntil</structfield></entry>
10989       <entry><type>abstime</type></entry>
10990       <entry>Password expiry time (only used for password authentication)</entry>
10991      </row>
10992
10993      <row>
10994       <entry><structfield>useconfig</structfield></entry>
10995       <entry><type>text[]</type></entry>
10996       <entry>Session defaults for run-time configuration variables</entry>
10997      </row>
10998     </tbody>
10999    </tgroup>
11000   </table>
11001
11002  </sect1>
11003
11004  <sect1 id="view-pg-user-mappings">
11005   <title><structname>pg_user_mappings</structname></title>
11006
11007   <indexterm zone="view-pg-user-mappings">
11008    <primary>pg_user_mappings</primary>
11009   </indexterm>
11010
11011   <para>
11012    The view <structname>pg_user_mappings</structname> provides access
11013    to information about user mappings.  This is essentially a publicly
11014    readable view of
11015    <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
11016    that leaves out the options field if the user has no rights to use
11017    it.
11018   </para>
11019
11020   <table>
11021    <title><structname>pg_user_mappings</> Columns</title>
11022
11023    <tgroup cols="4">
11024     <thead>
11025      <row>
11026       <entry>Name</entry>
11027       <entry>Type</entry>
11028       <entry>References</entry>
11029       <entry>Description</entry>
11030      </row>
11031     </thead>
11032
11033     <tbody>
11034      <row>
11035       <entry><structfield>umid</structfield></entry>
11036       <entry><type>oid</type></entry>
11037       <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
11038       <entry>OID of the user mapping</entry>
11039      </row>
11040
11041      <row>
11042       <entry><structfield>srvid</structfield></entry>
11043       <entry><type>oid</type></entry>
11044       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
11045       <entry>
11046        The OID of the foreign server that contains this mapping
11047       </entry>
11048      </row>
11049
11050      <row>
11051       <entry><structfield>srvname</structfield></entry>
11052       <entry><type>name</type></entry>
11053       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
11054       <entry>
11055        Name of the foreign server
11056       </entry>
11057      </row>
11058
11059      <row>
11060       <entry><structfield>umuser</structfield></entry>
11061       <entry><type>oid</type></entry>
11062       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
11063       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
11064      </row>
11065
11066      <row>
11067       <entry><structfield>usename</structfield></entry>
11068       <entry><type>name</type></entry>
11069       <entry></entry>
11070       <entry>Name of the local user to be mapped</entry>
11071      </row>
11072
11073      <row>
11074       <entry><structfield>umoptions</structfield></entry>
11075       <entry><type>text[]</type></entry>
11076       <entry></entry>
11077       <entry>
11078        User mapping specific options, as <quote>keyword=value</>
11079        strings, if the current user is the owner of the foreign
11080        server, else null
11081       </entry>
11082      </row>
11083     </tbody>
11084    </tgroup>
11085   </table>
11086  </sect1>
11087
11088
11089  <sect1 id="view-pg-views">
11090   <title><structname>pg_views</structname></title>
11091
11092   <indexterm zone="view-pg-views">
11093    <primary>pg_views</primary>
11094   </indexterm>
11095
11096   <para>
11097    The view <structname>pg_views</structname> provides access to
11098    useful information about each view in the database.
11099   </para>
11100
11101   <table>
11102    <title><structname>pg_views</> Columns</title>
11103
11104    <tgroup cols="4">
11105     <thead>
11106      <row>
11107       <entry>Name</entry>
11108       <entry>Type</entry>
11109       <entry>References</entry>
11110       <entry>Description</entry>
11111      </row>
11112     </thead>
11113     <tbody>
11114      <row>
11115       <entry><structfield>schemaname</structfield></entry>
11116       <entry><type>name</type></entry>
11117       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
11118       <entry>Name of schema containing view</entry>
11119      </row>
11120      <row>
11121       <entry><structfield>viewname</structfield></entry>
11122       <entry><type>name</type></entry>
11123       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
11124       <entry>Name of view</entry>
11125      </row>
11126      <row>
11127       <entry><structfield>viewowner</structfield></entry>
11128       <entry><type>name</type></entry>
11129       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
11130       <entry>Name of view's owner</entry>
11131      </row>
11132      <row>
11133       <entry><structfield>definition</structfield></entry>
11134       <entry><type>text</type></entry>
11135       <entry></entry>
11136       <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
11137      </row>
11138     </tbody>
11139    </tgroup>
11140   </table>
11141
11142  </sect1>
11143
11144 </chapter>