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