]> granicus.if.org Git - postgresql/blob - doc/src/sgml/catalogs.sgml
Trim trailing whitespace
[postgresql] / doc / src / sgml / catalogs.sgml
1 <!-- doc/src/sgml/catalogs.sgml -->
2 <!--
3  Documentation of the system catalogs, directed toward PostgreSQL developers
4  -->
5
6 <chapter id="catalogs">
7  <title>System Catalogs</title>
8
9   <para>
10    The system catalogs are the place where a relational database
11    management system stores schema metadata, such as information about
12    tables and columns, and internal bookkeeping information.
13    <productname>PostgreSQL</productname>'s system catalogs are regular
14    tables.  You can drop and recreate the tables, add columns, insert
15    and update values, and severely mess up your system that way.
16    Normally, one should not change the system catalogs by hand, there
17    are normally SQL commands to do that.  (For example, <command>CREATE
18    DATABASE</command> inserts a row into the
19    <structname>pg_database</structname> catalog &mdash; and actually
20    creates the database on disk.)  There are some exceptions for
21    particularly esoteric operations, but many of those have been made
22    available as SQL commands over time, and so the need for direct manipulation
23    of the system catalogs is ever decreasing.
24   </para>
25
26  <sect1 id="catalogs-overview">
27   <title>Overview</title>
28
29   <para>
30    <xref linkend="catalog-table"> lists the system catalogs.
31    More detailed documentation of each catalog follows below.
32   </para>
33
34   <para>
35    Most system catalogs are copied from the template database during
36    database creation and are thereafter database-specific. A few
37    catalogs are physically shared across all databases in a cluster;
38    these are noted in the descriptions of the individual catalogs.
39   </para>
40
41   <table id="catalog-table">
42    <title>System Catalogs</title>
43
44    <tgroup cols="2">
45     <thead>
46      <row>
47       <entry>Catalog Name</entry>
48       <entry>Purpose</entry>
49      </row>
50     </thead>
51
52     <tbody>
53      <row>
54       <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
55       <entry>aggregate functions</entry>
56      </row>
57
58      <row>
59       <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
60       <entry>index access methods</entry>
61      </row>
62
63      <row>
64       <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
65       <entry>access method operators</entry>
66      </row>
67
68      <row>
69       <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
70       <entry>access method support procedures</entry>
71      </row>
72
73      <row>
74       <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
75       <entry>column default values</entry>
76      </row>
77
78      <row>
79       <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
80       <entry>table columns (<quote>attributes</quote>)</entry>
81      </row>
82
83      <row>
84       <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
85       <entry>authorization identifiers (roles)</entry>
86      </row>
87
88      <row>
89       <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
90       <entry>authorization identifier membership relationships</entry>
91      </row>
92
93      <row>
94       <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
95       <entry>casts (data type conversions)</entry>
96      </row>
97
98      <row>
99       <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
100       <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
101      </row>
102
103      <row>
104       <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
105       <entry>collations (locale information)</entry>
106      </row>
107
108      <row>
109       <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
110       <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
111      </row>
112
113      <row>
114       <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
115       <entry>encoding conversion information</entry>
116      </row>
117
118      <row>
119       <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
120       <entry>databases within this database cluster</entry>
121      </row>
122
123      <row>
124       <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
125       <entry>per-role and per-database settings</entry>
126      </row>
127
128      <row>
129       <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
130       <entry>default privileges for object types</entry>
131      </row>
132
133      <row>
134       <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
135       <entry>dependencies between database objects</entry>
136      </row>
137
138      <row>
139       <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
140       <entry>descriptions or comments on database objects</entry>
141      </row>
142
143      <row>
144       <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
145       <entry>enum label and value definitions</entry>
146      </row>
147
148      <row>
149       <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
150       <entry>event triggers</entry>
151      </row>
152
153      <row>
154       <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
155       <entry>installed extensions</entry>
156      </row>
157
158      <row>
159       <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
160       <entry>foreign-data wrapper definitions</entry>
161      </row>
162
163      <row>
164       <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
165       <entry>foreign server definitions</entry>
166      </row>
167
168      <row>
169       <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
170       <entry>additional foreign table information</entry>
171      </row>
172
173      <row>
174       <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
175       <entry>additional index information</entry>
176      </row>
177
178      <row>
179       <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
180       <entry>table inheritance hierarchy</entry>
181      </row>
182
183      <row>
184       <entry><link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link></entry>
185       <entry>object initial privileges</entry>
186      </row>
187
188      <row>
189       <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
190       <entry>languages for writing functions</entry>
191      </row>
192
193      <row>
194       <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
195       <entry>data pages for large objects</entry>
196      </row>
197
198      <row>
199       <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
200       <entry>metadata for large objects</entry>
201      </row>
202
203      <row>
204       <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
205       <entry>schemas</entry>
206      </row>
207
208      <row>
209       <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
210       <entry>access method operator classes</entry>
211      </row>
212
213      <row>
214       <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
215       <entry>operators</entry>
216      </row>
217
218      <row>
219       <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
220       <entry>access method operator families</entry>
221      </row>
222
223      <row>
224       <entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
225       <entry>information about partition key of tables</entry>
226      </row>
227
228      <row>
229       <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
230       <entry>template data for procedural languages</entry>
231      </row>
232
233      <row>
234       <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
235       <entry>row-security policies</entry>
236      </row>
237
238      <row>
239       <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
240       <entry>functions and procedures</entry>
241      </row>
242
243      <row>
244       <entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
245       <entry>publications for logical replication</entry>
246      </row>
247
248      <row>
249       <entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
250       <entry>relation to publication mapping</entry>
251      </row>
252
253      <row>
254       <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
255       <entry>information about range types</entry>
256      </row>
257
258      <row>
259       <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
260       <entry>registered replication origins</entry>
261      </row>
262
263      <row>
264       <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
265       <entry>query rewrite rules</entry>
266      </row>
267
268      <row>
269       <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
270       <entry>security labels on database objects</entry>
271      </row>
272
273      <row>
274       <entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
275       <entry>information about sequences</entry>
276      </row>
277
278      <row>
279       <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
280       <entry>dependencies on shared objects</entry>
281      </row>
282
283      <row>
284       <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
285       <entry>comments on shared objects</entry>
286      </row>
287
288      <row>
289       <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
290       <entry>security labels on shared database objects</entry>
291      </row>
292
293      <row>
294       <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
295       <entry>planner statistics</entry>
296      </row>
297
298      <row>
299       <entry><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link></entry>
300       <entry>extended planner statistics</entry>
301      </row>
302
303      <row>
304       <entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
305       <entry>logical replication subscriptions</entry>
306      </row>
307
308      <row>
309       <entry><link linkend="catalog-pg-subscription-rel"><structname>pg_subscription_rel</structname></link></entry>
310       <entry>relation state for subscriptions</entry>
311      </row>
312
313      <row>
314       <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
315       <entry>tablespaces within this database cluster</entry>
316      </row>
317
318      <row>
319       <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
320       <entry>transforms (data type to procedural language conversions)</entry>
321      </row>
322
323      <row>
324       <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
325       <entry>triggers</entry>
326      </row>
327
328      <row>
329       <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
330       <entry>text search configurations</entry>
331      </row>
332
333      <row>
334       <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
335       <entry>text search configurations' token mappings</entry>
336      </row>
337
338      <row>
339       <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
340       <entry>text search dictionaries</entry>
341      </row>
342
343      <row>
344       <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
345       <entry>text search parsers</entry>
346      </row>
347
348      <row>
349       <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
350       <entry>text search templates</entry>
351      </row>
352
353      <row>
354       <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
355       <entry>data types</entry>
356      </row>
357
358      <row>
359       <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
360       <entry>mappings of users to foreign servers</entry>
361      </row>
362     </tbody>
363    </tgroup>
364   </table>
365  </sect1>
366
367
368  <sect1 id="catalog-pg-aggregate">
369   <title><structname>pg_aggregate</structname></title>
370
371   <indexterm zone="catalog-pg-aggregate">
372    <primary>pg_aggregate</primary>
373   </indexterm>
374
375   <para>
376    The catalog <structname>pg_aggregate</structname> stores information about
377    aggregate functions.  An aggregate function is a function that
378    operates on a set of values (typically one column from each row
379    that matches a query condition) and returns a single value computed
380    from all these values.  Typical aggregate functions are
381    <function>sum</function>, <function>count</function>, and
382    <function>max</function>.  Each entry in
383    <structname>pg_aggregate</structname> is an extension of an entry
384    in <structname>pg_proc</structname>.  The <structname>pg_proc</structname>
385    entry carries the aggregate's name, input and output data types, and
386    other information that is similar to ordinary functions.
387   </para>
388
389   <table>
390    <title><structname>pg_aggregate</> Columns</title>
391
392    <tgroup cols="4">
393     <thead>
394      <row>
395       <entry>Name</entry>
396       <entry>Type</entry>
397       <entry>References</entry>
398       <entry>Description</entry>
399      </row>
400     </thead>
401     <tbody>
402      <row>
403       <entry><structfield>aggfnoid</structfield></entry>
404       <entry><type>regproc</type></entry>
405       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
406       <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
407      </row>
408      <row>
409       <entry><structfield>aggkind</structfield></entry>
410       <entry><type>char</type></entry>
411       <entry></entry>
412       <entry>Aggregate kind:
413        <literal>n</literal> for <quote>normal</> aggregates,
414        <literal>o</literal> for <quote>ordered-set</> aggregates, or
415        <literal>h</literal> for <quote>hypothetical-set</> aggregates
416       </entry>
417      </row>
418      <row>
419       <entry><structfield>aggnumdirectargs</structfield></entry>
420       <entry><type>int2</type></entry>
421       <entry></entry>
422       <entry>Number of direct (non-aggregated) arguments of an ordered-set or
423        hypothetical-set aggregate, counting a variadic array as one argument.
424        If equal to <structfield>pronargs</>, the aggregate must be variadic
425        and the variadic array describes the aggregated arguments as well as
426        the final direct arguments.
427        Always zero for normal aggregates.</entry>
428      </row>
429      <row>
430       <entry><structfield>aggtransfn</structfield></entry>
431       <entry><type>regproc</type></entry>
432       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
433       <entry>Transition function</entry>
434      </row>
435      <row>
436       <entry><structfield>aggfinalfn</structfield></entry>
437       <entry><type>regproc</type></entry>
438       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
439       <entry>Final function (zero if none)</entry>
440      </row>
441      <row>
442       <entry><structfield>aggcombinefn</structfield></entry>
443       <entry><type>regproc</type></entry>
444       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
445       <entry>Combine function (zero if none)</entry>
446      </row>
447      <row>
448       <entry><structfield>aggserialfn</structfield></entry>
449       <entry><type>regproc</type></entry>
450       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
451       <entry>Serialization function (zero if none)</entry>
452      </row>
453      <row>
454       <entry><structfield>aggdeserialfn</structfield></entry>
455       <entry><type>regproc</type></entry>
456       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
457       <entry>Deserialization function (zero if none)</entry>
458      </row>
459      <row>
460       <entry><structfield>aggmtransfn</structfield></entry>
461       <entry><type>regproc</type></entry>
462       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
463       <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
464      </row>
465      <row>
466       <entry><structfield>aggminvtransfn</structfield></entry>
467       <entry><type>regproc</type></entry>
468       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
469       <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
470      </row>
471      <row>
472       <entry><structfield>aggmfinalfn</structfield></entry>
473       <entry><type>regproc</type></entry>
474       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
475       <entry>Final function for moving-aggregate mode (zero if none)</entry>
476      </row>
477      <row>
478       <entry><structfield>aggfinalextra</structfield></entry>
479       <entry><type>bool</type></entry>
480       <entry></entry>
481       <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
482      </row>
483      <row>
484       <entry><structfield>aggmfinalextra</structfield></entry>
485       <entry><type>bool</type></entry>
486       <entry></entry>
487       <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
488      </row>
489      <row>
490       <entry><structfield>aggsortop</structfield></entry>
491       <entry><type>oid</type></entry>
492       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
493       <entry>Associated sort operator (zero if none)</entry>
494      </row>
495      <row>
496       <entry><structfield>aggtranstype</structfield></entry>
497       <entry><type>oid</type></entry>
498       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
499       <entry>Data type of the aggregate function's internal transition (state) data</entry>
500      </row>
501      <row>
502       <entry><structfield>aggtransspace</structfield></entry>
503       <entry><type>int4</type></entry>
504       <entry></entry>
505       <entry>Approximate average size (in bytes) of the transition state
506        data, or zero to use a default estimate</entry>
507      </row>
508      <row>
509       <entry><structfield>aggmtranstype</structfield></entry>
510       <entry><type>oid</type></entry>
511       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
512       <entry>Data type of the aggregate function's internal transition (state)
513        data for moving-aggregate mode (zero if none)</entry>
514      </row>
515      <row>
516       <entry><structfield>aggmtransspace</structfield></entry>
517       <entry><type>int4</type></entry>
518       <entry></entry>
519       <entry>Approximate average size (in bytes) of the transition state data
520        for moving-aggregate mode, or zero to use a default estimate</entry>
521      </row>
522      <row>
523       <entry><structfield>agginitval</structfield></entry>
524       <entry><type>text</type></entry>
525       <entry></entry>
526       <entry>
527        The initial value of the transition state.  This is a text
528        field containing the initial value in its external string
529        representation.  If this field is null, the transition state
530        value starts out null.
531       </entry>
532      </row>
533      <row>
534       <entry><structfield>aggminitval</structfield></entry>
535       <entry><type>text</type></entry>
536       <entry></entry>
537       <entry>
538        The initial value of the transition state for moving-aggregate mode.
539        This is a text field containing the initial value in its external
540        string representation.  If this field is null, the transition state
541        value starts out null.
542       </entry>
543      </row>
544     </tbody>
545    </tgroup>
546   </table>
547
548   <para>
549    New aggregate functions are registered with the <xref
550    linkend="sql-createaggregate">
551    command.  See <xref linkend="xaggr"> for more information about
552    writing aggregate functions and the meaning of the transition
553    functions, etc.
554   </para>
555
556  </sect1>
557
558
559  <sect1 id="catalog-pg-am">
560   <title><structname>pg_am</structname></title>
561
562   <indexterm zone="catalog-pg-am">
563    <primary>pg_am</primary>
564   </indexterm>
565
566   <para>
567    The catalog <structname>pg_am</structname> stores information about
568    relation access methods.  There is one row for each access method supported
569    by the system.
570    Currently, only indexes have access methods.  The requirements for index
571    access methods are discussed in detail in <xref linkend="indexam">.
572   </para>
573
574   <table>
575    <title><structname>pg_am</> Columns</title>
576
577    <tgroup cols="4">
578     <thead>
579      <row>
580       <entry>Name</entry>
581       <entry>Type</entry>
582       <entry>References</entry>
583       <entry>Description</entry>
584      </row>
585     </thead>
586     <tbody>
587
588      <row>
589       <entry><structfield>oid</structfield></entry>
590       <entry><type>oid</type></entry>
591       <entry></entry>
592       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
593      </row>
594
595      <row>
596       <entry><structfield>amname</structfield></entry>
597       <entry><type>name</type></entry>
598       <entry></entry>
599       <entry>Name of the access method</entry>
600      </row>
601
602      <row>
603       <entry><structfield>amhandler</structfield></entry>
604       <entry><type>regproc</type></entry>
605       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
606       <entry>
607        OID of a handler function that is responsible for supplying information
608        about the access method
609       </entry>
610      </row>
611
612      <row>
613       <entry><structfield>amtype</structfield></entry>
614       <entry><type>char</type></entry>
615       <entry></entry>
616       <entry>
617        Currently always <literal>i</literal> to indicate an index access
618        method; other values may be allowed in future
619       </entry>
620      </row>
621     </tbody>
622    </tgroup>
623   </table>
624
625   <note>
626    <para>
627     Before <productname>PostgreSQL</> 9.6, <structname>pg_am</structname>
628     contained many additional columns representing properties of index access
629     methods.  That data is now only directly visible at the C code level.
630     However, <function>pg_index_column_has_property()</function> and related
631     functions have been added to allow SQL queries to inspect index access
632     method properties; see <xref linkend="functions-info-catalog-table">.
633    </para>
634   </note>
635
636  </sect1>
637
638
639  <sect1 id="catalog-pg-amop">
640   <title><structname>pg_amop</structname></title>
641
642   <indexterm zone="catalog-pg-amop">
643    <primary>pg_amop</primary>
644   </indexterm>
645
646   <para>
647    The catalog <structname>pg_amop</structname> stores information about
648    operators associated with access method operator families.  There is one
649    row for each operator that is a member of an operator family.  A family
650    member can be either a <firstterm>search</> operator or an
651    <firstterm>ordering</> operator.  An operator
652    can appear in more than one family, but cannot appear in more than one
653    search position nor more than one ordering position within a family.
654    (It is allowed, though unlikely, for an operator to be used for both
655    search and ordering purposes.)
656   </para>
657
658   <table>
659    <title><structname>pg_amop</> Columns</title>
660
661    <tgroup cols="4">
662     <thead>
663      <row>
664       <entry>Name</entry>
665       <entry>Type</entry>
666       <entry>References</entry>
667       <entry>Description</entry>
668      </row>
669     </thead>
670     <tbody>
671
672      <row>
673       <entry><structfield>oid</structfield></entry>
674       <entry><type>oid</type></entry>
675       <entry></entry>
676       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
677      </row>
678
679      <row>
680       <entry><structfield>amopfamily</structfield></entry>
681       <entry><type>oid</type></entry>
682       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
683       <entry>The operator family this entry is for</entry>
684      </row>
685
686      <row>
687       <entry><structfield>amoplefttype</structfield></entry>
688       <entry><type>oid</type></entry>
689       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
690       <entry>Left-hand input data type of operator</entry>
691      </row>
692
693      <row>
694       <entry><structfield>amoprighttype</structfield></entry>
695       <entry><type>oid</type></entry>
696       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
697       <entry>Right-hand input data type of operator</entry>
698      </row>
699
700      <row>
701       <entry><structfield>amopstrategy</structfield></entry>
702       <entry><type>int2</type></entry>
703       <entry></entry>
704       <entry>Operator strategy number</entry>
705      </row>
706
707      <row>
708       <entry><structfield>amoppurpose</structfield></entry>
709       <entry><type>char</type></entry>
710       <entry></entry>
711       <entry>Operator purpose, either <literal>s</> for search or
712        <literal>o</> for ordering</entry>
713      </row>
714
715      <row>
716       <entry><structfield>amopopr</structfield></entry>
717       <entry><type>oid</type></entry>
718       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
719       <entry>OID of the operator</entry>
720      </row>
721
722      <row>
723       <entry><structfield>amopmethod</structfield></entry>
724       <entry><type>oid</type></entry>
725       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
726       <entry>Index access method operator family is for</entry>
727      </row>
728
729      <row>
730       <entry><structfield>amopsortfamily</structfield></entry>
731       <entry><type>oid</type></entry>
732       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
733       <entry>The B-tree operator family this entry sorts according to, if an
734        ordering operator; zero if a search operator</entry>
735      </row>
736
737     </tbody>
738    </tgroup>
739   </table>
740
741   <para>
742    A <quote>search</> operator entry indicates that an index of this operator
743    family can be searched to find all rows satisfying
744    <literal>WHERE</>
745    <replaceable>indexed_column</>
746    <replaceable>operator</>
747    <replaceable>constant</>.
748    Obviously, such an operator must return <type>boolean</type>, and its left-hand input
749    type must match the index's column data type.
750   </para>
751
752   <para>
753    An <quote>ordering</> operator entry indicates that an index of this
754    operator family can be scanned to return rows in the order represented by
755    <literal>ORDER BY</>
756    <replaceable>indexed_column</>
757    <replaceable>operator</>
758    <replaceable>constant</>.
759    Such an operator could return any sortable data type, though again
760    its left-hand input type must match the index's column data type.
761    The exact semantics of the <literal>ORDER BY</> are specified by the
762    <structfield>amopsortfamily</structfield> column, which must reference
763    a B-tree operator family for the operator's result type.
764   </para>
765
766   <note>
767    <para>
768     At present, it's assumed that the sort order for an ordering operator
769     is the default for the referenced operator family, i.e., <literal>ASC NULLS
770     LAST</>.  This might someday be relaxed by adding additional columns
771     to specify sort options explicitly.
772    </para>
773   </note>
774
775   <para>
776    An entry's <structfield>amopmethod</> must match the
777    <structname>opfmethod</> of its containing operator family (including
778    <structfield>amopmethod</> here is an intentional denormalization of the
779    catalog structure for performance reasons).  Also,
780    <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
781    the <structfield>oprleft</> and <structfield>oprright</> fields of the
782    referenced <structname>pg_operator</> entry.
783   </para>
784
785  </sect1>
786
787
788  <sect1 id="catalog-pg-amproc">
789   <title><structname>pg_amproc</structname></title>
790
791   <indexterm zone="catalog-pg-amproc">
792    <primary>pg_amproc</primary>
793   </indexterm>
794
795   <para>
796    The catalog <structname>pg_amproc</structname> stores information about
797    support procedures associated with access method operator families.  There
798    is one row for each support procedure belonging to an operator family.
799   </para>
800
801   <table>
802    <title><structname>pg_amproc</structname> Columns</title>
803
804    <tgroup cols="4">
805     <thead>
806      <row>
807       <entry>Name</entry>
808       <entry>Type</entry>
809       <entry>References</entry>
810       <entry>Description</entry>
811      </row>
812     </thead>
813     <tbody>
814
815      <row>
816       <entry><structfield>oid</structfield></entry>
817       <entry><type>oid</type></entry>
818       <entry></entry>
819       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
820      </row>
821
822      <row>
823       <entry><structfield>amprocfamily</structfield></entry>
824       <entry><type>oid</type></entry>
825       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
826       <entry>The operator family this entry is for</entry>
827      </row>
828
829      <row>
830       <entry><structfield>amproclefttype</structfield></entry>
831       <entry><type>oid</type></entry>
832       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
833       <entry>Left-hand input data type of associated operator</entry>
834      </row>
835
836      <row>
837       <entry><structfield>amprocrighttype</structfield></entry>
838       <entry><type>oid</type></entry>
839       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
840       <entry>Right-hand input data type of associated operator</entry>
841      </row>
842
843      <row>
844       <entry><structfield>amprocnum</structfield></entry>
845       <entry><type>int2</type></entry>
846       <entry></entry>
847       <entry>Support procedure number</entry>
848      </row>
849
850      <row>
851       <entry><structfield>amproc</structfield></entry>
852       <entry><type>regproc</type></entry>
853       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
854       <entry>OID of the procedure</entry>
855      </row>
856
857     </tbody>
858    </tgroup>
859   </table>
860
861   <para>
862    The usual interpretation of the
863    <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
864    is that they identify the left and right input types of the operator(s)
865    that a particular support procedure supports.  For some access methods
866    these match the input data type(s) of the support procedure itself, for
867    others not.  There is a notion of <quote>default</> support procedures for
868    an index, which are those with <structfield>amproclefttype</> and
869    <structfield>amprocrighttype</> both equal to the index operator class's
870    <structfield>opcintype</>.
871   </para>
872
873  </sect1>
874
875
876  <sect1 id="catalog-pg-attrdef">
877   <title><structname>pg_attrdef</structname></title>
878
879   <indexterm zone="catalog-pg-attrdef">
880    <primary>pg_attrdef</primary>
881   </indexterm>
882
883   <para>
884    The catalog <structname>pg_attrdef</structname> stores column default values.  The main information
885    about columns is stored in <structname>pg_attribute</structname>
886    (see below).  Only columns that explicitly specify a default value
887    (when the table is created or the column is added) will have an
888    entry here.
889   </para>
890
891   <table>
892    <title><structname>pg_attrdef</> Columns</title>
893
894    <tgroup cols="4">
895     <thead>
896      <row>
897       <entry>Name</entry>
898       <entry>Type</entry>
899       <entry>References</entry>
900       <entry>Description</entry>
901      </row>
902     </thead>
903
904     <tbody>
905      <row>
906       <entry><structfield>oid</structfield></entry>
907       <entry><type>oid</type></entry>
908       <entry></entry>
909       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
910      </row>
911
912      <row>
913       <entry><structfield>adrelid</structfield></entry>
914       <entry><type>oid</type></entry>
915       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
916       <entry>The table this column belongs to</entry>
917      </row>
918
919      <row>
920       <entry><structfield>adnum</structfield></entry>
921       <entry><type>int2</type></entry>
922       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
923       <entry>The number of the column</entry>
924      </row>
925
926      <row>
927       <entry><structfield>adbin</structfield></entry>
928       <entry><type>pg_node_tree</type></entry>
929       <entry></entry>
930       <entry>The internal representation of the column default value</entry>
931      </row>
932
933      <row>
934       <entry><structfield>adsrc</structfield></entry>
935       <entry><type>text</type></entry>
936       <entry></entry>
937       <entry>A human-readable representation of the default value</entry>
938      </row>
939     </tbody>
940    </tgroup>
941   </table>
942
943    <para>
944     The <structfield>adsrc</structfield> field is historical, and is best
945     not used, because it does not track outside changes that might affect
946     the representation of the default value.  Reverse-compiling the
947     <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
948     example) is a better way to display the default value.
949    </para>
950
951  </sect1>
952
953
954  <sect1 id="catalog-pg-attribute">
955   <title><structname>pg_attribute</structname></title>
956
957   <indexterm zone="catalog-pg-attribute">
958    <primary>pg_attribute</primary>
959   </indexterm>
960
961   <para>
962    The catalog <structname>pg_attribute</structname> stores information about
963    table columns.  There will be exactly one
964    <structname>pg_attribute</structname> row for every column in every
965    table in the database.  (There will also be attribute entries for
966    indexes, and indeed all objects that have <structname>pg_class</structname>
967    entries.)
968   </para>
969
970   <para>
971    The term attribute is equivalent to column and is used for
972    historical reasons.
973   </para>
974
975   <table>
976    <title><structname>pg_attribute</> Columns</title>
977
978    <tgroup cols="4">
979     <thead>
980      <row>
981       <entry>Name</entry>
982       <entry>Type</entry>
983       <entry>References</entry>
984       <entry>Description</entry>
985      </row>
986     </thead>
987
988     <tbody>
989      <row>
990       <entry><structfield>attrelid</structfield></entry>
991       <entry><type>oid</type></entry>
992       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
993       <entry>The table this column belongs to</entry>
994      </row>
995
996      <row>
997       <entry><structfield>attname</structfield></entry>
998       <entry><type>name</type></entry>
999       <entry></entry>
1000       <entry>The column name</entry>
1001      </row>
1002
1003      <row>
1004       <entry><structfield>atttypid</structfield></entry>
1005       <entry><type>oid</type></entry>
1006       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1007       <entry>The data type of this column</entry>
1008      </row>
1009
1010      <row>
1011       <entry><structfield>attstattarget</structfield></entry>
1012       <entry><type>int4</type></entry>
1013       <entry></entry>
1014       <entry>
1015        <structfield>attstattarget</structfield> controls the level of detail
1016        of statistics accumulated for this column by
1017        <xref linkend="sql-analyze">.
1018        A zero value indicates that no statistics should be collected.
1019        A negative value says to use the system default statistics target.
1020        The exact meaning of positive values is data type-dependent.
1021        For scalar data types, <structfield>attstattarget</structfield>
1022        is both the target number of <quote>most common values</quote>
1023        to collect, and the target number of histogram bins to create.
1024       </entry>
1025      </row>
1026
1027      <row>
1028       <entry><structfield>attlen</structfield></entry>
1029       <entry><type>int2</type></entry>
1030       <entry></entry>
1031       <entry>
1032        A copy of <literal>pg_type.typlen</literal> of this column's
1033        type
1034       </entry>
1035      </row>
1036
1037      <row>
1038       <entry><structfield>attnum</structfield></entry>
1039       <entry><type>int2</type></entry>
1040       <entry></entry>
1041       <entry>
1042        The number of the column.  Ordinary columns are numbered from 1
1043        up.  System columns, such as <structfield>oid</structfield>,
1044        have (arbitrary) negative numbers.
1045       </entry>
1046      </row>
1047
1048      <row>
1049       <entry><structfield>attndims</structfield></entry>
1050       <entry><type>int4</type></entry>
1051       <entry></entry>
1052       <entry>
1053        Number of dimensions, if the column is an array type; otherwise 0.
1054        (Presently, the number of dimensions of an array is not enforced,
1055        so any nonzero value effectively means <quote>it's an array</>.)
1056       </entry>
1057      </row>
1058
1059      <row>
1060       <entry><structfield>attcacheoff</structfield></entry>
1061       <entry><type>int4</type></entry>
1062       <entry></entry>
1063       <entry>
1064        Always -1 in storage, but when loaded into a row descriptor
1065        in memory this might be updated to cache the offset of the attribute
1066        within the row
1067       </entry>
1068      </row>
1069
1070      <row>
1071       <entry><structfield>atttypmod</structfield></entry>
1072       <entry><type>int4</type></entry>
1073       <entry></entry>
1074       <entry>
1075        <structfield>atttypmod</structfield> records type-specific data
1076        supplied at table creation time (for example, the maximum
1077        length of a <type>varchar</type> column).  It is passed to
1078        type-specific input functions and length coercion functions.
1079        The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1080       </entry>
1081      </row>
1082
1083      <row>
1084       <entry><structfield>attbyval</structfield></entry>
1085       <entry><type>bool</type></entry>
1086       <entry></entry>
1087       <entry>
1088        A copy of <literal>pg_type.typbyval</> of this column's type
1089       </entry>
1090      </row>
1091
1092      <row>
1093       <entry><structfield>attstorage</structfield></entry>
1094       <entry><type>char</type></entry>
1095       <entry></entry>
1096       <entry>
1097        Normally a copy of <literal>pg_type.typstorage</> of this
1098        column's type.  For TOAST-able data types, this can be altered
1099        after column creation to control storage policy.
1100       </entry>
1101      </row>
1102
1103      <row>
1104       <entry><structfield>attalign</structfield></entry>
1105       <entry><type>char</type></entry>
1106       <entry></entry>
1107       <entry>
1108        A copy of <literal>pg_type.typalign</> of this column's type
1109       </entry>
1110      </row>
1111
1112      <row>
1113       <entry><structfield>attnotnull</structfield></entry>
1114       <entry><type>bool</type></entry>
1115       <entry></entry>
1116       <entry>
1117        This represents a not-null constraint.
1118       </entry>
1119      </row>
1120
1121      <row>
1122       <entry><structfield>atthasdef</structfield></entry>
1123       <entry><type>bool</type></entry>
1124       <entry></entry>
1125       <entry>
1126        This column has a default value, in which case there will be a
1127        corresponding entry in the <structname>pg_attrdef</structname>
1128        catalog that actually defines the value.
1129       </entry>
1130      </row>
1131
1132      <row>
1133       <entry><structfield>attidentity</structfield></entry>
1134       <entry><type>char</type></entry>
1135       <entry></entry>
1136       <entry>
1137        If a zero byte (<literal>''</literal>), then not an identity column.
1138        Otherwise, <literal>a</literal> = generated
1139        always, <literal>d</literal> = generated by default.
1140       </entry>
1141      </row>
1142
1143      <row>
1144       <entry><structfield>attisdropped</structfield></entry>
1145       <entry><type>bool</type></entry>
1146       <entry></entry>
1147       <entry>
1148        This column has been dropped and is no longer valid.  A dropped
1149        column is still physically present in the table, but is
1150        ignored by the parser and so cannot be accessed via SQL.
1151       </entry>
1152      </row>
1153
1154      <row>
1155       <entry><structfield>attislocal</structfield></entry>
1156       <entry><type>bool</type></entry>
1157       <entry></entry>
1158       <entry>
1159        This column is defined locally in the relation.  Note that a column can
1160        be locally defined and inherited simultaneously.
1161       </entry>
1162      </row>
1163
1164      <row>
1165       <entry><structfield>attinhcount</structfield></entry>
1166       <entry><type>int4</type></entry>
1167       <entry></entry>
1168       <entry>
1169        The number of direct ancestors this column has.  A column with a
1170        nonzero number of ancestors cannot be dropped nor renamed.
1171       </entry>
1172      </row>
1173
1174      <row>
1175       <entry><structfield>attcollation</structfield></entry>
1176       <entry><type>oid</type></entry>
1177       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1178       <entry>
1179        The defined collation of the column, or zero if the column is
1180        not of a collatable data type.
1181       </entry>
1182      </row>
1183
1184      <row>
1185       <entry><structfield>attacl</structfield></entry>
1186       <entry><type>aclitem[]</type></entry>
1187       <entry></entry>
1188       <entry>
1189        Column-level access privileges, if any have been granted specifically
1190        on this column
1191       </entry>
1192      </row>
1193
1194      <row>
1195       <entry><structfield>attoptions</structfield></entry>
1196       <entry><type>text[]</type></entry>
1197       <entry></entry>
1198       <entry>
1199        Attribute-level options, as <quote>keyword=value</> strings
1200       </entry>
1201      </row>
1202
1203      <row>
1204       <entry><structfield>attfdwoptions</structfield></entry>
1205       <entry><type>text[]</type></entry>
1206       <entry></entry>
1207       <entry>
1208        Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1209       </entry>
1210      </row>
1211
1212     </tbody>
1213    </tgroup>
1214   </table>
1215
1216   <para>
1217    In a dropped column's <structname>pg_attribute</structname> entry,
1218    <structfield>atttypid</structfield> is reset to zero, but
1219    <structfield>attlen</structfield> and the other fields copied from
1220    <structname>pg_type</> are still valid.  This arrangement is needed
1221    to cope with the situation where the dropped column's data type was
1222    later dropped, and so there is no <structname>pg_type</> row anymore.
1223    <structfield>attlen</structfield> and the other fields can be used
1224    to interpret the contents of a row of the table.
1225   </para>
1226  </sect1>
1227
1228
1229  <sect1 id="catalog-pg-authid">
1230   <title><structname>pg_authid</structname></title>
1231
1232   <indexterm zone="catalog-pg-authid">
1233    <primary>pg_authid</primary>
1234   </indexterm>
1235
1236   <para>
1237    The catalog <structname>pg_authid</structname> contains information about
1238    database authorization identifiers (roles).  A role subsumes the concepts
1239    of <quote>users</> and <quote>groups</>.  A user is essentially just a
1240    role with the <structfield>rolcanlogin</> flag set.  Any role (with or
1241    without <structfield>rolcanlogin</>) can have other roles as members; see
1242    <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1243   </para>
1244
1245   <para>
1246    Since this catalog contains passwords, it must not be publicly readable.
1247    <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1248    is a publicly readable view on
1249    <structname>pg_authid</structname> that blanks out the password field.
1250   </para>
1251
1252   <para>
1253    <xref linkend="user-manag"> contains detailed information about user and
1254    privilege management.
1255   </para>
1256
1257   <para>
1258    Because user identities are cluster-wide,
1259    <structname>pg_authid</structname>
1260    is shared across all databases of a cluster: there is only one
1261    copy of <structname>pg_authid</structname> per cluster, not
1262    one per database.
1263   </para>
1264
1265   <table>
1266    <title><structname>pg_authid</> Columns</title>
1267
1268    <tgroup cols="3">
1269     <thead>
1270      <row>
1271       <entry>Name</entry>
1272       <entry>Type</entry>
1273       <entry>Description</entry>
1274      </row>
1275     </thead>
1276
1277     <tbody>
1278
1279      <row>
1280       <entry><structfield>oid</structfield></entry>
1281       <entry><type>oid</type></entry>
1282       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1283      </row>
1284
1285      <row>
1286       <entry><structfield>rolname</structfield></entry>
1287       <entry><type>name</type></entry>
1288       <entry>Role name</entry>
1289      </row>
1290
1291      <row>
1292       <entry><structfield>rolsuper</structfield></entry>
1293       <entry><type>bool</type></entry>
1294       <entry>Role has superuser privileges</entry>
1295      </row>
1296
1297      <row>
1298       <entry><structfield>rolinherit</structfield></entry>
1299       <entry><type>bool</type></entry>
1300       <entry>Role automatically inherits privileges of roles it is a
1301        member of</entry>
1302      </row>
1303
1304      <row>
1305       <entry><structfield>rolcreaterole</structfield></entry>
1306       <entry><type>bool</type></entry>
1307       <entry>Role can create more roles</entry>
1308      </row>
1309
1310      <row>
1311       <entry><structfield>rolcreatedb</structfield></entry>
1312       <entry><type>bool</type></entry>
1313       <entry>Role can create databases</entry>
1314      </row>
1315
1316      <row>
1317       <entry><structfield>rolcanlogin</structfield></entry>
1318       <entry><type>bool</type></entry>
1319       <entry>
1320        Role can log in. That is, this role can be given as the initial
1321        session authorization identifier
1322       </entry>
1323      </row>
1324
1325      <row>
1326       <entry><structfield>rolreplication</structfield></entry>
1327       <entry><type>bool</type></entry>
1328       <entry>
1329        Role is a replication role. That is, this role can initiate streaming
1330        replication (see <xref linkend="streaming-replication">) and set/unset
1331        the system backup mode using <function>pg_start_backup</> and
1332        <function>pg_stop_backup</>
1333       </entry>
1334      </row>
1335
1336      <row>
1337       <entry><structfield>rolbypassrls</structfield></entry>
1338       <entry><type>bool</type></entry>
1339       <entry>
1340        Role bypasses every row level security policy, see
1341        <xref linkend="ddl-rowsecurity"> for more information.
1342       </entry>
1343      </row>
1344
1345      <row>
1346       <entry><structfield>rolconnlimit</structfield></entry>
1347       <entry><type>int4</type></entry>
1348       <entry>
1349        For roles that can log in, this sets maximum number of concurrent
1350        connections this role can make.  -1 means no limit.
1351       </entry>
1352      </row>
1353
1354      <row>
1355       <entry><structfield>rolpassword</structfield></entry>
1356       <entry><type>text</type></entry>
1357       <entry>
1358        Password (possibly encrypted); null if none. The format depends
1359        on the form of encryption used.
1360       </entry>
1361      </row>
1362
1363      <row>
1364       <entry><structfield>rolvaliduntil</structfield></entry>
1365       <entry><type>timestamptz</type></entry>
1366       <entry>Password expiry time (only used for password authentication);
1367        null if no expiration</entry>
1368      </row>
1369     </tbody>
1370    </tgroup>
1371   </table>
1372
1373   <para>
1374    For an MD5 encrypted password, <structfield>rolpassword</structfield>
1375    column will begin with the string <literal>md5</> followed by a
1376    32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
1377    password concatenated to their user name. For example, if user
1378    <literal>joe</> has password <literal>xyzzy</>, <productname>PostgreSQL</>
1379    will store the md5 hash of <literal>xyzzyjoe</>.
1380   </para>
1381
1382   <para>
1383    If the password is encrypted with SCRAM-SHA-256, it has the format:
1384 <synopsis>
1385 SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</>:<replaceable>&lt;salt&gt;</>$<replaceable>&lt;StoredKey&gt;</>:<replaceable>&lt;ServerKey&gt;</>
1386 </synopsis>
1387    where <replaceable>salt</>, <replaceable>StoredKey</> and
1388    <replaceable>ServerKey</> are in Base64 encoded format. This format is
1389    the same as that specified by RFC 5803.
1390   </para>
1391
1392   <para>
1393     A password that does not follow either of those formats is assumed to be
1394     unencrypted.
1395   </para>
1396  </sect1>
1397
1398
1399  <sect1 id="catalog-pg-auth-members">
1400   <title><structname>pg_auth_members</structname></title>
1401
1402   <indexterm zone="catalog-pg-auth-members">
1403    <primary>pg_auth_members</primary>
1404   </indexterm>
1405
1406   <para>
1407    The catalog <structname>pg_auth_members</structname> shows the membership
1408    relations between roles.  Any non-circular set of relationships is allowed.
1409   </para>
1410
1411   <para>
1412    Because user identities are cluster-wide,
1413    <structname>pg_auth_members</structname>
1414    is shared across all databases of a cluster: there is only one
1415    copy of <structname>pg_auth_members</structname> per cluster, not
1416    one per database.
1417   </para>
1418
1419   <table>
1420    <title><structname>pg_auth_members</> Columns</title>
1421
1422    <tgroup cols="4">
1423     <thead>
1424      <row>
1425       <entry>Name</entry>
1426       <entry>Type</entry>
1427       <entry>References</entry>
1428       <entry>Description</entry>
1429      </row>
1430     </thead>
1431
1432     <tbody>
1433      <row>
1434       <entry><structfield>roleid</structfield></entry>
1435       <entry><type>oid</type></entry>
1436       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1437       <entry>ID of a role that has a member</entry>
1438      </row>
1439
1440      <row>
1441       <entry><structfield>member</structfield></entry>
1442       <entry><type>oid</type></entry>
1443       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1444       <entry>ID of a role that is a member of <structfield>roleid</></entry>
1445      </row>
1446
1447      <row>
1448       <entry><structfield>grantor</structfield></entry>
1449       <entry><type>oid</type></entry>
1450       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1451       <entry>ID of the role that granted this membership</entry>
1452      </row>
1453
1454      <row>
1455       <entry><structfield>admin_option</structfield></entry>
1456       <entry><type>bool</type></entry>
1457       <entry></entry>
1458       <entry>True if <structfield>member</> can grant membership in
1459        <structfield>roleid</> to others</entry>
1460      </row>
1461     </tbody>
1462    </tgroup>
1463   </table>
1464
1465  </sect1>
1466
1467
1468  <sect1 id="catalog-pg-cast">
1469   <title><structname>pg_cast</structname></title>
1470
1471   <indexterm zone="catalog-pg-cast">
1472    <primary>pg_cast</primary>
1473   </indexterm>
1474
1475   <para>
1476    The catalog <structname>pg_cast</structname> stores data type conversion
1477    paths, both built-in and user-defined.
1478   </para>
1479
1480   <para>
1481    It should be noted that <structname>pg_cast</structname> does not represent
1482    every type conversion that the system knows how to perform; only those that
1483    cannot be deduced from some generic rule.  For example, casting between a
1484    domain and its base type is not explicitly represented in
1485    <structname>pg_cast</structname>.  Another important exception is that
1486    <quote>automatic I/O conversion casts</>, those performed using a data
1487    type's own I/O functions to convert to or from <type>text</> or other
1488    string types, are not explicitly represented in
1489    <structname>pg_cast</structname>.
1490   </para>
1491
1492   <table>
1493    <title><structname>pg_cast</> Columns</title>
1494
1495    <tgroup cols="4">
1496     <thead>
1497      <row>
1498       <entry>Name</entry>
1499       <entry>Type</entry>
1500       <entry>References</entry>
1501       <entry>Description</entry>
1502      </row>
1503     </thead>
1504
1505     <tbody>
1506      <row>
1507       <entry><structfield>oid</structfield></entry>
1508       <entry><type>oid</type></entry>
1509       <entry></entry>
1510       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1511      </row>
1512
1513      <row>
1514       <entry><structfield>castsource</structfield></entry>
1515       <entry><type>oid</type></entry>
1516       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1517       <entry>OID of the source data type</entry>
1518      </row>
1519
1520      <row>
1521       <entry><structfield>casttarget</structfield></entry>
1522       <entry><type>oid</type></entry>
1523       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1524       <entry>OID of the target data type</entry>
1525      </row>
1526
1527      <row>
1528       <entry><structfield>castfunc</structfield></entry>
1529       <entry><type>oid</type></entry>
1530       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1531       <entry>
1532        The OID of the function to use to perform this cast.  Zero is
1533        stored if the cast method doesn't require a function.
1534       </entry>
1535      </row>
1536
1537      <row>
1538       <entry><structfield>castcontext</structfield></entry>
1539       <entry><type>char</type></entry>
1540       <entry></entry>
1541       <entry>
1542        Indicates what contexts the cast can be invoked in.
1543        <literal>e</> means only as an explicit cast (using
1544        <literal>CAST</> or <literal>::</> syntax).
1545        <literal>a</> means implicitly in assignment
1546        to a target column, as well as explicitly.
1547        <literal>i</> means implicitly in expressions, as well as the
1548        other cases.
1549       </entry>
1550      </row>
1551      <row>
1552       <entry><structfield>castmethod</structfield></entry>
1553       <entry><type>char</type></entry>
1554       <entry></entry>
1555       <entry>
1556        Indicates how the cast is performed.
1557        <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1558        <literal>i</> means that the input/output functions are used.
1559        <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1560       </entry>
1561      </row>
1562     </tbody>
1563    </tgroup>
1564   </table>
1565
1566   <para>
1567    The cast functions listed in <structname>pg_cast</structname> must
1568    always take the cast source type as their first argument type, and
1569    return the cast destination type as their result type.  A cast
1570    function can have up to three arguments.  The second argument,
1571    if present, must be type <type>integer</>; it receives the type
1572    modifier associated with the destination type, or -1
1573    if there is none.  The third argument,
1574    if present, must be type <type>boolean</>; it receives <literal>true</>
1575    if the cast is an explicit cast, <literal>false</> otherwise.
1576   </para>
1577
1578   <para>
1579    It is legitimate to create a <structname>pg_cast</structname> entry
1580    in which the source and target types are the same, if the associated
1581    function takes more than one argument.  Such entries represent
1582    <quote>length coercion functions</> that coerce values of the type
1583    to be legal for a particular type modifier value.
1584   </para>
1585
1586   <para>
1587    When a <structname>pg_cast</structname> entry has different source and
1588    target types and a function that takes more than one argument, it
1589    represents converting from one type to another and applying a length
1590    coercion in a single step.  When no such entry is available, coercion
1591    to a type that uses a type modifier involves two steps, one to
1592    convert between data types and a second to apply the modifier.
1593   </para>
1594  </sect1>
1595
1596  <sect1 id="catalog-pg-class">
1597   <title><structname>pg_class</structname></title>
1598
1599   <indexterm zone="catalog-pg-class">
1600    <primary>pg_class</primary>
1601   </indexterm>
1602
1603   <para>
1604    The catalog <structname>pg_class</structname> catalogs tables and most
1605    everything else that has columns or is otherwise similar to a
1606    table.  This includes indexes (but see also
1607    <structname>pg_index</structname>), sequences (but see also
1608    <structname>pg_sequence</structname>), views, materialized
1609    views, composite types, and TOAST tables; see <structfield>relkind</>.
1610    Below, when we mean all of these
1611    kinds of objects we speak of <quote>relations</quote>.  Not all
1612    columns are meaningful for all relation types.
1613   </para>
1614
1615   <table>
1616    <title><structname>pg_class</> Columns</title>
1617
1618    <tgroup cols="4">
1619     <thead>
1620      <row>
1621       <entry>Name</entry>
1622       <entry>Type</entry>
1623       <entry>References</entry>
1624       <entry>Description</entry>
1625      </row>
1626     </thead>
1627
1628     <tbody>
1629      <row>
1630       <entry><structfield>oid</structfield></entry>
1631       <entry><type>oid</type></entry>
1632       <entry></entry>
1633       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1634      </row>
1635
1636      <row>
1637       <entry><structfield>relname</structfield></entry>
1638       <entry><type>name</type></entry>
1639       <entry></entry>
1640       <entry>Name of the table, index, view, etc.</entry>
1641      </row>
1642
1643      <row>
1644       <entry><structfield>relnamespace</structfield></entry>
1645       <entry><type>oid</type></entry>
1646       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1647       <entry>
1648        The OID of the namespace that contains this relation
1649       </entry>
1650      </row>
1651
1652      <row>
1653       <entry><structfield>reltype</structfield></entry>
1654       <entry><type>oid</type></entry>
1655       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1656       <entry>
1657        The OID of the data type that corresponds to this table's row type,
1658        if any (zero for indexes, which have no <structname>pg_type</> entry)
1659       </entry>
1660      </row>
1661
1662      <row>
1663       <entry><structfield>reloftype</structfield></entry>
1664       <entry><type>oid</type></entry>
1665       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1666       <entry>
1667        For typed tables, the OID of the underlying composite type,
1668        zero for all other relations
1669       </entry>
1670      </row>
1671
1672      <row>
1673       <entry><structfield>relowner</structfield></entry>
1674       <entry><type>oid</type></entry>
1675       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1676       <entry>Owner of the relation</entry>
1677      </row>
1678
1679      <row>
1680       <entry><structfield>relam</structfield></entry>
1681       <entry><type>oid</type></entry>
1682       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1683       <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1684      </row>
1685
1686      <row>
1687       <entry><structfield>relfilenode</structfield></entry>
1688       <entry><type>oid</type></entry>
1689       <entry></entry>
1690       <entry>Name of the on-disk file of this relation; zero means this
1691        is a <quote>mapped</> relation whose disk file name is determined
1692        by low-level state</entry>
1693      </row>
1694
1695      <row>
1696       <entry><structfield>reltablespace</structfield></entry>
1697       <entry><type>oid</type></entry>
1698       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1699       <entry>
1700        The tablespace in which this relation is stored.  If zero,
1701        the database's default tablespace is implied.  (Not meaningful
1702        if the relation has no on-disk file.)
1703       </entry>
1704      </row>
1705
1706      <row>
1707       <entry><structfield>relpages</structfield></entry>
1708       <entry><type>int4</type></entry>
1709       <entry></entry>
1710       <entry>
1711        Size of the on-disk representation of this table in pages (of size
1712        <symbol>BLCKSZ</symbol>).  This is only an estimate used by the
1713        planner.  It is updated by <command>VACUUM</command>,
1714        <command>ANALYZE</command>, and a few DDL commands such as
1715        <command>CREATE INDEX</command>.
1716       </entry>
1717      </row>
1718
1719      <row>
1720       <entry><structfield>reltuples</structfield></entry>
1721       <entry><type>float4</type></entry>
1722       <entry></entry>
1723       <entry>
1724        Number of rows in the table.  This is only an estimate used by the
1725        planner.  It is updated by <command>VACUUM</command>,
1726        <command>ANALYZE</command>, and a few DDL commands such as
1727        <command>CREATE INDEX</command>.
1728       </entry>
1729      </row>
1730
1731      <row>
1732       <entry><structfield>relallvisible</structfield></entry>
1733       <entry><type>int4</type></entry>
1734       <entry></entry>
1735       <entry>
1736        Number of pages that are marked all-visible in the table's
1737        visibility map.  This is only an estimate used by the
1738        planner.  It is updated by <command>VACUUM</command>,
1739        <command>ANALYZE</command>, and a few DDL commands such as
1740        <command>CREATE INDEX</command>.
1741       </entry>
1742      </row>
1743
1744      <row>
1745       <entry><structfield>reltoastrelid</structfield></entry>
1746       <entry><type>oid</type></entry>
1747       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1748       <entry>
1749        OID of the TOAST table associated with this table, 0 if none.  The
1750        TOAST table stores large attributes <quote>out of line</quote> in a
1751        secondary table.
1752       </entry>
1753      </row>
1754
1755      <row>
1756       <entry><structfield>relhasindex</structfield></entry>
1757       <entry><type>bool</type></entry>
1758       <entry></entry>
1759       <entry>
1760        True if this is a table and it has (or recently had) any indexes
1761       </entry>
1762      </row>
1763
1764      <row>
1765       <entry><structfield>relisshared</structfield></entry>
1766       <entry><type>bool</type></entry>
1767       <entry></entry>
1768       <entry>
1769        True if this table is shared across all databases in the cluster.  Only
1770        certain system catalogs (such as <structname>pg_database</structname>)
1771        are shared.
1772       </entry>
1773      </row>
1774
1775      <row>
1776       <entry><structfield>relpersistence</structfield></entry>
1777       <entry><type>char</type></entry>
1778       <entry></entry>
1779       <entry>
1780        <literal>p</> = permanent table, <literal>u</> = unlogged table,
1781        <literal>t</> = temporary table
1782       </entry>
1783      </row>
1784
1785      <row>
1786       <entry><structfield>relkind</structfield></entry>
1787       <entry><type>char</type></entry>
1788       <entry></entry>
1789       <entry>
1790        <literal>r</> = ordinary table,
1791        <literal>i</> = index,
1792        <literal>S</> = sequence,
1793        <literal>t</> = TOAST table,
1794        <literal>v</> = view,
1795        <literal>m</> = materialized view,
1796        <literal>c</> = composite type,
1797        <literal>f</> = foreign table,
1798        <literal>p</> = partitioned table
1799       </entry>
1800      </row>
1801
1802      <row>
1803       <entry><structfield>relnatts</structfield></entry>
1804       <entry><type>int2</type></entry>
1805       <entry></entry>
1806       <entry>
1807        Number of user columns in the relation (system columns not
1808        counted).  There must be this many corresponding entries in
1809        <structname>pg_attribute</structname>.  See also
1810        <literal>pg_attribute.attnum</literal>.
1811       </entry>
1812      </row>
1813
1814      <row>
1815       <entry><structfield>relchecks</structfield></entry>
1816       <entry><type>int2</type></entry>
1817       <entry></entry>
1818       <entry>
1819        Number of <literal>CHECK</> constraints on the table; see
1820        <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1821       </entry>
1822      </row>
1823
1824      <row>
1825       <entry><structfield>relhasoids</structfield></entry>
1826       <entry><type>bool</type></entry>
1827       <entry></entry>
1828       <entry>
1829        True if we generate an OID for each row of the relation
1830       </entry>
1831      </row>
1832
1833      <row>
1834       <entry><structfield>relhaspkey</structfield></entry>
1835       <entry><type>bool</type></entry>
1836       <entry></entry>
1837       <entry>
1838        True if the table has (or once had) a primary key
1839       </entry>
1840      </row>
1841
1842      <row>
1843       <entry><structfield>relhasrules</structfield></entry>
1844       <entry><type>bool</type></entry>
1845       <entry></entry>
1846       <entry>
1847        True if table has (or once had) rules; see
1848        <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1849       </entry>
1850      </row>
1851
1852      <row>
1853       <entry><structfield>relhastriggers</structfield></entry>
1854       <entry><type>bool</type></entry>
1855       <entry></entry>
1856       <entry>
1857        True if table has (or once had) triggers; see
1858        <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1859       </entry>
1860      </row>
1861
1862      <row>
1863       <entry><structfield>relhassubclass</structfield></entry>
1864       <entry><type>bool</type></entry>
1865       <entry></entry>
1866       <entry>True if table has (or once had) any inheritance children</entry>
1867      </row>
1868
1869      <row>
1870       <entry><structfield>relrowsecurity</structfield></entry>
1871       <entry><type>bool</type></entry>
1872       <entry></entry>
1873       <entry>
1874        True if table has row level security enabled; see
1875        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1876       </entry>
1877      </row>
1878
1879      <row>
1880       <entry><structfield>relforcerowsecurity</structfield></entry>
1881       <entry><type>bool</type></entry>
1882       <entry></entry>
1883       <entry>
1884        True if row level security (when enabled) will also apply to table owner; see
1885        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1886       </entry>
1887      </row>
1888
1889      <row>
1890       <entry><structfield>relispopulated</structfield></entry>
1891       <entry><type>bool</type></entry>
1892       <entry></entry>
1893       <entry>True if relation is populated (this is true for all
1894        relations other than some materialized views)</entry>
1895      </row>
1896
1897      <row>
1898       <entry><structfield>relreplident</structfield></entry>
1899       <entry><type>char</type></entry>
1900       <entry></entry>
1901       <entry>
1902        Columns used to form <quote>replica identity</> for rows:
1903        <literal>d</> = default (primary key, if any),
1904        <literal>n</> = nothing,
1905        <literal>f</> = all columns
1906        <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1907       </entry>
1908      </row>
1909
1910      <row>
1911       <entry><structfield>relispartition</structfield></entry>
1912       <entry><type>bool</type></entry>
1913       <entry></entry>
1914       <entry>True if table is a partition</entry>
1915      </row>
1916
1917      <row>
1918       <entry><structfield>relfrozenxid</structfield></entry>
1919       <entry><type>xid</type></entry>
1920       <entry></entry>
1921       <entry>
1922        All transaction IDs before this one have been replaced with a permanent
1923        (<quote>frozen</>) transaction ID in this table.  This is used to track
1924        whether the table needs to be vacuumed in order to prevent transaction
1925        ID wraparound or to allow <literal>pg_xact</> to be shrunk.  Zero
1926        (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1927       </entry>
1928      </row>
1929
1930      <row>
1931       <entry><structfield>relminmxid</structfield></entry>
1932       <entry><type>xid</type></entry>
1933       <entry></entry>
1934       <entry>
1935        All multixact IDs before this one have been replaced by a
1936        transaction ID in this table.  This is used to track
1937        whether the table needs to be vacuumed in order to prevent multixact ID
1938        wraparound or to allow <literal>pg_multixact</> to be shrunk.  Zero
1939        (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1940       </entry>
1941      </row>
1942
1943      <row>
1944       <entry><structfield>relacl</structfield></entry>
1945       <entry><type>aclitem[]</type></entry>
1946       <entry></entry>
1947       <entry>
1948        Access privileges; see
1949        <xref linkend="sql-grant"> and
1950        <xref linkend="sql-revoke">
1951        for details
1952       </entry>
1953      </row>
1954
1955      <row>
1956       <entry><structfield>reloptions</structfield></entry>
1957       <entry><type>text[]</type></entry>
1958       <entry></entry>
1959       <entry>
1960        Access-method-specific options, as <quote>keyword=value</> strings
1961       </entry>
1962      </row>
1963
1964      <row>
1965       <entry><structfield>relpartbound</structfield></entry>
1966       <entry><type>pg_node_tree</type></entry>
1967       <entry></entry>
1968       <entry>
1969        If table is a partition (see <structfield>relispartition</structfield>),
1970        internal representation of the partition bound
1971       </entry>
1972      </row>
1973     </tbody>
1974    </tgroup>
1975   </table>
1976
1977   <para>
1978    Several of the Boolean flags in <structname>pg_class</> are maintained
1979    lazily: they are guaranteed to be true if that's the correct state, but
1980    may not be reset to false immediately when the condition is no longer
1981    true.  For example, <structfield>relhasindex</> is set by
1982    <command>CREATE INDEX</command>, but it is never cleared by
1983    <command>DROP INDEX</command>.  Instead, <command>VACUUM</command> clears
1984    <structfield>relhasindex</> if it finds the table has no indexes.  This
1985    arrangement avoids race conditions and improves concurrency.
1986   </para>
1987  </sect1>
1988
1989  <sect1 id="catalog-pg-collation">
1990   <title><structname>pg_collation</structname></title>
1991
1992   <indexterm zone="catalog-pg-collation">
1993    <primary>pg_collation</primary>
1994   </indexterm>
1995
1996   <para>
1997    The catalog <structname>pg_collation</structname> describes the
1998    available collations, which are essentially mappings from an SQL
1999    name to operating system locale categories.
2000    See <xref linkend="collation"> for more information.
2001   </para>
2002
2003   <table>
2004    <title><structname>pg_collation</> Columns</title>
2005
2006    <tgroup cols="4">
2007     <thead>
2008      <row>
2009       <entry>Name</entry>
2010       <entry>Type</entry>
2011       <entry>References</entry>
2012       <entry>Description</entry>
2013      </row>
2014     </thead>
2015
2016     <tbody>
2017      <row>
2018       <entry><structfield>oid</structfield></entry>
2019       <entry><type>oid</type></entry>
2020       <entry></entry>
2021       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2022      </row>
2023
2024      <row>
2025       <entry><structfield>collname</structfield></entry>
2026       <entry><type>name</type></entry>
2027       <entry></entry>
2028       <entry>Collation name (unique per namespace and encoding)</entry>
2029      </row>
2030
2031      <row>
2032       <entry><structfield>collnamespace</structfield></entry>
2033       <entry><type>oid</type></entry>
2034       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2035       <entry>
2036        The OID of the namespace that contains this collation
2037       </entry>
2038      </row>
2039
2040      <row>
2041       <entry><structfield>collowner</structfield></entry>
2042       <entry><type>oid</type></entry>
2043       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2044       <entry>Owner of the collation</entry>
2045      </row>
2046
2047      <row>
2048       <entry><structfield>collprovider</structfield></entry>
2049       <entry><type>char</type></entry>
2050       <entry></entry>
2051       <entry>Provider of the collation: <literal>d</literal> = database
2052        default, <literal>c</literal> = libc, <literal>i</literal> = icu</entry>
2053      </row>
2054
2055      <row>
2056       <entry><structfield>collencoding</structfield></entry>
2057       <entry><type>int4</type></entry>
2058       <entry></entry>
2059       <entry>Encoding in which the collation is applicable, or -1 if it
2060        works for any encoding</entry>
2061      </row>
2062
2063      <row>
2064       <entry><structfield>collcollate</structfield></entry>
2065       <entry><type>name</type></entry>
2066       <entry></entry>
2067       <entry><symbol>LC_COLLATE</> for this collation object</entry>
2068      </row>
2069
2070      <row>
2071       <entry><structfield>collctype</structfield></entry>
2072       <entry><type>name</type></entry>
2073       <entry></entry>
2074       <entry><symbol>LC_CTYPE</> for this collation object</entry>
2075      </row>
2076
2077      <row>
2078       <entry><structfield>collversion</structfield></entry>
2079       <entry><type>text</type></entry>
2080       <entry></entry>
2081       <entry>
2082        Provider-specific version of the collation.  This is recorded when the
2083        collation is created and then checked when it is used, to detect
2084        changes in the collation definition that could lead to data corruption.
2085       </entry>
2086      </row>
2087     </tbody>
2088    </tgroup>
2089   </table>
2090
2091   <para>
2092    Note that the unique key on this catalog is (<structfield>collname</>,
2093    <structfield>collencoding</>, <structfield>collnamespace</>) not just
2094    (<structfield>collname</>, <structfield>collnamespace</>).
2095    <productname>PostgreSQL</productname> generally ignores all
2096    collations that do not have <structfield>collencoding</> equal to
2097    either the current database's encoding or -1, and creation of new entries
2098    with the same name as an entry with <structfield>collencoding</> = -1
2099    is forbidden.  Therefore it is sufficient to use a qualified SQL name
2100    (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2101    even though this is not unique according to the catalog definition.
2102    The reason for defining the catalog this way is that
2103    <application>initdb</> fills it in at cluster initialization time with
2104    entries for all locales available on the system, so it must be able to
2105    hold entries for all encodings that might ever be used in the cluster.
2106   </para>
2107
2108   <para>
2109    In the <literal>template0</> database, it could be useful to create
2110    collations whose encoding does not match the database encoding,
2111    since they could match the encodings of databases later cloned from
2112    <literal>template0</>.  This would currently have to be done manually.
2113   </para>
2114  </sect1>
2115
2116  <sect1 id="catalog-pg-constraint">
2117   <title><structname>pg_constraint</structname></title>
2118
2119   <indexterm zone="catalog-pg-constraint">
2120    <primary>pg_constraint</primary>
2121   </indexterm>
2122
2123   <para>
2124    The catalog <structname>pg_constraint</structname> stores check, primary
2125    key, unique, foreign key, and exclusion constraints on tables.
2126    (Column constraints are not treated specially.  Every column constraint is
2127    equivalent to some table constraint.)
2128    Not-null constraints are represented in the <structname>pg_attribute</>
2129    catalog, not here.
2130   </para>
2131
2132   <para>
2133    User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2134    TRIGGER</>) also give rise to an entry in this table.
2135   </para>
2136
2137   <para>
2138    Check constraints on domains are stored here, too.
2139   </para>
2140
2141   <table>
2142    <title><structname>pg_constraint</> Columns</title>
2143
2144    <tgroup cols="4">
2145     <thead>
2146      <row>
2147       <entry>Name</entry>
2148       <entry>Type</entry>
2149       <entry>References</entry>
2150       <entry>Description</entry>
2151      </row>
2152     </thead>
2153
2154     <tbody>
2155      <row>
2156       <entry><structfield>oid</structfield></entry>
2157       <entry><type>oid</type></entry>
2158       <entry></entry>
2159       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2160      </row>
2161
2162      <row>
2163       <entry><structfield>conname</structfield></entry>
2164       <entry><type>name</type></entry>
2165       <entry></entry>
2166       <entry>Constraint name (not necessarily unique!)</entry>
2167      </row>
2168
2169      <row>
2170       <entry><structfield>connamespace</structfield></entry>
2171       <entry><type>oid</type></entry>
2172       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2173       <entry>
2174        The OID of the namespace that contains this constraint
2175       </entry>
2176      </row>
2177
2178      <row>
2179       <entry><structfield>contype</structfield></entry>
2180       <entry><type>char</type></entry>
2181       <entry></entry>
2182       <entry>
2183         <literal>c</> = check constraint,
2184         <literal>f</> = foreign key constraint,
2185         <literal>p</> = primary key constraint,
2186         <literal>u</> = unique constraint,
2187         <literal>t</> = constraint trigger,
2188         <literal>x</> = exclusion constraint
2189       </entry>
2190      </row>
2191
2192      <row>
2193       <entry><structfield>condeferrable</structfield></entry>
2194       <entry><type>bool</type></entry>
2195       <entry></entry>
2196       <entry>Is the constraint deferrable?</entry>
2197      </row>
2198
2199      <row>
2200       <entry><structfield>condeferred</structfield></entry>
2201       <entry><type>bool</type></entry>
2202       <entry></entry>
2203       <entry>Is the constraint deferred by default?</entry>
2204      </row>
2205
2206      <row>
2207       <entry><structfield>convalidated</structfield></entry>
2208       <entry><type>bool</type></entry>
2209       <entry></entry>
2210       <entry>Has the constraint been validated?
2211        Currently, can only be false for foreign keys and CHECK constraints</entry>
2212      </row>
2213
2214      <row>
2215       <entry><structfield>conrelid</structfield></entry>
2216       <entry><type>oid</type></entry>
2217       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2218       <entry>The table this constraint is on; 0 if not a table constraint</entry>
2219      </row>
2220
2221      <row>
2222       <entry><structfield>contypid</structfield></entry>
2223       <entry><type>oid</type></entry>
2224       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2225       <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2226      </row>
2227
2228      <row>
2229       <entry><structfield>conindid</structfield></entry>
2230       <entry><type>oid</type></entry>
2231       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2232       <entry>The index supporting this constraint, if it's a unique, primary
2233        key, foreign key, or exclusion constraint; else 0</entry>
2234      </row>
2235
2236      <row>
2237       <entry><structfield>confrelid</structfield></entry>
2238       <entry><type>oid</type></entry>
2239       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2240       <entry>If a foreign key, the referenced table; else 0</entry>
2241      </row>
2242
2243      <row>
2244       <entry><structfield>confupdtype</structfield></entry>
2245       <entry><type>char</type></entry>
2246       <entry></entry>
2247       <entry>Foreign key update action code:
2248             <literal>a</> = no action,
2249             <literal>r</> = restrict,
2250             <literal>c</> = cascade,
2251             <literal>n</> = set null,
2252             <literal>d</> = set default
2253           </entry>
2254      </row>
2255
2256      <row>
2257       <entry><structfield>confdeltype</structfield></entry>
2258       <entry><type>char</type></entry>
2259       <entry></entry>
2260       <entry>Foreign key deletion action code:
2261             <literal>a</> = no action,
2262             <literal>r</> = restrict,
2263             <literal>c</> = cascade,
2264             <literal>n</> = set null,
2265             <literal>d</> = set default
2266           </entry>
2267      </row>
2268
2269      <row>
2270       <entry><structfield>confmatchtype</structfield></entry>
2271       <entry><type>char</type></entry>
2272       <entry></entry>
2273       <entry>Foreign key match type:
2274             <literal>f</> = full,
2275             <literal>p</> = partial,
2276             <literal>s</> = simple
2277           </entry>
2278      </row>
2279
2280      <row>
2281       <entry><structfield>conislocal</structfield></entry>
2282       <entry><type>bool</type></entry>
2283       <entry></entry>
2284       <entry>
2285        This constraint is defined locally for the relation.  Note that a
2286        constraint can be locally defined and inherited simultaneously.
2287       </entry>
2288      </row>
2289
2290      <row>
2291       <entry><structfield>coninhcount</structfield></entry>
2292       <entry><type>int4</type></entry>
2293       <entry></entry>
2294       <entry>
2295        The number of direct inheritance ancestors this constraint has.
2296        A constraint with
2297        a nonzero number of ancestors cannot be dropped nor renamed.
2298       </entry>
2299      </row>
2300
2301      <row>
2302       <entry><structfield>connoinherit</structfield></entry>
2303       <entry><type>bool</type></entry>
2304       <entry></entry>
2305       <entry>
2306        This constraint is defined locally for the relation.  It is a
2307        non-inheritable constraint.
2308       </entry>
2309      </row>
2310
2311      <row>
2312       <entry><structfield>conkey</structfield></entry>
2313       <entry><type>int2[]</type></entry>
2314       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2315       <entry>If a table constraint (including foreign keys, but not constraint
2316        triggers), list of the constrained columns</entry>
2317      </row>
2318
2319      <row>
2320       <entry><structfield>confkey</structfield></entry>
2321       <entry><type>int2[]</type></entry>
2322       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2323       <entry>If a foreign key, list of the referenced columns</entry>
2324      </row>
2325
2326      <row>
2327       <entry><structfield>conpfeqop</structfield></entry>
2328       <entry><type>oid[]</type></entry>
2329       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2330       <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2331      </row>
2332
2333      <row>
2334       <entry><structfield>conppeqop</structfield></entry>
2335       <entry><type>oid[]</type></entry>
2336       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2337       <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2338      </row>
2339
2340      <row>
2341       <entry><structfield>conffeqop</structfield></entry>
2342       <entry><type>oid[]</type></entry>
2343       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2344       <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2345      </row>
2346
2347      <row>
2348       <entry><structfield>conexclop</structfield></entry>
2349       <entry><type>oid[]</type></entry>
2350       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2351       <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2352      </row>
2353
2354      <row>
2355       <entry><structfield>conbin</structfield></entry>
2356       <entry><type>pg_node_tree</type></entry>
2357       <entry></entry>
2358       <entry>If a check constraint, an internal representation of the expression</entry>
2359      </row>
2360
2361      <row>
2362       <entry><structfield>consrc</structfield></entry>
2363       <entry><type>text</type></entry>
2364       <entry></entry>
2365       <entry>If a check constraint, a human-readable representation of the expression</entry>
2366      </row>
2367     </tbody>
2368    </tgroup>
2369   </table>
2370
2371   <para>
2372    In the case of an exclusion constraint, <structfield>conkey</structfield>
2373    is only useful for constraint elements that are simple column references.
2374    For other cases, a zero appears in <structfield>conkey</structfield>
2375    and the associated index must be consulted to discover the expression
2376    that is constrained.  (<structfield>conkey</structfield> thus has the
2377    same contents as <structname>pg_index</>.<structfield>indkey</> for the
2378    index.)
2379   </para>
2380
2381   <note>
2382    <para>
2383     <structfield>consrc</structfield> is not updated when referenced objects
2384     change; for example, it won't track renaming of columns.  Rather than
2385     relying on this field, it's best to use <function>pg_get_constraintdef()</>
2386     to extract the definition of a check constraint.
2387    </para>
2388   </note>
2389
2390   <note>
2391    <para>
2392     <literal>pg_class.relchecks</literal> needs to agree with the
2393     number of check-constraint entries found in this table for each
2394     relation.
2395    </para>
2396   </note>
2397  </sect1>
2398
2399
2400  <sect1 id="catalog-pg-conversion">
2401   <title><structname>pg_conversion</structname></title>
2402
2403   <indexterm zone="catalog-pg-conversion">
2404    <primary>pg_conversion</primary>
2405   </indexterm>
2406
2407   <para>
2408    The catalog <structname>pg_conversion</structname> describes
2409    encoding conversion procedures.  See <xref linkend="sql-createconversion">
2410    for more information.
2411   </para>
2412
2413   <table>
2414    <title><structname>pg_conversion</> Columns</title>
2415
2416    <tgroup cols="4">
2417     <thead>
2418      <row>
2419       <entry>Name</entry>
2420       <entry>Type</entry>
2421       <entry>References</entry>
2422       <entry>Description</entry>
2423      </row>
2424     </thead>
2425
2426     <tbody>
2427      <row>
2428       <entry><structfield>oid</structfield></entry>
2429       <entry><type>oid</type></entry>
2430       <entry></entry>
2431       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2432      </row>
2433
2434      <row>
2435       <entry><structfield>conname</structfield></entry>
2436       <entry><type>name</type></entry>
2437       <entry></entry>
2438       <entry>Conversion name (unique within a namespace)</entry>
2439      </row>
2440
2441      <row>
2442       <entry><structfield>connamespace</structfield></entry>
2443       <entry><type>oid</type></entry>
2444       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2445       <entry>
2446        The OID of the namespace that contains this conversion
2447       </entry>
2448      </row>
2449
2450      <row>
2451       <entry><structfield>conowner</structfield></entry>
2452       <entry><type>oid</type></entry>
2453       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2454       <entry>Owner of the conversion</entry>
2455      </row>
2456
2457      <row>
2458       <entry><structfield>conforencoding</structfield></entry>
2459       <entry><type>int4</type></entry>
2460       <entry></entry>
2461       <entry>Source encoding ID</entry>
2462      </row>
2463
2464      <row>
2465       <entry><structfield>contoencoding</structfield></entry>
2466       <entry><type>int4</type></entry>
2467       <entry></entry>
2468       <entry>Destination encoding ID</entry>
2469      </row>
2470
2471      <row>
2472       <entry><structfield>conproc</structfield></entry>
2473       <entry><type>regproc</type></entry>
2474       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2475       <entry>Conversion procedure</entry>
2476      </row>
2477
2478      <row>
2479       <entry><structfield>condefault</structfield></entry>
2480       <entry><type>bool</type></entry>
2481       <entry></entry>
2482       <entry>True if this is the default conversion</entry>
2483      </row>
2484
2485     </tbody>
2486    </tgroup>
2487   </table>
2488
2489  </sect1>
2490
2491  <sect1 id="catalog-pg-database">
2492   <title><structname>pg_database</structname></title>
2493
2494   <indexterm zone="catalog-pg-database">
2495    <primary>pg_database</primary>
2496   </indexterm>
2497
2498   <para>
2499    The catalog <structname>pg_database</structname> stores information about
2500    the available databases.  Databases are created with the <xref
2501    linkend="sql-createdatabase"> command.
2502    Consult <xref linkend="managing-databases"> for details about the meaning
2503    of some of the parameters.
2504   </para>
2505
2506   <para>
2507    Unlike most system catalogs, <structname>pg_database</structname>
2508    is shared across all databases of a cluster: there is only one
2509    copy of <structname>pg_database</structname> per cluster, not
2510    one per database.
2511   </para>
2512
2513   <table>
2514    <title><structname>pg_database</> Columns</title>
2515
2516    <tgroup cols="4">
2517     <thead>
2518      <row>
2519       <entry>Name</entry>
2520       <entry>Type</entry>
2521       <entry>References</entry>
2522       <entry>Description</entry>
2523      </row>
2524     </thead>
2525
2526     <tbody>
2527      <row>
2528       <entry><structfield>oid</structfield></entry>
2529       <entry><type>oid</type></entry>
2530       <entry></entry>
2531       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2532      </row>
2533
2534      <row>
2535       <entry><structfield>datname</structfield></entry>
2536       <entry><type>name</type></entry>
2537       <entry></entry>
2538       <entry>Database name</entry>
2539      </row>
2540
2541      <row>
2542       <entry><structfield>datdba</structfield></entry>
2543       <entry><type>oid</type></entry>
2544       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2545       <entry>Owner of the database, usually the user who created it</entry>
2546      </row>
2547
2548      <row>
2549       <entry><structfield>encoding</structfield></entry>
2550       <entry><type>int4</type></entry>
2551       <entry></entry>
2552       <entry>Character encoding for this database
2553           (<function>pg_encoding_to_char()</function> can translate
2554            this number to the encoding name)</entry>
2555      </row>
2556
2557      <row>
2558       <entry><structfield>datcollate</structfield></entry>
2559       <entry><type>name</type></entry>
2560       <entry></entry>
2561       <entry>LC_COLLATE for this database</entry>
2562      </row>
2563
2564      <row>
2565       <entry><structfield>datctype</structfield></entry>
2566       <entry><type>name</type></entry>
2567       <entry></entry>
2568       <entry>LC_CTYPE for this database</entry>
2569      </row>
2570
2571      <row>
2572       <entry><structfield>datistemplate</structfield></entry>
2573       <entry><type>bool</type></entry>
2574       <entry></entry>
2575       <entry>
2576        If true, then this database can be cloned by
2577        any user with <literal>CREATEDB</> privileges;
2578        if false, then only superusers or the owner of
2579        the database can clone it.
2580       </entry>
2581      </row>
2582
2583      <row>
2584       <entry><structfield>datallowconn</structfield></entry>
2585       <entry><type>bool</type></entry>
2586       <entry></entry>
2587       <entry>
2588        If false then no one can connect to this database.  This is
2589        used to protect the <literal>template0</> database from being altered.
2590       </entry>
2591      </row>
2592
2593      <row>
2594       <entry><structfield>datconnlimit</structfield></entry>
2595       <entry><type>int4</type></entry>
2596       <entry></entry>
2597       <entry>
2598        Sets maximum number of concurrent connections that can be made
2599        to this database.  -1 means no limit.
2600       </entry>
2601      </row>
2602
2603      <row>
2604       <entry><structfield>datlastsysoid</structfield></entry>
2605       <entry><type>oid</type></entry>
2606       <entry></entry>
2607       <entry>
2608        Last system OID in the database; useful
2609        particularly to <application>pg_dump</application>
2610       </entry>
2611      </row>
2612
2613      <row>
2614       <entry><structfield>datfrozenxid</structfield></entry>
2615       <entry><type>xid</type></entry>
2616       <entry></entry>
2617       <entry>
2618        All transaction IDs before this one have been replaced with a permanent
2619        (<quote>frozen</>) transaction ID in this database.  This is used to
2620        track whether the database needs to be vacuumed in order to prevent
2621        transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
2622        It is the minimum of the per-table
2623        <structname>pg_class</>.<structfield>relfrozenxid</> values.
2624       </entry>
2625      </row>
2626
2627      <row>
2628       <entry><structfield>datminmxid</structfield></entry>
2629       <entry><type>xid</type></entry>
2630       <entry></entry>
2631       <entry>
2632        All multixact IDs before this one have been replaced with a
2633        transaction ID in this database.  This is used to
2634        track whether the database needs to be vacuumed in order to prevent
2635        multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2636        It is the minimum of the per-table
2637        <structname>pg_class</>.<structfield>relminmxid</> values.
2638       </entry>
2639      </row>
2640
2641      <row>
2642       <entry><structfield>dattablespace</structfield></entry>
2643       <entry><type>oid</type></entry>
2644       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2645       <entry>
2646        The default tablespace for the database.
2647        Within this database, all tables for which
2648        <structname>pg_class</>.<structfield>reltablespace</> is zero
2649        will be stored in this tablespace; in particular, all the non-shared
2650        system catalogs will be there.
2651       </entry>
2652      </row>
2653
2654      <row>
2655       <entry><structfield>datacl</structfield></entry>
2656       <entry><type>aclitem[]</type></entry>
2657       <entry></entry>
2658       <entry>
2659        Access privileges; see
2660        <xref linkend="sql-grant"> and
2661        <xref linkend="sql-revoke">
2662        for details
2663       </entry>
2664      </row>
2665     </tbody>
2666    </tgroup>
2667   </table>
2668  </sect1>
2669
2670
2671  <sect1 id="catalog-pg-db-role-setting">
2672   <title><structname>pg_db_role_setting</structname></title>
2673
2674   <indexterm zone="catalog-pg-db-role-setting">
2675    <primary>pg_db_role_setting</primary>
2676   </indexterm>
2677
2678   <para>
2679    The catalog <structname>pg_db_role_setting</structname> records the default
2680    values that have been set for run-time configuration variables,
2681    for each role and database combination.
2682   </para>
2683
2684   <para>
2685    Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2686    is shared across all databases of a cluster: there is only one
2687    copy of <structname>pg_db_role_setting</structname> per cluster, not
2688    one per database.
2689   </para>
2690
2691   <table>
2692    <title><structname>pg_db_role_setting</> Columns</title>
2693
2694    <tgroup cols="4">
2695     <thead>
2696      <row>
2697       <entry>Name</entry>
2698       <entry>Type</entry>
2699       <entry>References</entry>
2700       <entry>Description</entry>
2701      </row>
2702     </thead>
2703
2704     <tbody>
2705      <row>
2706       <entry><structfield>setdatabase</structfield></entry>
2707       <entry><type>oid</type></entry>
2708       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2709       <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2710      </row>
2711
2712      <row>
2713       <entry><structfield>setrole</structfield></entry>
2714       <entry><type>oid</type></entry>
2715       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2716       <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2717      </row>
2718
2719      <row>
2720       <entry><structfield>setconfig</structfield></entry>
2721       <entry><type>text[]</type></entry>
2722       <entry></entry>
2723       <entry>Defaults for run-time configuration variables</entry>
2724      </row>
2725     </tbody>
2726    </tgroup>
2727   </table>
2728  </sect1>
2729
2730
2731  <sect1 id="catalog-pg-default-acl">
2732   <title><structname>pg_default_acl</structname></title>
2733
2734   <indexterm zone="catalog-pg-default-acl">
2735    <primary>pg_default_acl</primary>
2736   </indexterm>
2737
2738   <para>
2739    The catalog <structname>pg_default_acl</> stores initial
2740    privileges to be assigned to newly created objects.
2741   </para>
2742
2743   <table>
2744    <title><structname>pg_default_acl</> Columns</title>
2745
2746    <tgroup cols="4">
2747     <thead>
2748      <row>
2749       <entry>Name</entry>
2750       <entry>Type</entry>
2751       <entry>References</entry>
2752       <entry>Description</entry>
2753      </row>
2754     </thead>
2755
2756     <tbody>
2757      <row>
2758       <entry><structfield>oid</structfield></entry>
2759       <entry><type>oid</type></entry>
2760       <entry></entry>
2761       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2762      </row>
2763
2764      <row>
2765       <entry><structfield>defaclrole</structfield></entry>
2766       <entry><type>oid</type></entry>
2767       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2768       <entry>The OID of the role associated with this entry</entry>
2769      </row>
2770
2771      <row>
2772       <entry><structfield>defaclnamespace</structfield></entry>
2773       <entry><type>oid</type></entry>
2774       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2775       <entry>The OID of the namespace associated with this entry,
2776        or 0 if none</entry>
2777      </row>
2778
2779      <row>
2780       <entry><structfield>defaclobjtype</structfield></entry>
2781       <entry><type>char</type></entry>
2782       <entry></entry>
2783       <entry>
2784        Type of object this entry is for:
2785        <literal>r</> = relation (table, view),
2786        <literal>S</> = sequence,
2787        <literal>f</> = function,
2788        <literal>T</> = type
2789       </entry>
2790      </row>
2791
2792      <row>
2793       <entry><structfield>defaclacl</structfield></entry>
2794       <entry><type>aclitem[]</type></entry>
2795       <entry></entry>
2796       <entry>
2797        Access privileges that this type of object should have on creation
2798       </entry>
2799      </row>
2800     </tbody>
2801    </tgroup>
2802   </table>
2803
2804   <para>
2805    A <structname>pg_default_acl</> entry shows the initial privileges to
2806    be assigned to an object belonging to the indicated user.  There are
2807    currently two types of entry: <quote>global</> entries with
2808    <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2809    that reference a particular schema.  If a global entry is present then
2810    it <emphasis>overrides</> the normal hard-wired default privileges
2811    for the object type.  A per-schema entry, if present, represents privileges
2812    to be <emphasis>added to</> the global or hard-wired default privileges.
2813   </para>
2814
2815   <para>
2816    Note that when an ACL entry in another catalog is null, it is taken
2817    to represent the hard-wired default privileges for its object,
2818    <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2819    at the moment.  <structname>pg_default_acl</> is only consulted during
2820    object creation.
2821   </para>
2822
2823  </sect1>
2824
2825
2826  <sect1 id="catalog-pg-depend">
2827   <title><structname>pg_depend</structname></title>
2828
2829   <indexterm zone="catalog-pg-depend">
2830    <primary>pg_depend</primary>
2831   </indexterm>
2832
2833   <para>
2834    The catalog <structname>pg_depend</structname> records the dependency
2835    relationships between database objects.  This information allows
2836    <command>DROP</> commands to find which other objects must be dropped
2837    by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2838    RESTRICT</> case.
2839   </para>
2840
2841   <para>
2842    See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2843    which performs a similar function for dependencies involving objects
2844    that are shared across a database cluster.
2845   </para>
2846
2847   <table>
2848    <title><structname>pg_depend</> Columns</title>
2849
2850    <tgroup cols="4">
2851     <thead>
2852      <row>
2853       <entry>Name</entry>
2854       <entry>Type</entry>
2855       <entry>References</entry>
2856       <entry>Description</entry>
2857      </row>
2858     </thead>
2859
2860     <tbody>
2861      <row>
2862       <entry><structfield>classid</structfield></entry>
2863       <entry><type>oid</type></entry>
2864       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2865       <entry>The OID of the system catalog the dependent object is in</entry>
2866      </row>
2867
2868      <row>
2869       <entry><structfield>objid</structfield></entry>
2870       <entry><type>oid</type></entry>
2871       <entry>any OID column</entry>
2872       <entry>The OID of the specific dependent object</entry>
2873      </row>
2874
2875      <row>
2876       <entry><structfield>objsubid</structfield></entry>
2877       <entry><type>int4</type></entry>
2878       <entry></entry>
2879       <entry>
2880        For a table column, this is the column number (the
2881        <structfield>objid</> and <structfield>classid</> refer to the
2882        table itself).  For all other object types, this column is
2883        zero.
2884       </entry>
2885      </row>
2886
2887      <row>
2888       <entry><structfield>refclassid</structfield></entry>
2889       <entry><type>oid</type></entry>
2890       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2891       <entry>The OID of the system catalog the referenced object is in</entry>
2892      </row>
2893
2894      <row>
2895       <entry><structfield>refobjid</structfield></entry>
2896       <entry><type>oid</type></entry>
2897       <entry>any OID column</entry>
2898       <entry>The OID of the specific referenced object</entry>
2899      </row>
2900
2901      <row>
2902       <entry><structfield>refobjsubid</structfield></entry>
2903       <entry><type>int4</type></entry>
2904       <entry></entry>
2905       <entry>
2906        For a table column, this is the column number (the
2907        <structfield>refobjid</> and <structfield>refclassid</> refer
2908        to the table itself).  For all other object types, this column
2909        is zero.
2910       </entry>
2911      </row>
2912
2913      <row>
2914       <entry><structfield>deptype</structfield></entry>
2915       <entry><type>char</type></entry>
2916       <entry></entry>
2917       <entry>
2918        A code defining the specific semantics of this dependency relationship; see text
2919       </entry>
2920      </row>
2921
2922     </tbody>
2923    </tgroup>
2924   </table>
2925
2926   <para>
2927    In all cases, a <structname>pg_depend</structname> entry indicates that the
2928    referenced object cannot be dropped without also dropping the dependent
2929    object.  However, there are several subflavors identified by
2930    <structfield>deptype</>:
2931
2932    <variablelist>
2933     <varlistentry>
2934      <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2935      <listitem>
2936       <para>
2937        A normal relationship between separately-created objects.  The
2938        dependent object can be dropped without affecting the
2939        referenced object.  The referenced object can only be dropped
2940        by specifying <literal>CASCADE</>, in which case the dependent
2941        object is dropped, too.  Example: a table column has a normal
2942        dependency on its data type.
2943       </para>
2944      </listitem>
2945     </varlistentry>
2946
2947     <varlistentry>
2948      <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2949      <listitem>
2950       <para>
2951        The dependent object can be dropped separately from the
2952        referenced object, and should be automatically dropped
2953        (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2954        mode) if the referenced object is dropped.  Example: a named
2955        constraint on a table is made autodependent on the table, so
2956        that it will go away if the table is dropped.
2957       </para>
2958      </listitem>
2959     </varlistentry>
2960
2961     <varlistentry>
2962      <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2963      <listitem>
2964       <para>
2965        The dependent object was created as part of creation of the
2966        referenced object, and is really just a part of its internal
2967        implementation.  A <command>DROP</> of the dependent object
2968        will be disallowed outright (we'll tell the user to issue a
2969        <command>DROP</> against the referenced object, instead).  A
2970        <command>DROP</> of the referenced object will be propagated
2971        through to drop the dependent object whether
2972        <command>CASCADE</> is specified or not.  Example: a trigger
2973        that's created to enforce a foreign-key constraint is made
2974        internally dependent on the constraint's
2975        <structname>pg_constraint</> entry.
2976       </para>
2977      </listitem>
2978     </varlistentry>
2979
2980     <varlistentry>
2981      <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2982      <listitem>
2983       <para>
2984        The dependent object is a member of the <firstterm>extension</> that is
2985        the referenced object (see
2986        <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2987        The dependent object can be dropped only via
2988        <command>DROP EXTENSION</> on the referenced object.  Functionally
2989        this dependency type acts the same as an internal dependency, but
2990        it's kept separate for clarity and to simplify <application>pg_dump</>.
2991       </para>
2992      </listitem>
2993     </varlistentry>
2994
2995     <varlistentry>
2996      <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2997      <listitem>
2998       <para>
2999        The dependent object is not a member of the extension that is the
3000        referenced object (and so should not be ignored by pg_dump), but
3001        cannot function without it and should be dropped when the
3002        extension itself is. The dependent object may be dropped on its
3003        own as well.
3004       </para>
3005      </listitem>
3006     </varlistentry>
3007
3008     <varlistentry>
3009      <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
3010      <listitem>
3011       <para>
3012        There is no dependent object; this type of entry is a signal
3013        that the system itself depends on the referenced object, and so
3014        that object must never be deleted.  Entries of this type are
3015        created only by <command>initdb</command>.  The columns for the
3016        dependent object contain zeroes.
3017       </para>
3018      </listitem>
3019     </varlistentry>
3020    </variablelist>
3021
3022    Other dependency flavors might be needed in future.
3023   </para>
3024
3025  </sect1>
3026
3027
3028  <sect1 id="catalog-pg-description">
3029   <title><structname>pg_description</structname></title>
3030
3031   <indexterm zone="catalog-pg-description">
3032    <primary>pg_description</primary>
3033   </indexterm>
3034
3035   <para>
3036    The catalog <structname>pg_description</> stores optional descriptions
3037    (comments) for each database object.  Descriptions can be manipulated
3038    with the <xref linkend="sql-comment"> command and viewed with
3039    <application>psql</application>'s <literal>\d</literal> commands.
3040    Descriptions of many built-in system objects are provided in the initial
3041    contents of <structname>pg_description</structname>.
3042   </para>
3043
3044   <para>
3045    See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3046    which performs a similar function for descriptions involving objects that
3047    are shared across a database cluster.
3048   </para>
3049
3050   <table>
3051    <title><structname>pg_description</> Columns</title>
3052
3053    <tgroup cols="4">
3054     <thead>
3055      <row>
3056       <entry>Name</entry>
3057       <entry>Type</entry>
3058       <entry>References</entry>
3059       <entry>Description</entry>
3060      </row>
3061     </thead>
3062
3063     <tbody>
3064      <row>
3065       <entry><structfield>objoid</structfield></entry>
3066       <entry><type>oid</type></entry>
3067       <entry>any OID column</entry>
3068       <entry>The OID of the object this description pertains to</entry>
3069      </row>
3070
3071      <row>
3072       <entry><structfield>classoid</structfield></entry>
3073       <entry><type>oid</type></entry>
3074       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3075       <entry>The OID of the system catalog this object appears in</entry>
3076      </row>
3077
3078      <row>
3079       <entry><structfield>objsubid</structfield></entry>
3080       <entry><type>int4</type></entry>
3081       <entry></entry>
3082       <entry>
3083        For a comment on a table column, this is the column number (the
3084        <structfield>objoid</> and <structfield>classoid</> refer to
3085        the table itself).  For all other object types, this column is
3086        zero.
3087       </entry>
3088      </row>
3089
3090      <row>
3091       <entry><structfield>description</structfield></entry>
3092       <entry><type>text</type></entry>
3093       <entry></entry>
3094       <entry>Arbitrary text that serves as the description of this object</entry>
3095      </row>
3096     </tbody>
3097    </tgroup>
3098   </table>
3099
3100  </sect1>
3101
3102
3103  <sect1 id="catalog-pg-enum">
3104   <title><structname>pg_enum</structname></title>
3105
3106   <indexterm zone="catalog-pg-enum">
3107    <primary>pg_enum</primary>
3108   </indexterm>
3109
3110   <para>
3111    The <structname>pg_enum</structname> catalog contains entries
3112    showing the values and labels for each enum type. The
3113    internal representation of a given enum value is actually the OID
3114    of its associated row in <structname>pg_enum</structname>.
3115   </para>
3116
3117   <table>
3118    <title><structname>pg_enum</> Columns</title>
3119
3120    <tgroup cols="4">
3121     <thead>
3122      <row>
3123       <entry>Name</entry>
3124       <entry>Type</entry>
3125       <entry>References</entry>
3126       <entry>Description</entry>
3127      </row>
3128     </thead>
3129
3130     <tbody>
3131      <row>
3132       <entry><structfield>oid</structfield></entry>
3133       <entry><type>oid</type></entry>
3134       <entry></entry>
3135       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3136      </row>
3137
3138      <row>
3139       <entry><structfield>enumtypid</structfield></entry>
3140       <entry><type>oid</type></entry>
3141       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3142       <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3143      </row>
3144
3145      <row>
3146       <entry><structfield>enumsortorder</structfield></entry>
3147       <entry><type>float4</type></entry>
3148       <entry></entry>
3149       <entry>The sort position of this enum value within its enum type</entry>
3150      </row>
3151
3152      <row>
3153       <entry><structfield>enumlabel</structfield></entry>
3154       <entry><type>name</type></entry>
3155       <entry></entry>
3156       <entry>The textual label for this enum value</entry>
3157      </row>
3158     </tbody>
3159    </tgroup>
3160   </table>
3161
3162   <para>
3163    The OIDs for <structname>pg_enum</structname> rows follow a special
3164    rule: even-numbered OIDs are guaranteed to be ordered in the same way
3165    as the sort ordering of their enum type.  That is, if two even OIDs
3166    belong to the same enum type, the smaller OID must have the smaller
3167    <structfield>enumsortorder</structfield> value.  Odd-numbered OID values
3168    need bear no relationship to the sort order.  This rule allows the
3169    enum comparison routines to avoid catalog lookups in many common cases.
3170    The routines that create and alter enum types attempt to assign even
3171    OIDs to enum values whenever possible.
3172   </para>
3173
3174   <para>
3175    When an enum type is created, its members are assigned sort-order
3176    positions 1..<replaceable>n</>.  But members added later might be given
3177    negative or fractional values of <structfield>enumsortorder</structfield>.
3178    The only requirement on these values is that they be correctly
3179    ordered and unique within each enum type.
3180   </para>
3181  </sect1>
3182
3183
3184  <sect1 id="catalog-pg-event-trigger">
3185   <title><structname>pg_event_trigger</structname></title>
3186
3187   <indexterm zone="catalog-pg-event-trigger">
3188    <primary>pg_event_trigger</primary>
3189   </indexterm>
3190
3191   <para>
3192    The catalog <structname>pg_event_trigger</structname> stores event triggers.
3193    See <xref linkend="event-triggers"> for more information.
3194   </para>
3195
3196   <table>
3197    <title><structname>pg_event_trigger</> Columns</title>
3198
3199    <tgroup cols="4">
3200     <thead>
3201      <row>
3202       <entry>Name</entry>
3203       <entry>Type</entry>
3204       <entry>References</entry>
3205       <entry>Description</entry>
3206      </row>
3207     </thead>
3208
3209     <tbody>
3210      <row>
3211       <entry><structfield>evtname</structfield></entry>
3212       <entry><type>name</type></entry>
3213       <entry></entry>
3214       <entry>Trigger name (must be unique)</entry>
3215      </row>
3216
3217      <row>
3218       <entry><structfield>evtevent</structfield></entry>
3219       <entry><type>name</type></entry>
3220       <entry></entry>
3221       <entry>Identifies the event for which this trigger fires</entry>
3222      </row>
3223
3224      <row>
3225       <entry><structfield>evtowner</structfield></entry>
3226       <entry><type>oid</type></entry>
3227       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3228       <entry>Owner of the event trigger</entry>
3229      </row>
3230
3231      <row>
3232       <entry><structfield>evtfoid</structfield></entry>
3233       <entry><type>oid</type></entry>
3234       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3235       <entry>The function to be called</entry>
3236      </row>
3237
3238      <row>
3239       <entry><structfield>evtenabled</structfield></entry>
3240       <entry><type>char</type></entry>
3241       <entry></entry>
3242       <entry>
3243        Controls in which <xref linkend="guc-session-replication-role"> modes
3244        the event trigger fires.
3245        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3246        <literal>D</> = trigger is disabled,
3247        <literal>R</> = trigger fires in <quote>replica</> mode,
3248        <literal>A</> = trigger fires always.
3249       </entry>
3250      </row>
3251
3252      <row>
3253       <entry><structfield>evttags</structfield></entry>
3254       <entry><type>text[]</type></entry>
3255       <entry></entry>
3256       <entry>
3257         Command tags for which this trigger will fire.  If NULL, the firing
3258         of this trigger is not restricted on the basis of the command tag.
3259       </entry>
3260      </row>
3261     </tbody>
3262    </tgroup>
3263   </table>
3264  </sect1>
3265
3266
3267  <sect1 id="catalog-pg-extension">
3268   <title><structname>pg_extension</structname></title>
3269
3270   <indexterm zone="catalog-pg-extension">
3271    <primary>pg_extension</primary>
3272   </indexterm>
3273
3274   <para>
3275    The catalog <structname>pg_extension</structname> stores information
3276    about the installed extensions.  See <xref linkend="extend-extensions">
3277    for details about extensions.
3278   </para>
3279
3280   <table>
3281    <title><structname>pg_extension</> Columns</title>
3282
3283    <tgroup cols="4">
3284     <thead>
3285      <row>
3286       <entry>Name</entry>
3287       <entry>Type</entry>
3288       <entry>References</entry>
3289       <entry>Description</entry>
3290      </row>
3291     </thead>
3292
3293     <tbody>
3294      <row>
3295       <entry><structfield>oid</structfield></entry>
3296       <entry><type>oid</type></entry>
3297       <entry></entry>
3298       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3299      </row>
3300
3301      <row>
3302       <entry><structfield>extname</structfield></entry>
3303       <entry><type>name</type></entry>
3304       <entry></entry>
3305       <entry>Name of the extension</entry>
3306      </row>
3307
3308      <row>
3309       <entry><structfield>extowner</structfield></entry>
3310       <entry><type>oid</type></entry>
3311       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3312       <entry>Owner of the extension</entry>
3313      </row>
3314
3315      <row>
3316       <entry><structfield>extnamespace</structfield></entry>
3317       <entry><type>oid</type></entry>
3318       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3319       <entry>Schema containing the extension's exported objects</entry>
3320      </row>
3321
3322      <row>
3323       <entry><structfield>extrelocatable</structfield></entry>
3324       <entry><type>bool</type></entry>
3325       <entry></entry>
3326       <entry>True if extension can be relocated to another schema</entry>
3327      </row>
3328
3329      <row>
3330       <entry><structfield>extversion</structfield></entry>
3331       <entry><type>text</type></entry>
3332       <entry></entry>
3333       <entry>Version name for the extension</entry>
3334      </row>
3335
3336      <row>
3337       <entry><structfield>extconfig</structfield></entry>
3338       <entry><type>oid[]</type></entry>
3339       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3340       <entry>Array of <type>regclass</> OIDs for the extension's configuration
3341        table(s), or <literal>NULL</> if none</entry>
3342      </row>
3343
3344      <row>
3345       <entry><structfield>extcondition</structfield></entry>
3346       <entry><type>text[]</type></entry>
3347       <entry></entry>
3348       <entry>Array of <literal>WHERE</>-clause filter conditions for the
3349        extension's configuration table(s), or <literal>NULL</> if none</entry>
3350      </row>
3351
3352     </tbody>
3353    </tgroup>
3354   </table>
3355
3356   <para>
3357    Note that unlike most catalogs with a <quote>namespace</> column,
3358    <structfield>extnamespace</structfield> is not meant to imply
3359    that the extension belongs to that schema.  Extension names are never
3360    schema-qualified.  Rather, <structfield>extnamespace</structfield>
3361    indicates the schema that contains most or all of the extension's
3362    objects.  If <structfield>extrelocatable</structfield> is true, then
3363    this schema must in fact contain all schema-qualifiable objects
3364    belonging to the extension.
3365   </para>
3366  </sect1>
3367
3368
3369  <sect1 id="catalog-pg-foreign-data-wrapper">
3370   <title><structname>pg_foreign_data_wrapper</structname></title>
3371
3372   <indexterm zone="catalog-pg-foreign-data-wrapper">
3373    <primary>pg_foreign_data_wrapper</primary>
3374   </indexterm>
3375
3376   <para>
3377    The catalog <structname>pg_foreign_data_wrapper</structname> stores
3378    foreign-data wrapper definitions.  A foreign-data wrapper is the
3379    mechanism by which external data, residing on foreign servers, is
3380    accessed.
3381   </para>
3382
3383   <table>
3384    <title><structname>pg_foreign_data_wrapper</> Columns</title>
3385
3386    <tgroup cols="4">
3387     <thead>
3388      <row>
3389       <entry>Name</entry>
3390       <entry>Type</entry>
3391       <entry>References</entry>
3392       <entry>Description</entry>
3393      </row>
3394     </thead>
3395
3396     <tbody>
3397      <row>
3398       <entry><structfield>oid</structfield></entry>
3399       <entry><type>oid</type></entry>
3400       <entry></entry>
3401       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3402      </row>
3403
3404      <row>
3405       <entry><structfield>fdwname</structfield></entry>
3406       <entry><type>name</type></entry>
3407       <entry></entry>
3408       <entry>Name of the foreign-data wrapper</entry>
3409      </row>
3410
3411      <row>
3412       <entry><structfield>fdwowner</structfield></entry>
3413       <entry><type>oid</type></entry>
3414       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3415       <entry>Owner of the foreign-data wrapper</entry>
3416      </row>
3417
3418      <row>
3419       <entry><structfield>fdwhandler</structfield></entry>
3420       <entry><type>oid</type></entry>
3421       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3422       <entry>
3423        References a handler function that is responsible for
3424        supplying execution routines for the foreign-data wrapper.
3425        Zero if no handler is provided
3426       </entry>
3427      </row>
3428
3429      <row>
3430       <entry><structfield>fdwvalidator</structfield></entry>
3431       <entry><type>oid</type></entry>
3432       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3433       <entry>
3434        References a validator function that is responsible for
3435        checking the validity of the options given to the
3436        foreign-data wrapper, as well as options for foreign servers and user
3437        mappings using the foreign-data wrapper.  Zero if no validator
3438        is provided
3439       </entry>
3440      </row>
3441
3442      <row>
3443       <entry><structfield>fdwacl</structfield></entry>
3444       <entry><type>aclitem[]</type></entry>
3445       <entry></entry>
3446       <entry>
3447        Access privileges; see
3448        <xref linkend="sql-grant"> and
3449        <xref linkend="sql-revoke">
3450        for details
3451       </entry>
3452      </row>
3453
3454      <row>
3455       <entry><structfield>fdwoptions</structfield></entry>
3456       <entry><type>text[]</type></entry>
3457       <entry></entry>
3458       <entry>
3459        Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3460       </entry>
3461      </row>
3462     </tbody>
3463    </tgroup>
3464   </table>
3465  </sect1>
3466
3467
3468  <sect1 id="catalog-pg-foreign-server">
3469   <title><structname>pg_foreign_server</structname></title>
3470
3471   <indexterm zone="catalog-pg-foreign-server">
3472    <primary>pg_foreign_server</primary>
3473   </indexterm>
3474
3475   <para>
3476    The catalog <structname>pg_foreign_server</structname> stores
3477    foreign server definitions.  A foreign server describes a source
3478    of external data, such as a remote server.  Foreign
3479    servers are accessed via foreign-data wrappers.
3480   </para>
3481
3482   <table>
3483    <title><structname>pg_foreign_server</> Columns</title>
3484
3485    <tgroup cols="4">
3486     <thead>
3487      <row>
3488       <entry>Name</entry>
3489       <entry>Type</entry>
3490       <entry>References</entry>
3491       <entry>Description</entry>
3492      </row>
3493     </thead>
3494
3495     <tbody>
3496      <row>
3497       <entry><structfield>oid</structfield></entry>
3498       <entry><type>oid</type></entry>
3499       <entry></entry>
3500       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3501      </row>
3502
3503      <row>
3504       <entry><structfield>srvname</structfield></entry>
3505       <entry><type>name</type></entry>
3506       <entry></entry>
3507       <entry>Name of the foreign server</entry>
3508      </row>
3509
3510      <row>
3511       <entry><structfield>srvowner</structfield></entry>
3512       <entry><type>oid</type></entry>
3513       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3514       <entry>Owner of the foreign server</entry>
3515      </row>
3516
3517      <row>
3518       <entry><structfield>srvfdw</structfield></entry>
3519       <entry><type>oid</type></entry>
3520       <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3521       <entry>OID of the foreign-data wrapper of this foreign server</entry>
3522      </row>
3523
3524      <row>
3525       <entry><structfield>srvtype</structfield></entry>
3526       <entry><type>text</type></entry>
3527       <entry></entry>
3528       <entry>Type of the server (optional)</entry>
3529      </row>
3530
3531      <row>
3532       <entry><structfield>srvversion</structfield></entry>
3533       <entry><type>text</type></entry>
3534       <entry></entry>
3535       <entry>Version of the server (optional)</entry>
3536      </row>
3537
3538      <row>
3539       <entry><structfield>srvacl</structfield></entry>
3540       <entry><type>aclitem[]</type></entry>
3541       <entry></entry>
3542       <entry>
3543        Access privileges; see
3544        <xref linkend="sql-grant"> and
3545        <xref linkend="sql-revoke">
3546        for details
3547       </entry>
3548      </row>
3549
3550      <row>
3551       <entry><structfield>srvoptions</structfield></entry>
3552       <entry><type>text[]</type></entry>
3553       <entry></entry>
3554       <entry>
3555        Foreign server specific options, as <quote>keyword=value</> strings
3556       </entry>
3557      </row>
3558     </tbody>
3559    </tgroup>
3560   </table>
3561  </sect1>
3562
3563
3564  <sect1 id="catalog-pg-foreign-table">
3565   <title><structname>pg_foreign_table</structname></title>
3566
3567   <indexterm zone="catalog-pg-foreign-table">
3568    <primary>pg_foreign_table</primary>
3569   </indexterm>
3570
3571   <para>
3572    The catalog <structname>pg_foreign_table</structname> contains
3573    auxiliary information about foreign tables.  A foreign table is
3574    primarily represented by a <structname>pg_class</structname> entry,
3575    just like a regular table.  Its <structname>pg_foreign_table</structname>
3576    entry contains the information that is pertinent only to foreign tables
3577    and not any other kind of relation.
3578   </para>
3579
3580   <table>
3581    <title><structname>pg_foreign_table</> Columns</title>
3582
3583    <tgroup cols="4">
3584     <thead>
3585      <row>
3586       <entry>Name</entry>
3587       <entry>Type</entry>
3588       <entry>References</entry>
3589       <entry>Description</entry>
3590      </row>
3591     </thead>
3592
3593     <tbody>
3594      <row>
3595       <entry><structfield>ftrelid</structfield></entry>
3596       <entry><type>oid</type></entry>
3597       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3598       <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3599      </row>
3600
3601      <row>
3602       <entry><structfield>ftserver</structfield></entry>
3603       <entry><type>oid</type></entry>
3604       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3605       <entry>OID of the foreign server for this foreign table</entry>
3606      </row>
3607
3608      <row>
3609       <entry><structfield>ftoptions</structfield></entry>
3610       <entry><type>text[]</type></entry>
3611       <entry></entry>
3612       <entry>
3613        Foreign table options, as <quote>keyword=value</> strings
3614       </entry>
3615      </row>
3616     </tbody>
3617    </tgroup>
3618   </table>
3619  </sect1>
3620
3621
3622  <sect1 id="catalog-pg-index">
3623   <title><structname>pg_index</structname></title>
3624
3625   <indexterm zone="catalog-pg-index">
3626    <primary>pg_index</primary>
3627   </indexterm>
3628
3629   <para>
3630    The catalog <structname>pg_index</structname> contains part of the information
3631    about indexes.  The rest is mostly in
3632    <structname>pg_class</structname>.
3633   </para>
3634
3635   <table>
3636    <title><structname>pg_index</> Columns</title>
3637
3638    <tgroup cols="4">
3639     <thead>
3640      <row>
3641       <entry>Name</entry>
3642       <entry>Type</entry>
3643       <entry>References</entry>
3644       <entry>Description</entry>
3645      </row>
3646     </thead>
3647
3648     <tbody>
3649      <row>
3650       <entry><structfield>indexrelid</structfield></entry>
3651       <entry><type>oid</type></entry>
3652       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3653       <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3654      </row>
3655
3656      <row>
3657       <entry><structfield>indrelid</structfield></entry>
3658       <entry><type>oid</type></entry>
3659       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3660       <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3661      </row>
3662
3663      <row>
3664       <entry><structfield>indnatts</structfield></entry>
3665       <entry><type>int2</type></entry>
3666       <entry></entry>
3667       <entry>The number of columns in the index (duplicates
3668       <literal>pg_class.relnatts</literal>)</entry>
3669      </row>
3670
3671      <row>
3672       <entry><structfield>indisunique</structfield></entry>
3673       <entry><type>bool</type></entry>
3674       <entry></entry>
3675       <entry>If true, this is a unique index</entry>
3676      </row>
3677
3678      <row>
3679       <entry><structfield>indisprimary</structfield></entry>
3680       <entry><type>bool</type></entry>
3681       <entry></entry>
3682       <entry>If true, this index represents the primary key of the table
3683       (<structfield>indisunique</> should always be true when this is true)</entry>
3684      </row>
3685
3686      <row>
3687       <entry><structfield>indisexclusion</structfield></entry>
3688       <entry><type>bool</type></entry>
3689       <entry></entry>
3690       <entry>If true, this index supports an exclusion constraint</entry>
3691      </row>
3692
3693      <row>
3694       <entry><structfield>indimmediate</structfield></entry>
3695       <entry><type>bool</type></entry>
3696       <entry></entry>
3697       <entry>If true, the uniqueness check is enforced immediately on
3698        insertion
3699        (irrelevant if <structfield>indisunique</> is not true)</entry>
3700      </row>
3701
3702      <row>
3703       <entry><structfield>indisclustered</structfield></entry>
3704       <entry><type>bool</type></entry>
3705       <entry></entry>
3706       <entry>If true, the table was last clustered on this index</entry>
3707      </row>
3708
3709      <row>
3710       <entry><structfield>indisvalid</structfield></entry>
3711       <entry><type>bool</type></entry>
3712       <entry></entry>
3713       <entry>
3714        If true, the index is currently valid for queries.  False means the
3715        index is possibly incomplete: it must still be modified by
3716        <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3717        be used for queries. If it is unique, the uniqueness property is not
3718        guaranteed true either.
3719       </entry>
3720      </row>
3721
3722      <row>
3723       <entry><structfield>indcheckxmin</structfield></entry>
3724       <entry><type>bool</type></entry>
3725       <entry></entry>
3726       <entry>
3727        If true, queries must not use the index until the <structfield>xmin</>
3728        of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3729        event horizon, because the table may contain broken HOT chains with
3730        incompatible rows that they can see
3731       </entry>
3732      </row>
3733
3734      <row>
3735       <entry><structfield>indisready</structfield></entry>
3736       <entry><type>bool</type></entry>
3737       <entry></entry>
3738       <entry>
3739        If true, the index is currently ready for inserts.  False means the
3740        index must be ignored by <command>INSERT</>/<command>UPDATE</>
3741        operations.
3742       </entry>
3743      </row>
3744
3745      <row>
3746       <entry><structfield>indislive</structfield></entry>
3747       <entry><type>bool</type></entry>
3748       <entry></entry>
3749       <entry>
3750        If false, the index is in process of being dropped, and should be
3751        ignored for all purposes (including HOT-safety decisions)
3752       </entry>
3753      </row>
3754
3755      <row>
3756       <entry><structfield>indisreplident</structfield></entry>
3757       <entry><type>bool</type></entry>
3758       <entry></entry>
3759       <entry>
3760        If true this index has been chosen as <quote>replica identity</>
3761        using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3762        ...</>
3763       </entry>
3764      </row>
3765
3766      <row>
3767       <entry><structfield>indkey</structfield></entry>
3768       <entry><type>int2vector</type></entry>
3769       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3770       <entry>
3771        This is an array of <structfield>indnatts</structfield> values that
3772        indicate which table columns this index indexes.  For example a value
3773        of <literal>1 3</literal> would mean that the first and the third table
3774        columns make up the index key.  A zero in this array indicates that the
3775        corresponding index attribute is an expression over the table columns,
3776        rather than a simple column reference.
3777       </entry>
3778      </row>
3779
3780      <row>
3781       <entry><structfield>indcollation</structfield></entry>
3782       <entry><type>oidvector</type></entry>
3783       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3784       <entry>
3785        For each column in the index key, this contains the OID of the
3786        collation to use for the index, or zero if the column is not
3787        of a collatable data type.
3788       </entry>
3789      </row>
3790
3791      <row>
3792       <entry><structfield>indclass</structfield></entry>
3793       <entry><type>oidvector</type></entry>
3794       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3795       <entry>
3796        For each column in the index key, this contains the OID of
3797        the operator class to use.  See
3798        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3799       </entry>
3800      </row>
3801
3802      <row>
3803       <entry><structfield>indoption</structfield></entry>
3804       <entry><type>int2vector</type></entry>
3805       <entry></entry>
3806       <entry>
3807        This is an array of <structfield>indnatts</structfield> values that
3808        store per-column flag bits.  The meaning of the bits is defined by
3809        the index's access method.
3810       </entry>
3811      </row>
3812
3813      <row>
3814       <entry><structfield>indexprs</structfield></entry>
3815       <entry><type>pg_node_tree</type></entry>
3816       <entry></entry>
3817       <entry>
3818        Expression trees (in <function>nodeToString()</function>
3819        representation) for index attributes that are not simple column
3820        references.  This is a list with one element for each zero
3821        entry in <structfield>indkey</>.  Null if all index attributes
3822        are simple references.
3823       </entry>
3824      </row>
3825
3826      <row>
3827       <entry><structfield>indpred</structfield></entry>
3828       <entry><type>pg_node_tree</type></entry>
3829       <entry></entry>
3830       <entry>
3831        Expression tree (in <function>nodeToString()</function>
3832        representation) for partial index predicate.  Null if not a
3833        partial index.
3834       </entry>
3835      </row>
3836     </tbody>
3837    </tgroup>
3838   </table>
3839
3840  </sect1>
3841
3842
3843  <sect1 id="catalog-pg-inherits">
3844   <title><structname>pg_inherits</structname></title>
3845
3846   <indexterm zone="catalog-pg-inherits">
3847    <primary>pg_inherits</primary>
3848   </indexterm>
3849
3850   <para>
3851    The catalog <structname>pg_inherits</> records information about
3852    table inheritance hierarchies.  There is one entry for each direct
3853    child table in the database.  (Indirect inheritance can be determined
3854    by following chains of entries.)
3855   </para>
3856
3857   <table>
3858    <title><structname>pg_inherits</> Columns</title>
3859
3860    <tgroup cols="4">
3861     <thead>
3862      <row>
3863       <entry>Name</entry>
3864       <entry>Type</entry>
3865       <entry>References</entry>
3866       <entry>Description</entry>
3867      </row>
3868     </thead>
3869
3870     <tbody>
3871      <row>
3872       <entry><structfield>inhrelid</structfield></entry>
3873       <entry><type>oid</type></entry>
3874       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3875       <entry>
3876        The OID of the child table
3877       </entry>
3878      </row>
3879
3880      <row>
3881       <entry><structfield>inhparent</structfield></entry>
3882       <entry><type>oid</type></entry>
3883       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3884       <entry>
3885        The OID of the parent table
3886       </entry>
3887      </row>
3888
3889      <row>
3890       <entry><structfield>inhseqno</structfield></entry>
3891       <entry><type>int4</type></entry>
3892       <entry></entry>
3893       <entry>
3894        If there is more than one direct parent for a child table (multiple
3895        inheritance), this number tells the order in which the
3896        inherited columns are to be arranged.  The count starts at 1.
3897       </entry>
3898      </row>
3899     </tbody>
3900    </tgroup>
3901   </table>
3902
3903  </sect1>
3904
3905  <sect1 id="catalog-pg-init-privs">
3906   <title><structname>pg_init_privs</structname></title>
3907
3908   <indexterm zone="catalog-pg-init-privs">
3909    <primary>pg_init_privs</primary>
3910   </indexterm>
3911
3912   <para>
3913    The catalog <structname>pg_init_privs</> records information about
3914    the initial privileges of objects in the system.  There is one entry
3915    for each object in the database which has a non-default (non-NULL)
3916    initial set of privileges.
3917   </para>
3918
3919   <para>
3920    Objects can have initial privileges either by having those privileges set
3921    when the system is initialized (by <application>initdb</>) or when the
3922    object is created during a <command>CREATE EXTENSION</command> and the
3923    extension script sets initial privileges using the <command>GRANT</command>
3924    system.  Note that the system will automatically handle recording of the
3925    privileges during the extension script and that extension authors need
3926    only use the <command>GRANT</command> and <command>REVOKE</command>
3927    statements in their script to have the privileges recorded.  The
3928    <literal>privtype</literal> column indicates if the initial privilege was
3929    set by <application>initdb</> or during a
3930    <command>CREATE EXTENSION</command> command.
3931   </para>
3932
3933   <para>
3934    Objects which have initial privileges set by <application>initdb</> will
3935    have entries where <literal>privtype</literal> is
3936    <literal>'i'</literal>, while objects which have initial privileges set
3937    by <command>CREATE EXTENSION</command> will have entries where
3938    <literal>privtype</literal> is <literal>'e'</literal>.
3939   </para>
3940
3941   <table>
3942    <title><structname>pg_init_privs</> Columns</title>
3943
3944    <tgroup cols="4">
3945     <thead>
3946      <row>
3947       <entry>Name</entry>
3948       <entry>Type</entry>
3949       <entry>References</entry>
3950       <entry>Description</entry>
3951      </row>
3952     </thead>
3953
3954     <tbody>
3955      <row>
3956       <entry><structfield>objoid</structfield></entry>
3957       <entry><type>oid</type></entry>
3958       <entry>any OID column</entry>
3959       <entry>The OID of the specific object</entry>
3960      </row>
3961
3962      <row>
3963       <entry><structfield>classoid</structfield></entry>
3964       <entry><type>oid</type></entry>
3965       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3966       <entry>The OID of the system catalog the object is in</entry>
3967      </row>
3968
3969      <row>
3970       <entry><structfield>objsubid</structfield></entry>
3971       <entry><type>int4</type></entry>
3972       <entry></entry>
3973       <entry>
3974        For a table column, this is the column number (the
3975        <structfield>objoid</> and <structfield>classoid</> refer to the
3976        table itself).  For all other object types, this column is
3977        zero.
3978       </entry>
3979      </row>
3980
3981      <row>
3982       <entry><structfield>privtype</structfield></entry>
3983       <entry><type>char</type></entry>
3984       <entry></entry>
3985       <entry>
3986        A code defining the type of initial privilege of this object; see text
3987       </entry>
3988      </row>
3989
3990      <row>
3991       <entry><structfield>initprivs</structfield></entry>
3992       <entry><type>aclitem[]</type></entry>
3993       <entry></entry>
3994       <entry>
3995        The initial access privileges; see
3996        <xref linkend="sql-grant"> and
3997        <xref linkend="sql-revoke">
3998        for details
3999       </entry>
4000      </row>
4001
4002     </tbody>
4003    </tgroup>
4004   </table>
4005
4006  </sect1>
4007
4008
4009  <sect1 id="catalog-pg-language">
4010   <title><structname>pg_language</structname></title>
4011
4012   <indexterm zone="catalog-pg-language">
4013    <primary>pg_language</primary>
4014   </indexterm>
4015
4016   <para>
4017    The catalog <structname>pg_language</structname> registers
4018    languages in which you can write functions or stored procedures.
4019    See <xref linkend="sql-createlanguage">
4020    and <xref linkend="xplang"> for more information about language handlers.
4021   </para>
4022
4023   <table>
4024    <title><structname>pg_language</> Columns</title>
4025
4026    <tgroup cols="4">
4027     <thead>
4028      <row>
4029       <entry>Name</entry>
4030       <entry>Type</entry>
4031       <entry>References</entry>
4032       <entry>Description</entry>
4033      </row>
4034     </thead>
4035
4036     <tbody>
4037      <row>
4038       <entry><structfield>oid</structfield></entry>
4039       <entry><type>oid</type></entry>
4040       <entry></entry>
4041       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4042      </row>
4043
4044      <row>
4045       <entry><structfield>lanname</structfield></entry>
4046       <entry><type>name</type></entry>
4047       <entry></entry>
4048       <entry>Name of the language</entry>
4049      </row>
4050
4051      <row>
4052       <entry><structfield>lanowner</structfield></entry>
4053       <entry><type>oid</type></entry>
4054       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4055       <entry>Owner of the language</entry>
4056      </row>
4057
4058      <row>
4059       <entry><structfield>lanispl</structfield></entry>
4060       <entry><type>bool</type></entry>
4061       <entry></entry>
4062       <entry>
4063        This is false for internal languages (such as
4064        <acronym>SQL</acronym>) and true for user-defined languages.
4065        Currently, <application>pg_dump</application> still uses this
4066        to determine which languages need to be dumped, but this might be
4067        replaced by a different mechanism in the future.
4068       </entry>
4069      </row>
4070
4071      <row>
4072       <entry><structfield>lanpltrusted</structfield></entry>
4073       <entry><type>bool</type></entry>
4074       <entry></entry>
4075       <entry>
4076        True if this is a trusted language, which means that it is believed
4077        not to grant access to anything outside the normal SQL execution
4078        environment.  Only superusers can create functions in untrusted
4079        languages.
4080       </entry>
4081      </row>
4082
4083      <row>
4084       <entry><structfield>lanplcallfoid</structfield></entry>
4085       <entry><type>oid</type></entry>
4086       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4087       <entry>
4088        For noninternal languages this references the language
4089        handler, which is a special function that is responsible for
4090        executing all functions that are written in the particular
4091        language
4092       </entry>
4093      </row>
4094
4095      <row>
4096       <entry><structfield>laninline</structfield></entry>
4097       <entry><type>oid</type></entry>
4098       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4099       <entry>
4100        This references a function that is responsible for executing
4101        <quote>inline</> anonymous code blocks
4102        (<xref linkend="sql-do"> blocks).
4103        Zero if inline blocks are not supported.
4104       </entry>
4105      </row>
4106
4107      <row>
4108       <entry><structfield>lanvalidator</structfield></entry>
4109       <entry><type>oid</type></entry>
4110       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4111       <entry>
4112        This references a language validator function that is responsible
4113        for checking the syntax and validity of new functions when they
4114        are created.  Zero if no validator is provided.
4115       </entry>
4116      </row>
4117
4118      <row>
4119       <entry><structfield>lanacl</structfield></entry>
4120       <entry><type>aclitem[]</type></entry>
4121       <entry></entry>
4122       <entry>
4123        Access privileges; see
4124        <xref linkend="sql-grant"> and
4125        <xref linkend="sql-revoke">
4126        for details
4127       </entry>
4128      </row>
4129     </tbody>
4130    </tgroup>
4131   </table>
4132
4133  </sect1>
4134
4135
4136  <sect1 id="catalog-pg-largeobject">
4137   <title><structname>pg_largeobject</structname></title>
4138
4139   <indexterm zone="catalog-pg-largeobject">
4140    <primary>pg_largeobject</primary>
4141   </indexterm>
4142
4143   <para>
4144    The catalog <structname>pg_largeobject</structname> holds the data making up
4145    <quote>large objects</quote>.  A large object is identified by an OID
4146    assigned when it is created.  Each large object is broken into
4147    segments or <quote>pages</> small enough to be conveniently stored as rows
4148    in <structname>pg_largeobject</structname>.
4149    The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4150    <literal>BLCKSZ/4</>, or typically 2 kB).
4151   </para>
4152
4153   <para>
4154    Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4155    associated with large objects.  As a result,
4156    <structname>pg_largeobject</structname> was publicly readable and could be
4157    used to obtain the OIDs (and contents) of all large objects in the system.
4158    This is no longer the case; use
4159    <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4160    to obtain a list of large object OIDs.
4161   </para>
4162
4163   <table>
4164    <title><structname>pg_largeobject</> Columns</title>
4165
4166    <tgroup cols="4">
4167     <thead>
4168      <row>
4169       <entry>Name</entry>
4170       <entry>Type</entry>
4171       <entry>References</entry>
4172       <entry>Description</entry>
4173      </row>
4174     </thead>
4175
4176     <tbody>
4177      <row>
4178       <entry><structfield>loid</structfield></entry>
4179       <entry><type>oid</type></entry>
4180       <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4181       <entry>Identifier of the large object that includes this page</entry>
4182      </row>
4183
4184      <row>
4185       <entry><structfield>pageno</structfield></entry>
4186       <entry><type>int4</type></entry>
4187       <entry></entry>
4188       <entry>Page number of this page within its large object
4189       (counting from zero)</entry>
4190      </row>
4191
4192      <row>
4193       <entry><structfield>data</structfield></entry>
4194       <entry><type>bytea</type></entry>
4195       <entry></entry>
4196       <entry>
4197        Actual data stored in the large object.
4198        This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4199       </entry>
4200      </row>
4201     </tbody>
4202    </tgroup>
4203   </table>
4204
4205   <para>
4206    Each row of <structname>pg_largeobject</structname> holds data
4207    for one page of a large object, beginning at
4208    byte offset (<literal>pageno * LOBLKSIZE</>) within the object.  The implementation
4209    allows sparse storage: pages might be missing, and might be shorter than
4210    <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4211    Missing regions within a large object read as zeroes.
4212   </para>
4213
4214  </sect1>
4215
4216  <sect1 id="catalog-pg-largeobject-metadata">
4217   <title><structname>pg_largeobject_metadata</structname></title>
4218
4219   <indexterm zone="catalog-pg-largeobject-metadata">
4220    <primary>pg_largeobject_metadata</primary>
4221   </indexterm>
4222
4223   <para>
4224    The catalog <structname>pg_largeobject_metadata</structname>
4225    holds metadata associated with large objects.  The actual large object
4226    data is stored in
4227    <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4228   </para>
4229
4230   <table>
4231    <title><structname>pg_largeobject_metadata</> Columns</title>
4232
4233    <tgroup cols="4">
4234     <thead>
4235      <row>
4236       <entry>Name</entry>
4237       <entry>Type</entry>
4238       <entry>References</entry>
4239       <entry>Description</entry>
4240      </row>
4241     </thead>
4242
4243     <tbody>
4244      <row>
4245       <entry><structfield>oid</structfield></entry>
4246       <entry><type>oid</type></entry>
4247       <entry></entry>
4248       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4249      </row>
4250
4251      <row>
4252       <entry><structfield>lomowner</structfield></entry>
4253       <entry><type>oid</type></entry>
4254       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4255       <entry>Owner of the large object</entry>
4256      </row>
4257
4258      <row>
4259       <entry><structfield>lomacl</structfield></entry>
4260       <entry><type>aclitem[]</type></entry>
4261       <entry></entry>
4262       <entry>
4263        Access privileges; see
4264        <xref linkend="sql-grant"> and
4265        <xref linkend="sql-revoke">
4266        for details
4267       </entry>
4268      </row>
4269
4270     </tbody>
4271    </tgroup>
4272   </table>
4273  </sect1>
4274
4275
4276  <sect1 id="catalog-pg-namespace">
4277   <title><structname>pg_namespace</structname></title>
4278
4279   <indexterm zone="catalog-pg-namespace">
4280    <primary>pg_namespace</primary>
4281   </indexterm>
4282
4283   <para>
4284    The catalog <structname>pg_namespace</> stores namespaces.
4285    A namespace is the structure underlying SQL schemas: each namespace
4286    can have a separate collection of relations, types, etc. without name
4287    conflicts.
4288   </para>
4289
4290   <table>
4291    <title><structname>pg_namespace</> Columns</title>
4292
4293    <tgroup cols="4">
4294     <thead>
4295      <row>
4296       <entry>Name</entry>
4297       <entry>Type</entry>
4298       <entry>References</entry>
4299       <entry>Description</entry>
4300      </row>
4301     </thead>
4302
4303     <tbody>
4304      <row>
4305       <entry><structfield>oid</structfield></entry>
4306       <entry><type>oid</type></entry>
4307       <entry></entry>
4308       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4309      </row>
4310
4311      <row>
4312       <entry><structfield>nspname</structfield></entry>
4313       <entry><type>name</type></entry>
4314       <entry></entry>
4315       <entry>Name of the namespace</entry>
4316      </row>
4317
4318      <row>
4319       <entry><structfield>nspowner</structfield></entry>
4320       <entry><type>oid</type></entry>
4321       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4322       <entry>Owner of the namespace</entry>
4323      </row>
4324
4325      <row>
4326       <entry><structfield>nspacl</structfield></entry>
4327       <entry><type>aclitem[]</type></entry>
4328       <entry></entry>
4329       <entry>
4330        Access privileges; see
4331        <xref linkend="sql-grant"> and
4332        <xref linkend="sql-revoke">
4333        for details
4334       </entry>
4335      </row>
4336     </tbody>
4337    </tgroup>
4338   </table>
4339
4340  </sect1>
4341
4342
4343  <sect1 id="catalog-pg-opclass">
4344   <title><structname>pg_opclass</structname></title>
4345
4346   <indexterm zone="catalog-pg-opclass">
4347    <primary>pg_opclass</primary>
4348   </indexterm>
4349
4350   <para>
4351    The catalog <structname>pg_opclass</structname> defines
4352    index access method operator classes.  Each operator class defines
4353    semantics for index columns of a particular data type and a particular
4354    index access method.  An operator class essentially specifies that a
4355    particular operator family is applicable to a particular indexable column
4356    data type.  The set of operators from the family that are actually usable
4357    with the indexed column are whichever ones accept the column's data type
4358    as their left-hand input.
4359   </para>
4360
4361   <para>
4362    Operator classes are described at length in <xref linkend="xindex">.
4363   </para>
4364
4365   <table>
4366    <title><structname>pg_opclass</> Columns</title>
4367
4368    <tgroup cols="4">
4369     <thead>
4370      <row>
4371       <entry>Name</entry>
4372       <entry>Type</entry>
4373       <entry>References</entry>
4374       <entry>Description</entry>
4375      </row>
4376     </thead>
4377     <tbody>
4378
4379      <row>
4380       <entry><structfield>oid</structfield></entry>
4381       <entry><type>oid</type></entry>
4382       <entry></entry>
4383       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4384      </row>
4385
4386      <row>
4387       <entry><structfield>opcmethod</structfield></entry>
4388       <entry><type>oid</type></entry>
4389       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4390       <entry>Index access method operator class is for</entry>
4391      </row>
4392
4393      <row>
4394       <entry><structfield>opcname</structfield></entry>
4395       <entry><type>name</type></entry>
4396       <entry></entry>
4397       <entry>Name of this operator class</entry>
4398      </row>
4399
4400      <row>
4401       <entry><structfield>opcnamespace</structfield></entry>
4402       <entry><type>oid</type></entry>
4403       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4404       <entry>Namespace of this operator class</entry>
4405      </row>
4406
4407      <row>
4408       <entry><structfield>opcowner</structfield></entry>
4409       <entry><type>oid</type></entry>
4410       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4411       <entry>Owner of the operator class</entry>
4412      </row>
4413
4414      <row>
4415       <entry><structfield>opcfamily</structfield></entry>
4416       <entry><type>oid</type></entry>
4417       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4418       <entry>Operator family containing the operator class</entry>
4419      </row>
4420
4421      <row>
4422       <entry><structfield>opcintype</structfield></entry>
4423       <entry><type>oid</type></entry>
4424       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4425       <entry>Data type that the operator class indexes</entry>
4426      </row>
4427
4428      <row>
4429       <entry><structfield>opcdefault</structfield></entry>
4430       <entry><type>bool</type></entry>
4431       <entry></entry>
4432       <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4433      </row>
4434
4435      <row>
4436       <entry><structfield>opckeytype</structfield></entry>
4437       <entry><type>oid</type></entry>
4438       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4439       <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4440      </row>
4441
4442     </tbody>
4443    </tgroup>
4444   </table>
4445
4446   <para>
4447    An operator class's <structfield>opcmethod</> must match the
4448    <structname>opfmethod</> of its containing operator family.
4449    Also, there must be no more than one <structname>pg_opclass</structname>
4450    row having <structname>opcdefault</> true for any given combination of
4451    <structname>opcmethod</> and <structname>opcintype</>.
4452   </para>
4453
4454  </sect1>
4455
4456
4457  <sect1 id="catalog-pg-operator">
4458   <title><structname>pg_operator</structname></title>
4459
4460   <indexterm zone="catalog-pg-operator">
4461    <primary>pg_operator</primary>
4462   </indexterm>
4463
4464   <para>
4465    The catalog <structname>pg_operator</> stores information about operators.
4466    See <xref linkend="sql-createoperator">
4467    and <xref linkend="xoper"> for more information.
4468   </para>
4469
4470   <table>
4471    <title><structname>pg_operator</> Columns</title>
4472
4473    <tgroup cols="4">
4474     <thead>
4475      <row>
4476       <entry>Name</entry>
4477       <entry>Type</entry>
4478       <entry>References</entry>
4479       <entry>Description</entry>
4480      </row>
4481     </thead>
4482
4483     <tbody>
4484      <row>
4485       <entry><structfield>oid</structfield></entry>
4486       <entry><type>oid</type></entry>
4487       <entry></entry>
4488       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4489      </row>
4490
4491      <row>
4492       <entry><structfield>oprname</structfield></entry>
4493       <entry><type>name</type></entry>
4494       <entry></entry>
4495       <entry>Name of the operator</entry>
4496      </row>
4497
4498      <row>
4499       <entry><structfield>oprnamespace</structfield></entry>
4500       <entry><type>oid</type></entry>
4501       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4502       <entry>
4503        The OID of the namespace that contains this operator
4504       </entry>
4505      </row>
4506
4507      <row>
4508       <entry><structfield>oprowner</structfield></entry>
4509       <entry><type>oid</type></entry>
4510       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4511       <entry>Owner of the operator</entry>
4512      </row>
4513
4514      <row>
4515       <entry><structfield>oprkind</structfield></entry>
4516       <entry><type>char</type></entry>
4517       <entry></entry>
4518       <entry>
4519        <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4520        (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4521       </entry>
4522      </row>
4523
4524      <row>
4525       <entry><structfield>oprcanmerge</structfield></entry>
4526       <entry><type>bool</type></entry>
4527       <entry></entry>
4528       <entry>This operator supports merge joins</entry>
4529      </row>
4530
4531      <row>
4532       <entry><structfield>oprcanhash</structfield></entry>
4533       <entry><type>bool</type></entry>
4534       <entry></entry>
4535       <entry>This operator supports hash joins</entry>
4536      </row>
4537
4538      <row>
4539       <entry><structfield>oprleft</structfield></entry>
4540       <entry><type>oid</type></entry>
4541       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4542       <entry>Type of the left operand</entry>
4543      </row>
4544
4545      <row>
4546       <entry><structfield>oprright</structfield></entry>
4547       <entry><type>oid</type></entry>
4548       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4549       <entry>Type of the right operand</entry>
4550      </row>
4551
4552      <row>
4553       <entry><structfield>oprresult</structfield></entry>
4554       <entry><type>oid</type></entry>
4555       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4556       <entry>Type of the result</entry>
4557      </row>
4558
4559      <row>
4560       <entry><structfield>oprcom</structfield></entry>
4561       <entry><type>oid</type></entry>
4562       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4563       <entry>Commutator of this operator, if any</entry>
4564      </row>
4565
4566      <row>
4567       <entry><structfield>oprnegate</structfield></entry>
4568       <entry><type>oid</type></entry>
4569       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4570       <entry>Negator of this operator, if any</entry>
4571      </row>
4572
4573      <row>
4574       <entry><structfield>oprcode</structfield></entry>
4575       <entry><type>regproc</type></entry>
4576       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4577       <entry>Function that implements this operator</entry>
4578      </row>
4579
4580      <row>
4581       <entry><structfield>oprrest</structfield></entry>
4582       <entry><type>regproc</type></entry>
4583       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4584       <entry>Restriction selectivity estimation function for this operator</entry>
4585      </row>
4586
4587      <row>
4588       <entry><structfield>oprjoin</structfield></entry>
4589       <entry><type>regproc</type></entry>
4590       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4591       <entry>Join selectivity estimation function for this operator</entry>
4592      </row>
4593     </tbody>
4594    </tgroup>
4595   </table>
4596
4597   <para>
4598    Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4599    is zero for a prefix operator.
4600   </para>
4601
4602  </sect1>
4603
4604
4605  <sect1 id="catalog-pg-opfamily">
4606   <title><structname>pg_opfamily</structname></title>
4607
4608   <indexterm zone="catalog-pg-opfamily">
4609    <primary>pg_opfamily</primary>
4610   </indexterm>
4611
4612   <para>
4613    The catalog <structname>pg_opfamily</structname> defines operator families.
4614    Each operator family is a collection of operators and associated
4615    support routines that implement the semantics specified for a particular
4616    index access method.  Furthermore, the operators in a family are all
4617    <quote>compatible</>, in a way that is specified by the access method.
4618    The operator family concept allows cross-data-type operators to be used
4619    with indexes and to be reasoned about using knowledge of access method
4620    semantics.
4621   </para>
4622
4623   <para>
4624    Operator families are described at length in <xref linkend="xindex">.
4625   </para>
4626
4627   <table>
4628    <title><structname>pg_opfamily</> Columns</title>
4629
4630    <tgroup cols="4">
4631     <thead>
4632      <row>
4633       <entry>Name</entry>
4634       <entry>Type</entry>
4635       <entry>References</entry>
4636       <entry>Description</entry>
4637      </row>
4638     </thead>
4639     <tbody>
4640
4641      <row>
4642       <entry><structfield>oid</structfield></entry>
4643       <entry><type>oid</type></entry>
4644       <entry></entry>
4645       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4646      </row>
4647
4648      <row>
4649       <entry><structfield>opfmethod</structfield></entry>
4650       <entry><type>oid</type></entry>
4651       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4652       <entry>Index access method operator family is for</entry>
4653      </row>
4654
4655      <row>
4656       <entry><structfield>opfname</structfield></entry>
4657       <entry><type>name</type></entry>
4658       <entry></entry>
4659       <entry>Name of this operator family</entry>
4660      </row>
4661
4662      <row>
4663       <entry><structfield>opfnamespace</structfield></entry>
4664       <entry><type>oid</type></entry>
4665       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4666       <entry>Namespace of this operator family</entry>
4667      </row>
4668
4669      <row>
4670       <entry><structfield>opfowner</structfield></entry>
4671       <entry><type>oid</type></entry>
4672       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4673       <entry>Owner of the operator family</entry>
4674      </row>
4675
4676     </tbody>
4677    </tgroup>
4678   </table>
4679
4680   <para>
4681    The majority of the information defining an operator family is not in its
4682    <structname>pg_opfamily</structname> row, but in the associated rows in
4683    <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4684    <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4685    and
4686    <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4687   </para>
4688
4689  </sect1>
4690
4691
4692  <sect1 id="catalog-pg-partitioned-table">
4693   <title><structname>pg_partitioned_table</structname></title>
4694
4695   <indexterm zone="catalog-pg-partitioned-table">
4696    <primary>pg_partitioned_table</primary>
4697   </indexterm>
4698
4699   <para>
4700    The catalog <structname>pg_partitioned_table</structname> stores
4701    information about how tables are partitioned.
4702   </para>
4703
4704   <table>
4705    <title><structname>pg_partitioned_table</> Columns</title>
4706
4707    <tgroup cols="4">
4708     <thead>
4709      <row>
4710       <entry>Name</entry>
4711       <entry>Type</entry>
4712       <entry>References</entry>
4713       <entry>Description</entry>
4714      </row>
4715     </thead>
4716
4717     <tbody>
4718
4719      <row>
4720       <entry><structfield>partrelid</structfield></entry>
4721       <entry><type>oid</type></entry>
4722       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4723       <entry>The OID of the <structname>pg_class</> entry for this partitioned table</entry>
4724      </row>
4725
4726      <row>
4727       <entry><structfield>partstrat</structfield></entry>
4728       <entry><type>char</type></entry>
4729       <entry></entry>
4730       <entry>
4731        Partitioning strategy; <literal>l</> = list partitioned table,
4732        <literal>r</> = range partitioned table
4733       </entry>
4734      </row>
4735
4736      <row>
4737       <entry><structfield>partnatts</structfield></entry>
4738       <entry><type>int2</type></entry>
4739       <entry></entry>
4740       <entry>The number of columns in partition key</entry>
4741      </row>
4742
4743      <row>
4744       <entry><structfield>partattrs</structfield></entry>
4745       <entry><type>int2vector</type></entry>
4746       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4747       <entry>
4748        This is an array of <structfield>partnatts</structfield> values that
4749        indicate which table columns are part of the partition key.  For
4750        example, a value of <literal>1 3</literal> would mean that the first
4751        and the third table columns make up the partition key.  A zero in this
4752        array indicates that the corresponding partition key column is an
4753        expression, rather than a simple column reference.
4754       </entry>
4755      </row>
4756
4757      <row>
4758       <entry><structfield>partclass</structfield></entry>
4759       <entry><type>oidvector</type></entry>
4760       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4761       <entry>
4762        For each column in the partition key, this contains the OID of the
4763        operator class to use.  See
4764        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4765       </entry>
4766      </row>
4767
4768      <row>
4769       <entry><structfield>partcollation</structfield></entry>
4770       <entry><type>oidvector</type></entry>
4771       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4772       <entry>
4773        For each column in the partition key, this contains the OID of the
4774        collation to use for partitioning, or zero if the column is not
4775        of a collatable data type.
4776       </entry>
4777      </row>
4778
4779      <row>
4780       <entry><structfield>partexprs</structfield></entry>
4781       <entry><type>pg_node_tree</type></entry>
4782       <entry></entry>
4783       <entry>
4784        Expression trees (in <function>nodeToString()</function>
4785        representation) for partition key columns that are not simple column
4786        references.  This is a list with one element for each zero
4787        entry in <structfield>partattrs</>.  Null if all partition key columns
4788        are simple references.
4789       </entry>
4790      </row>
4791
4792     </tbody>
4793    </tgroup>
4794   </table>
4795  </sect1>
4796
4797
4798  <sect1 id="catalog-pg-pltemplate">
4799   <title><structname>pg_pltemplate</structname></title>
4800
4801   <indexterm zone="catalog-pg-pltemplate">
4802    <primary>pg_pltemplate</primary>
4803   </indexterm>
4804
4805   <para>
4806    The catalog <structname>pg_pltemplate</structname> stores
4807    <quote>template</> information for procedural languages.
4808    A template for a language allows the language to be created in a
4809    particular database by a simple <command>CREATE LANGUAGE</> command,
4810    with no need to specify implementation details.
4811   </para>
4812
4813   <para>
4814    Unlike most system catalogs, <structname>pg_pltemplate</structname>
4815    is shared across all databases of a cluster: there is only one
4816    copy of <structname>pg_pltemplate</structname> per cluster, not
4817    one per database.  This allows the information to be accessible in
4818    each database as it is needed.
4819   </para>
4820
4821   <table>
4822    <title><structname>pg_pltemplate</> Columns</title>
4823
4824    <tgroup cols="3">
4825     <thead>
4826      <row>
4827       <entry>Name</entry>
4828       <entry>Type</entry>
4829       <entry>Description</entry>
4830      </row>
4831     </thead>
4832
4833     <tbody>
4834      <row>
4835       <entry><structfield>tmplname</structfield></entry>
4836       <entry><type>name</type></entry>
4837       <entry>Name of the language this template is for</entry>
4838      </row>
4839
4840      <row>
4841       <entry><structfield>tmpltrusted</structfield></entry>
4842       <entry><type>boolean</type></entry>
4843       <entry>True if language is considered trusted</entry>
4844      </row>
4845
4846      <row>
4847       <entry><structfield>tmpldbacreate</structfield></entry>
4848       <entry><type>boolean</type></entry>
4849       <entry>True if language may be created by a database owner</entry>
4850      </row>
4851
4852      <row>
4853       <entry><structfield>tmplhandler</structfield></entry>
4854       <entry><type>text</type></entry>
4855       <entry>Name of call handler function</entry>
4856      </row>
4857
4858      <row>
4859       <entry><structfield>tmplinline</structfield></entry>
4860       <entry><type>text</type></entry>
4861       <entry>Name of anonymous-block handler function, or null if none</entry>
4862      </row>
4863
4864      <row>
4865       <entry><structfield>tmplvalidator</structfield></entry>
4866       <entry><type>text</type></entry>
4867       <entry>Name of validator function, or null if none</entry>
4868      </row>
4869
4870      <row>
4871       <entry><structfield>tmpllibrary</structfield></entry>
4872       <entry><type>text</type></entry>
4873       <entry>Path of shared library that implements language</entry>
4874      </row>
4875
4876      <row>
4877       <entry><structfield>tmplacl</structfield></entry>
4878       <entry><type>aclitem[]</type></entry>
4879       <entry>Access privileges for template (not actually used)</entry>
4880      </row>
4881
4882     </tbody>
4883    </tgroup>
4884   </table>
4885
4886   <para>
4887    There are not currently any commands that manipulate procedural language
4888    templates; to change the built-in information, a superuser must modify
4889    the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4890    or <command>UPDATE</command> commands.
4891   </para>
4892
4893   <note>
4894    <para>
4895     It is likely that <structname>pg_pltemplate</> will be removed in some
4896     future release of <productname>PostgreSQL</productname>, in favor of
4897     keeping this knowledge about procedural languages in their respective
4898     extension installation scripts.
4899    </para>
4900   </note>
4901
4902  </sect1>
4903
4904
4905  <sect1 id="catalog-pg-policy">
4906   <title><structname>pg_policy</structname></title>
4907
4908   <indexterm zone="catalog-pg-policy">
4909    <primary>pg_policy</primary>
4910   </indexterm>
4911
4912   <para>
4913    The catalog <structname>pg_policy</structname> stores row level
4914    security policies for tables.  A policy includes the kind of
4915    command that it applies to (possibly all commands), the roles that it
4916    applies to, the expression to be added as a security-barrier
4917    qualification to queries that include the table, and the expression
4918    to be added as a <literal>WITH CHECK</> option for queries that attempt to
4919    add new records to the table.
4920   </para>
4921
4922   <table>
4923
4924    <title><structname>pg_policy</structname> Columns</title>
4925
4926    <tgroup cols="4">
4927     <thead>
4928      <row>
4929       <entry>Name</entry>
4930       <entry>Type</entry>
4931       <entry>References</entry>
4932       <entry>Description</entry>
4933      </row>
4934     </thead>
4935
4936     <tbody>
4937      <row>
4938       <entry><structfield>polname</structfield></entry>
4939       <entry><type>name</type></entry>
4940       <entry></entry>
4941       <entry>The name of the policy</entry>
4942      </row>
4943
4944      <row>
4945       <entry><structfield>polrelid</structfield></entry>
4946       <entry><type>oid</type></entry>
4947       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4948       <entry>The table to which the policy applies</entry>
4949      </row>
4950
4951      <row>
4952       <entry><structfield>polcmd</structfield></entry>
4953       <entry><type>char</type></entry>
4954       <entry></entry>
4955       <entry>The command type to which the policy is applied:
4956        <literal>r</> for <command>SELECT</>,
4957        <literal>a</> for <command>INSERT</>,
4958        <literal>w</> for <command>UPDATE</>,
4959        <literal>d</> for <command>DELETE</>,
4960        or <literal>*</> for all</entry>
4961      </row>
4962
4963      <row>
4964       <entry><structfield>polpermissive</structfield></entry>
4965       <entry><type>boolean</type></entry>
4966       <entry></entry>
4967       <entry>Is the policy permissive or restrictive?</entry>
4968      </row>
4969
4970      <row>
4971       <entry><structfield>polroles</structfield></entry>
4972       <entry><type>oid[]</type></entry>
4973       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4974       <entry>The roles to which the policy is applied</entry>
4975      </row>
4976
4977      <row>
4978       <entry><structfield>polqual</structfield></entry>
4979       <entry><type>pg_node_tree</type></entry>
4980       <entry></entry>
4981       <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4982      </row>
4983
4984      <row>
4985       <entry><structfield>polwithcheck</structfield></entry>
4986       <entry><type>pg_node_tree</type></entry>
4987       <entry></entry>
4988       <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4989      </row>
4990
4991     </tbody>
4992    </tgroup>
4993   </table>
4994
4995   <note>
4996    <para>
4997     Policies stored in <structname>pg_policy</> are applied only when
4998     <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4999     their table.
5000    </para>
5001   </note>
5002
5003  </sect1>
5004
5005  <sect1 id="catalog-pg-proc">
5006   <title><structname>pg_proc</structname></title>
5007
5008   <indexterm zone="catalog-pg-proc">
5009    <primary>pg_proc</primary>
5010   </indexterm>
5011
5012   <para>
5013    The catalog <structname>pg_proc</> stores information about functions (or procedures).
5014    See <xref linkend="sql-createfunction">
5015    and <xref linkend="xfunc"> for more information.
5016   </para>
5017
5018   <para>
5019    The table contains data for aggregate functions as well as plain functions.
5020    If <structfield>proisagg</structfield> is true, there should be a matching
5021    row in <structfield>pg_aggregate</structfield>.
5022   </para>
5023
5024   <table>
5025    <title><structname>pg_proc</> Columns</title>
5026
5027    <tgroup cols="4">
5028     <thead>
5029      <row>
5030       <entry>Name</entry>
5031       <entry>Type</entry>
5032       <entry>References</entry>
5033       <entry>Description</entry>
5034      </row>
5035     </thead>
5036
5037     <tbody>
5038      <row>
5039       <entry><structfield>oid</structfield></entry>
5040       <entry><type>oid</type></entry>
5041       <entry></entry>
5042       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5043      </row>
5044
5045      <row>
5046       <entry><structfield>proname</structfield></entry>
5047       <entry><type>name</type></entry>
5048       <entry></entry>
5049       <entry>Name of the function</entry>
5050      </row>
5051
5052      <row>
5053       <entry><structfield>pronamespace</structfield></entry>
5054       <entry><type>oid</type></entry>
5055       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5056       <entry>
5057        The OID of the namespace that contains this function
5058       </entry>
5059      </row>
5060
5061      <row>
5062       <entry><structfield>proowner</structfield></entry>
5063       <entry><type>oid</type></entry>
5064       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5065       <entry>Owner of the function</entry>
5066      </row>
5067
5068      <row>
5069       <entry><structfield>prolang</structfield></entry>
5070       <entry><type>oid</type></entry>
5071       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
5072       <entry>Implementation language or call interface of this function</entry>
5073      </row>
5074
5075      <row>
5076       <entry><structfield>procost</structfield></entry>
5077       <entry><type>float4</type></entry>
5078       <entry></entry>
5079       <entry>Estimated execution cost (in units of
5080        <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
5081        this is cost per row returned</entry>
5082      </row>
5083
5084      <row>
5085       <entry><structfield>prorows</structfield></entry>
5086       <entry><type>float4</type></entry>
5087       <entry></entry>
5088       <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
5089      </row>
5090
5091      <row>
5092       <entry><structfield>provariadic</structfield></entry>
5093       <entry><type>oid</type></entry>
5094       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5095       <entry>Data type of the variadic array parameter's elements,
5096        or zero if the function does not have a variadic parameter</entry>
5097      </row>
5098
5099      <row>
5100       <entry><structfield>protransform</structfield></entry>
5101       <entry><type>regproc</type></entry>
5102       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5103       <entry>Calls to this function can be simplified by this other function
5104        (see <xref linkend="xfunc-transform-functions">)</entry>
5105      </row>
5106
5107      <row>
5108       <entry><structfield>proisagg</structfield></entry>
5109       <entry><type>bool</type></entry>
5110       <entry></entry>
5111       <entry>Function is an aggregate function</entry>
5112      </row>
5113
5114      <row>
5115       <entry><structfield>proiswindow</structfield></entry>
5116       <entry><type>bool</type></entry>
5117       <entry></entry>
5118       <entry>Function is a window function</entry>
5119      </row>
5120
5121      <row>
5122       <entry><structfield>prosecdef</structfield></entry>
5123       <entry><type>bool</type></entry>
5124       <entry></entry>
5125       <entry>Function is a security definer (i.e., a <quote>setuid</>
5126       function)</entry>
5127      </row>
5128
5129      <row>
5130       <entry><structfield>proleakproof</structfield></entry>
5131       <entry><type>bool</type></entry>
5132       <entry></entry>
5133       <entry>
5134        The function has no side effects.  No information about the
5135        arguments is conveyed except via the return value.  Any function
5136        that might throw an error depending on the values of its arguments
5137        is not leak-proof.
5138       </entry>
5139      </row>
5140
5141      <row>
5142       <entry><structfield>proisstrict</structfield></entry>
5143       <entry><type>bool</type></entry>
5144       <entry></entry>
5145       <entry>
5146        Function returns null if any call argument is null.  In that
5147        case the function won't actually be called at all.  Functions
5148        that are not <quote>strict</quote> must be prepared to handle
5149        null inputs.
5150       </entry>
5151      </row>
5152
5153      <row>
5154       <entry><structfield>proretset</structfield></entry>
5155       <entry><type>bool</type></entry>
5156       <entry></entry>
5157       <entry>Function returns a set (i.e., multiple values of the specified
5158       data type)</entry>
5159      </row>
5160
5161      <row>
5162       <entry><structfield>provolatile</structfield></entry>
5163       <entry><type>char</type></entry>
5164       <entry></entry>
5165       <entry>
5166        <structfield>provolatile</structfield> tells whether the function's
5167        result depends only on its input arguments, or is affected by outside
5168        factors.
5169        It is <literal>i</literal> for <quote>immutable</> functions,
5170        which always deliver the same result for the same inputs.
5171        It is <literal>s</literal> for <quote>stable</> functions,
5172        whose results (for fixed inputs) do not change within a scan.
5173        It is <literal>v</literal> for <quote>volatile</> functions,
5174        whose results might change at any time.  (Use <literal>v</literal> also
5175        for functions with side-effects, so that calls to them cannot get
5176        optimized away.)
5177       </entry>
5178      </row>
5179
5180      <row>
5181       <entry><structfield>proparallel</structfield></entry>
5182       <entry><type>char</type></entry>
5183       <entry></entry>
5184       <entry>
5185        <structfield>proparallel</structfield> tells whether the function
5186        can be safely run in parallel mode.
5187        It is <literal>s</literal> for functions which are safe to run in
5188        parallel mode without restriction.
5189        It is <literal>r</literal> for functions which can be run in parallel
5190        mode, but their execution is restricted to the parallel group leader;
5191        parallel worker processes cannot invoke these functions.
5192        It is <literal>u</literal> for functions which are unsafe in parallel
5193        mode; the presence of such a function forces a serial execution plan.
5194       </entry>
5195      </row>
5196
5197      <row>
5198       <entry><structfield>pronargs</structfield></entry>
5199       <entry><type>int2</type></entry>
5200       <entry></entry>
5201       <entry>Number of input arguments</entry>
5202      </row>
5203
5204      <row>
5205       <entry><structfield>pronargdefaults</structfield></entry>
5206       <entry><type>int2</type></entry>
5207       <entry></entry>
5208       <entry>Number of arguments that have defaults</entry>
5209      </row>
5210
5211      <row>
5212       <entry><structfield>prorettype</structfield></entry>
5213       <entry><type>oid</type></entry>
5214       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5215       <entry>Data type of the return value</entry>
5216      </row>
5217
5218      <row>
5219       <entry><structfield>proargtypes</structfield></entry>
5220       <entry><type>oidvector</type></entry>
5221       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5222       <entry>
5223        An array with the data types of the function arguments.  This includes
5224        only input arguments (including <literal>INOUT</literal> and
5225        <literal>VARIADIC</> arguments), and thus represents
5226        the call signature of the function.
5227       </entry>
5228      </row>
5229
5230      <row>
5231       <entry><structfield>proallargtypes</structfield></entry>
5232       <entry><type>oid[]</type></entry>
5233       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5234       <entry>
5235        An array with the data types of the function arguments.  This includes
5236        all arguments (including <literal>OUT</literal> and
5237        <literal>INOUT</literal> arguments); however, if all the
5238        arguments are <literal>IN</literal> arguments, this field will be null.
5239        Note that subscripting is 1-based, whereas for historical reasons
5240        <structfield>proargtypes</> is subscripted from 0.
5241       </entry>
5242      </row>
5243
5244      <row>
5245       <entry><structfield>proargmodes</structfield></entry>
5246       <entry><type>char[]</type></entry>
5247       <entry></entry>
5248       <entry>
5249         An array with the modes of the function arguments, encoded as
5250         <literal>i</literal> for <literal>IN</> arguments,
5251         <literal>o</literal> for <literal>OUT</> arguments,
5252         <literal>b</literal> for <literal>INOUT</> arguments,
5253         <literal>v</literal> for <literal>VARIADIC</> arguments,
5254         <literal>t</literal> for <literal>TABLE</> arguments.
5255         If all the arguments are <literal>IN</literal> arguments,
5256         this field will be null.
5257         Note that subscripts correspond to positions of
5258         <structfield>proallargtypes</> not <structfield>proargtypes</>.
5259       </entry>
5260      </row>
5261
5262      <row>
5263       <entry><structfield>proargnames</structfield></entry>
5264       <entry><type>text[]</type></entry>
5265       <entry></entry>
5266       <entry>
5267         An array with the names of the function arguments.
5268         Arguments without a name are set to empty strings in the array.
5269         If none of the arguments have a name, this field will be null.
5270         Note that subscripts correspond to positions of
5271         <structfield>proallargtypes</> not <structfield>proargtypes</>.
5272       </entry>
5273      </row>
5274
5275      <row>
5276       <entry><structfield>proargdefaults</structfield></entry>
5277       <entry><type>pg_node_tree</type></entry>
5278       <entry></entry>
5279       <entry>
5280        Expression trees (in <function>nodeToString()</function> representation)
5281        for default values.  This is a list with
5282        <structfield>pronargdefaults</> elements, corresponding to the last
5283        <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5284        <replaceable>N</> <structfield>proargtypes</> positions).
5285        If none of the arguments have defaults, this field will be null.
5286       </entry>
5287      </row>
5288
5289      <row>
5290       <entry><structfield>protrftypes</structfield></entry>
5291       <entry><type>oid[]</type></entry>
5292       <entry></entry>
5293       <entry>
5294        Data type OIDs for which to apply transforms.
5295       </entry>
5296      </row>
5297
5298      <row>
5299       <entry><structfield>prosrc</structfield></entry>
5300       <entry><type>text</type></entry>
5301       <entry></entry>
5302       <entry>
5303        This tells the function handler how to invoke the function.  It
5304        might be the actual source code of the function for interpreted
5305        languages, a link symbol, a file name, or just about anything
5306        else, depending on the implementation language/call convention.
5307       </entry>
5308      </row>
5309
5310      <row>
5311       <entry><structfield>probin</structfield></entry>
5312       <entry><type>text</type></entry>
5313       <entry></entry>
5314       <entry>
5315        Additional information about how to invoke the function.
5316        Again, the interpretation is language-specific.
5317       </entry>
5318      </row>
5319
5320      <row>
5321       <entry><structfield>proconfig</structfield></entry>
5322       <entry><type>text[]</type></entry>
5323       <entry></entry>
5324       <entry>Function's local settings for run-time configuration variables</entry>
5325      </row>
5326
5327      <row>
5328       <entry><structfield>proacl</structfield></entry>
5329       <entry><type>aclitem[]</type></entry>
5330       <entry></entry>
5331       <entry>
5332        Access privileges; see
5333        <xref linkend="sql-grant"> and
5334        <xref linkend="sql-revoke">
5335        for details
5336       </entry>
5337      </row>
5338     </tbody>
5339    </tgroup>
5340   </table>
5341
5342   <para>
5343    For compiled functions, both built-in and dynamically loaded,
5344    <structfield>prosrc</structfield> contains the function's C-language
5345    name (link symbol).  For all other currently-known language types,
5346    <structfield>prosrc</structfield> contains the function's source
5347    text.  <structfield>probin</structfield> is unused except for
5348    dynamically-loaded C functions, for which it gives the name of the
5349    shared library file containing the function.
5350   </para>
5351
5352  </sect1>
5353
5354  <sect1 id="catalog-pg-publication">
5355   <title><structname>pg_publication</structname></title>
5356
5357   <indexterm zone="catalog-pg-publication">
5358    <primary>pg_publication</primary>
5359   </indexterm>
5360
5361   <para>
5362    The catalog <structname>pg_publication</structname> contains all
5363    publications created in the database.  For more on publications see
5364    <xref linkend="logical-replication-publication">.
5365   </para>
5366
5367   <table>
5368    <title><structname>pg_publication</structname> Columns</title>
5369
5370    <tgroup cols="4">
5371     <thead>
5372      <row>
5373       <entry>Name</entry>
5374       <entry>Type</entry>
5375       <entry>References</entry>
5376       <entry>Description</entry>
5377      </row>
5378     </thead>
5379
5380     <tbody>
5381      <row>
5382       <entry><structfield>oid</structfield></entry>
5383       <entry><type>oid</type></entry>
5384       <entry></entry>
5385       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5386      </row>
5387
5388      <row>
5389       <entry><structfield>pubname</structfield></entry>
5390       <entry><type>Name</type></entry>
5391       <entry></entry>
5392       <entry>Name of the publication</entry>
5393      </row>
5394
5395      <row>
5396       <entry><structfield>pubowner</structfield></entry>
5397       <entry><type>oid</type></entry>
5398       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5399       <entry>Owner of the publication</entry>
5400      </row>
5401
5402      <row>
5403       <entry><structfield>puballtables</structfield></entry>
5404       <entry><type>bool</type></entry>
5405       <entry></entry>
5406       <entry>If true, this publication automatically includes all tables
5407        in the database, including any that will be created in the future.
5408       </entry>
5409      </row>
5410
5411      <row>
5412       <entry><structfield>pubinsert</structfield></entry>
5413       <entry><type>bool</type></entry>
5414       <entry></entry>
5415       <entry>If true, <command>INSERT</command> operations are replicated for
5416        tables in the publication.</entry>
5417      </row>
5418
5419      <row>
5420       <entry><structfield>pubupdate</structfield></entry>
5421       <entry><type>bool</type></entry>
5422       <entry></entry>
5423       <entry>If true, <command>UPDATE</command> operations are replicated for
5424        tables in the publication.</entry>
5425      </row>
5426
5427      <row>
5428       <entry><structfield>pubdelete</structfield></entry>
5429       <entry><type>bool</type></entry>
5430       <entry></entry>
5431       <entry>If true, <command>DELETE</command> operations are replicated for
5432        tables in the publication.</entry>
5433      </row>
5434     </tbody>
5435    </tgroup>
5436   </table>
5437  </sect1>
5438
5439  <sect1 id="catalog-pg-publication-rel">
5440   <title><structname>pg_publication_rel</structname></title>
5441
5442   <indexterm zone="catalog-pg-publication-rel">
5443    <primary>pg_publication_rel</primary>
5444   </indexterm>
5445
5446   <para>
5447    The catalog <structname>pg_publication_rel</structname> contains the
5448    mapping between relations and publications in the database.  This is a
5449    many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
5450    for a more user-friendly view of this information.
5451   </para>
5452
5453   <table>
5454    <title><structname>pg_publication_rel</structname> Columns</title>
5455
5456    <tgroup cols="4">
5457     <thead>
5458      <row>
5459       <entry>Name</entry>
5460       <entry>Type</entry>
5461       <entry>References</entry>
5462       <entry>Description</entry>
5463      </row>
5464     </thead>
5465
5466     <tbody>
5467      <row>
5468       <entry><structfield>prpubid</structfield></entry>
5469       <entry><type>oid</type></entry>
5470       <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
5471       <entry>Reference to publication</entry>
5472      </row>
5473
5474      <row>
5475       <entry><structfield>prrelid</structfield></entry>
5476       <entry><type>oid</type></entry>
5477       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5478       <entry>Reference to relation</entry>
5479      </row>
5480     </tbody>
5481    </tgroup>
5482   </table>
5483  </sect1>
5484
5485  <sect1 id="catalog-pg-range">
5486   <title><structname>pg_range</structname></title>
5487
5488   <indexterm zone="catalog-pg-range">
5489    <primary>pg_range</primary>
5490   </indexterm>
5491
5492   <para>
5493    The catalog <structname>pg_range</structname> stores information about
5494    range types.  This is in addition to the types' entries in
5495    <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5496   </para>
5497
5498   <table>
5499    <title><structname>pg_range</> Columns</title>
5500
5501    <tgroup cols="4">
5502     <thead>
5503      <row>
5504       <entry>Name</entry>
5505       <entry>Type</entry>
5506       <entry>References</entry>
5507       <entry>Description</entry>
5508      </row>
5509     </thead>
5510
5511     <tbody>
5512      <row>
5513       <entry><structfield>rngtypid</structfield></entry>
5514       <entry><type>oid</type></entry>
5515       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5516       <entry>OID of the range type</entry>
5517      </row>
5518
5519      <row>
5520       <entry><structfield>rngsubtype</structfield></entry>
5521       <entry><type>oid</type></entry>
5522       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5523       <entry>OID of the element type (subtype) of this range type</entry>
5524      </row>
5525
5526      <row>
5527       <entry><structfield>rngcollation</structfield></entry>
5528       <entry><type>oid</type></entry>
5529       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5530       <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5531      </row>
5532
5533      <row>
5534       <entry><structfield>rngsubopc</structfield></entry>
5535       <entry><type>oid</type></entry>
5536       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5537       <entry>OID of the subtype's operator class used for range comparisons</entry>
5538      </row>
5539
5540      <row>
5541       <entry><structfield>rngcanonical</structfield></entry>
5542       <entry><type>regproc</type></entry>
5543       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5544       <entry>OID of the function to convert a range value into canonical form,
5545       or 0 if none</entry>
5546      </row>
5547
5548      <row>
5549       <entry><structfield>rngsubdiff</structfield></entry>
5550       <entry><type>regproc</type></entry>
5551       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5552       <entry>OID of the function to return the difference between two element
5553       values as <type>double precision</type>, or 0 if none</entry>
5554      </row>
5555     </tbody>
5556    </tgroup>
5557   </table>
5558
5559   <para>
5560    <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5561    element type is collatable) determines the sort ordering used by the range
5562    type.  <structfield>rngcanonical</> is used when the element type is
5563    discrete.  <structfield>rngsubdiff</> is optional but should be supplied to
5564    improve performance of GiST indexes on the range type.
5565   </para>
5566
5567  </sect1>
5568
5569  <sect1 id="catalog-pg-replication-origin">
5570   <title><structname>pg_replication_origin</structname></title>
5571
5572   <indexterm zone="catalog-pg-replication-origin">
5573    <primary>pg_replication_origin</primary>
5574   </indexterm>
5575
5576   <para>
5577    The <structname>pg_replication_origin</structname> catalog contains
5578    all replication origins created.  For more on replication origins
5579    see <xref linkend="replication-origins">.
5580   </para>
5581
5582   <table>
5583
5584    <title><structname>pg_replication_origin</structname> Columns</title>
5585
5586    <tgroup cols="4">
5587     <thead>
5588      <row>
5589       <entry>Name</entry>
5590       <entry>Type</entry>
5591       <entry>References</entry>
5592       <entry>Description</entry>
5593      </row>
5594     </thead>
5595
5596     <tbody>
5597      <row>
5598       <entry><structfield>roident</structfield></entry>
5599       <entry><type>Oid</type></entry>
5600       <entry></entry>
5601       <entry>A unique, cluster-wide identifier for the replication
5602       origin. Should never leave the system.</entry>
5603      </row>
5604
5605      <row>
5606       <entry><structfield>roname</structfield></entry>
5607       <entry><type>text</type></entry>
5608       <entry></entry>
5609       <entry>The external, user defined, name of a replication
5610       origin.</entry>
5611      </row>
5612     </tbody>
5613    </tgroup>
5614   </table>
5615  </sect1>
5616
5617  <sect1 id="catalog-pg-rewrite">
5618   <title><structname>pg_rewrite</structname></title>
5619
5620   <indexterm zone="catalog-pg-rewrite">
5621    <primary>pg_rewrite</primary>
5622   </indexterm>
5623
5624   <para>
5625    The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5626   </para>
5627
5628   <table>
5629    <title><structname>pg_rewrite</> Columns</title>
5630
5631    <tgroup cols="4">
5632     <thead>
5633      <row>
5634       <entry>Name</entry>
5635       <entry>Type</entry>
5636       <entry>References</entry>
5637       <entry>Description</entry>
5638      </row>
5639     </thead>
5640
5641     <tbody>
5642      <row>
5643       <entry><structfield>oid</structfield></entry>
5644       <entry><type>oid</type></entry>
5645       <entry></entry>
5646       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5647      </row>
5648
5649      <row>
5650       <entry><structfield>rulename</structfield></entry>
5651       <entry><type>name</type></entry>
5652       <entry></entry>
5653       <entry>Rule name</entry>
5654      </row>
5655
5656      <row>
5657       <entry><structfield>ev_class</structfield></entry>
5658       <entry><type>oid</type></entry>
5659       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5660       <entry>The table this rule is for</entry>
5661      </row>
5662
5663      <row>
5664       <entry><structfield>ev_type</structfield></entry>
5665       <entry><type>char</type></entry>
5666       <entry></entry>
5667       <entry>
5668        Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5669        <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5670        <command>DELETE</>
5671       </entry>
5672      </row>
5673
5674      <row>
5675       <entry><structfield>ev_enabled</structfield></entry>
5676       <entry><type>char</type></entry>
5677       <entry></entry>
5678       <entry>
5679        Controls in which <xref linkend="guc-session-replication-role"> modes
5680        the rule fires.
5681        <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5682        <literal>D</> = rule is disabled,
5683        <literal>R</> = rule fires in <quote>replica</> mode,
5684        <literal>A</> = rule fires always.
5685       </entry>
5686      </row>
5687
5688      <row>
5689       <entry><structfield>is_instead</structfield></entry>
5690       <entry><type>bool</type></entry>
5691       <entry></entry>
5692       <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5693      </row>
5694
5695      <row>
5696       <entry><structfield>ev_qual</structfield></entry>
5697       <entry><type>pg_node_tree</type></entry>
5698       <entry></entry>
5699       <entry>
5700        Expression tree (in the form of a
5701        <function>nodeToString()</function> representation) for the
5702        rule's qualifying condition
5703       </entry>
5704      </row>
5705
5706      <row>
5707       <entry><structfield>ev_action</structfield></entry>
5708       <entry><type>pg_node_tree</type></entry>
5709       <entry></entry>
5710       <entry>
5711        Query tree (in the form of a
5712        <function>nodeToString()</function> representation) for the
5713        rule's action
5714       </entry>
5715      </row>
5716     </tbody>
5717    </tgroup>
5718   </table>
5719
5720   <note>
5721    <para>
5722     <literal>pg_class.relhasrules</literal>
5723     must be true if a table has any rules in this catalog.
5724    </para>
5725   </note>
5726
5727  </sect1>
5728
5729  <sect1 id="catalog-pg-seclabel">
5730   <title><structname>pg_seclabel</structname></title>
5731
5732   <indexterm zone="catalog-pg-seclabel">
5733    <primary>pg_seclabel</primary>
5734   </indexterm>
5735
5736   <para>
5737    The catalog <structname>pg_seclabel</structname> stores security
5738    labels on database objects.  Security labels can be manipulated
5739    with the <xref linkend="sql-security-label"> command.  For an easier
5740    way to view security labels, see <xref linkend="view-pg-seclabels">.
5741   </para>
5742
5743   <para>
5744    See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5745    which performs a similar function for security labels of database objects
5746    that are shared across a database cluster.
5747   </para>
5748
5749   <table>
5750    <title><structname>pg_seclabel</structname> Columns</title>
5751
5752    <tgroup cols="4">
5753     <thead>
5754      <row>
5755       <entry>Name</entry>
5756       <entry>Type</entry>
5757       <entry>References</entry>
5758       <entry>Description</entry>
5759      </row>
5760     </thead>
5761
5762     <tbody>
5763      <row>
5764       <entry><structfield>objoid</structfield></entry>
5765       <entry><type>oid</type></entry>
5766       <entry>any OID column</entry>
5767       <entry>The OID of the object this security label pertains to</entry>
5768      </row>
5769
5770      <row>
5771       <entry><structfield>classoid</structfield></entry>
5772       <entry><type>oid</type></entry>
5773       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5774       <entry>The OID of the system catalog this object appears in</entry>
5775      </row>
5776
5777      <row>
5778       <entry><structfield>objsubid</structfield></entry>
5779       <entry><type>int4</type></entry>
5780       <entry></entry>
5781       <entry>
5782        For a security label on a table column, this is the column number (the
5783        <structfield>objoid</> and <structfield>classoid</> refer to
5784        the table itself).  For all other object types, this column is
5785        zero.
5786       </entry>
5787      </row>
5788
5789      <row>
5790       <entry><structfield>provider</structfield></entry>
5791       <entry><type>text</type></entry>
5792       <entry></entry>
5793       <entry>The label provider associated with this label.</entry>
5794      </row>
5795
5796      <row>
5797       <entry><structfield>label</structfield></entry>
5798       <entry><type>text</type></entry>
5799       <entry></entry>
5800       <entry>The security label applied to this object.</entry>
5801      </row>
5802     </tbody>
5803    </tgroup>
5804   </table>
5805  </sect1>
5806
5807  <sect1 id="catalog-pg-sequence">
5808   <title><structname>pg_sequence</structname></title>
5809
5810   <indexterm zone="catalog-pg-sequence">
5811    <primary>pg_sequence</primary>
5812   </indexterm>
5813
5814   <para>
5815    The catalog <structname>pg_sequence</structname> contains information about
5816    sequences.  Some of the information about sequences, such as the name and
5817    the schema, is in <structname>pg_class</structname>.
5818   </para>
5819
5820   <table>
5821    <title><structname>pg_sequence</> Columns</title>
5822
5823    <tgroup cols="4">
5824     <thead>
5825      <row>
5826       <entry>Name</entry>
5827       <entry>Type</entry>
5828       <entry>References</entry>
5829       <entry>Description</entry>
5830      </row>
5831     </thead>
5832
5833     <tbody>
5834      <row>
5835       <entry><structfield>seqrelid</structfield></entry>
5836       <entry><type>oid</type></entry>
5837       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5838       <entry>The OID of the <structname>pg_class</> entry for this sequence</entry>
5839      </row>
5840
5841      <row>
5842       <entry><structfield>seqtypid</structfield></entry>
5843       <entry><type>oid</type></entry>
5844       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5845       <entry>Data type of the sequence</entry>
5846      </row>
5847
5848      <row>
5849       <entry><structfield>seqstart</structfield></entry>
5850       <entry><type>int8</type></entry>
5851       <entry></entry>
5852       <entry>Start value of the sequence</entry>
5853      </row>
5854
5855      <row>
5856       <entry><structfield>seqincrement</structfield></entry>
5857       <entry><type>int8</type></entry>
5858       <entry></entry>
5859       <entry>Increment value of the sequence</entry>
5860      </row>
5861
5862      <row>
5863       <entry><structfield>seqmax</structfield></entry>
5864       <entry><type>int8</type></entry>
5865       <entry></entry>
5866       <entry>Maximum value of the sequence</entry>
5867      </row>
5868
5869      <row>
5870       <entry><structfield>seqmin</structfield></entry>
5871       <entry><type>int8</type></entry>
5872       <entry></entry>
5873       <entry>Minimum value of the sequence</entry>
5874      </row>
5875
5876      <row>
5877       <entry><structfield>seqcache</structfield></entry>
5878       <entry><type>int8</type></entry>
5879       <entry></entry>
5880       <entry>Cache size of the sequence</entry>
5881      </row>
5882
5883      <row>
5884       <entry><structfield>seqcycle</structfield></entry>
5885       <entry><type>bool</type></entry>
5886       <entry></entry>
5887       <entry>Whether the sequence cycles</entry>
5888      </row>
5889     </tbody>
5890    </tgroup>
5891   </table>
5892  </sect1>
5893
5894  <sect1 id="catalog-pg-shdepend">
5895   <title><structname>pg_shdepend</structname></title>
5896
5897   <indexterm zone="catalog-pg-shdepend">
5898    <primary>pg_shdepend</primary>
5899   </indexterm>
5900
5901   <para>
5902    The catalog <structname>pg_shdepend</structname> records the
5903    dependency relationships between database objects and shared objects,
5904    such as roles.  This information allows
5905    <productname>PostgreSQL</productname> to ensure that those objects are
5906    unreferenced before attempting to delete them.
5907   </para>
5908
5909   <para>
5910    See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5911    which performs a similar function for dependencies involving objects
5912    within a single database.
5913   </para>
5914
5915   <para>
5916    Unlike most system catalogs, <structname>pg_shdepend</structname>
5917    is shared across all databases of a cluster: there is only one
5918    copy of <structname>pg_shdepend</structname> per cluster, not
5919    one per database.
5920   </para>
5921
5922   <table>
5923    <title><structname>pg_shdepend</> Columns</title>
5924
5925    <tgroup cols="4">
5926     <thead>
5927      <row>
5928       <entry>Name</entry>
5929       <entry>Type</entry>
5930       <entry>References</entry>
5931       <entry>Description</entry>
5932      </row>
5933     </thead>
5934
5935     <tbody>
5936      <row>
5937       <entry><structfield>dbid</structfield></entry>
5938       <entry><type>oid</type></entry>
5939       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5940       <entry>The OID of the database the dependent object is in,
5941        or zero for a shared object</entry>
5942      </row>
5943
5944      <row>
5945       <entry><structfield>classid</structfield></entry>
5946       <entry><type>oid</type></entry>
5947       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5948       <entry>The OID of the system catalog the dependent object is in</entry>
5949      </row>
5950
5951      <row>
5952       <entry><structfield>objid</structfield></entry>
5953       <entry><type>oid</type></entry>
5954       <entry>any OID column</entry>
5955       <entry>The OID of the specific dependent object</entry>
5956      </row>
5957
5958      <row>
5959       <entry><structfield>objsubid</structfield></entry>
5960       <entry><type>int4</type></entry>
5961       <entry></entry>
5962       <entry>
5963        For a table column, this is the column number (the
5964        <structfield>objid</> and <structfield>classid</> refer to the
5965        table itself).  For all other object types, this column is zero.
5966       </entry>
5967      </row>
5968
5969      <row>
5970       <entry><structfield>refclassid</structfield></entry>
5971       <entry><type>oid</type></entry>
5972       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5973       <entry>The OID of the system catalog the referenced object is in
5974        (must be a shared catalog)</entry>
5975      </row>
5976
5977      <row>
5978       <entry><structfield>refobjid</structfield></entry>
5979       <entry><type>oid</type></entry>
5980       <entry>any OID column</entry>
5981       <entry>The OID of the specific referenced object</entry>
5982      </row>
5983
5984      <row>
5985       <entry><structfield>deptype</structfield></entry>
5986       <entry><type>char</type></entry>
5987       <entry></entry>
5988       <entry>
5989        A code defining the specific semantics of this dependency relationship; see text
5990       </entry>
5991      </row>
5992
5993     </tbody>
5994    </tgroup>
5995   </table>
5996
5997   <para>
5998    In all cases, a <structname>pg_shdepend</structname> entry indicates that
5999    the referenced object cannot be dropped without also dropping the dependent
6000    object.  However, there are several subflavors identified by
6001    <structfield>deptype</>:
6002
6003    <variablelist>
6004     <varlistentry>
6005      <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
6006      <listitem>
6007       <para>
6008        The referenced object (which must be a role) is the owner of the
6009        dependent object.
6010       </para>
6011      </listitem>
6012     </varlistentry>
6013
6014     <varlistentry>
6015      <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
6016      <listitem>
6017       <para>
6018        The referenced object (which must be a role) is mentioned in the
6019        ACL (access control list, i.e., privileges list) of the
6020        dependent object.  (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
6021        not made for the owner of the object, since the owner will have
6022        a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
6023       </para>
6024      </listitem>
6025     </varlistentry>
6026
6027     <varlistentry>
6028      <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
6029      <listitem>
6030       <para>
6031        The referenced object (which must be a role) is mentioned as the
6032        target of a dependent policy object.
6033       </para>
6034      </listitem>
6035     </varlistentry>
6036
6037     <varlistentry>
6038      <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
6039      <listitem>
6040       <para>
6041        There is no dependent object; this type of entry is a signal
6042        that the system itself depends on the referenced object, and so
6043        that object must never be deleted.  Entries of this type are
6044        created only by <command>initdb</command>.  The columns for the
6045        dependent object contain zeroes.
6046       </para>
6047      </listitem>
6048     </varlistentry>
6049    </variablelist>
6050
6051    Other dependency flavors might be needed in future.  Note in particular
6052    that the current definition only supports roles as referenced objects.
6053   </para>
6054
6055  </sect1>
6056
6057  <sect1 id="catalog-pg-shdescription">
6058   <title><structname>pg_shdescription</structname></title>
6059
6060   <indexterm zone="catalog-pg-shdescription">
6061    <primary>pg_shdescription</primary>
6062   </indexterm>
6063
6064   <para>
6065    The catalog <structname>pg_shdescription</structname> stores optional
6066    descriptions (comments) for shared database objects.  Descriptions can be
6067    manipulated with the <xref linkend="sql-comment"> command and viewed with
6068    <application>psql</application>'s <literal>\d</literal> commands.
6069   </para>
6070
6071   <para>
6072    See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6073    which performs a similar function for descriptions involving objects
6074    within a single database.
6075   </para>
6076
6077   <para>
6078    Unlike most system catalogs, <structname>pg_shdescription</structname>
6079    is shared across all databases of a cluster: there is only one
6080    copy of <structname>pg_shdescription</structname> per cluster, not
6081    one per database.
6082   </para>
6083
6084   <table>
6085    <title><structname>pg_shdescription</> Columns</title>
6086
6087    <tgroup cols="4">
6088     <thead>
6089      <row>
6090       <entry>Name</entry>
6091       <entry>Type</entry>
6092       <entry>References</entry>
6093       <entry>Description</entry>
6094      </row>
6095     </thead>
6096
6097     <tbody>
6098      <row>
6099       <entry><structfield>objoid</structfield></entry>
6100       <entry><type>oid</type></entry>
6101       <entry>any OID column</entry>
6102       <entry>The OID of the object this description pertains to</entry>
6103      </row>
6104
6105      <row>
6106       <entry><structfield>classoid</structfield></entry>
6107       <entry><type>oid</type></entry>
6108       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6109       <entry>The OID of the system catalog this object appears in</entry>
6110      </row>
6111
6112      <row>
6113       <entry><structfield>description</structfield></entry>
6114       <entry><type>text</type></entry>
6115       <entry></entry>
6116       <entry>Arbitrary text that serves as the description of this object</entry>
6117      </row>
6118     </tbody>
6119    </tgroup>
6120   </table>
6121
6122  </sect1>
6123
6124  <sect1 id="catalog-pg-shseclabel">
6125   <title><structname>pg_shseclabel</structname></title>
6126
6127   <indexterm zone="catalog-pg-shseclabel">
6128    <primary>pg_shseclabel</primary>
6129   </indexterm>
6130
6131   <para>
6132    The catalog <structname>pg_shseclabel</structname> stores security
6133    labels on shared database objects.  Security labels can be manipulated
6134    with the <xref linkend="sql-security-label"> command.  For an easier
6135    way to view security labels, see <xref linkend="view-pg-seclabels">.
6136   </para>
6137
6138   <para>
6139    See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6140    which performs a similar function for security labels involving objects
6141    within a single database.
6142   </para>
6143
6144   <para>
6145    Unlike most system catalogs, <structname>pg_shseclabel</structname>
6146    is shared across all databases of a cluster: there is only one
6147    copy of <structname>pg_shseclabel</structname> per cluster, not
6148    one per database.
6149   </para>
6150
6151   <table>
6152    <title><structname>pg_shseclabel</structname> Columns</title>
6153    <tgroup cols="4">
6154     <thead>
6155      <row>
6156       <entry>Name</entry>
6157       <entry>Type</entry>
6158       <entry>References</entry>
6159       <entry>Description</entry>
6160      </row>
6161     </thead>
6162     <tbody>
6163      <row>
6164       <entry><structfield>objoid</structfield></entry>
6165       <entry><type>oid</type></entry>
6166       <entry>any OID column</entry>
6167       <entry>The OID of the object this security label pertains to</entry>
6168      </row>
6169      <row>
6170       <entry><structfield>classoid</structfield></entry>
6171       <entry><type>oid</type></entry>
6172       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6173       <entry>The OID of the system catalog this object appears in</entry>
6174      </row>
6175      <row>
6176       <entry><structfield>provider</structfield></entry>
6177       <entry><type>text</type></entry>
6178       <entry></entry>
6179       <entry>The label provider associated with this label.</entry>
6180      </row>
6181      <row>
6182       <entry><structfield>label</structfield></entry>
6183       <entry><type>text</type></entry>
6184       <entry></entry>
6185       <entry>The security label applied to this object.</entry>
6186      </row>
6187     </tbody>
6188    </tgroup>
6189   </table>
6190  </sect1>
6191
6192  <sect1 id="catalog-pg-statistic">
6193   <title><structname>pg_statistic</structname></title>
6194
6195   <indexterm zone="catalog-pg-statistic">
6196    <primary>pg_statistic</primary>
6197   </indexterm>
6198
6199   <para>
6200    The catalog <structname>pg_statistic</structname> stores
6201    statistical data about the contents of the database.  Entries are
6202    created by <xref linkend="sql-analyze">
6203    and subsequently used by the query planner.  Note that all the
6204    statistical data is inherently approximate, even assuming that it
6205    is up-to-date.
6206   </para>
6207
6208   <para>
6209    Normally there is one entry, with <structfield>stainherit</> =
6210    <literal>false</>, for each table column that has been analyzed.
6211    If the table has inheritance children, a second entry with
6212    <structfield>stainherit</> = <literal>true</> is also created.  This row
6213    represents the column's statistics over the inheritance tree, i.e.,
6214    statistics for the data you'd see with
6215    <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
6216    whereas the <structfield>stainherit</> = <literal>false</> row represents
6217    the results of
6218    <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
6219   </para>
6220
6221   <para>
6222    <structname>pg_statistic</structname> also stores statistical data about
6223    the values of index expressions.  These are described as if they were
6224    actual data columns; in particular, <structfield>starelid</structfield>
6225    references the index.  No entry is made for an ordinary non-expression
6226    index column, however, since it would be redundant with the entry
6227    for the underlying table column.  Currently, entries for index expressions
6228    always have <structfield>stainherit</> = <literal>false</>.
6229   </para>
6230
6231   <para>
6232    Since different kinds of statistics might be appropriate for different
6233    kinds of data, <structname>pg_statistic</structname> is designed not
6234    to assume very much about what sort of statistics it stores.  Only
6235    extremely general statistics (such as nullness) are given dedicated
6236    columns in <structname>pg_statistic</structname>.  Everything else
6237    is stored in <quote>slots</quote>, which are groups of associated columns
6238    whose content is identified by a code number in one of the slot's columns.
6239    For more information see
6240    <filename>src/include/catalog/pg_statistic.h</filename>.
6241   </para>
6242
6243   <para>
6244    <structname>pg_statistic</structname> should not be readable by the
6245    public, since even statistical information about a table's contents
6246    might be considered sensitive.  (Example: minimum and maximum values
6247    of a salary column might be quite interesting.)
6248    <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6249    is a publicly readable view on
6250    <structname>pg_statistic</structname> that only exposes information
6251    about those tables that are readable by the current user.
6252   </para>
6253
6254   <table>
6255    <title><structname>pg_statistic</> Columns</title>
6256
6257    <tgroup cols="4">
6258     <thead>
6259      <row>
6260       <entry>Name</entry>
6261       <entry>Type</entry>
6262       <entry>References</entry>
6263       <entry>Description</entry>
6264      </row>
6265     </thead>
6266
6267     <tbody>
6268      <row>
6269       <entry><structfield>starelid</structfield></entry>
6270       <entry><type>oid</type></entry>
6271       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6272       <entry>The table or index that the described column belongs to</entry>
6273      </row>
6274
6275      <row>
6276       <entry><structfield>staattnum</structfield></entry>
6277       <entry><type>int2</type></entry>
6278       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6279       <entry>The number of the described column</entry>
6280      </row>
6281
6282      <row>
6283       <entry><structfield>stainherit</structfield></entry>
6284       <entry><type>bool</type></entry>
6285       <entry></entry>
6286       <entry>If true, the stats include inheritance child columns, not just the
6287        values in the specified relation</entry>
6288      </row>
6289
6290      <row>
6291       <entry><structfield>stanullfrac</structfield></entry>
6292       <entry><type>float4</type></entry>
6293       <entry></entry>
6294       <entry>The fraction of the column's entries that are null</entry>
6295      </row>
6296
6297      <row>
6298       <entry><structfield>stawidth</structfield></entry>
6299       <entry><type>int4</type></entry>
6300       <entry></entry>
6301       <entry>The average stored width, in bytes, of nonnull entries</entry>
6302      </row>
6303
6304      <row>
6305       <entry><structfield>stadistinct</structfield></entry>
6306       <entry><type>float4</type></entry>
6307       <entry></entry>
6308       <entry>The number of distinct nonnull data values in the column.
6309       A value greater than zero is the actual number of distinct values.
6310       A value less than zero is the negative of a multiplier for the number
6311       of rows in the table; for example, a column in which about 80% of the
6312       values are nonnull and each nonnull value appears about twice on
6313       average could be represented by <structfield>stadistinct</> = -0.4.
6314       A zero value means the number of distinct values is unknown.
6315       </entry>
6316      </row>
6317
6318      <row>
6319       <entry><structfield>stakind<replaceable>N</></structfield></entry>
6320       <entry><type>int2</type></entry>
6321       <entry></entry>
6322       <entry>
6323        A code number indicating the kind of statistics stored in the
6324        <replaceable>N</>th <quote>slot</quote> of the
6325        <structname>pg_statistic</structname> row.
6326       </entry>
6327      </row>
6328
6329      <row>
6330       <entry><structfield>staop<replaceable>N</></structfield></entry>
6331       <entry><type>oid</type></entry>
6332       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6333       <entry>
6334        An operator used to derive the statistics stored in the
6335        <replaceable>N</>th <quote>slot</quote>.  For example, a
6336        histogram slot would show the <literal>&lt;</literal> operator
6337        that defines the sort order of the data.
6338       </entry>
6339      </row>
6340
6341      <row>
6342       <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6343       <entry><type>float4[]</type></entry>
6344       <entry></entry>
6345       <entry>
6346        Numerical statistics of the appropriate kind for the
6347        <replaceable>N</>th <quote>slot</quote>, or null if the slot
6348        kind does not involve numerical values
6349       </entry>
6350      </row>
6351
6352      <row>
6353       <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6354       <entry><type>anyarray</type></entry>
6355       <entry></entry>
6356       <entry>
6357        Column data values of the appropriate kind for the
6358        <replaceable>N</>th <quote>slot</quote>, or null if the slot
6359        kind does not store any data values.  Each array's element
6360        values are actually of the specific column's data type, or a related
6361        type such as an array's element type, so there is no way to define
6362        these columns' type more specifically than <type>anyarray</>.
6363       </entry>
6364      </row>
6365     </tbody>
6366    </tgroup>
6367   </table>
6368
6369  </sect1>
6370
6371  <sect1 id="catalog-pg-statistic-ext">
6372   <title><structname>pg_statistic_ext</structname></title>
6373
6374   <indexterm zone="catalog-pg-statistic-ext">
6375    <primary>pg_statistic_ext</primary>
6376   </indexterm>
6377
6378   <para>
6379    The catalog <structname>pg_statistic_ext</structname>
6380    holds extended planner statistics.
6381    Each row in this catalog corresponds to a <firstterm>statistics object</>
6382    created with <xref linkend="sql-createstatistics">.
6383   </para>
6384
6385   <table>
6386    <title><structname>pg_statistic_ext</> Columns</title>
6387
6388    <tgroup cols="4">
6389     <thead>
6390      <row>
6391       <entry>Name</entry>
6392       <entry>Type</entry>
6393       <entry>References</entry>
6394       <entry>Description</entry>
6395      </row>
6396     </thead>
6397
6398     <tbody>
6399
6400      <row>
6401       <entry><structfield>stxrelid</structfield></entry>
6402       <entry><type>oid</type></entry>
6403       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6404       <entry>Table containing the columns described by this object</entry>
6405      </row>
6406
6407      <row>
6408       <entry><structfield>stxname</structfield></entry>
6409       <entry><type>name</type></entry>
6410       <entry></entry>
6411       <entry>Name of the statistics object</entry>
6412      </row>
6413
6414      <row>
6415       <entry><structfield>stxnamespace</structfield></entry>
6416       <entry><type>oid</type></entry>
6417       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6418       <entry>
6419        The OID of the namespace that contains this statistics object
6420       </entry>
6421      </row>
6422
6423      <row>
6424       <entry><structfield>stxowner</structfield></entry>
6425       <entry><type>oid</type></entry>
6426       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6427       <entry>Owner of the statistics object</entry>
6428      </row>
6429
6430      <row>
6431       <entry><structfield>stxkeys</structfield></entry>
6432       <entry><type>int2vector</type></entry>
6433       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6434       <entry>
6435        An array of attribute numbers, indicating which table columns are
6436        covered by this statistics object;
6437        for example a value of <literal>1 3</literal> would
6438        mean that the first and the third table columns are covered
6439       </entry>
6440      </row>
6441
6442      <row>
6443       <entry><structfield>stxkind</structfield></entry>
6444       <entry><type>char[]</type></entry>
6445       <entry></entry>
6446       <entry>
6447         An array containing codes for the enabled statistic types;
6448         valid values are:
6449         <literal>d</literal> for n-distinct statistics,
6450         <literal>f</literal> for functional dependency statistics
6451       </entry>
6452      </row>
6453
6454      <row>
6455       <entry><structfield>stxndistinct</structfield></entry>
6456       <entry><type>pg_ndistinct</type></entry>
6457       <entry></entry>
6458       <entry>
6459        N-distinct counts, serialized as <structname>pg_ndistinct</> type
6460       </entry>
6461      </row>
6462
6463      <row>
6464       <entry><structfield>stxdependencies</structfield></entry>
6465       <entry><type>pg_dependencies</type></entry>
6466       <entry></entry>
6467       <entry>
6468        Functional dependency statistics, serialized
6469        as <structname>pg_dependencies</> type
6470       </entry>
6471      </row>
6472
6473     </tbody>
6474    </tgroup>
6475   </table>
6476
6477   <para>
6478    The <structfield>stxkind</structfield> field is filled at creation of the
6479    statistics object, indicating which statistic type(s) are desired.
6480    The fields after it are initially NULL and are filled only when the
6481    corresponding statistic has been computed by <command>ANALYZE</>.
6482   </para>
6483  </sect1>
6484
6485  <sect1 id="catalog-pg-subscription">
6486   <title><structname>pg_subscription</structname></title>
6487
6488   <indexterm zone="catalog-pg-subscription">
6489    <primary>pg_subscription</primary>
6490   </indexterm>
6491
6492   <para>
6493    The catalog <structname>pg_subscription</structname> contains all existing
6494    logical replication subscriptions.  For more information about logical
6495    replication see <xref linkend="logical-replication">.
6496   </para>
6497
6498   <para>
6499    Unlike most system catalogs, <structname>pg_subscription</structname> is
6500    shared across all databases of a cluster: There is only one copy
6501    of <structname>pg_subscription</structname> per cluster, not one per
6502    database.
6503   </para>
6504
6505   <para>
6506    Access to the column <structfield>subconninfo</structfield> is revoked from
6507    normal users, because it could contain plain-text passwords.
6508   </para>
6509
6510   <table>
6511    <title><structname>pg_subscription</structname> Columns</title>
6512
6513    <tgroup cols="4">
6514     <thead>
6515      <row>
6516       <entry>Name</entry>
6517       <entry>Type</entry>
6518       <entry>References</entry>
6519       <entry>Description</entry>
6520      </row>
6521     </thead>
6522
6523     <tbody>
6524      <row>
6525       <entry><structfield>oid</structfield></entry>
6526       <entry><type>oid</type></entry>
6527       <entry></entry>
6528       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6529      </row>
6530
6531      <row>
6532       <entry><structfield>subdbid</structfield></entry>
6533       <entry><type>oid</type></entry>
6534       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6535       <entry>OID of the database which the subscription resides in</entry>
6536      </row>
6537
6538      <row>
6539       <entry><structfield>subname</structfield></entry>
6540       <entry><type>name</type></entry>
6541       <entry></entry>
6542       <entry>Name of the subscription</entry>
6543      </row>
6544
6545      <row>
6546       <entry><structfield>subowner</structfield></entry>
6547       <entry><type>oid</type></entry>
6548       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6549       <entry>Owner of the subscription</entry>
6550      </row>
6551
6552      <row>
6553       <entry><structfield>subenabled</structfield></entry>
6554       <entry><type>bool</type></entry>
6555       <entry></entry>
6556       <entry>If true, the subscription is enabled and should be replicating.</entry>
6557      </row>
6558
6559      <row>
6560       <entry><structfield>subsynccommit</structfield></entry>
6561       <entry><type>text</type></entry>
6562       <entry></entry>
6563       <entry>
6564        Contains the value of the <varname>synchronous_commit</varname>
6565        setting for the subscription workers.
6566       </entry>
6567      </row>
6568
6569      <row>
6570       <entry><structfield>subconninfo</structfield></entry>
6571       <entry><type>text</type></entry>
6572       <entry></entry>
6573       <entry>Connection string to the upstream database</entry>
6574      </row>
6575
6576      <row>
6577       <entry><structfield>subslotname</structfield></entry>
6578       <entry><type>name</type></entry>
6579       <entry></entry>
6580       <entry>Name of the replication slot in the upstream database. Also used
6581        for local replication origin name.</entry>
6582      </row>
6583
6584      <row>
6585       <entry><structfield>subpublications</structfield></entry>
6586       <entry><type>text[]</type></entry>
6587       <entry></entry>
6588       <entry>Array of subscribed publication names. These reference the
6589        publications on the publisher server. For more on publications
6590        see <xref linkend="logical-replication-publication">.
6591       </entry>
6592      </row>
6593     </tbody>
6594    </tgroup>
6595   </table>
6596  </sect1>
6597
6598  <sect1 id="catalog-pg-subscription-rel">
6599   <title><structname>pg_subscription_rel</structname></title>
6600
6601   <indexterm zone="catalog-pg-subscription-rel">
6602    <primary>pg_subscription_rel</primary>
6603   </indexterm>
6604
6605   <para>
6606    The catalog <structname>pg_subscription_rel</structname> contains the
6607    state for each replicated relation in each subscription.  This is a
6608    many-to-many mapping.
6609   </para>
6610
6611   <para>
6612    This catalog only contains tables known to the subscription after running
6613    either <command>CREATE SUBSCRIPTION</command> or
6614    <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command>.
6615   </para>
6616
6617   <table>
6618    <title><structname>pg_subscription_rel</structname> Columns</title>
6619
6620    <tgroup cols="4">
6621     <thead>
6622      <row>
6623       <entry>Name</entry>
6624       <entry>Type</entry>
6625       <entry>References</entry>
6626       <entry>Description</entry>
6627      </row>
6628     </thead>
6629
6630     <tbody>
6631      <row>
6632       <entry><structfield>srsubid</structfield></entry>
6633       <entry><type>oid</type></entry>
6634       <entry><literal><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.oid</literal></entry>
6635       <entry>Reference to subscription</entry>
6636      </row>
6637
6638      <row>
6639       <entry><structfield>srrelid</structfield></entry>
6640       <entry><type>oid</type></entry>
6641       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6642       <entry>Reference to relation</entry>
6643      </row>
6644
6645      <row>
6646       <entry><structfield>srsubstate</structfield></entry>
6647       <entry><type>char</type></entry>
6648       <entry></entry>
6649       <entry>
6650        State code:
6651        <literal>i</> = initialize,
6652        <literal>d</> = data is being copied,
6653        <literal>s</> = synchronized,
6654        <literal>r</> = ready (normal replication)
6655       </entry>
6656      </row>
6657
6658      <row>
6659       <entry><structfield>srsublsn</structfield></entry>
6660       <entry><type>pg_lsn</type></entry>
6661       <entry></entry>
6662       <entry>
6663        End LSN for <literal>s</> and <literal>r</> states.
6664       </entry>
6665      </row>
6666     </tbody>
6667    </tgroup>
6668   </table>
6669  </sect1>
6670
6671  <sect1 id="catalog-pg-tablespace">
6672   <title><structname>pg_tablespace</structname></title>
6673
6674   <indexterm zone="catalog-pg-tablespace">
6675    <primary>pg_tablespace</primary>
6676   </indexterm>
6677
6678   <para>
6679    The catalog <structname>pg_tablespace</structname> stores information
6680    about the available tablespaces.  Tables can be placed in particular
6681    tablespaces to aid administration of disk layout.
6682   </para>
6683
6684   <para>
6685    Unlike most system catalogs, <structname>pg_tablespace</structname>
6686    is shared across all databases of a cluster: there is only one
6687    copy of <structname>pg_tablespace</structname> per cluster, not
6688    one per database.
6689   </para>
6690
6691   <table>
6692    <title><structname>pg_tablespace</> Columns</title>
6693
6694    <tgroup cols="4">
6695     <thead>
6696      <row>
6697       <entry>Name</entry>
6698       <entry>Type</entry>
6699       <entry>References</entry>
6700       <entry>Description</entry>
6701      </row>
6702     </thead>
6703
6704     <tbody>
6705      <row>
6706       <entry><structfield>oid</structfield></entry>
6707       <entry><type>oid</type></entry>
6708       <entry></entry>
6709       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6710      </row>
6711
6712      <row>
6713       <entry><structfield>spcname</structfield></entry>
6714       <entry><type>name</type></entry>
6715       <entry></entry>
6716       <entry>Tablespace name</entry>
6717      </row>
6718
6719      <row>
6720       <entry><structfield>spcowner</structfield></entry>
6721       <entry><type>oid</type></entry>
6722       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6723       <entry>Owner of the tablespace, usually the user who created it</entry>
6724      </row>
6725
6726      <row>
6727       <entry><structfield>spcacl</structfield></entry>
6728       <entry><type>aclitem[]</type></entry>
6729       <entry></entry>
6730       <entry>
6731        Access privileges; see
6732        <xref linkend="sql-grant"> and
6733        <xref linkend="sql-revoke">
6734        for details
6735       </entry>
6736      </row>
6737
6738      <row>
6739       <entry><structfield>spcoptions</structfield></entry>
6740       <entry><type>text[]</type></entry>
6741       <entry></entry>
6742       <entry>
6743        Tablespace-level options, as <quote>keyword=value</> strings
6744       </entry>
6745      </row>
6746     </tbody>
6747    </tgroup>
6748   </table>
6749  </sect1>
6750
6751
6752  <sect1 id="catalog-pg-transform">
6753   <title><structname>pg_transform</structname></title>
6754
6755   <indexterm zone="catalog-pg-transform">
6756    <primary>pg_transform</primary>
6757   </indexterm>
6758
6759   <para>
6760    The catalog <structname>pg_transform</structname> stores information about
6761    transforms, which are a mechanism to adapt data types to procedural
6762    languages.  See <xref linkend="sql-createtransform"> for more information.
6763   </para>
6764
6765   <table>
6766    <title><structname>pg_transform</> Columns</title>
6767
6768    <tgroup cols="4">
6769     <thead>
6770      <row>
6771       <entry>Name</entry>
6772       <entry>Type</entry>
6773       <entry>References</entry>
6774       <entry>Description</entry>
6775      </row>
6776     </thead>
6777
6778     <tbody>
6779      <row>
6780       <entry><structfield>trftype</structfield></entry>
6781       <entry><type>oid</type></entry>
6782       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6783       <entry>OID of the data type this transform is for</entry>
6784      </row>
6785
6786      <row>
6787       <entry><structfield>trflang</structfield></entry>
6788       <entry><type>oid</type></entry>
6789       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6790       <entry>OID of the language this transform is for</entry>
6791      </row>
6792
6793      <row>
6794       <entry><structfield>trffromsql</structfield></entry>
6795       <entry><type>regproc</type></entry>
6796       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6797       <entry>
6798        The OID of the function to use when converting the data type for input
6799        to the procedural language (e.g., function parameters).  Zero is stored
6800        if this operation is not supported.
6801       </entry>
6802      </row>
6803
6804      <row>
6805       <entry><structfield>trftosql</structfield></entry>
6806       <entry><type>regproc</type></entry>
6807       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6808       <entry>
6809        The OID of the function to use when converting output from the
6810        procedural language (e.g., return values) to the data type.  Zero is
6811        stored if this operation is not supported.
6812       </entry>
6813      </row>
6814     </tbody>
6815    </tgroup>
6816   </table>
6817  </sect1>
6818
6819
6820  <sect1 id="catalog-pg-trigger">
6821   <title><structname>pg_trigger</structname></title>
6822
6823   <indexterm zone="catalog-pg-trigger">
6824    <primary>pg_trigger</primary>
6825   </indexterm>
6826
6827   <para>
6828    The catalog <structname>pg_trigger</structname> stores triggers on tables
6829    and views.
6830    See <xref linkend="sql-createtrigger">
6831    for more information.
6832   </para>
6833
6834   <table>
6835    <title><structname>pg_trigger</> Columns</title>
6836
6837    <tgroup cols="4">
6838     <thead>
6839      <row>
6840       <entry>Name</entry>
6841       <entry>Type</entry>
6842       <entry>References</entry>
6843       <entry>Description</entry>
6844      </row>
6845     </thead>
6846
6847     <tbody>
6848      <row>
6849       <entry><structfield>oid</structfield></entry>
6850       <entry><type>oid</type></entry>
6851       <entry></entry>
6852       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6853      </row>
6854
6855      <row>
6856       <entry><structfield>tgrelid</structfield></entry>
6857       <entry><type>oid</type></entry>
6858       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6859       <entry>The table this trigger is on</entry>
6860      </row>
6861
6862      <row>
6863       <entry><structfield>tgname</structfield></entry>
6864       <entry><type>name</type></entry>
6865       <entry></entry>
6866       <entry>Trigger name (must be unique among triggers of same table)</entry>
6867      </row>
6868
6869      <row>
6870       <entry><structfield>tgfoid</structfield></entry>
6871       <entry><type>oid</type></entry>
6872       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6873       <entry>The function to be called</entry>
6874      </row>
6875
6876      <row>
6877       <entry><structfield>tgtype</structfield></entry>
6878       <entry><type>int2</type></entry>
6879       <entry></entry>
6880       <entry>Bit mask identifying trigger firing conditions</entry>
6881      </row>
6882
6883      <row>
6884       <entry><structfield>tgenabled</structfield></entry>
6885       <entry><type>char</type></entry>
6886       <entry></entry>
6887       <entry>
6888        Controls in which <xref linkend="guc-session-replication-role"> modes
6889        the trigger fires.
6890        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6891        <literal>D</> = trigger is disabled,
6892        <literal>R</> = trigger fires in <quote>replica</> mode,
6893        <literal>A</> = trigger fires always.
6894       </entry>
6895      </row>
6896
6897      <row>
6898       <entry><structfield>tgisinternal</structfield></entry>
6899       <entry><type>bool</type></entry>
6900       <entry></entry>
6901       <entry>True if trigger is internally generated (usually, to enforce
6902        the constraint identified by <structfield>tgconstraint</>)</entry>
6903      </row>
6904
6905      <row>
6906       <entry><structfield>tgconstrrelid</structfield></entry>
6907       <entry><type>oid</type></entry>
6908       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6909       <entry>The table referenced by a referential integrity constraint</entry>
6910      </row>
6911
6912      <row>
6913       <entry><structfield>tgconstrindid</structfield></entry>
6914       <entry><type>oid</type></entry>
6915       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6916       <entry>The index supporting a unique, primary key, referential integrity,
6917        or exclusion constraint</entry>
6918      </row>
6919
6920      <row>
6921       <entry><structfield>tgconstraint</structfield></entry>
6922       <entry><type>oid</type></entry>
6923       <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6924       <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6925      </row>
6926
6927      <row>
6928       <entry><structfield>tgdeferrable</structfield></entry>
6929       <entry><type>bool</type></entry>
6930       <entry></entry>
6931       <entry>True if constraint trigger is deferrable</entry>
6932      </row>
6933
6934      <row>
6935       <entry><structfield>tginitdeferred</structfield></entry>
6936       <entry><type>bool</type></entry>
6937       <entry></entry>
6938       <entry>True if constraint trigger is initially deferred</entry>
6939      </row>
6940
6941      <row>
6942       <entry><structfield>tgnargs</structfield></entry>
6943       <entry><type>int2</type></entry>
6944       <entry></entry>
6945       <entry>Number of argument strings passed to trigger function</entry>
6946      </row>
6947
6948      <row>
6949       <entry><structfield>tgattr</structfield></entry>
6950       <entry><type>int2vector</type></entry>
6951       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6952       <entry>Column numbers, if trigger is column-specific; otherwise an
6953        empty array</entry>
6954      </row>
6955
6956      <row>
6957       <entry><structfield>tgargs</structfield></entry>
6958       <entry><type>bytea</type></entry>
6959       <entry></entry>
6960       <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6961      </row>
6962
6963      <row>
6964       <entry><structfield>tgqual</structfield></entry>
6965       <entry><type>pg_node_tree</type></entry>
6966       <entry></entry>
6967       <entry>Expression tree (in <function>nodeToString()</function>
6968        representation) for the trigger's <literal>WHEN</> condition, or null
6969        if none</entry>
6970      </row>
6971
6972      <row>
6973       <entry><structfield>tgoldtable</structfield></entry>
6974       <entry><type>name</type></entry>
6975       <entry></entry>
6976       <entry><literal>REFERENCING</> clause name for <literal>OLD TABLE</>,
6977        or null if none</entry>
6978      </row>
6979
6980      <row>
6981       <entry><structfield>tgnewtable</structfield></entry>
6982       <entry><type>name</type></entry>
6983       <entry></entry>
6984       <entry><literal>REFERENCING</> clause name for <literal>NEW TABLE</>,
6985        or null if none</entry>
6986      </row>
6987     </tbody>
6988    </tgroup>
6989   </table>
6990
6991   <para>
6992    Currently, column-specific triggering is supported only for
6993    <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6994    only for that event type.  <structfield>tgtype</structfield> might
6995    contain bits for other event types as well, but those are presumed
6996    to be table-wide regardless of what is in <structfield>tgattr</>.
6997   </para>
6998
6999   <note>
7000    <para>
7001     When <structfield>tgconstraint</> is nonzero,
7002     <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
7003     <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
7004     largely redundant with the referenced <structname>pg_constraint</> entry.
7005     However, it is possible for a non-deferrable trigger to be associated
7006     with a deferrable constraint: foreign key constraints can have some
7007     deferrable and some non-deferrable triggers.
7008    </para>
7009   </note>
7010
7011   <note>
7012    <para>
7013     <literal>pg_class.relhastriggers</literal>
7014     must be true if a relation has any triggers in this catalog.
7015    </para>
7016   </note>
7017
7018  </sect1>
7019
7020
7021  <sect1 id="catalog-pg-ts-config">
7022   <title><structname>pg_ts_config</structname></title>
7023
7024   <indexterm zone="catalog-pg-ts-config">
7025    <primary>pg_ts_config</primary>
7026   </indexterm>
7027
7028   <para>
7029    The <structname>pg_ts_config</structname> catalog contains entries
7030    representing text search configurations.  A configuration specifies
7031    a particular text search parser and a list of dictionaries to use
7032    for each of the parser's output token types.  The parser is shown
7033    in the <structname>pg_ts_config</structname> entry, but the
7034    token-to-dictionary mapping is defined by subsidiary entries in <link
7035    linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
7036   </para>
7037
7038   <para>
7039    <productname>PostgreSQL</productname>'s text search features are
7040    described at length in <xref linkend="textsearch">.
7041   </para>
7042
7043   <table>
7044    <title><structname>pg_ts_config</> Columns</title>
7045
7046    <tgroup cols="4">
7047     <thead>
7048      <row>
7049       <entry>Name</entry>
7050       <entry>Type</entry>
7051       <entry>References</entry>
7052       <entry>Description</entry>
7053      </row>
7054     </thead>
7055
7056     <tbody>
7057      <row>
7058       <entry><structfield>oid</structfield></entry>
7059       <entry><type>oid</type></entry>
7060       <entry></entry>
7061       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7062      </row>
7063
7064      <row>
7065       <entry><structfield>cfgname</structfield></entry>
7066       <entry><type>name</type></entry>
7067       <entry></entry>
7068       <entry>Text search configuration name</entry>
7069      </row>
7070
7071      <row>
7072       <entry><structfield>cfgnamespace</structfield></entry>
7073       <entry><type>oid</type></entry>
7074       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7075       <entry>
7076        The OID of the namespace that contains this configuration
7077       </entry>
7078      </row>
7079
7080      <row>
7081       <entry><structfield>cfgowner</structfield></entry>
7082       <entry><type>oid</type></entry>
7083       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7084       <entry>Owner of the configuration</entry>
7085      </row>
7086
7087      <row>
7088       <entry><structfield>cfgparser</structfield></entry>
7089       <entry><type>oid</type></entry>
7090       <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
7091       <entry>The OID of the text search parser for this configuration</entry>
7092      </row>
7093     </tbody>
7094    </tgroup>
7095   </table>
7096  </sect1>
7097
7098
7099  <sect1 id="catalog-pg-ts-config-map">
7100   <title><structname>pg_ts_config_map</structname></title>
7101
7102   <indexterm zone="catalog-pg-ts-config-map">
7103    <primary>pg_ts_config_map</primary>
7104   </indexterm>
7105
7106   <para>
7107    The <structname>pg_ts_config_map</structname> catalog contains entries
7108    showing which text search dictionaries should be consulted, and in
7109    what order, for each output token type of each text search configuration's
7110    parser.
7111   </para>
7112
7113   <para>
7114    <productname>PostgreSQL</productname>'s text search features are
7115    described at length in <xref linkend="textsearch">.
7116   </para>
7117
7118   <table>
7119    <title><structname>pg_ts_config_map</> Columns</title>
7120
7121    <tgroup cols="4">
7122     <thead>
7123      <row>
7124       <entry>Name</entry>
7125       <entry>Type</entry>
7126       <entry>References</entry>
7127       <entry>Description</entry>
7128      </row>
7129     </thead>
7130
7131     <tbody>
7132      <row>
7133       <entry><structfield>mapcfg</structfield></entry>
7134       <entry><type>oid</type></entry>
7135       <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
7136       <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
7137      </row>
7138
7139      <row>
7140       <entry><structfield>maptokentype</structfield></entry>
7141       <entry><type>integer</type></entry>
7142       <entry></entry>
7143       <entry>A token type emitted by the configuration's parser</entry>
7144      </row>
7145
7146      <row>
7147       <entry><structfield>mapseqno</structfield></entry>
7148       <entry><type>integer</type></entry>
7149       <entry></entry>
7150       <entry>Order in which to consult this entry (lower
7151        <structfield>mapseqno</>s first)</entry>
7152      </row>
7153
7154      <row>
7155       <entry><structfield>mapdict</structfield></entry>
7156       <entry><type>oid</type></entry>
7157       <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
7158       <entry>The OID of the text search dictionary to consult</entry>
7159      </row>
7160     </tbody>
7161    </tgroup>
7162   </table>
7163  </sect1>
7164
7165
7166  <sect1 id="catalog-pg-ts-dict">
7167   <title><structname>pg_ts_dict</structname></title>
7168
7169   <indexterm zone="catalog-pg-ts-dict">
7170    <primary>pg_ts_dict</primary>
7171   </indexterm>
7172
7173   <para>
7174    The <structname>pg_ts_dict</structname> catalog contains entries
7175    defining text search dictionaries.  A dictionary depends on a text
7176    search template, which specifies all the implementation functions
7177    needed; the dictionary itself provides values for the user-settable
7178    parameters supported by the template.  This division of labor allows
7179    dictionaries to be created by unprivileged users.  The parameters
7180    are specified by a text string <structfield>dictinitoption</>,
7181    whose format and meaning vary depending on the template.
7182   </para>
7183
7184   <para>
7185    <productname>PostgreSQL</productname>'s text search features are
7186    described at length in <xref linkend="textsearch">.
7187   </para>
7188
7189   <table>
7190    <title><structname>pg_ts_dict</> Columns</title>
7191
7192    <tgroup cols="4">
7193     <thead>
7194      <row>
7195       <entry>Name</entry>
7196       <entry>Type</entry>
7197       <entry>References</entry>
7198       <entry>Description</entry>
7199      </row>
7200     </thead>
7201
7202     <tbody>
7203      <row>
7204       <entry><structfield>oid</structfield></entry>
7205       <entry><type>oid</type></entry>
7206       <entry></entry>
7207       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7208      </row>
7209
7210      <row>
7211       <entry><structfield>dictname</structfield></entry>
7212       <entry><type>name</type></entry>
7213       <entry></entry>
7214       <entry>Text search dictionary name</entry>
7215      </row>
7216
7217      <row>
7218       <entry><structfield>dictnamespace</structfield></entry>
7219       <entry><type>oid</type></entry>
7220       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7221       <entry>
7222        The OID of the namespace that contains this dictionary
7223       </entry>
7224      </row>
7225
7226      <row>
7227       <entry><structfield>dictowner</structfield></entry>
7228       <entry><type>oid</type></entry>
7229       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7230       <entry>Owner of the dictionary</entry>
7231      </row>
7232
7233      <row>
7234       <entry><structfield>dicttemplate</structfield></entry>
7235       <entry><type>oid</type></entry>
7236       <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
7237       <entry>The OID of the text search template for this dictionary</entry>
7238      </row>
7239
7240      <row>
7241       <entry><structfield>dictinitoption</structfield></entry>
7242       <entry><type>text</type></entry>
7243       <entry></entry>
7244       <entry>Initialization option string for the template</entry>
7245      </row>
7246     </tbody>
7247    </tgroup>
7248   </table>
7249  </sect1>
7250
7251
7252  <sect1 id="catalog-pg-ts-parser">
7253   <title><structname>pg_ts_parser</structname></title>
7254
7255   <indexterm zone="catalog-pg-ts-parser">
7256    <primary>pg_ts_parser</primary>
7257   </indexterm>
7258
7259   <para>
7260    The <structname>pg_ts_parser</structname> catalog contains entries
7261    defining text search parsers.  A parser is responsible for splitting
7262    input text into lexemes and assigning a token type to each lexeme.
7263    Since a parser must be implemented by C-language-level functions,
7264    creation of new parsers is restricted to database superusers.
7265   </para>
7266
7267   <para>
7268    <productname>PostgreSQL</productname>'s text search features are
7269    described at length in <xref linkend="textsearch">.
7270   </para>
7271
7272   <table>
7273    <title><structname>pg_ts_parser</> Columns</title>
7274
7275    <tgroup cols="4">
7276     <thead>
7277      <row>
7278       <entry>Name</entry>
7279       <entry>Type</entry>
7280       <entry>References</entry>
7281       <entry>Description</entry>
7282      </row>
7283     </thead>
7284
7285     <tbody>
7286      <row>
7287       <entry><structfield>oid</structfield></entry>
7288       <entry><type>oid</type></entry>
7289       <entry></entry>
7290       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7291      </row>
7292
7293      <row>
7294       <entry><structfield>prsname</structfield></entry>
7295       <entry><type>name</type></entry>
7296       <entry></entry>
7297       <entry>Text search parser name</entry>
7298      </row>
7299
7300      <row>
7301       <entry><structfield>prsnamespace</structfield></entry>
7302       <entry><type>oid</type></entry>
7303       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7304       <entry>
7305        The OID of the namespace that contains this parser
7306       </entry>
7307      </row>
7308
7309      <row>
7310       <entry><structfield>prsstart</structfield></entry>
7311       <entry><type>regproc</type></entry>
7312       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7313       <entry>OID of the parser's startup function</entry>
7314      </row>
7315
7316      <row>
7317       <entry><structfield>prstoken</structfield></entry>
7318       <entry><type>regproc</type></entry>
7319       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7320       <entry>OID of the parser's next-token function</entry>
7321      </row>
7322
7323      <row>
7324       <entry><structfield>prsend</structfield></entry>
7325       <entry><type>regproc</type></entry>
7326       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7327       <entry>OID of the parser's shutdown function</entry>
7328      </row>
7329
7330      <row>
7331       <entry><structfield>prsheadline</structfield></entry>
7332       <entry><type>regproc</type></entry>
7333       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7334       <entry>OID of the parser's headline function</entry>
7335      </row>
7336
7337      <row>
7338       <entry><structfield>prslextype</structfield></entry>
7339       <entry><type>regproc</type></entry>
7340       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7341       <entry>OID of the parser's lextype function</entry>
7342      </row>
7343     </tbody>
7344    </tgroup>
7345   </table>
7346  </sect1>
7347
7348
7349  <sect1 id="catalog-pg-ts-template">
7350   <title><structname>pg_ts_template</structname></title>
7351
7352   <indexterm zone="catalog-pg-ts-template">
7353    <primary>pg_ts_template</primary>
7354   </indexterm>
7355
7356   <para>
7357    The <structname>pg_ts_template</structname> catalog contains entries
7358    defining text search templates.  A template is the implementation
7359    skeleton for a class of text search dictionaries.
7360    Since a template must be implemented by C-language-level functions,
7361    creation of new templates is restricted to database superusers.
7362   </para>
7363
7364   <para>
7365    <productname>PostgreSQL</productname>'s text search features are
7366    described at length in <xref linkend="textsearch">.
7367   </para>
7368
7369   <table>
7370    <title><structname>pg_ts_template</> Columns</title>
7371
7372    <tgroup cols="4">
7373     <thead>
7374      <row>
7375       <entry>Name</entry>
7376       <entry>Type</entry>
7377       <entry>References</entry>
7378       <entry>Description</entry>
7379      </row>
7380     </thead>
7381
7382     <tbody>
7383      <row>
7384       <entry><structfield>oid</structfield></entry>
7385       <entry><type>oid</type></entry>
7386       <entry></entry>
7387       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7388      </row>
7389
7390      <row>
7391       <entry><structfield>tmplname</structfield></entry>
7392       <entry><type>name</type></entry>
7393       <entry></entry>
7394       <entry>Text search template name</entry>
7395      </row>
7396
7397      <row>
7398       <entry><structfield>tmplnamespace</structfield></entry>
7399       <entry><type>oid</type></entry>
7400       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7401       <entry>
7402        The OID of the namespace that contains this template
7403       </entry>
7404      </row>
7405
7406      <row>
7407       <entry><structfield>tmplinit</structfield></entry>
7408       <entry><type>regproc</type></entry>
7409       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7410       <entry>OID of the template's initialization function</entry>
7411      </row>
7412
7413      <row>
7414       <entry><structfield>tmpllexize</structfield></entry>
7415       <entry><type>regproc</type></entry>
7416       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7417       <entry>OID of the template's lexize function</entry>
7418      </row>
7419     </tbody>
7420    </tgroup>
7421   </table>
7422  </sect1>
7423
7424
7425  <sect1 id="catalog-pg-type">
7426   <title><structname>pg_type</structname></title>
7427
7428   <indexterm zone="catalog-pg-type">
7429    <primary>pg_type</primary>
7430   </indexterm>
7431
7432   <para>
7433    The catalog <structname>pg_type</structname> stores information about data
7434    types.  Base types and enum types (scalar types) are created with
7435    <xref linkend="sql-createtype">, and
7436    domains with
7437    <xref linkend="sql-createdomain">.
7438    A composite type is automatically created for each table in the database, to
7439    represent the row structure of the table.  It is also possible to create
7440    composite types with <command>CREATE TYPE AS</command>.
7441   </para>
7442
7443   <table>
7444    <title><structname>pg_type</> Columns</title>
7445
7446    <tgroup cols="4">
7447     <thead>
7448      <row>
7449       <entry>Name</entry>
7450       <entry>Type</entry>
7451       <entry>References</entry>
7452       <entry>Description</entry>
7453      </row>
7454     </thead>
7455
7456     <tbody>
7457      <row>
7458       <entry><structfield>oid</structfield></entry>
7459       <entry><type>oid</type></entry>
7460       <entry></entry>
7461       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7462      </row>
7463
7464      <row>
7465       <entry><structfield>typname</structfield></entry>
7466       <entry><type>name</type></entry>
7467       <entry></entry>
7468       <entry>Data type name</entry>
7469      </row>
7470
7471      <row>
7472       <entry><structfield>typnamespace</structfield></entry>
7473       <entry><type>oid</type></entry>
7474       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7475       <entry>
7476        The OID of the namespace that contains this type
7477       </entry>
7478      </row>
7479
7480      <row>
7481       <entry><structfield>typowner</structfield></entry>
7482       <entry><type>oid</type></entry>
7483       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7484       <entry>Owner of the type</entry>
7485      </row>
7486
7487      <row>
7488       <entry><structfield>typlen</structfield></entry>
7489       <entry><type>int2</type></entry>
7490       <entry></entry>
7491       <entry>
7492        For a fixed-size type, <structfield>typlen</structfield> is the number
7493        of bytes in the internal representation of the type.  But for a
7494        variable-length type, <structfield>typlen</structfield> is negative.
7495        -1 indicates a <quote>varlena</> type (one that has a length word),
7496        -2 indicates a null-terminated C string.
7497       </entry>
7498      </row>
7499
7500      <row>
7501       <entry><structfield>typbyval</structfield></entry>
7502       <entry><type>bool</type></entry>
7503       <entry></entry>
7504       <entry>
7505        <structfield>typbyval</structfield> determines whether internal
7506        routines pass a value of this type by value or by reference.
7507        <structfield>typbyval</structfield> had better be false if
7508        <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7509        where Datum is 8 bytes).
7510        Variable-length types are always passed by reference. Note that
7511        <structfield>typbyval</structfield> can be false even if the
7512        length would allow pass-by-value.
7513       </entry>
7514      </row>
7515
7516      <row>
7517       <entry><structfield>typtype</structfield></entry>
7518       <entry><type>char</type></entry>
7519       <entry></entry>
7520       <entry>
7521        <structfield>typtype</structfield> is
7522        <literal>b</literal> for a base type,
7523        <literal>c</literal> for a composite type (e.g., a table's row type),
7524        <literal>d</literal> for a domain,
7525        <literal>e</literal> for an enum type,
7526        <literal>p</literal> for a pseudo-type, or
7527        <literal>r</literal> for a range type.
7528        See also <structfield>typrelid</structfield> and
7529        <structfield>typbasetype</structfield>.
7530       </entry>
7531      </row>
7532
7533      <row>
7534       <entry><structfield>typcategory</structfield></entry>
7535       <entry><type>char</type></entry>
7536       <entry></entry>
7537       <entry>
7538        <structfield>typcategory</structfield> is an arbitrary classification
7539        of data types that is used by the parser to determine which implicit
7540        casts should be <quote>preferred</>.
7541        See <xref linkend="catalog-typcategory-table">.
7542       </entry>
7543      </row>
7544
7545      <row>
7546       <entry><structfield>typispreferred</structfield></entry>
7547       <entry><type>bool</type></entry>
7548       <entry></entry>
7549       <entry>
7550        True if the type is a preferred cast target within its
7551        <structfield>typcategory</structfield>
7552       </entry>
7553      </row>
7554
7555      <row>
7556       <entry><structfield>typisdefined</structfield></entry>
7557       <entry><type>bool</type></entry>
7558       <entry></entry>
7559       <entry>
7560        True if the type is defined, false if this is a placeholder
7561        entry for a not-yet-defined type.  When
7562        <structfield>typisdefined</structfield> is false, nothing
7563        except the type name, namespace, and OID can be relied on.
7564       </entry>
7565      </row>
7566
7567      <row>
7568       <entry><structfield>typdelim</structfield></entry>
7569       <entry><type>char</type></entry>
7570       <entry></entry>
7571       <entry>
7572        Character that separates two values of this type when parsing
7573        array input.  Note that the delimiter is associated with the array
7574        element data type, not the array data type.
7575       </entry>
7576      </row>
7577
7578      <row>
7579       <entry><structfield>typrelid</structfield></entry>
7580       <entry><type>oid</type></entry>
7581       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7582       <entry>
7583        If this is a composite type (see
7584        <structfield>typtype</structfield>), then this column points to
7585        the <structname>pg_class</structname> entry that defines the
7586        corresponding table.  (For a free-standing composite type, the
7587        <structname>pg_class</structname> entry doesn't really represent
7588        a table, but it is needed anyway for the type's
7589        <structname>pg_attribute</structname> entries to link to.)
7590        Zero for non-composite types.
7591       </entry>
7592      </row>
7593
7594      <row>
7595       <entry><structfield>typelem</structfield></entry>
7596       <entry><type>oid</type></entry>
7597       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7598       <entry>
7599        If <structfield>typelem</structfield> is not 0 then it
7600        identifies another row in <structname>pg_type</structname>.
7601        The current type can then be subscripted like an array yielding
7602        values of type <structfield>typelem</structfield>.  A
7603        <quote>true</quote> array type is variable length
7604        (<structfield>typlen</structfield> = -1),
7605        but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
7606        also have nonzero <structfield>typelem</structfield>, for example
7607        <type>name</type> and <type>point</type>.
7608        If a fixed-length type has a <structfield>typelem</structfield> then
7609        its internal representation must be some number of values of the
7610        <structfield>typelem</structfield> data type with no other data.
7611        Variable-length array types have a header defined by the array
7612        subroutines.
7613       </entry>
7614      </row>
7615
7616      <row>
7617       <entry><structfield>typarray</structfield></entry>
7618       <entry><type>oid</type></entry>
7619       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7620       <entry>
7621        If <structfield>typarray</structfield> is not 0 then it
7622        identifies another row in <structname>pg_type</structname>, which
7623        is the <quote>true</quote> array type having this type as element
7624       </entry>
7625      </row>
7626
7627      <row>
7628       <entry><structfield>typinput</structfield></entry>
7629       <entry><type>regproc</type></entry>
7630       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7631       <entry>Input conversion function (text format)</entry>
7632      </row>
7633
7634      <row>
7635       <entry><structfield>typoutput</structfield></entry>
7636       <entry><type>regproc</type></entry>
7637       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7638       <entry>Output conversion function (text format)</entry>
7639      </row>
7640
7641      <row>
7642       <entry><structfield>typreceive</structfield></entry>
7643       <entry><type>regproc</type></entry>
7644       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7645       <entry>Input conversion function (binary format), or 0 if none</entry>
7646      </row>
7647
7648      <row>
7649       <entry><structfield>typsend</structfield></entry>
7650       <entry><type>regproc</type></entry>
7651       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7652       <entry>Output conversion function (binary format), or 0 if none</entry>
7653      </row>
7654
7655      <row>
7656       <entry><structfield>typmodin</structfield></entry>
7657       <entry><type>regproc</type></entry>
7658       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7659       <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7660      </row>
7661
7662      <row>
7663       <entry><structfield>typmodout</structfield></entry>
7664       <entry><type>regproc</type></entry>
7665       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7666       <entry>Type modifier output function, or 0 to use the standard format</entry>
7667      </row>
7668
7669      <row>
7670       <entry><structfield>typanalyze</structfield></entry>
7671       <entry><type>regproc</type></entry>
7672       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7673       <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7674      </row>
7675
7676      <row>
7677       <entry><structfield>typalign</structfield></entry>
7678       <entry><type>char</type></entry>
7679       <entry></entry>
7680       <entry><para>
7681
7682        <structfield>typalign</structfield> is the alignment required
7683        when storing a value of this type.  It applies to storage on
7684        disk as well as most representations of the value inside
7685        <productname>PostgreSQL</>.
7686        When multiple values are stored consecutively, such
7687        as in the representation of a complete row on disk, padding is
7688        inserted before a datum of this type so that it begins on the
7689        specified boundary.  The alignment reference is the beginning
7690        of the first datum in the sequence.
7691       </para>
7692
7693       <para>
7694        Possible values are:
7695        <itemizedlist>
7696         <listitem>
7697          <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7698         </listitem>
7699         <listitem>
7700          <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7701         </listitem>
7702         <listitem>
7703          <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7704         </listitem>
7705         <listitem>
7706          <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7707         </listitem>
7708        </itemizedlist>
7709       </para><note>
7710        <para>
7711         For types used in system tables, it is critical that the size
7712         and alignment defined in <structname>pg_type</structname>
7713         agree with the way that the compiler will lay out the column in
7714         a structure representing a table row.
7715        </para>
7716       </note></entry>
7717      </row>
7718
7719      <row>
7720       <entry><structfield>typstorage</structfield></entry>
7721       <entry><type>char</type></entry>
7722       <entry></entry>
7723       <entry><para>
7724        <structfield>typstorage</structfield> tells for varlena
7725        types (those with <structfield>typlen</structfield> = -1) if
7726        the type is prepared for toasting and what the default strategy
7727        for attributes of this type should be.
7728        Possible values are
7729        <itemizedlist>
7730         <listitem>
7731          <para><literal>p</>: Value must always be stored plain.</para>
7732         </listitem>
7733         <listitem>
7734          <para>
7735           <literal>e</>: Value can be stored in a <quote>secondary</quote>
7736           relation (if relation has one, see
7737           <literal>pg_class.reltoastrelid</literal>).
7738          </para>
7739         </listitem>
7740         <listitem>
7741          <para><literal>m</>: Value can be stored compressed inline.</para>
7742         </listitem>
7743         <listitem>
7744          <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7745         </listitem>
7746        </itemizedlist>
7747        Note that <literal>m</> columns can also be moved out to secondary
7748        storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7749        moved first).
7750       </para></entry>
7751      </row>
7752
7753      <row>
7754       <entry><structfield>typnotnull</structfield></entry>
7755       <entry><type>bool</type></entry>
7756       <entry></entry>
7757       <entry><para>
7758        <structfield>typnotnull</structfield> represents a not-null
7759        constraint on a type.  Used for domains only.
7760       </para></entry>
7761      </row>
7762
7763      <row>
7764       <entry><structfield>typbasetype</structfield></entry>
7765       <entry><type>oid</type></entry>
7766       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7767       <entry><para>
7768        If this is a domain (see <structfield>typtype</structfield>), then
7769        <structfield>typbasetype</structfield> identifies the type that this
7770        one is based on.  Zero if this type is not a domain.
7771       </para></entry>
7772      </row>
7773
7774      <row>
7775       <entry><structfield>typtypmod</structfield></entry>
7776       <entry><type>int4</type></entry>
7777       <entry></entry>
7778       <entry><para>
7779        Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7780        to be applied to their base type (-1 if base type does not use a
7781        <literal>typmod</>).  -1 if this type is not a domain.
7782       </para></entry>
7783      </row>
7784
7785      <row>
7786       <entry><structfield>typndims</structfield></entry>
7787       <entry><type>int4</type></entry>
7788       <entry></entry>
7789       <entry><para>
7790        <structfield>typndims</structfield> is the number of array dimensions
7791        for a domain over an array (that is, <structfield>typbasetype</> is
7792        an array type).
7793        Zero for types other than domains over array types.
7794        </para></entry>
7795      </row>
7796
7797      <row>
7798       <entry><structfield>typcollation</structfield></entry>
7799       <entry><type>oid</type></entry>
7800       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7801       <entry><para>
7802        <structfield>typcollation</structfield> specifies the collation
7803        of the type.  If the type does not support collations, this will
7804        be zero.  A base type that supports collations will have
7805        <symbol>DEFAULT_COLLATION_OID</symbol> here.  A domain over a
7806        collatable type can have some other collation OID, if one was
7807        specified for the domain.
7808       </para></entry>
7809      </row>
7810
7811      <row>
7812       <entry><structfield>typdefaultbin</structfield></entry>
7813       <entry><type>pg_node_tree</type></entry>
7814       <entry></entry>
7815       <entry><para>
7816        If <structfield>typdefaultbin</> is not null, it is the
7817        <function>nodeToString()</function>
7818        representation of a default expression for the type.  This is
7819        only used for domains.
7820       </para></entry>
7821      </row>
7822
7823      <row>
7824       <entry><structfield>typdefault</structfield></entry>
7825       <entry><type>text</type></entry>
7826       <entry></entry>
7827       <entry><para>
7828        <structfield>typdefault</> is null if the type has no associated
7829        default value. If <structfield>typdefaultbin</> is not null,
7830        <structfield>typdefault</> must contain a human-readable version of the
7831        default expression represented by <structfield>typdefaultbin</>.  If
7832        <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7833        not, then <structfield>typdefault</> is the external representation of
7834        the type's default value, which can be fed to the type's input
7835        converter to produce a constant.
7836       </para></entry>
7837      </row>
7838
7839      <row>
7840       <entry><structfield>typacl</structfield></entry>
7841       <entry><type>aclitem[]</type></entry>
7842       <entry></entry>
7843       <entry>
7844        Access privileges; see
7845        <xref linkend="sql-grant"> and
7846        <xref linkend="sql-revoke">
7847        for details
7848       </entry>
7849      </row>
7850     </tbody>
7851    </tgroup>
7852   </table>
7853
7854   <para>
7855    <xref linkend="catalog-typcategory-table"> lists the system-defined values
7856    of <structfield>typcategory</>.  Any future additions to this list will
7857    also be upper-case ASCII letters.  All other ASCII characters are reserved
7858    for user-defined categories.
7859   </para>
7860
7861   <table id="catalog-typcategory-table">
7862    <title><structfield>typcategory</> Codes</title>
7863
7864    <tgroup cols="2">
7865     <thead>
7866      <row>
7867       <entry>Code</entry>
7868       <entry>Category</entry>
7869      </row>
7870     </thead>
7871
7872     <tbody>
7873      <row>
7874       <entry><literal>A</literal></entry>
7875       <entry>Array types</entry>
7876      </row>
7877      <row>
7878       <entry><literal>B</literal></entry>
7879       <entry>Boolean types</entry>
7880      </row>
7881      <row>
7882       <entry><literal>C</literal></entry>
7883       <entry>Composite types</entry>
7884      </row>
7885      <row>
7886       <entry><literal>D</literal></entry>
7887       <entry>Date/time types</entry>
7888      </row>
7889      <row>
7890       <entry><literal>E</literal></entry>
7891       <entry>Enum types</entry>
7892      </row>
7893      <row>
7894       <entry><literal>G</literal></entry>
7895       <entry>Geometric types</entry>
7896      </row>
7897      <row>
7898       <entry><literal>I</literal></entry>
7899       <entry>Network address types</entry>
7900      </row>
7901      <row>
7902       <entry><literal>N</literal></entry>
7903       <entry>Numeric types</entry>
7904      </row>
7905      <row>
7906       <entry><literal>P</literal></entry>
7907       <entry>Pseudo-types</entry>
7908      </row>
7909      <row>
7910       <entry><literal>R</literal></entry>
7911       <entry>Range types</entry>
7912      </row>
7913      <row>
7914       <entry><literal>S</literal></entry>
7915       <entry>String types</entry>
7916      </row>
7917      <row>
7918       <entry><literal>T</literal></entry>
7919       <entry>Timespan types</entry>
7920      </row>
7921      <row>
7922       <entry><literal>U</literal></entry>
7923       <entry>User-defined types</entry>
7924      </row>
7925      <row>
7926       <entry><literal>V</literal></entry>
7927       <entry>Bit-string types</entry>
7928      </row>
7929      <row>
7930       <entry><literal>X</literal></entry>
7931       <entry><type>unknown</> type</entry>
7932      </row>
7933     </tbody>
7934    </tgroup>
7935   </table>
7936
7937  </sect1>
7938
7939
7940  <sect1 id="catalog-pg-user-mapping">
7941   <title><structname>pg_user_mapping</structname></title>
7942
7943   <indexterm zone="catalog-pg-user-mapping">
7944    <primary>pg_user_mapping</primary>
7945   </indexterm>
7946
7947   <para>
7948    The catalog <structname>pg_user_mapping</structname> stores
7949    the mappings from local user to remote.  Access to this catalog is
7950    restricted from normal users, use the view
7951    <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7952    instead.
7953   </para>
7954
7955   <table>
7956    <title><structname>pg_user_mapping</> Columns</title>
7957
7958    <tgroup cols="4">
7959     <thead>
7960      <row>
7961       <entry>Name</entry>
7962       <entry>Type</entry>
7963       <entry>References</entry>
7964       <entry>Description</entry>
7965      </row>
7966     </thead>
7967
7968     <tbody>
7969      <row>
7970       <entry><structfield>oid</structfield></entry>
7971       <entry><type>oid</type></entry>
7972       <entry></entry>
7973       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7974      </row>
7975
7976      <row>
7977       <entry><structfield>umuser</structfield></entry>
7978       <entry><type>oid</type></entry>
7979       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7980       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7981      </row>
7982
7983      <row>
7984       <entry><structfield>umserver</structfield></entry>
7985       <entry><type>oid</type></entry>
7986       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7987       <entry>
7988        The OID of the foreign server that contains this mapping
7989       </entry>
7990      </row>
7991
7992      <row>
7993       <entry><structfield>umoptions</structfield></entry>
7994       <entry><type>text[]</type></entry>
7995       <entry></entry>
7996       <entry>
7997        User mapping specific options, as <quote>keyword=value</> strings
7998       </entry>
7999      </row>
8000     </tbody>
8001    </tgroup>
8002   </table>
8003  </sect1>
8004
8005
8006  <sect1 id="views-overview">
8007   <title>System Views</title>
8008
8009   <para>
8010    In addition to the system catalogs, <productname>PostgreSQL</productname>
8011    provides a number of built-in views.  Some system views provide convenient
8012    access to some commonly used queries on the system catalogs.  Other views
8013    provide access to internal server state.
8014   </para>
8015
8016   <para>
8017    The information schema (<xref linkend="information-schema">) provides
8018    an alternative set of views which overlap the functionality of the system
8019    views.  Since the information schema is SQL-standard whereas the views
8020    described here are <productname>PostgreSQL</productname>-specific,
8021    it's usually better to use the information schema if it provides all
8022    the information you need.
8023   </para>
8024
8025   <para>
8026    <xref linkend="view-table"> lists the system views described here.
8027    More detailed documentation of each view follows below.
8028    There are some additional views that provide access to the results of
8029    the statistics collector; they are described in <xref
8030    linkend="monitoring-stats-views-table">.
8031   </para>
8032
8033   <para>
8034    Except where noted, all the views described here are read-only.
8035   </para>
8036
8037   <table id="view-table">
8038    <title>System Views</title>
8039
8040    <tgroup cols="2">
8041     <thead>
8042      <row>
8043       <entry>View Name</entry>
8044       <entry>Purpose</entry>
8045      </row>
8046     </thead>
8047
8048     <tbody>
8049      <row>
8050       <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
8051       <entry>available extensions</entry>
8052      </row>
8053
8054      <row>
8055       <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
8056       <entry>available versions of extensions</entry>
8057      </row>
8058
8059      <row>
8060       <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
8061       <entry>compile-time configuration parameters</entry>
8062      </row>
8063
8064      <row>
8065       <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
8066       <entry>open cursors</entry>
8067      </row>
8068
8069      <row>
8070       <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
8071       <entry>summary of configuration file contents</entry>
8072      </row>
8073
8074      <row>
8075       <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
8076       <entry>groups of database users</entry>
8077      </row>
8078
8079      <row>
8080       <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
8081       <entry>summary of client authentication configuration file contents</entry>
8082      </row>
8083
8084      <row>
8085       <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
8086       <entry>indexes</entry>
8087      </row>
8088
8089      <row>
8090       <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
8091       <entry>locks currently held or awaited</entry>
8092      </row>
8093
8094      <row>
8095       <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
8096       <entry>materialized views</entry>
8097      </row>
8098
8099      <row>
8100       <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
8101       <entry>policies</entry>
8102      </row>
8103
8104      <row>
8105       <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
8106       <entry>prepared statements</entry>
8107      </row>
8108
8109      <row>
8110       <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
8111       <entry>prepared transactions</entry>
8112      </row>
8113
8114      <row>
8115       <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
8116       <entry>publications and their associated tables</entry>
8117      </row>
8118
8119      <row>
8120       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
8121       <entry>information about replication origins, including replication progress</entry>
8122      </row>
8123
8124      <row>
8125       <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
8126       <entry>replication slot information</entry>
8127      </row>
8128
8129      <row>
8130       <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
8131       <entry>database roles</entry>
8132      </row>
8133
8134      <row>
8135       <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
8136       <entry>rules</entry>
8137      </row>
8138
8139      <row>
8140       <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
8141       <entry>security labels</entry>
8142      </row>
8143
8144      <row>
8145       <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
8146       <entry>sequences</entry>
8147      </row>
8148
8149      <row>
8150       <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
8151       <entry>parameter settings</entry>
8152      </row>
8153
8154      <row>
8155       <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
8156       <entry>database users</entry>
8157      </row>
8158
8159      <row>
8160       <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
8161       <entry>planner statistics</entry>
8162      </row>
8163
8164      <row>
8165       <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
8166       <entry>tables</entry>
8167      </row>
8168
8169      <row>
8170       <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
8171       <entry>time zone abbreviations</entry>
8172      </row>
8173
8174      <row>
8175       <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
8176       <entry>time zone names</entry>
8177      </row>
8178
8179      <row>
8180       <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
8181       <entry>database users</entry>
8182      </row>
8183
8184      <row>
8185       <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
8186       <entry>user mappings</entry>
8187      </row>
8188
8189      <row>
8190       <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
8191       <entry>views</entry>
8192      </row>
8193
8194     </tbody>
8195    </tgroup>
8196   </table>
8197  </sect1>
8198
8199  <sect1 id="view-pg-available-extensions">
8200   <title><structname>pg_available_extensions</structname></title>
8201
8202   <indexterm zone="view-pg-available-extensions">
8203    <primary>pg_available_extensions</primary>
8204   </indexterm>
8205
8206   <para>
8207    The <structname>pg_available_extensions</structname> view lists the
8208    extensions that are available for installation.
8209    See also the
8210    <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8211    catalog, which shows the extensions currently installed.
8212   </para>
8213
8214   <table>
8215    <title><structname>pg_available_extensions</> Columns</title>
8216
8217    <tgroup cols="3">
8218     <thead>
8219      <row>
8220       <entry>Name</entry>
8221       <entry>Type</entry>
8222       <entry>Description</entry>
8223      </row>
8224     </thead>
8225
8226     <tbody>
8227      <row>
8228       <entry><structfield>name</structfield></entry>
8229       <entry><type>name</type></entry>
8230       <entry>Extension name</entry>
8231      </row>
8232
8233      <row>
8234       <entry><structfield>default_version</structfield></entry>
8235       <entry><type>text</type></entry>
8236       <entry>Name of default version, or <literal>NULL</literal> if none is
8237        specified</entry>
8238      </row>
8239
8240      <row>
8241       <entry><structfield>installed_version</structfield></entry>
8242       <entry><type>text</type></entry>
8243       <entry>Currently installed version of the extension,
8244        or <literal>NULL</literal> if not installed</entry>
8245      </row>
8246
8247      <row>
8248       <entry><structfield>comment</structfield></entry>
8249       <entry><type>text</type></entry>
8250       <entry>Comment string from the extension's control file</entry>
8251      </row>
8252     </tbody>
8253    </tgroup>
8254   </table>
8255
8256   <para>
8257    The <structname>pg_available_extensions</structname> view is read only.
8258   </para>
8259  </sect1>
8260
8261  <sect1 id="view-pg-available-extension-versions">
8262   <title><structname>pg_available_extension_versions</structname></title>
8263
8264   <indexterm zone="view-pg-available-extension-versions">
8265    <primary>pg_available_extension_versions</primary>
8266   </indexterm>
8267
8268   <para>
8269    The <structname>pg_available_extension_versions</structname> view lists the
8270    specific extension versions that are available for installation.
8271    See also the <link
8272    linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8273    catalog, which shows the extensions currently installed.
8274   </para>
8275
8276   <table>
8277    <title><structname>pg_available_extension_versions</> Columns</title>
8278
8279    <tgroup cols="3">
8280     <thead>
8281      <row>
8282       <entry>Name</entry>
8283       <entry>Type</entry>
8284       <entry>Description</entry>
8285      </row>
8286     </thead>
8287
8288     <tbody>
8289      <row>
8290       <entry><structfield>name</structfield></entry>
8291       <entry><type>name</type></entry>
8292       <entry>Extension name</entry>
8293      </row>
8294
8295      <row>
8296       <entry><structfield>version</structfield></entry>
8297       <entry><type>text</type></entry>
8298       <entry>Version name</entry>
8299      </row>
8300
8301      <row>
8302       <entry><structfield>installed</structfield></entry>
8303       <entry><type>bool</type></entry>
8304       <entry>True if this version of this extension is currently
8305        installed</entry>
8306      </row>
8307
8308      <row>
8309       <entry><structfield>superuser</structfield></entry>
8310       <entry><type>bool</type></entry>
8311       <entry>True if only superusers are allowed to install this extension</entry>
8312      </row>
8313
8314      <row>
8315       <entry><structfield>relocatable</structfield></entry>
8316       <entry><type>bool</type></entry>
8317       <entry>True if extension can be relocated to another schema</entry>
8318      </row>
8319
8320      <row>
8321       <entry><structfield>schema</structfield></entry>
8322       <entry><type>name</type></entry>
8323       <entry>Name of the schema that the extension must be installed into,
8324        or <literal>NULL</literal> if partially or fully relocatable</entry>
8325      </row>
8326
8327      <row>
8328       <entry><structfield>requires</structfield></entry>
8329       <entry><type>name[]</type></entry>
8330       <entry>Names of prerequisite extensions,
8331        or <literal>NULL</literal> if none</entry>
8332      </row>
8333
8334      <row>
8335       <entry><structfield>comment</structfield></entry>
8336       <entry><type>text</type></entry>
8337       <entry>Comment string from the extension's control file</entry>
8338      </row>
8339     </tbody>
8340    </tgroup>
8341   </table>
8342
8343   <para>
8344    The <structname>pg_available_extension_versions</structname> view is read
8345    only.
8346   </para>
8347  </sect1>
8348
8349  <sect1 id="view-pg-config">
8350   <title><structname>pg_config</structname></title>
8351
8352   <indexterm zone="view-pg-config">
8353    <primary>pg_config</primary>
8354   </indexterm>
8355
8356   <para>
8357    The view <structname>pg_config</structname> describes the
8358    compile-time configuration parameters of the currently installed
8359    version of <productname>PostgreSQL</>. It is intended, for example, to
8360    be used by software packages that want to interface to
8361    <productname>PostgreSQL</> to facilitate finding the required header
8362    files and libraries. It provides the same basic information as the
8363    <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
8364    application.
8365   </para>
8366
8367   <para>
8368    By default, the <structname>pg_config</structname> view can be read
8369    only by superusers.
8370   </para>
8371
8372   <table>
8373    <title><structname>pg_config</> Columns</title>
8374    <tgroup cols="3">
8375     <thead>
8376      <row>
8377       <entry>Name</entry>
8378       <entry>Type</entry>
8379       <entry>Description</entry>
8380      </row>
8381     </thead>
8382
8383     <tbody>
8384      <row>
8385       <entry><structfield>name</structfield></entry>
8386       <entry><type>text</type></entry>
8387       <entry>The parameter name</entry>
8388      </row>
8389
8390      <row>
8391       <entry><structfield>setting</structfield></entry>
8392       <entry><type>text</type></entry>
8393       <entry>The parameter value</entry>
8394      </row>
8395     </tbody>
8396    </tgroup>
8397   </table>
8398
8399  </sect1>
8400
8401  <sect1 id="view-pg-cursors">
8402   <title><structname>pg_cursors</structname></title>
8403
8404   <indexterm zone="view-pg-cursors">
8405    <primary>pg_cursors</primary>
8406   </indexterm>
8407
8408   <para>
8409    The <structname>pg_cursors</structname> view lists the cursors that
8410    are currently available. Cursors can be defined in several ways:
8411    <itemizedlist>
8412     <listitem>
8413      <para>
8414       via the <xref linkend="sql-declare">
8415       statement in SQL
8416      </para>
8417     </listitem>
8418
8419     <listitem>
8420      <para>
8421       via the Bind message in the frontend/backend protocol, as
8422       described in <xref linkend="protocol-flow-ext-query">
8423      </para>
8424     </listitem>
8425
8426     <listitem>
8427      <para>
8428       via the Server Programming Interface (SPI), as described in
8429       <xref linkend="spi-interface">
8430      </para>
8431     </listitem>
8432    </itemizedlist>
8433
8434    The <structname>pg_cursors</structname> view displays cursors
8435    created by any of these means. Cursors only exist for the duration
8436    of the transaction that defines them, unless they have been
8437    declared <literal>WITH HOLD</literal>. Therefore non-holdable
8438    cursors are only present in the view until the end of their
8439    creating transaction.
8440
8441    <note>
8442     <para>
8443      Cursors are used internally to implement some of the components
8444      of <productname>PostgreSQL</>, such as procedural languages.
8445      Therefore, the <structname>pg_cursors</> view might include cursors
8446      that have not been explicitly created by the user.
8447     </para>
8448    </note>
8449   </para>
8450
8451   <table>
8452    <title><structname>pg_cursors</> Columns</title>
8453
8454    <tgroup cols="3">
8455     <thead>
8456      <row>
8457       <entry>Name</entry>
8458       <entry>Type</entry>
8459       <entry>Description</entry>
8460      </row>
8461     </thead>
8462
8463     <tbody>
8464      <row>
8465       <entry><structfield>name</structfield></entry>
8466       <entry><type>text</type></entry>
8467       <entry>The name of the cursor</entry>
8468      </row>
8469
8470      <row>
8471       <entry><structfield>statement</structfield></entry>
8472       <entry><type>text</type></entry>
8473       <entry>The verbatim query string submitted to declare this cursor</entry>
8474      </row>
8475
8476      <row>
8477       <entry><structfield>is_holdable</structfield></entry>
8478       <entry><type>boolean</type></entry>
8479       <entry>
8480        <literal>true</literal> if the cursor is holdable (that is, it
8481        can be accessed after the transaction that declared the cursor
8482        has committed); <literal>false</literal> otherwise
8483        </entry>
8484      </row>
8485
8486      <row>
8487       <entry><structfield>is_binary</structfield></entry>
8488       <entry><type>boolean</type></entry>
8489       <entry>
8490        <literal>true</literal> if the cursor was declared
8491        <literal>BINARY</literal>; <literal>false</literal>
8492        otherwise
8493        </entry>
8494      </row>
8495
8496      <row>
8497       <entry><structfield>is_scrollable</structfield></entry>
8498       <entry><type>boolean</type></entry>
8499       <entry>
8500        <literal>true</> if the cursor is scrollable (that is, it
8501        allows rows to be retrieved in a nonsequential manner);
8502        <literal>false</literal> otherwise
8503        </entry>
8504      </row>
8505
8506      <row>
8507       <entry><structfield>creation_time</structfield></entry>
8508       <entry><type>timestamptz</type></entry>
8509       <entry>The time at which the cursor was declared</entry>
8510      </row>
8511     </tbody>
8512    </tgroup>
8513   </table>
8514
8515   <para>
8516    The <structname>pg_cursors</structname> view is read only.
8517   </para>
8518
8519  </sect1>
8520
8521  <sect1 id="view-pg-file-settings">
8522   <title><structname>pg_file_settings</structname></title>
8523
8524   <indexterm zone="view-pg-file-settings">
8525    <primary>pg_file_settings</primary>
8526   </indexterm>
8527
8528   <para>
8529    The view <structname>pg_file_settings</structname> provides a summary of
8530    the contents of the server's configuration file(s).  A row appears in
8531    this view for each <quote>name = value</> entry appearing in the files,
8532    with annotations indicating whether the value could be applied
8533    successfully.  Additional row(s) may appear for problems not linked to
8534    a <quote>name = value</> entry, such as syntax errors in the files.
8535   </para>
8536
8537   <para>
8538    This view is helpful for checking whether planned changes in the
8539    configuration files will work, or for diagnosing a previous failure.
8540    Note that this view reports on the <emphasis>current</> contents of the
8541    files, not on what was last applied by the server.  (The
8542    <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
8543    view is usually sufficient to determine that.)
8544   </para>
8545
8546   <para>
8547    By default, the <structname>pg_file_settings</structname> view can be read
8548    only by superusers.
8549   </para>
8550
8551   <table>
8552    <title><structname>pg_file_settings</> Columns</title>
8553
8554   <tgroup cols="3">
8555    <thead>
8556     <row>
8557      <entry>Name</entry>
8558      <entry>Type</entry>
8559      <entry>Description</entry>
8560     </row>
8561    </thead>
8562    <tbody>
8563     <row>
8564      <entry><structfield>sourcefile</structfield></entry>
8565      <entry><structfield>text</structfield></entry>
8566      <entry>Full path name of the configuration file</entry>
8567     </row>
8568     <row>
8569      <entry><structfield>sourceline</structfield></entry>
8570      <entry><structfield>integer</structfield></entry>
8571      <entry>
8572       Line number within the configuration file where the entry appears
8573      </entry>
8574     </row>
8575     <row>
8576      <entry><structfield>seqno</structfield></entry>
8577      <entry><structfield>integer</structfield></entry>
8578      <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
8579     </row>
8580     <row>
8581      <entry><structfield>name</structfield></entry>
8582      <entry><structfield>text</structfield></entry>
8583      <entry>Configuration parameter name</entry>
8584     </row>
8585     <row>
8586      <entry><structfield>setting</structfield></entry>
8587      <entry><structfield>text</structfield></entry>
8588      <entry>Value to be assigned to the parameter</entry>
8589     </row>
8590     <row>
8591      <entry><structfield>applied</structfield></entry>
8592      <entry><structfield>boolean</structfield></entry>
8593      <entry>True if the value can be applied successfully</entry>
8594     </row>
8595     <row>
8596      <entry><structfield>error</structfield></entry>
8597      <entry><structfield>text</structfield></entry>
8598      <entry>If not null, an error message indicating why this entry could
8599       not be applied</entry>
8600     </row>
8601    </tbody>
8602   </tgroup>
8603   </table>
8604
8605   <para>
8606    If the configuration file contains syntax errors or invalid parameter
8607    names, the server will not attempt to apply any settings from it, and
8608    therefore all the <structfield>applied</> fields will read as false.
8609    In such a case there will be one or more rows with
8610    non-null <structfield>error</structfield> fields indicating the
8611    problem(s).  Otherwise, individual settings will be applied if possible.
8612    If an individual setting cannot be applied (e.g., invalid value, or the
8613    setting cannot be changed after server start) it will have an appropriate
8614    message in the <structfield>error</structfield> field.  Another way that
8615    an entry might have <structfield>applied</> = false is that it is
8616    overridden by a later entry for the same parameter name; this case is not
8617    considered an error so nothing appears in
8618    the <structfield>error</structfield> field.
8619   </para>
8620
8621   <para>
8622    See <xref linkend="config-setting"> for more information about the various
8623    ways to change run-time parameters.
8624   </para>
8625
8626 </sect1>
8627
8628  <sect1 id="view-pg-group">
8629   <title><structname>pg_group</structname></title>
8630
8631   <indexterm zone="view-pg-group">
8632    <primary>pg_group</primary>
8633   </indexterm>
8634
8635   <para>
8636    The view <structname>pg_group</structname> exists for backwards
8637    compatibility: it emulates a catalog that existed in
8638    <productname>PostgreSQL</productname> before version 8.1.
8639    It shows the names and members of all roles that are marked as not
8640    <structfield>rolcanlogin</>, which is an approximation to the set
8641    of roles that are being used as groups.
8642   </para>
8643
8644   <table>
8645    <title><structname>pg_group</> Columns</title>
8646
8647    <tgroup cols="4">
8648     <thead>
8649      <row>
8650       <entry>Name</entry>
8651       <entry>Type</entry>
8652       <entry>References</entry>
8653       <entry>Description</entry>
8654      </row>
8655     </thead>
8656
8657     <tbody>
8658      <row>
8659       <entry><structfield>groname</structfield></entry>
8660       <entry><type>name</type></entry>
8661       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8662       <entry>Name of the group</entry>
8663      </row>
8664
8665      <row>
8666       <entry><structfield>grosysid</structfield></entry>
8667       <entry><type>oid</type></entry>
8668       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8669       <entry>ID of this group</entry>
8670      </row>
8671
8672      <row>
8673       <entry><structfield>grolist</structfield></entry>
8674       <entry><type>oid[]</type></entry>
8675       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8676       <entry>An array containing the IDs of the roles in this group</entry>
8677      </row>
8678     </tbody>
8679    </tgroup>
8680   </table>
8681
8682  </sect1>
8683
8684  <sect1 id="view-pg-hba-file-rules">
8685   <title><structname>pg_hba_file_rules</structname></title>
8686
8687   <indexterm zone="view-pg-hba-file-rules">
8688    <primary>pg_hba_file_rules</primary>
8689   </indexterm>
8690
8691   <para>
8692    The view <structname>pg_hba_file_rules</structname> provides a summary of
8693    the contents of the client authentication configuration
8694    file, <filename>pg_hba.conf</>.  A row appears in this view for each
8695    non-empty, non-comment line in the file, with annotations indicating
8696    whether the rule could be applied successfully.
8697   </para>
8698
8699   <para>
8700    This view can be helpful for checking whether planned changes in the
8701    authentication configuration file will work, or for diagnosing a previous
8702    failure.  Note that this view reports on the <emphasis>current</> contents
8703    of the file, not on what was last loaded by the server.
8704   </para>
8705
8706   <para>
8707    By default, the <structname>pg_hba_file_rules</structname> view can be read
8708    only by superusers.
8709   </para>
8710
8711   <table>
8712    <title><structname>pg_hba_file_rules</> Columns</title>
8713
8714   <tgroup cols="3">
8715    <thead>
8716     <row>
8717      <entry>Name</entry>
8718      <entry>Type</entry>
8719      <entry>Description</entry>
8720     </row>
8721    </thead>
8722    <tbody>
8723     <row>
8724      <entry><structfield>line_number</structfield></entry>
8725      <entry><structfield>integer</structfield></entry>
8726      <entry>
8727       Line number of this rule in <filename>pg_hba.conf</>
8728      </entry>
8729     </row>
8730     <row>
8731      <entry><structfield>type</structfield></entry>
8732      <entry><structfield>text</structfield></entry>
8733      <entry>Type of connection</entry>
8734     </row>
8735     <row>
8736      <entry><structfield>database</structfield></entry>
8737      <entry><structfield>text[]</structfield></entry>
8738      <entry>List of database name(s) to which this rule applies</entry>
8739     </row>
8740     <row>
8741      <entry><structfield>user_name</structfield></entry>
8742      <entry><structfield>text[]</structfield></entry>
8743      <entry>List of user and group name(s) to which this rule applies</entry>
8744     </row>
8745     <row>
8746      <entry><structfield>address</structfield></entry>
8747      <entry><structfield>text</structfield></entry>
8748      <entry>
8749       Host name or IP address, or one
8750       of <literal>all</literal>, <literal>samehost</literal>,
8751       or <literal>samenet</literal>, or null for local connections
8752      </entry>
8753     </row>
8754     <row>
8755      <entry><structfield>netmask</structfield></entry>
8756      <entry><structfield>text</structfield></entry>
8757      <entry>IP address mask, or null if not applicable</entry>
8758     </row>
8759     <row>
8760      <entry><structfield>auth_method</structfield></entry>
8761      <entry><type>text</type></entry>
8762      <entry>Authentication method</entry>
8763     </row>
8764     <row>
8765      <entry><structfield>options</structfield></entry>
8766      <entry><type>text[]</type></entry>
8767      <entry>Options specified for authentication method, if any</entry>
8768     </row>
8769     <row>
8770      <entry><structfield>error</structfield></entry>
8771      <entry><structfield>text</structfield></entry>
8772      <entry>
8773       If not null, an error message indicating why this
8774       line could not be processed
8775      </entry>
8776     </row>
8777    </tbody>
8778   </tgroup>
8779   </table>
8780
8781   <para>
8782    Usually, a row reflecting an incorrect entry will have values for only
8783    the <structfield>line_number</> and <structfield>error</> fields.
8784   </para>
8785
8786   <para>
8787    See <xref linkend="client-authentication"> for more information about
8788    client authentication configuration.
8789   </para>
8790  </sect1>
8791
8792  <sect1 id="view-pg-indexes">
8793   <title><structname>pg_indexes</structname></title>
8794
8795   <indexterm zone="view-pg-indexes">
8796    <primary>pg_indexes</primary>
8797   </indexterm>
8798
8799   <para>
8800    The view <structname>pg_indexes</structname> provides access to
8801    useful information about each index in the database.
8802   </para>
8803
8804   <table>
8805    <title><structname>pg_indexes</> Columns</title>
8806
8807    <tgroup cols="4">
8808     <thead>
8809      <row>
8810       <entry>Name</entry>
8811       <entry>Type</entry>
8812       <entry>References</entry>
8813       <entry>Description</entry>
8814      </row>
8815     </thead>
8816     <tbody>
8817      <row>
8818       <entry><structfield>schemaname</structfield></entry>
8819       <entry><type>name</type></entry>
8820       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8821       <entry>Name of schema containing table and index</entry>
8822      </row>
8823      <row>
8824       <entry><structfield>tablename</structfield></entry>
8825       <entry><type>name</type></entry>
8826       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8827       <entry>Name of table the index is for</entry>
8828      </row>
8829      <row>
8830       <entry><structfield>indexname</structfield></entry>
8831       <entry><type>name</type></entry>
8832       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8833       <entry>Name of index</entry>
8834      </row>
8835      <row>
8836       <entry><structfield>tablespace</structfield></entry>
8837       <entry><type>name</type></entry>
8838       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8839       <entry>Name of tablespace containing index (null if default for database)</entry>
8840      </row>
8841      <row>
8842       <entry><structfield>indexdef</structfield></entry>
8843       <entry><type>text</type></entry>
8844       <entry></entry>
8845       <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8846       command)</entry>
8847      </row>
8848     </tbody>
8849    </tgroup>
8850   </table>
8851
8852  </sect1>
8853
8854  <sect1 id="view-pg-locks">
8855   <title><structname>pg_locks</structname></title>
8856
8857   <indexterm zone="view-pg-locks">
8858    <primary>pg_locks</primary>
8859   </indexterm>
8860
8861   <para>
8862    The view <structname>pg_locks</structname> provides access to
8863    information about the locks held by active processes within the
8864    database server.  See <xref linkend="mvcc"> for more discussion
8865    of locking.
8866   </para>
8867
8868   <para>
8869    <structname>pg_locks</structname> contains one row per active lockable
8870    object, requested lock mode, and relevant process.  Thus, the same
8871    lockable object might
8872    appear many times, if multiple processes are holding or waiting
8873    for locks on it.  However, an object that currently has no locks on it
8874    will not appear at all.
8875   </para>
8876
8877   <para>
8878    There are several distinct types of lockable objects:
8879    whole relations (e.g., tables), individual pages of relations,
8880    individual tuples of relations,
8881    transaction IDs (both virtual and permanent IDs),
8882    and general database objects (identified by class OID and object OID,
8883    in the same way as in <structname>pg_description</structname> or
8884    <structname>pg_depend</structname>).  Also, the right to extend a
8885    relation is represented as a separate lockable object.
8886    Also, <quote>advisory</> locks can be taken on numbers that have
8887    user-defined meanings.
8888   </para>
8889
8890   <table>
8891    <title><structname>pg_locks</> Columns</title>
8892
8893    <tgroup cols="4">
8894     <thead>
8895      <row>
8896       <entry>Name</entry>
8897       <entry>Type</entry>
8898       <entry>References</entry>
8899       <entry>Description</entry>
8900      </row>
8901     </thead>
8902     <tbody>
8903      <row>
8904       <entry><structfield>locktype</structfield></entry>
8905       <entry><type>text</type></entry>
8906       <entry></entry>
8907       <entry>
8908        Type of the lockable object:
8909        <literal>relation</>,
8910        <literal>extend</>,
8911        <literal>page</>,
8912        <literal>tuple</>,
8913        <literal>transactionid</>,
8914        <literal>virtualxid</>,
8915        <literal>object</>,
8916        <literal>userlock</>, or
8917        <literal>advisory</>
8918       </entry>
8919      </row>
8920      <row>
8921       <entry><structfield>database</structfield></entry>
8922       <entry><type>oid</type></entry>
8923       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8924       <entry>
8925        OID of the database in which the lock target exists, or
8926        zero if the target is a shared object, or
8927        null if the target is a transaction ID
8928       </entry>
8929      </row>
8930      <row>
8931       <entry><structfield>relation</structfield></entry>
8932       <entry><type>oid</type></entry>
8933       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8934       <entry>
8935        OID of the relation targeted by the lock, or null if the target is not
8936        a relation or part of a relation
8937       </entry>
8938      </row>
8939      <row>
8940       <entry><structfield>page</structfield></entry>
8941       <entry><type>integer</type></entry>
8942       <entry></entry>
8943       <entry>
8944        Page number targeted by the lock within the relation,
8945        or null if the target is not a relation page or tuple
8946       </entry>
8947      </row>
8948      <row>
8949       <entry><structfield>tuple</structfield></entry>
8950       <entry><type>smallint</type></entry>
8951       <entry></entry>
8952       <entry>
8953        Tuple number targeted by the lock within the page,
8954        or null if the target is not a tuple
8955       </entry>
8956      </row>
8957      <row>
8958       <entry><structfield>virtualxid</structfield></entry>
8959       <entry><type>text</type></entry>
8960       <entry></entry>
8961       <entry>
8962        Virtual ID of the transaction targeted by the lock,
8963        or null if the target is not a virtual transaction ID
8964       </entry>
8965      </row>
8966      <row>
8967       <entry><structfield>transactionid</structfield></entry>
8968       <entry><type>xid</type></entry>
8969       <entry></entry>
8970       <entry>
8971        ID of the transaction targeted by the lock,
8972        or null if the target is not a transaction ID
8973       </entry>
8974      </row>
8975      <row>
8976       <entry><structfield>classid</structfield></entry>
8977       <entry><type>oid</type></entry>
8978       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8979       <entry>
8980        OID of the system catalog containing the lock target, or null if the
8981        target is not a general database object
8982       </entry>
8983      </row>
8984      <row>
8985       <entry><structfield>objid</structfield></entry>
8986       <entry><type>oid</type></entry>
8987       <entry>any OID column</entry>
8988       <entry>
8989        OID of the lock target within its system catalog, or null if the
8990        target is not a general database object
8991       </entry>
8992      </row>
8993      <row>
8994       <entry><structfield>objsubid</structfield></entry>
8995       <entry><type>smallint</type></entry>
8996       <entry></entry>
8997       <entry>
8998        Column number targeted by the lock (the
8999        <structfield>classid</> and <structfield>objid</> refer to the
9000        table itself),
9001        or zero if the target is some other general database object,
9002        or null if the target is not a general database object
9003       </entry>
9004      </row>
9005      <row>
9006       <entry><structfield>virtualtransaction</structfield></entry>
9007       <entry><type>text</type></entry>
9008       <entry></entry>
9009       <entry>
9010        Virtual ID of the transaction that is holding or awaiting this lock
9011       </entry>
9012      </row>
9013      <row>
9014       <entry><structfield>pid</structfield></entry>
9015       <entry><type>integer</type></entry>
9016       <entry></entry>
9017       <entry>
9018        Process ID of the server process holding or awaiting this
9019        lock, or null if the lock is held by a prepared transaction
9020       </entry>
9021      </row>
9022      <row>
9023       <entry><structfield>mode</structfield></entry>
9024       <entry><type>text</type></entry>
9025       <entry></entry>
9026       <entry>Name of the lock mode held or desired by this process (see <xref
9027       linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
9028      </row>
9029      <row>
9030       <entry><structfield>granted</structfield></entry>
9031       <entry><type>boolean</type></entry>
9032       <entry></entry>
9033       <entry>True if lock is held, false if lock is awaited</entry>
9034      </row>
9035      <row>
9036       <entry><structfield>fastpath</structfield></entry>
9037       <entry><type>boolean</type></entry>
9038       <entry></entry>
9039       <entry>True if lock was taken via fast path, false if taken via main
9040        lock table</entry>
9041      </row>
9042     </tbody>
9043    </tgroup>
9044   </table>
9045
9046   <para>
9047    <structfield>granted</structfield> is true in a row representing a lock
9048    held by the indicated process.  False indicates that this process is
9049    currently waiting to acquire this lock, which implies that at least one
9050    other process is holding or waiting for a conflicting lock mode on the same
9051    lockable object.  The waiting process will sleep until the other lock is
9052    released (or a deadlock situation is detected).  A single process can be
9053    waiting to acquire at most one lock at a time.
9054   </para>
9055
9056   <para>
9057    Throughout running a transaction, a server process holds an exclusive lock
9058    on the transaction's virtual transaction ID.  If a permanent ID is assigned
9059    to the transaction (which normally happens only if the transaction changes
9060    the state of the database), it also holds an exclusive lock on the
9061    transaction's permanent transaction ID until it ends.  When a process finds
9062    it necessary to wait specifically for another transaction to end, it does
9063    so by attempting to acquire share lock on the other transaction's ID
9064    (either virtual or permanent ID depending on the situation). That will
9065    succeed only when the other transaction terminates and releases its locks.
9066   </para>
9067
9068   <para>
9069    Although tuples are a lockable type of object,
9070    information about row-level locks is stored on disk, not in memory,
9071    and therefore row-level locks normally do not appear in this view.
9072    If a process is waiting for a
9073    row-level lock, it will usually appear in the view as waiting for the
9074    permanent transaction ID of the current holder of that row lock.
9075   </para>
9076
9077   <para>
9078    Advisory locks can be acquired on keys consisting of either a single
9079    <type>bigint</type> value or two integer values.
9080    A <type>bigint</type> key is displayed with its
9081    high-order half in the <structfield>classid</> column, its low-order half
9082    in the <structfield>objid</> column, and <structfield>objsubid</> equal
9083    to 1. The original <type>bigint</type> value can be reassembled with the
9084    expression <literal>(classid::bigint &lt;&lt; 32) |
9085    objid::bigint</literal>. Integer keys are displayed with the
9086    first key in the
9087    <structfield>classid</> column, the second key in the <structfield>objid</>
9088    column, and <structfield>objsubid</> equal to 2.  The actual meaning of
9089    the keys is up to the user.  Advisory locks are local to each database,
9090    so the <structfield>database</> column is meaningful for an advisory lock.
9091   </para>
9092
9093   <para>
9094    <structname>pg_locks</structname> provides a global view of all locks
9095    in the database cluster, not only those relevant to the current database.
9096    Although its <structfield>relation</structfield> column can be joined
9097    against <structname>pg_class</>.<structfield>oid</> to identify locked
9098    relations, this will only work correctly for relations in the current
9099    database (those for which the <structfield>database</structfield> column
9100    is either the current database's OID or zero).
9101   </para>
9102
9103   <para>
9104    The <structfield>pid</structfield> column can be joined to the
9105    <structfield>pid</structfield> column of the <link
9106    linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
9107    view to get more
9108    information on the session holding or awaiting each lock,
9109    for example
9110 <programlisting>
9111 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
9112     ON pl.pid = psa.pid;
9113 </programlisting>
9114    Also, if you are using prepared transactions, the
9115    <structfield>virtualtransaction</> column can be joined to the
9116    <structfield>transaction</structfield> column of the <link
9117    linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
9118    view to get more information on prepared transactions that hold locks.
9119    (A prepared transaction can never be waiting for a lock,
9120    but it continues to hold the locks it acquired while running.)
9121    For example:
9122 <programlisting>
9123 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
9124     ON pl.virtualtransaction = '-1/' || ppx.transaction;
9125 </programlisting>
9126   </para>
9127
9128   <para>
9129    While it is possible to obtain information about which processes block
9130    which other processes by joining <structname>pg_locks</structname> against
9131    itself, this is very difficult to get right in detail.  Such a query would
9132    have to encode knowledge about which lock modes conflict with which
9133    others.  Worse, the <structname>pg_locks</structname> view does not expose
9134    information about which processes are ahead of which others in lock wait
9135    queues, nor information about which processes are parallel workers running
9136    on behalf of which other client sessions.  It is better to use
9137    the <function>pg_blocking_pids()</> function
9138    (see <xref linkend="functions-info-session-table">) to identify which
9139    process(es) a waiting process is blocked behind.
9140   </para>
9141
9142   <para>
9143    The <structname>pg_locks</structname> view displays data from both the
9144    regular lock manager and the predicate lock manager, which are
9145    separate systems; in addition, the regular lock manager subdivides its
9146    locks into regular and <firstterm>fast-path</> locks.
9147    This data is not guaranteed to be entirely consistent.
9148    When the view is queried,
9149    data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
9150    is gathered from each backend one at a time, without freezing the state of
9151    the entire lock manager, so it is possible for locks to be taken or
9152    released while information is gathered.  Note, however, that these locks are
9153    known not to conflict with any other lock currently in place.  After
9154    all backends have been queried for fast-path locks, the remainder of the
9155    regular lock manager is locked as a unit, and a consistent snapshot of all
9156    remaining locks is collected as an atomic action.  After unlocking the
9157    regular lock manager, the predicate lock manager is similarly locked and all
9158    predicate locks are collected as an atomic action.  Thus, with the exception
9159    of fast-path locks, each lock manager will deliver a consistent set of
9160    results, but as we do not lock both lock managers simultaneously, it is
9161    possible for locks to be taken or released after we interrogate the regular
9162    lock manager and before we interrogate the predicate lock manager.
9163   </para>
9164
9165   <para>
9166    Locking the regular and/or predicate lock manager could have some
9167    impact on database performance if this view is very frequently accessed.
9168    The locks are held only for the minimum amount of time necessary to
9169    obtain data from the lock managers, but this does not completely eliminate
9170    the possibility of a performance impact.
9171   </para>
9172
9173  </sect1>
9174
9175  <sect1 id="view-pg-matviews">
9176   <title><structname>pg_matviews</structname></title>
9177
9178   <indexterm zone="view-pg-matviews">
9179    <primary>pg_matviews</primary>
9180   </indexterm>
9181
9182   <indexterm zone="view-pg-matviews">
9183    <primary>materialized views</primary>
9184   </indexterm>
9185
9186   <para>
9187    The view <structname>pg_matviews</structname> provides access to
9188    useful information about each materialized view in the database.
9189   </para>
9190
9191   <table>
9192    <title><structname>pg_matviews</> Columns</title>
9193
9194    <tgroup cols="4">
9195     <thead>
9196      <row>
9197       <entry>Name</entry>
9198       <entry>Type</entry>
9199       <entry>References</entry>
9200       <entry>Description</entry>
9201      </row>
9202     </thead>
9203     <tbody>
9204      <row>
9205       <entry><structfield>schemaname</structfield></entry>
9206       <entry><type>name</type></entry>
9207       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9208       <entry>Name of schema containing materialized view</entry>
9209      </row>
9210      <row>
9211       <entry><structfield>matviewname</structfield></entry>
9212       <entry><type>name</type></entry>
9213       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9214       <entry>Name of materialized view</entry>
9215      </row>
9216      <row>
9217       <entry><structfield>matviewowner</structfield></entry>
9218       <entry><type>name</type></entry>
9219       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9220       <entry>Name of materialized view's owner</entry>
9221      </row>
9222      <row>
9223       <entry><structfield>tablespace</structfield></entry>
9224       <entry><type>name</type></entry>
9225       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
9226       <entry>Name of tablespace containing materialized view (null if default for database)</entry>
9227      </row>
9228      <row>
9229       <entry><structfield>hasindexes</structfield></entry>
9230       <entry><type>boolean</type></entry>
9231       <entry></entry>
9232       <entry>True if materialized view has (or recently had) any indexes</entry>
9233      </row>
9234      <row>
9235       <entry><structfield>ispopulated</structfield></entry>
9236       <entry><type>boolean</type></entry>
9237       <entry></entry>
9238       <entry>True if materialized view is currently populated</entry>
9239      </row>
9240      <row>
9241       <entry><structfield>definition</structfield></entry>
9242       <entry><type>text</type></entry>
9243       <entry></entry>
9244       <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
9245      </row>
9246     </tbody>
9247    </tgroup>
9248   </table>
9249
9250  </sect1>
9251
9252  <sect1 id="view-pg-policies">
9253   <title><structname>pg_policies</structname></title>
9254
9255   <indexterm zone="view-pg-policies">
9256    <primary>pg_policies</primary>
9257   </indexterm>
9258
9259   <para>
9260    The view <structname>pg_policies</structname> provides access to
9261    useful information about each row-level security policy in the database.
9262   </para>
9263
9264   <table>
9265    <title><structname>pg_policies</> Columns</title>
9266
9267    <tgroup cols="4">
9268     <thead>
9269      <row>
9270       <entry>Name</entry>
9271       <entry>Type</entry>
9272       <entry>References</entry>
9273       <entry>Description</entry>
9274      </row>
9275     </thead>
9276     <tbody>
9277      <row>
9278       <entry><structfield>schemaname</structfield></entry>
9279       <entry><type>name</type></entry>
9280       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9281       <entry>Name of schema containing table policy is on</entry>
9282      </row>
9283      <row>
9284       <entry><structfield>tablename</structfield></entry>
9285       <entry><type>name</type></entry>
9286       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9287       <entry>Name of table policy is on</entry>
9288      </row>
9289      <row>
9290       <entry><structfield>policyname</structfield></entry>
9291       <entry><type>name</type></entry>
9292       <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
9293       <entry>Name of policy</entry>
9294      </row>
9295      <row>
9296       <entry><structfield>polpermissive</structfield></entry>
9297       <entry><type>text</type></entry>
9298       <entry></entry>
9299       <entry>Is the policy permissive or restrictive?</entry>
9300      </row>
9301      <row>
9302       <entry><structfield>roles</structfield></entry>
9303       <entry><type>name[]</type></entry>
9304       <entry></entry>
9305       <entry>The roles to which this policy applies</entry>
9306      </row>
9307      <row>
9308       <entry><structfield>cmd</structfield></entry>
9309       <entry><type>text</type></entry>
9310       <entry></entry>
9311       <entry>The command type to which the policy is applied</entry>
9312      </row>
9313      <row>
9314       <entry><structfield>qual</structfield></entry>
9315       <entry><type>text</type></entry>
9316       <entry></entry>
9317       <entry>The expression added to the security barrier qualifications for
9318       queries that this policy applies to</entry>
9319      </row>
9320      <row>
9321       <entry><structfield>with_check</structfield></entry>
9322       <entry><type>text</type></entry>
9323       <entry></entry>
9324       <entry>The expression added to the WITH CHECK qualifications for
9325       queries that attempt to add rows to this table</entry>
9326      </row>
9327     </tbody>
9328    </tgroup>
9329   </table>
9330
9331  </sect1>
9332
9333  <sect1 id="view-pg-prepared-statements">
9334   <title><structname>pg_prepared_statements</structname></title>
9335
9336   <indexterm zone="view-pg-prepared-statements">
9337    <primary>pg_prepared_statements</primary>
9338   </indexterm>
9339
9340   <para>
9341    The <structname>pg_prepared_statements</structname> view displays
9342    all the prepared statements that are available in the current
9343    session. See <xref linkend="sql-prepare"> for more information about prepared
9344    statements.
9345   </para>
9346
9347   <para>
9348    <structname>pg_prepared_statements</structname> contains one row
9349    for each prepared statement. Rows are added to the view when a new
9350    prepared statement is created and removed when a prepared statement
9351    is released (for example, via the <xref linkend="sql-deallocate"> command).
9352   </para>
9353
9354   <table>
9355    <title><structname>pg_prepared_statements</> Columns</title>
9356
9357    <tgroup cols="3">
9358     <thead>
9359      <row>
9360       <entry>Name</entry>
9361       <entry>Type</entry>
9362       <entry>Description</entry>
9363      </row>
9364     </thead>
9365     <tbody>
9366      <row>
9367       <entry><structfield>name</structfield></entry>
9368       <entry><type>text</type></entry>
9369       <entry>
9370        The identifier of the prepared statement
9371       </entry>
9372      </row>
9373      <row>
9374       <entry><structfield>statement</structfield></entry>
9375       <entry><type>text</type></entry>
9376       <entry>
9377        The query string submitted by the client to create this
9378        prepared statement. For prepared statements created via SQL,
9379        this is the <command>PREPARE</command> statement submitted by
9380        the client. For prepared statements created via the
9381        frontend/backend protocol, this is the text of the prepared
9382        statement itself.
9383       </entry>
9384      </row>
9385      <row>
9386       <entry><structfield>prepare_time</structfield></entry>
9387       <entry><type>timestamptz</type></entry>
9388       <entry>
9389        The time at which the prepared statement was created
9390       </entry>
9391      </row>
9392      <row>
9393       <entry><structfield>parameter_types</structfield></entry>
9394       <entry><type>regtype[]</type></entry>
9395       <entry>
9396        The expected parameter types for the prepared statement in the
9397        form of an array of <type>regtype</type>. The OID corresponding
9398        to an element of this array can be obtained by casting the
9399        <type>regtype</type> value to <type>oid</type>.
9400       </entry>
9401      </row>
9402      <row>
9403       <entry><structfield>from_sql</structfield></entry>
9404       <entry><type>boolean</type></entry>
9405       <entry>
9406        <literal>true</literal> if the prepared statement was created
9407        via the <command>PREPARE</command> SQL command;
9408        <literal>false</literal> if the statement was prepared via the
9409        frontend/backend protocol
9410       </entry>
9411      </row>
9412     </tbody>
9413    </tgroup>
9414   </table>
9415
9416   <para>
9417    The <structname>pg_prepared_statements</structname> view is read only.
9418   </para>
9419  </sect1>
9420
9421  <sect1 id="view-pg-prepared-xacts">
9422   <title><structname>pg_prepared_xacts</structname></title>
9423
9424   <indexterm zone="view-pg-prepared-xacts">
9425    <primary>pg_prepared_xacts</primary>
9426   </indexterm>
9427
9428   <para>
9429    The view <structname>pg_prepared_xacts</structname> displays
9430    information about transactions that are currently prepared for two-phase
9431    commit (see <xref linkend="sql-prepare-transaction"> for details).
9432   </para>
9433
9434   <para>
9435    <structname>pg_prepared_xacts</structname> contains one row per prepared
9436    transaction.  An entry is removed when the transaction is committed or
9437    rolled back.
9438   </para>
9439
9440   <table>
9441    <title><structname>pg_prepared_xacts</> Columns</title>
9442
9443    <tgroup cols="4">
9444     <thead>
9445      <row>
9446       <entry>Name</entry>
9447       <entry>Type</entry>
9448       <entry>References</entry>
9449       <entry>Description</entry>
9450      </row>
9451     </thead>
9452     <tbody>
9453      <row>
9454       <entry><structfield>transaction</structfield></entry>
9455       <entry><type>xid</type></entry>
9456       <entry></entry>
9457       <entry>
9458        Numeric transaction identifier of the prepared transaction
9459       </entry>
9460      </row>
9461      <row>
9462       <entry><structfield>gid</structfield></entry>
9463       <entry><type>text</type></entry>
9464       <entry></entry>
9465       <entry>
9466        Global transaction identifier that was assigned to the transaction
9467       </entry>
9468      </row>
9469      <row>
9470       <entry><structfield>prepared</structfield></entry>
9471       <entry><type>timestamp with time zone</type></entry>
9472       <entry></entry>
9473       <entry>
9474        Time at which the transaction was prepared for commit
9475       </entry>
9476      </row>
9477      <row>
9478       <entry><structfield>owner</structfield></entry>
9479       <entry><type>name</type></entry>
9480       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9481       <entry>
9482        Name of the user that executed the transaction
9483       </entry>
9484      </row>
9485      <row>
9486       <entry><structfield>database</structfield></entry>
9487       <entry><type>name</type></entry>
9488       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9489       <entry>
9490        Name of the database in which the transaction was executed
9491       </entry>
9492      </row>
9493     </tbody>
9494    </tgroup>
9495   </table>
9496
9497   <para>
9498    When the <structname>pg_prepared_xacts</structname> view is accessed, the
9499    internal transaction manager data structures are momentarily locked, and
9500    a copy is made for the view to display.  This ensures that the
9501    view produces a consistent set of results, while not blocking
9502    normal operations longer than necessary.  Nonetheless
9503    there could be some impact on database performance if this view is
9504    frequently accessed.
9505   </para>
9506
9507  </sect1>
9508
9509  <sect1 id="view-pg-publication-tables">
9510   <title><structname>pg_publication_tables</structname></title>
9511
9512   <indexterm zone="view-pg-publication-tables">
9513    <primary>pg_publication_tables</primary>
9514   </indexterm>
9515
9516   <para>
9517    The view <structname>pg_publication_tables</structname> provides
9518    information about the mapping between publications and the tables they
9519    contain.  Unlike the underlying
9520    catalog <structname>pg_publication_rel</structname>, this view expands
9521    publications defined as <literal>FOR ALL TABLES</literal>, so for such
9522    publications there will be a row for each eligible table.
9523   </para>
9524
9525   <table>
9526    <title><structname>pg_publication_tables</structname> Columns</title>
9527
9528    <tgroup cols="4">
9529     <thead>
9530      <row>
9531       <entry>Name</entry>
9532       <entry>Type</entry>
9533       <entry>References</entry>
9534       <entry>Description</entry>
9535      </row>
9536     </thead>
9537
9538     <tbody>
9539      <row>
9540       <entry><structfield>pubname</structfield></entry>
9541       <entry><type>name</type></entry>
9542       <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
9543       <entry>Name of publication</entry>
9544      </row>
9545
9546      <row>
9547       <entry><structfield>schemaname</structfield></entry>
9548       <entry><type>name</type></entry>
9549       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9550       <entry>Name of schema containing table</entry>
9551      </row>
9552
9553      <row>
9554       <entry><structfield>tablename</structfield></entry>
9555       <entry><type>name</type></entry>
9556       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9557       <entry>Name of table</entry>
9558      </row>
9559     </tbody>
9560    </tgroup>
9561   </table>
9562  </sect1>
9563
9564   <sect1 id="view-pg-replication-origin-status">
9565   <title><structname>pg_replication_origin_status</structname></title>
9566
9567   <indexterm zone="view-pg-replication-origin-status">
9568    <primary>pg_replication_origin_status</primary>
9569   </indexterm>
9570
9571   <para>
9572    The <structname>pg_replication_origin_status</structname> view
9573    contains information about how far replay for a certain origin has
9574    progressed.  For more on replication origins
9575    see <xref linkend="replication-origins">.
9576   </para>
9577
9578   <table>
9579
9580    <title><structname>pg_replication_origin_status</structname> Columns</title>
9581
9582    <tgroup cols="4">
9583     <thead>
9584      <row>
9585       <entry>Name</entry>
9586       <entry>Type</entry>
9587       <entry>References</entry>
9588       <entry>Description</entry>
9589      </row>
9590     </thead>
9591
9592     <tbody>
9593      <row>
9594       <entry><structfield>local_id</structfield></entry>
9595       <entry><type>Oid</type></entry>
9596       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
9597       <entry>internal node identifier</entry>
9598      </row>
9599
9600      <row>
9601       <entry><structfield>external_id</structfield></entry>
9602       <entry><type>text</type></entry>
9603       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
9604       <entry>external node identifier</entry>
9605      </row>
9606
9607      <row>
9608       <entry><structfield>remote_lsn</structfield></entry>
9609       <entry><type>pg_lsn</type></entry>
9610       <entry></entry>
9611       <entry>The origin node's LSN up to which data has been replicated.</entry>
9612      </row>
9613
9614      <row>
9615       <entry><structfield>local_lsn</structfield></entry>
9616       <entry><type>pg_lsn</type></entry>
9617       <entry></entry>
9618       <entry>
9619        This node's LSN at which <literal>remote_lsn</literal> has
9620        been replicated. Used to flush commit records before persisting
9621        data to disk when using asynchronous commits.
9622       </entry>
9623      </row>
9624     </tbody>
9625    </tgroup>
9626   </table>
9627  </sect1>
9628
9629  <sect1 id="view-pg-replication-slots">
9630   <title><structname>pg_replication_slots</structname></title>
9631
9632   <indexterm zone="view-pg-replication-slots">
9633    <primary>pg_replication_slots</primary>
9634   </indexterm>
9635
9636   <para>
9637    The <structname>pg_replication_slots</structname> view provides a listing
9638    of all replication slots that currently exist on the database cluster,
9639    along with their current state.
9640   </para>
9641
9642   <para>
9643    For more on replication slots,
9644    see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
9645   </para>
9646
9647   <table>
9648
9649    <title><structname>pg_replication_slots</structname> Columns</title>
9650
9651    <tgroup cols="4">
9652     <thead>
9653      <row>
9654       <entry>Name</entry>
9655       <entry>Type</entry>
9656       <entry>References</entry>
9657       <entry>Description</entry>
9658      </row>
9659     </thead>
9660
9661     <tbody>
9662      <row>
9663       <entry><structfield>slot_name</structfield></entry>
9664       <entry><type>name</type></entry>
9665       <entry></entry>
9666       <entry>A unique, cluster-wide identifier for the replication slot</entry>
9667      </row>
9668
9669      <row>
9670       <entry><structfield>plugin</structfield></entry>
9671       <entry><type>name</type></entry>
9672       <entry></entry>
9673       <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
9674      </row>
9675
9676      <row>
9677       <entry><structfield>slot_type</structfield></entry>
9678       <entry><type>text</type></entry>
9679       <entry></entry>
9680       <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
9681      </row>
9682
9683      <row>
9684       <entry><structfield>datoid</structfield></entry>
9685       <entry><type>oid</type></entry>
9686       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9687       <entry>The OID of the database this slot is associated with, or
9688       null. Only logical slots have an associated database.</entry>
9689      </row>
9690
9691      <row>
9692       <entry><structfield>database</structfield></entry>
9693       <entry><type>text</type></entry>
9694       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9695       <entry>The name of the database this slot is associated with, or
9696       null. Only logical slots have an associated database.</entry>
9697      </row>
9698
9699      <row>
9700       <entry><structfield>temporary</structfield></entry>
9701       <entry><type>boolean</type></entry>
9702       <entry></entry>
9703       <entry>True if this is a temporary replication slot. Temporary slots are
9704       not saved to disk and are automatically dropped on error or when
9705       the session has finished.</entry>
9706      </row>
9707
9708      <row>
9709       <entry><structfield>active</structfield></entry>
9710       <entry><type>boolean</type></entry>
9711       <entry></entry>
9712       <entry>True if this slot is currently actively being used</entry>
9713      </row>
9714
9715      <row>
9716       <entry><structfield>active_pid</structfield></entry>
9717       <entry><type>integer</type></entry>
9718       <entry></entry>
9719       <entry>The process ID of the session using this slot if the slot
9720        is currently actively being used. <literal>NULL</literal> if
9721        inactive.
9722       </entry>
9723      </row>
9724
9725      <row>
9726       <entry><structfield>xmin</structfield></entry>
9727       <entry><type>xid</type></entry>
9728       <entry></entry>
9729       <entry>The oldest transaction that this slot needs the database to
9730       retain.  <literal>VACUUM</literal> cannot remove tuples deleted
9731       by any later transaction.
9732       </entry>
9733      </row>
9734
9735      <row>
9736       <entry><structfield>catalog_xmin</structfield></entry>
9737       <entry><type>xid</type></entry>
9738       <entry></entry>
9739       <entry>The oldest transaction affecting the system catalogs that this
9740       slot needs the database to retain.  <literal>VACUUM</literal> cannot
9741       remove catalog tuples deleted by any later transaction.
9742       </entry>
9743      </row>
9744
9745      <row>
9746       <entry><structfield>restart_lsn</structfield></entry>
9747       <entry><type>pg_lsn</type></entry>
9748       <entry></entry>
9749       <entry>The address (<literal>LSN</literal>) of oldest WAL which still
9750       might be required by the consumer of this slot and thus won't be
9751       automatically removed during checkpoints.
9752       </entry>
9753      </row>
9754
9755      <row>
9756       <entry><structfield>confirmed_flush_lsn</structfield></entry>
9757       <entry><type>pg_lsn</type></entry>
9758       <entry></entry>
9759       <entry>The address (<literal>LSN</literal>) up to which the logical
9760       slot's consumer has confirmed receiving data. Data older than this is
9761       not available anymore. <literal>NULL</> for physical slots.
9762       </entry>
9763      </row>
9764
9765     </tbody>
9766    </tgroup>
9767   </table>
9768  </sect1>
9769
9770  <sect1 id="view-pg-roles">
9771   <title><structname>pg_roles</structname></title>
9772
9773   <indexterm zone="view-pg-roles">
9774    <primary>pg_roles</primary>
9775   </indexterm>
9776
9777   <para>
9778    The view <structname>pg_roles</structname> provides access to
9779    information about database roles.  This is simply a publicly
9780    readable view of
9781    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9782    that blanks out the password field.
9783   </para>
9784
9785   <para>
9786    This view explicitly exposes the OID column of the underlying table,
9787    since that is needed to do joins to other catalogs.
9788   </para>
9789
9790   <table>
9791    <title><structname>pg_roles</> Columns</title>
9792
9793    <tgroup cols="4">
9794     <thead>
9795      <row>
9796       <entry>Name</entry>
9797       <entry>Type</entry>
9798       <entry>References</entry>
9799       <entry>Description</entry>
9800      </row>
9801     </thead>
9802
9803     <tbody>
9804      <row>
9805       <entry><structfield>rolname</structfield></entry>
9806       <entry><type>name</type></entry>
9807       <entry></entry>
9808       <entry>Role name</entry>
9809      </row>
9810
9811      <row>
9812       <entry><structfield>rolsuper</structfield></entry>
9813       <entry><type>bool</type></entry>
9814       <entry></entry>
9815       <entry>Role has superuser privileges</entry>
9816      </row>
9817
9818      <row>
9819       <entry><structfield>rolinherit</structfield></entry>
9820       <entry><type>bool</type></entry>
9821       <entry></entry>
9822       <entry>Role automatically inherits privileges of roles it is a
9823        member of</entry>
9824      </row>
9825
9826      <row>
9827       <entry><structfield>rolcreaterole</structfield></entry>
9828       <entry><type>bool</type></entry>
9829       <entry></entry>
9830       <entry>Role can create more roles</entry>
9831      </row>
9832
9833      <row>
9834       <entry><structfield>rolcreatedb</structfield></entry>
9835       <entry><type>bool</type></entry>
9836       <entry></entry>
9837       <entry>Role can create databases</entry>
9838      </row>
9839
9840      <row>
9841       <entry><structfield>rolcanlogin</structfield></entry>
9842       <entry><type>bool</type></entry>
9843       <entry></entry>
9844       <entry>
9845        Role can log in. That is, this role can be given as the initial
9846        session authorization identifier
9847       </entry>
9848      </row>
9849
9850      <row>
9851       <entry><structfield>rolreplication</structfield></entry>
9852       <entry><type>bool</type></entry>
9853       <entry></entry>
9854       <entry>
9855        Role is a replication role. That is, this role can initiate streaming
9856        replication (see <xref linkend="streaming-replication">) and set/unset
9857        the system backup mode using <function>pg_start_backup</> and
9858        <function>pg_stop_backup</>
9859       </entry>
9860      </row>
9861
9862      <row>
9863       <entry><structfield>rolconnlimit</structfield></entry>
9864       <entry><type>int4</type></entry>
9865       <entry></entry>
9866       <entry>
9867        For roles that can log in, this sets maximum number of concurrent
9868        connections this role can make.  -1 means no limit.
9869       </entry>
9870      </row>
9871
9872      <row>
9873       <entry><structfield>rolpassword</structfield></entry>
9874       <entry><type>text</type></entry>
9875       <entry></entry>
9876       <entry>Not the password (always reads as <literal>********</>)</entry>
9877      </row>
9878
9879      <row>
9880       <entry><structfield>rolvaliduntil</structfield></entry>
9881       <entry><type>timestamptz</type></entry>
9882       <entry></entry>
9883       <entry>Password expiry time (only used for password authentication);
9884        null if no expiration</entry>
9885      </row>
9886
9887      <row>
9888       <entry><structfield>rolbypassrls</structfield></entry>
9889       <entry><type>bool</type></entry>
9890       <entry></entry>
9891       <entry>
9892        Role bypasses every row level security policy, see
9893        <xref linkend="ddl-rowsecurity"> for more information.
9894       </entry>
9895      </row>
9896
9897      <row>
9898       <entry><structfield>rolconfig</structfield></entry>
9899       <entry><type>text[]</type></entry>
9900       <entry></entry>
9901       <entry>Role-specific defaults for run-time configuration variables</entry>
9902      </row>
9903
9904      <row>
9905       <entry><structfield>oid</structfield></entry>
9906       <entry><type>oid</type></entry>
9907       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9908       <entry>ID of role</entry>
9909      </row>
9910     </tbody>
9911    </tgroup>
9912   </table>
9913
9914  </sect1>
9915
9916  <sect1 id="view-pg-rules">
9917   <title><structname>pg_rules</structname></title>
9918
9919   <indexterm zone="view-pg-rules">
9920    <primary>pg_rules</primary>
9921   </indexterm>
9922
9923   <para>
9924    The view <structname>pg_rules</structname> provides access to
9925    useful information about query rewrite rules.
9926   </para>
9927
9928   <table>
9929    <title><structname>pg_rules</> Columns</title>
9930
9931    <tgroup cols="4">
9932     <thead>
9933      <row>
9934       <entry>Name</entry>
9935       <entry>Type</entry>
9936       <entry>References</entry>
9937       <entry>Description</entry>
9938      </row>
9939     </thead>
9940     <tbody>
9941      <row>
9942       <entry><structfield>schemaname</structfield></entry>
9943       <entry><type>name</type></entry>
9944       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9945       <entry>Name of schema containing table</entry>
9946      </row>
9947      <row>
9948       <entry><structfield>tablename</structfield></entry>
9949       <entry><type>name</type></entry>
9950       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9951       <entry>Name of table the rule is for</entry>
9952      </row>
9953      <row>
9954       <entry><structfield>rulename</structfield></entry>
9955       <entry><type>name</type></entry>
9956       <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
9957       <entry>Name of rule</entry>
9958      </row>
9959      <row>
9960       <entry><structfield>definition</structfield></entry>
9961       <entry><type>text</type></entry>
9962       <entry></entry>
9963       <entry>Rule definition (a reconstructed creation command)</entry>
9964      </row>
9965     </tbody>
9966    </tgroup>
9967   </table>
9968
9969   <para>
9970    The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
9971    of views and materialized views; those can be seen in
9972    <structname>pg_views</> and <structname>pg_matviews</>.
9973   </para>
9974
9975  </sect1>
9976
9977  <sect1 id="view-pg-seclabels">
9978   <title><structname>pg_seclabels</structname></title>
9979
9980   <indexterm zone="view-pg-seclabels">
9981    <primary>pg_seclabels</primary>
9982   </indexterm>
9983
9984   <para>
9985    The view <structname>pg_seclabels</structname> provides information about
9986    security labels.  It as an easier-to-query version of the
9987    <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9988   </para>
9989
9990   <table>
9991    <title><structname>pg_seclabels</> Columns</title>
9992
9993    <tgroup cols="4">
9994     <thead>
9995      <row>
9996       <entry>Name</entry>
9997       <entry>Type</entry>
9998       <entry>References</entry>
9999       <entry>Description</entry>
10000      </row>
10001     </thead>
10002     <tbody>
10003      <row>
10004       <entry><structfield>objoid</structfield></entry>
10005       <entry><type>oid</type></entry>
10006       <entry>any OID column</entry>
10007       <entry>The OID of the object this security label pertains to</entry>
10008      </row>
10009      <row>
10010       <entry><structfield>classoid</structfield></entry>
10011       <entry><type>oid</type></entry>
10012       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
10013       <entry>The OID of the system catalog this object appears in</entry>
10014      </row>
10015      <row>
10016       <entry><structfield>objsubid</structfield></entry>
10017       <entry><type>int4</type></entry>
10018       <entry></entry>
10019       <entry>
10020        For a security label on a table column, this is the column number (the
10021        <structfield>objoid</> and <structfield>classoid</> refer to
10022        the table itself).  For all other object types, this column is
10023        zero.
10024       </entry>
10025      </row>
10026      <row>
10027       <entry><structfield>objtype</structfield></entry>
10028       <entry><type>text</type></entry>
10029       <entry></entry>
10030       <entry>
10031          The type of object to which this label applies, as text.
10032       </entry>
10033      </row>
10034      <row>
10035       <entry><structfield>objnamespace</structfield></entry>
10036       <entry><type>oid</type></entry>
10037       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
10038       <entry>
10039        The OID of the namespace for this object, if applicable;
10040        otherwise NULL.
10041       </entry>
10042      </row>
10043      <row>
10044       <entry><structfield>objname</structfield></entry>
10045       <entry><type>text</type></entry>
10046       <entry></entry>
10047       <entry>
10048        The name of the object to which this label applies, as text.
10049       </entry>
10050      </row>
10051      <row>
10052       <entry><structfield>provider</structfield></entry>
10053       <entry><type>text</type></entry>
10054       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
10055       <entry>The label provider associated with this label.</entry>
10056      </row>
10057      <row>
10058       <entry><structfield>label</structfield></entry>
10059       <entry><type>text</type></entry>
10060       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
10061       <entry>The security label applied to this object.</entry>
10062      </row>
10063     </tbody>
10064    </tgroup>
10065   </table>
10066  </sect1>
10067
10068  <sect1 id="view-pg-sequences">
10069   <title><structname>pg_sequences</structname></title>
10070
10071   <indexterm zone="view-pg-sequences">
10072    <primary>pg_sequences</primary>
10073   </indexterm>
10074
10075   <para>
10076    The view <structname>pg_sequences</structname> provides access to
10077    useful information about each sequence in the database.
10078   </para>
10079
10080   <table>
10081    <title><structname>pg_sequences</> Columns</title>
10082
10083    <tgroup cols="4">
10084     <thead>
10085      <row>
10086       <entry>Name</entry>
10087       <entry>Type</entry>
10088       <entry>References</entry>
10089       <entry>Description</entry>
10090      </row>
10091     </thead>
10092     <tbody>
10093      <row>
10094       <entry><structfield>schemaname</structfield></entry>
10095       <entry><type>name</type></entry>
10096       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10097       <entry>Name of schema containing sequence</entry>
10098      </row>
10099      <row>
10100       <entry><structfield>sequencename</structfield></entry>
10101       <entry><type>name</type></entry>
10102       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10103       <entry>Name of sequence</entry>
10104      </row>
10105      <row>
10106       <entry><structfield>sequenceowner</structfield></entry>
10107       <entry><type>name</type></entry>
10108       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10109       <entry>Name of sequence's owner</entry>
10110      </row>
10111      <row>
10112       <entry><structfield>data_type</structfield></entry>
10113       <entry><type>regtype</type></entry>
10114       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_type</structname></link>.oid</literal></entry>
10115       <entry>Data type of the sequence</entry>
10116      </row>
10117      <row>
10118       <entry><structfield>start_value</structfield></entry>
10119       <entry><type>bigint</type></entry>
10120       <entry></entry>
10121       <entry>Start value of the sequence</entry>
10122      </row>
10123      <row>
10124       <entry><structfield>min_value</structfield></entry>
10125       <entry><type>bigint</type></entry>
10126       <entry></entry>
10127       <entry>Minimum value of the sequence</entry>
10128      </row>
10129      <row>
10130       <entry><structfield>max_value</structfield></entry>
10131       <entry><type>bigint</type></entry>
10132       <entry></entry>
10133       <entry>Maximum value of the sequence</entry>
10134      </row>
10135      <row>
10136       <entry><structfield>increment_by</structfield></entry>
10137       <entry><type>bigint</type></entry>
10138       <entry></entry>
10139       <entry>Increment value of the sequence</entry>
10140      </row>
10141      <row>
10142       <entry><structfield>cycle</structfield></entry>
10143       <entry><type>boolean</type></entry>
10144       <entry></entry>
10145       <entry>Whether the sequence cycles</entry>
10146      </row>
10147      <row>
10148       <entry><structfield>cache_size</structfield></entry>
10149       <entry><type>bigint</type></entry>
10150       <entry></entry>
10151       <entry>Cache size of the sequence</entry>
10152      </row>
10153      <row>
10154       <entry><structfield>last_value</structfield></entry>
10155       <entry><type>bigint</type></entry>
10156       <entry></entry>
10157       <entry>The last sequence value written to disk.  If caching is used,
10158        this value can be greater than the last value handed out from the
10159        sequence.  Null if the sequence has not been read from yet.  Also, if
10160        the current user does not have <literal>USAGE</literal>
10161        or <literal>SELECT</literal> privilege on the sequence, the value is
10162        null.</entry>
10163      </row>
10164     </tbody>
10165    </tgroup>
10166   </table>
10167  </sect1>
10168
10169  <sect1 id="view-pg-settings">
10170   <title><structname>pg_settings</structname></title>
10171
10172   <indexterm zone="view-pg-settings">
10173    <primary>pg_settings</primary>
10174   </indexterm>
10175
10176   <para>
10177    The view <structname>pg_settings</structname> provides access to
10178    run-time parameters of the server.  It is essentially an alternative
10179    interface to the <xref linkend="sql-show">
10180    and <xref linkend="sql-set"> commands.
10181    It also provides access to some facts about each parameter that are
10182    not directly available from <command>SHOW</>, such as minimum and
10183    maximum values.
10184   </para>
10185
10186   <table>
10187    <title><structname>pg_settings</> Columns</title>
10188
10189    <tgroup cols="3">
10190     <thead>
10191      <row>
10192       <entry>Name</entry>
10193       <entry>Type</entry>
10194       <entry>Description</entry>
10195      </row>
10196     </thead>
10197     <tbody>
10198      <row>
10199       <entry><structfield>name</structfield></entry>
10200       <entry><type>text</type></entry>
10201       <entry>Run-time configuration parameter name</entry>
10202      </row>
10203      <row>
10204       <entry><structfield>setting</structfield></entry>
10205       <entry><type>text</type></entry>
10206       <entry>Current value of the parameter</entry>
10207      </row>
10208      <row>
10209       <entry><structfield>unit</structfield></entry>
10210       <entry><type>text</type></entry>
10211       <entry>Implicit unit of the parameter</entry>
10212      </row>
10213      <row>
10214       <entry><structfield>category</structfield></entry>
10215       <entry><type>text</type></entry>
10216       <entry>Logical group of the parameter</entry>
10217      </row>
10218      <row>
10219       <entry><structfield>short_desc</structfield></entry>
10220       <entry><type>text</type></entry>
10221       <entry>A brief description of the parameter</entry>
10222      </row>
10223      <row>
10224       <entry><structfield>extra_desc</structfield></entry>
10225       <entry><type>text</type></entry>
10226       <entry>Additional, more detailed, description of the parameter</entry>
10227      </row>
10228      <row>
10229       <entry><structfield>context</structfield></entry>
10230       <entry><type>text</type></entry>
10231       <entry>Context required to set the parameter's value (see below)</entry>
10232      </row>
10233      <row>
10234       <entry><structfield>vartype</structfield></entry>
10235       <entry><type>text</type></entry>
10236       <entry>Parameter type (<literal>bool</>, <literal>enum</>,
10237        <literal>integer</>, <literal>real</>, or <literal>string</>)
10238       </entry>
10239      </row>
10240      <row>
10241       <entry><structfield>source</structfield></entry>
10242       <entry><type>text</type></entry>
10243       <entry>Source of the current parameter value</entry>
10244      </row>
10245      <row>
10246       <entry><structfield>min_val</structfield></entry>
10247       <entry><type>text</type></entry>
10248       <entry>Minimum allowed value of the parameter (null for non-numeric
10249       values)</entry>
10250      </row>
10251      <row>
10252       <entry><structfield>max_val</structfield></entry>
10253       <entry><type>text</type></entry>
10254       <entry>Maximum allowed value of the parameter (null for non-numeric
10255       values)</entry>
10256      </row>
10257      <row>
10258       <entry><structfield>enumvals</structfield></entry>
10259       <entry><type>text[]</type></entry>
10260       <entry>Allowed values of an enum parameter (null for non-enum
10261       values)</entry>
10262      </row>
10263      <row>
10264       <entry><structfield>boot_val</structfield></entry>
10265       <entry><type>text</type></entry>
10266       <entry>Parameter value assumed at server startup if the parameter is
10267       not otherwise set</entry>
10268      </row>
10269      <row>
10270       <entry><structfield>reset_val</structfield></entry>
10271       <entry><type>text</type></entry>
10272       <entry>Value that <command>RESET</command> would reset the parameter to
10273       in the current session</entry>
10274      </row>
10275      <row>
10276       <entry><structfield>sourcefile</structfield></entry>
10277       <entry><type>text</type></entry>
10278       <entry>Configuration file the current value was set in (null for
10279       values set from sources other than configuration files, or when
10280       examined by a user who is neither a superuser or a member of
10281       <literal>pg_read_all_settings</literal>); helpful when using
10282       <literal>include</> directives in configuration files</entry>
10283      </row>
10284      <row>
10285       <entry><structfield>sourceline</structfield></entry>
10286       <entry><type>integer</type></entry>
10287       <entry>Line number within the configuration file the current value was
10288       set at (null for values set from sources other than configuration files,
10289       or when examined by a user who is neither a superuser or a member of
10290       <literal>pg_read_all_settings</literal>).
10291       </entry>
10292      </row>
10293      <row>
10294       <entry><structfield>pending_restart</structfield></entry>
10295       <entry><type>boolean</type></entry>
10296       <entry><literal>true</literal> if the value has been changed in the
10297       configuration file but needs a restart; or <literal>false</literal>
10298       otherwise.
10299       </entry>
10300      </row>
10301     </tbody>
10302    </tgroup>
10303   </table>
10304
10305   <para>
10306    There are several possible values of <structfield>context</structfield>.
10307    In order of decreasing difficulty of changing the setting, they are:
10308   </para>
10309
10310   <variablelist>
10311    <varlistentry>
10312     <!-- PGC_INTERNAL -->
10313     <term><literal>internal</literal></term>
10314     <listitem>
10315      <para>
10316       These settings cannot be changed directly; they reflect internally
10317       determined values.  Some of them may be adjustable by rebuilding the
10318       server with different configuration options, or by changing options
10319       supplied to <command>initdb</command>.
10320      </para>
10321     </listitem>
10322    </varlistentry>
10323    <varlistentry>
10324     <!-- PGC_POSTMASTER -->
10325     <term><literal>postmaster</literal></term>
10326     <listitem>
10327      <para>
10328       These settings can only be applied when the server starts, so any change
10329       requires restarting the server.  Values for these settings are typically
10330       stored in the <filename>postgresql.conf</filename> file, or passed on
10331       the command line when starting the server.  Of course, settings with any
10332       of the lower <structfield>context</structfield> types can also be
10333       set at server start time.
10334      </para>
10335     </listitem>
10336    </varlistentry>
10337    <varlistentry>
10338     <!-- PGC_SIGHUP -->
10339     <term><literal>sighup</literal></term>
10340     <listitem>
10341      <para>
10342       Changes to these settings can be made in
10343       <filename>postgresql.conf</filename> without restarting the server.
10344       Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
10345       cause it to re-read <filename>postgresql.conf</filename> and apply
10346       the changes.  The postmaster will also forward the
10347       <systemitem>SIGHUP</systemitem> signal to its child processes so that
10348       they all pick up the new value.
10349      </para>
10350     </listitem>
10351    </varlistentry>
10352    <varlistentry>
10353     <!-- PGC_SU_BACKEND -->
10354     <term><literal>superuser-backend</literal></term>
10355     <listitem>
10356      <para>
10357       Changes to these settings can be made in
10358       <filename>postgresql.conf</filename> without restarting the server.
10359       They can also be set for a particular session in the connection request
10360       packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10361       environment variable), but only if the connecting user is a superuser.
10362       However, these settings never change in a session after it is started.
10363       If you change them in <filename>postgresql.conf</filename>, send a
10364       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10365       re-read <filename>postgresql.conf</filename>.  The new values will only
10366       affect subsequently-launched sessions.
10367      </para>
10368     </listitem>
10369    </varlistentry>
10370    <varlistentry>
10371     <!-- PGC_BACKEND -->
10372     <term><literal>backend</literal></term>
10373     <listitem>
10374      <para>
10375       Changes to these settings can be made in
10376       <filename>postgresql.conf</filename> without restarting the server.
10377       They can also be set for a particular session in the connection request
10378       packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10379       environment variable); any user can make such a change for their session.
10380       However, these settings never change in a session after it is started.
10381       If you change them in <filename>postgresql.conf</filename>, send a
10382       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10383       re-read <filename>postgresql.conf</filename>.  The new values will only
10384       affect subsequently-launched sessions.
10385      </para>
10386     </listitem>
10387    </varlistentry>
10388    <varlistentry>
10389     <!-- PGC_SUSET -->
10390     <term><literal>superuser</literal></term>
10391     <listitem>
10392      <para>
10393       These settings can be set from <filename>postgresql.conf</filename>,
10394       or within a session via the <command>SET</> command; but only superusers
10395       can change them via <command>SET</>.  Changes in
10396       <filename>postgresql.conf</filename> will affect existing sessions
10397       only if no session-local value has been established with <command>SET</>.
10398      </para>
10399     </listitem>
10400    </varlistentry>
10401    <varlistentry>
10402     <!-- PGC_USERSET -->
10403     <term><literal>user</literal></term>
10404     <listitem>
10405      <para>
10406       These settings can be set from <filename>postgresql.conf</filename>,
10407       or within a session via the <command>SET</> command.  Any user is
10408       allowed to change their session-local value.  Changes in
10409       <filename>postgresql.conf</filename> will affect existing sessions
10410       only if no session-local value has been established with <command>SET</>.
10411      </para>
10412     </listitem>
10413    </varlistentry>
10414   </variablelist>
10415
10416   <para>
10417    See <xref linkend="config-setting"> for more information about the various
10418    ways to change these parameters.
10419   </para>
10420
10421   <para>
10422    The <structname>pg_settings</structname> view cannot be inserted into or
10423    deleted from, but it can be updated.  An <command>UPDATE</command> applied
10424    to a row of <structname>pg_settings</structname> is equivalent to executing
10425    the <xref linkend="sql-set"> command on that named
10426    parameter. The change only affects the value used by the current
10427    session. If an <command>UPDATE</command> is issued within a transaction
10428    that is later aborted, the effects of the <command>UPDATE</command> command
10429    disappear when the transaction is rolled back. Once the surrounding
10430    transaction is committed, the effects will persist until the end of the
10431    session, unless overridden by another <command>UPDATE</command> or
10432    <command>SET</command>.
10433   </para>
10434
10435  </sect1>
10436
10437  <sect1 id="view-pg-shadow">
10438   <title><structname>pg_shadow</structname></title>
10439
10440   <indexterm zone="view-pg-shadow">
10441    <primary>pg_shadow</primary>
10442   </indexterm>
10443
10444   <para>
10445    The view <structname>pg_shadow</structname> exists for backwards
10446    compatibility: it emulates a catalog that existed in
10447    <productname>PostgreSQL</productname> before version 8.1.
10448    It shows properties of all roles that are marked as
10449    <structfield>rolcanlogin</> in
10450    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
10451   </para>
10452
10453   <para>
10454    The name stems from the fact that this table
10455    should not be readable by the public since it contains passwords.
10456    <link linkend="view-pg-user"><structname>pg_user</structname></link>
10457    is a publicly readable view on
10458    <structname>pg_shadow</structname> that blanks out the password field.
10459   </para>
10460
10461   <table>
10462    <title><structname>pg_shadow</> Columns</title>
10463
10464    <tgroup cols="4">
10465     <thead>
10466      <row>
10467       <entry>Name</entry>
10468       <entry>Type</entry>
10469       <entry>References</entry>
10470       <entry>Description</entry>
10471      </row>
10472     </thead>
10473
10474     <tbody>
10475      <row>
10476       <entry><structfield>usename</structfield></entry>
10477       <entry><type>name</type></entry>
10478       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10479       <entry>User name</entry>
10480      </row>
10481
10482      <row>
10483       <entry><structfield>usesysid</structfield></entry>
10484       <entry><type>oid</type></entry>
10485       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10486       <entry>ID of this user</entry>
10487      </row>
10488
10489      <row>
10490       <entry><structfield>usecreatedb</structfield></entry>
10491       <entry><type>bool</type></entry>
10492       <entry></entry>
10493       <entry>User can create databases</entry>
10494      </row>
10495
10496      <row>
10497       <entry><structfield>usesuper</structfield></entry>
10498       <entry><type>bool</type></entry>
10499       <entry></entry>
10500       <entry>User is a superuser</entry>
10501      </row>
10502
10503      <row>
10504       <entry><structfield>userepl</structfield></entry>
10505       <entry><type>bool</type></entry>
10506       <entry></entry>
10507       <entry>
10508        User can initiate streaming replication and put the system in and
10509        out of backup mode.
10510       </entry>
10511      </row>
10512
10513      <row>
10514       <entry><structfield>usebypassrls</structfield></entry>
10515       <entry><type>bool</type></entry>
10516       <entry></entry>
10517       <entry>
10518        User bypasses every row level security policy, see
10519        <xref linkend="ddl-rowsecurity"> for more information.
10520       </entry>
10521      </row>
10522
10523      <row>
10524       <entry><structfield>passwd</structfield></entry>
10525       <entry><type>text</type></entry>
10526       <entry></entry>
10527       <entry>Password (possibly encrypted); null if none.  See
10528       <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
10529       for details of how encrypted passwords are stored.</entry>
10530      </row>
10531
10532      <row>
10533       <entry><structfield>valuntil</structfield></entry>
10534       <entry><type>abstime</type></entry>
10535       <entry></entry>
10536       <entry>Password expiry time (only used for password authentication)</entry>
10537      </row>
10538
10539      <row>
10540       <entry><structfield>useconfig</structfield></entry>
10541       <entry><type>text[]</type></entry>
10542       <entry></entry>
10543       <entry>Session defaults for run-time configuration variables</entry>
10544      </row>
10545     </tbody>
10546    </tgroup>
10547   </table>
10548
10549  </sect1>
10550
10551  <sect1 id="view-pg-stats">
10552   <title><structname>pg_stats</structname></title>
10553
10554   <indexterm zone="view-pg-stats">
10555    <primary>pg_stats</primary>
10556   </indexterm>
10557
10558   <para>
10559    The view <structname>pg_stats</structname> provides access to
10560    the information stored in the <link
10561    linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
10562    catalog.  This view allows access only to rows of
10563    <structname>pg_statistic</structname> that correspond to tables the
10564    user has permission to read, and therefore it is safe to allow public
10565    read access to this view.
10566   </para>
10567
10568   <para>
10569    <structname>pg_stats</structname> is also designed to present the
10570    information in a more readable format than the underlying catalog
10571    &mdash; at the cost that its schema must be extended whenever new slot types
10572    are defined for <structname>pg_statistic</structname>.
10573   </para>
10574
10575   <table>
10576    <title><structname>pg_stats</> Columns</title>
10577
10578    <tgroup cols="4">
10579     <thead>
10580      <row>
10581       <entry>Name</entry>
10582       <entry>Type</entry>
10583       <entry>References</entry>
10584       <entry>Description</entry>
10585      </row>
10586     </thead>
10587     <tbody>
10588      <row>
10589       <entry><structfield>schemaname</structfield></entry>
10590       <entry><type>name</type></entry>
10591       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10592       <entry>Name of schema containing table</entry>
10593      </row>
10594
10595      <row>
10596       <entry><structfield>tablename</structfield></entry>
10597       <entry><type>name</type></entry>
10598       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10599       <entry>Name of table</entry>
10600      </row>
10601
10602      <row>
10603       <entry><structfield>attname</structfield></entry>
10604       <entry><type>name</type></entry>
10605       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
10606       <entry>Name of the column described by this row</entry>
10607      </row>
10608
10609      <row>
10610       <entry><structfield>inherited</structfield></entry>
10611       <entry><type>bool</type></entry>
10612       <entry></entry>
10613       <entry>If true, this row includes inheritance child columns, not just the
10614        values in the specified table</entry>
10615      </row>
10616
10617      <row>
10618       <entry><structfield>null_frac</structfield></entry>
10619       <entry><type>real</type></entry>
10620       <entry></entry>
10621       <entry>Fraction of column entries that are null</entry>
10622      </row>
10623
10624      <row>
10625       <entry><structfield>avg_width</structfield></entry>
10626       <entry><type>integer</type></entry>
10627       <entry></entry>
10628       <entry>Average width in bytes of column's entries</entry>
10629      </row>
10630
10631      <row>
10632       <entry><structfield>n_distinct</structfield></entry>
10633       <entry><type>real</type></entry>
10634       <entry></entry>
10635       <entry>
10636        If greater than zero, the estimated number of distinct values in the
10637        column.  If less than zero, the negative of the number of distinct
10638        values divided by the number of rows.  (The negated form is used when
10639        <command>ANALYZE</> believes that the number of distinct values is
10640        likely to increase as the table grows; the positive form is used when
10641        the column seems to have a fixed number of possible values.)  For
10642        example, -1 indicates a unique column in which the number of distinct
10643        values is the same as the number of rows.
10644       </entry>
10645      </row>
10646
10647      <row>
10648       <entry><structfield>most_common_vals</structfield></entry>
10649       <entry><type>anyarray</type></entry>
10650       <entry></entry>
10651       <entry>
10652        A list of the most common values in the column. (Null if
10653        no values seem to be more common than any others.)
10654       </entry>
10655      </row>
10656
10657      <row>
10658       <entry><structfield>most_common_freqs</structfield></entry>
10659       <entry><type>real[]</type></entry>
10660       <entry></entry>
10661       <entry>
10662        A list of the frequencies of the most common values,
10663        i.e., number of occurrences of each divided by total number of rows.
10664        (Null when <structfield>most_common_vals</structfield> is.)
10665       </entry>
10666      </row>
10667
10668      <row>
10669       <entry><structfield>histogram_bounds</structfield></entry>
10670       <entry><type>anyarray</type></entry>
10671       <entry></entry>
10672       <entry>
10673        A list of values that divide the column's values into groups of
10674        approximately equal population.  The values in
10675        <structfield>most_common_vals</>, if present, are omitted from this
10676        histogram calculation.  (This column is null if the column data type
10677        does not have a <literal>&lt;</> operator or if the
10678        <structfield>most_common_vals</> list accounts for the entire
10679        population.)
10680       </entry>
10681      </row>
10682
10683      <row>
10684       <entry><structfield>correlation</structfield></entry>
10685       <entry><type>real</type></entry>
10686       <entry></entry>
10687       <entry>
10688        Statistical correlation between physical row ordering and
10689        logical ordering of the column values.  This ranges from -1 to +1.
10690        When the value is near -1 or +1, an index scan on the column will
10691        be estimated to be cheaper than when it is near zero, due to reduction
10692        of random access to the disk.  (This column is null if the column data
10693        type does not have a <literal>&lt;</> operator.)
10694       </entry>
10695      </row>
10696
10697      <row>
10698       <entry><structfield>most_common_elems</structfield></entry>
10699       <entry><type>anyarray</type></entry>
10700       <entry></entry>
10701       <entry>
10702        A list of non-null element values most often appearing within values of
10703        the column. (Null for scalar types.)
10704       </entry>
10705      </row>
10706
10707      <row>
10708       <entry><structfield>most_common_elem_freqs</structfield></entry>
10709       <entry><type>real[]</type></entry>
10710       <entry></entry>
10711       <entry>
10712        A list of the frequencies of the most common element values, i.e., the
10713        fraction of rows containing at least one instance of the given value.
10714        Two or three additional values follow the per-element frequencies;
10715        these are the minimum and maximum of the preceding per-element
10716        frequencies, and optionally the frequency of null elements.
10717        (Null when <structfield>most_common_elems</structfield> is.)
10718       </entry>
10719      </row>
10720
10721      <row>
10722       <entry><structfield>elem_count_histogram</structfield></entry>
10723       <entry><type>real[]</type></entry>
10724       <entry></entry>
10725       <entry>
10726        A histogram of the counts of distinct non-null element values within the
10727        values of the column, followed by the average number of distinct
10728        non-null elements.  (Null for scalar types.)
10729       </entry>
10730      </row>
10731     </tbody>
10732    </tgroup>
10733   </table>
10734
10735   <para>
10736    The maximum number of entries in the array fields can be controlled on a
10737    column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
10738    command, or globally by setting the
10739    <xref linkend="guc-default-statistics-target"> run-time parameter.
10740   </para>
10741
10742  </sect1>
10743
10744  <sect1 id="view-pg-tables">
10745   <title><structname>pg_tables</structname></title>
10746
10747   <indexterm zone="view-pg-tables">
10748    <primary>pg_tables</primary>
10749   </indexterm>
10750
10751   <para>
10752    The view <structname>pg_tables</structname> provides access to
10753    useful information about each table in the database.
10754   </para>
10755
10756   <table>
10757    <title><structname>pg_tables</> Columns</title>
10758
10759    <tgroup cols="4">
10760     <thead>
10761      <row>
10762       <entry>Name</entry>
10763       <entry>Type</entry>
10764       <entry>References</entry>
10765       <entry>Description</entry>
10766      </row>
10767     </thead>
10768     <tbody>
10769      <row>
10770       <entry><structfield>schemaname</structfield></entry>
10771       <entry><type>name</type></entry>
10772       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10773       <entry>Name of schema containing table</entry>
10774      </row>
10775      <row>
10776       <entry><structfield>tablename</structfield></entry>
10777       <entry><type>name</type></entry>
10778       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10779       <entry>Name of table</entry>
10780      </row>
10781      <row>
10782       <entry><structfield>tableowner</structfield></entry>
10783       <entry><type>name</type></entry>
10784       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10785       <entry>Name of table's owner</entry>
10786      </row>
10787      <row>
10788       <entry><structfield>tablespace</structfield></entry>
10789       <entry><type>name</type></entry>
10790       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
10791       <entry>Name of tablespace containing table (null if default for database)</entry>
10792      </row>
10793      <row>
10794       <entry><structfield>hasindexes</structfield></entry>
10795       <entry><type>boolean</type></entry>
10796       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
10797       <entry>True if table has (or recently had) any indexes</entry>
10798      </row>
10799      <row>
10800       <entry><structfield>hasrules</structfield></entry>
10801       <entry><type>boolean</type></entry>
10802       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
10803       <entry>True if table has (or once had) rules</entry>
10804      </row>
10805      <row>
10806       <entry><structfield>hastriggers</structfield></entry>
10807       <entry><type>boolean</type></entry>
10808       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
10809       <entry>True if table has (or once had) triggers</entry>
10810      </row>
10811      <row>
10812       <entry><structfield>rowsecurity</structfield></entry>
10813       <entry><type>boolean</type></entry>
10814       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
10815       <entry>True if row security is enabled on the table</entry>
10816      </row>
10817     </tbody>
10818    </tgroup>
10819   </table>
10820
10821  </sect1>
10822
10823  <sect1 id="view-pg-timezone-abbrevs">
10824   <title><structname>pg_timezone_abbrevs</structname></title>
10825
10826   <indexterm zone="view-pg-timezone-abbrevs">
10827    <primary>pg_timezone_abbrevs</primary>
10828   </indexterm>
10829
10830   <para>
10831    The view <structname>pg_timezone_abbrevs</structname> provides a list
10832    of time zone abbreviations that are currently recognized by the datetime
10833    input routines.  The contents of this view change when the
10834    <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
10835   </para>
10836
10837   <table>
10838    <title><structname>pg_timezone_abbrevs</> Columns</title>
10839
10840    <tgroup cols="3">
10841     <thead>
10842      <row>
10843       <entry>Name</entry>
10844       <entry>Type</entry>
10845       <entry>Description</entry>
10846      </row>
10847     </thead>
10848     <tbody>
10849      <row>
10850       <entry><structfield>abbrev</structfield></entry>
10851       <entry><type>text</type></entry>
10852       <entry>Time zone abbreviation</entry>
10853      </row>
10854      <row>
10855       <entry><structfield>utc_offset</structfield></entry>
10856       <entry><type>interval</type></entry>
10857       <entry>Offset from UTC (positive means east of Greenwich)</entry>
10858      </row>
10859      <row>
10860       <entry><structfield>is_dst</structfield></entry>
10861       <entry><type>boolean</type></entry>
10862       <entry>True if this is a daylight-savings abbreviation</entry>
10863      </row>
10864     </tbody>
10865    </tgroup>
10866   </table>
10867
10868   <para>
10869    While most timezone abbreviations represent fixed offsets from UTC,
10870    there are some that have historically varied in value
10871    (see <xref linkend="datetime-config-files"> for more information).
10872    In such cases this view presents their current meaning.
10873   </para>
10874
10875  </sect1>
10876
10877  <sect1 id="view-pg-timezone-names">
10878   <title><structname>pg_timezone_names</structname></title>
10879
10880   <indexterm zone="view-pg-timezone-names">
10881    <primary>pg_timezone_names</primary>
10882   </indexterm>
10883
10884   <para>
10885    The view <structname>pg_timezone_names</structname> provides a list
10886    of time zone names that are recognized by <command>SET TIMEZONE</>,
10887    along with their associated abbreviations, UTC offsets,
10888    and daylight-savings status.  (Technically,
10889    <productname>PostgreSQL</productname> does not use UTC because leap
10890    seconds are not handled.)
10891    Unlike the abbreviations shown in <link
10892    linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
10893    date rules.  Therefore, the associated information changes across local DST
10894    boundaries.  The displayed information is computed based on the current
10895    value of <function>CURRENT_TIMESTAMP</>.
10896   </para>
10897
10898   <table>
10899    <title><structname>pg_timezone_names</> Columns</title>
10900
10901    <tgroup cols="3">
10902     <thead>
10903      <row>
10904       <entry>Name</entry>
10905       <entry>Type</entry>
10906       <entry>Description</entry>
10907      </row>
10908     </thead>
10909     <tbody>
10910      <row>
10911       <entry><structfield>name</structfield></entry>
10912       <entry><type>text</type></entry>
10913       <entry>Time zone name</entry>
10914      </row>
10915      <row>
10916       <entry><structfield>abbrev</structfield></entry>
10917       <entry><type>text</type></entry>
10918       <entry>Time zone abbreviation</entry>
10919      </row>
10920      <row>
10921       <entry><structfield>utc_offset</structfield></entry>
10922       <entry><type>interval</type></entry>
10923       <entry>Offset from UTC (positive means east of Greenwich)</entry>
10924      </row>
10925      <row>
10926       <entry><structfield>is_dst</structfield></entry>
10927       <entry><type>boolean</type></entry>
10928       <entry>True if currently observing daylight savings</entry>
10929      </row>
10930     </tbody>
10931    </tgroup>
10932   </table>
10933
10934  </sect1>
10935
10936  <sect1 id="view-pg-user">
10937   <title><structname>pg_user</structname></title>
10938
10939   <indexterm zone="view-pg-user">
10940    <primary>pg_user</primary>
10941   </indexterm>
10942
10943   <para>
10944    The view <structname>pg_user</structname> provides access to
10945    information about database users.  This is simply a publicly
10946    readable view of
10947    <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
10948    that blanks out the password field.
10949   </para>
10950
10951   <table>
10952    <title><structname>pg_user</> Columns</title>
10953
10954    <tgroup cols="3">
10955     <thead>
10956      <row>
10957       <entry>Name</entry>
10958       <entry>Type</entry>
10959       <entry>Description</entry>
10960      </row>
10961     </thead>
10962     <tbody>
10963      <row>
10964       <entry><structfield>usename</structfield></entry>
10965       <entry><type>name</type></entry>
10966       <entry>User name</entry>
10967      </row>
10968
10969      <row>
10970       <entry><structfield>usesysid</structfield></entry>
10971       <entry><type>oid</type></entry>
10972       <entry>ID of this user</entry>
10973      </row>
10974
10975      <row>
10976       <entry><structfield>usecreatedb</structfield></entry>
10977       <entry><type>bool</type></entry>
10978       <entry>User can create databases</entry>
10979      </row>
10980
10981      <row>
10982       <entry><structfield>usesuper</structfield></entry>
10983       <entry><type>bool</type></entry>
10984       <entry>User is a superuser</entry>
10985      </row>
10986
10987      <row>
10988       <entry><structfield>userepl</structfield></entry>
10989       <entry><type>bool</type></entry>
10990       <entry>
10991        User can initiate streaming replication and put the system in and
10992        out of backup mode.
10993       </entry>
10994      </row>
10995
10996      <row>
10997       <entry><structfield>usebypassrls</structfield></entry>
10998       <entry><type>bool</type></entry>
10999       <entry>
11000        User bypasses every row level security policy, see
11001        <xref linkend="ddl-rowsecurity"> for more information.
11002       </entry>
11003      </row>
11004
11005      <row>
11006       <entry><structfield>passwd</structfield></entry>
11007       <entry><type>text</type></entry>
11008       <entry>Not the password (always reads as <literal>********</>)</entry>
11009      </row>
11010
11011      <row>
11012       <entry><structfield>valuntil</structfield></entry>
11013       <entry><type>abstime</type></entry>
11014       <entry>Password expiry time (only used for password authentication)</entry>
11015      </row>
11016
11017      <row>
11018       <entry><structfield>useconfig</structfield></entry>
11019       <entry><type>text[]</type></entry>
11020       <entry>Session defaults for run-time configuration variables</entry>
11021      </row>
11022     </tbody>
11023    </tgroup>
11024   </table>
11025
11026  </sect1>
11027
11028  <sect1 id="view-pg-user-mappings">
11029   <title><structname>pg_user_mappings</structname></title>
11030
11031   <indexterm zone="view-pg-user-mappings">
11032    <primary>pg_user_mappings</primary>
11033   </indexterm>
11034
11035   <para>
11036    The view <structname>pg_user_mappings</structname> provides access
11037    to information about user mappings.  This is essentially a publicly
11038    readable view of
11039    <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
11040    that leaves out the options field if the user has no rights to use
11041    it.
11042   </para>
11043
11044   <table>
11045    <title><structname>pg_user_mappings</> Columns</title>
11046
11047    <tgroup cols="4">
11048     <thead>
11049      <row>
11050       <entry>Name</entry>
11051       <entry>Type</entry>
11052       <entry>References</entry>
11053       <entry>Description</entry>
11054      </row>
11055     </thead>
11056
11057     <tbody>
11058      <row>
11059       <entry><structfield>umid</structfield></entry>
11060       <entry><type>oid</type></entry>
11061       <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
11062       <entry>OID of the user mapping</entry>
11063      </row>
11064
11065      <row>
11066       <entry><structfield>srvid</structfield></entry>
11067       <entry><type>oid</type></entry>
11068       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
11069       <entry>
11070        The OID of the foreign server that contains this mapping
11071       </entry>
11072      </row>
11073
11074      <row>
11075       <entry><structfield>srvname</structfield></entry>
11076       <entry><type>name</type></entry>
11077       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
11078       <entry>
11079        Name of the foreign server
11080       </entry>
11081      </row>
11082
11083      <row>
11084       <entry><structfield>umuser</structfield></entry>
11085       <entry><type>oid</type></entry>
11086       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
11087       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
11088      </row>
11089
11090      <row>
11091       <entry><structfield>usename</structfield></entry>
11092       <entry><type>name</type></entry>
11093       <entry></entry>
11094       <entry>Name of the local user to be mapped</entry>
11095      </row>
11096
11097      <row>
11098       <entry><structfield>umoptions</structfield></entry>
11099       <entry><type>text[]</type></entry>
11100       <entry></entry>
11101       <entry>
11102        User mapping specific options, as <quote>keyword=value</>
11103        strings.  This column will show as null unless the current user
11104        is the user being mapped, or the mapping is for
11105        <literal>PUBLIC</literal> and the current user is the server
11106        owner, or the current user is a superuser.  The intent is
11107        to protect password information stored as user mapping option.
11108       </entry>
11109      </row>
11110     </tbody>
11111    </tgroup>
11112   </table>
11113  </sect1>
11114
11115
11116  <sect1 id="view-pg-views">
11117   <title><structname>pg_views</structname></title>
11118
11119   <indexterm zone="view-pg-views">
11120    <primary>pg_views</primary>
11121   </indexterm>
11122
11123   <para>
11124    The view <structname>pg_views</structname> provides access to
11125    useful information about each view in the database.
11126   </para>
11127
11128   <table>
11129    <title><structname>pg_views</> Columns</title>
11130
11131    <tgroup cols="4">
11132     <thead>
11133      <row>
11134       <entry>Name</entry>
11135       <entry>Type</entry>
11136       <entry>References</entry>
11137       <entry>Description</entry>
11138      </row>
11139     </thead>
11140     <tbody>
11141      <row>
11142       <entry><structfield>schemaname</structfield></entry>
11143       <entry><type>name</type></entry>
11144       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
11145       <entry>Name of schema containing view</entry>
11146      </row>
11147      <row>
11148       <entry><structfield>viewname</structfield></entry>
11149       <entry><type>name</type></entry>
11150       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
11151       <entry>Name of view</entry>
11152      </row>
11153      <row>
11154       <entry><structfield>viewowner</structfield></entry>
11155       <entry><type>name</type></entry>
11156       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
11157       <entry>Name of view's owner</entry>
11158      </row>
11159      <row>
11160       <entry><structfield>definition</structfield></entry>
11161       <entry><type>text</type></entry>
11162       <entry></entry>
11163       <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
11164      </row>
11165     </tbody>
11166    </tgroup>
11167   </table>
11168
11169  </sect1>
11170
11171 </chapter>