]> granicus.if.org Git - postgresql/blob - doc/src/sgml/catalogs.sgml
Invent pg_hba_file_rules view to show the content of pg_hba.conf.
[postgresql] / doc / src / sgml / catalogs.sgml
1 <!-- doc/src/sgml/catalogs.sgml -->
2 <!--
3  Documentation of the system catalogs, directed toward PostgreSQL developers
4  -->
5
6 <chapter id="catalogs">
7  <title>System Catalogs</title>
8
9   <para>
10    The system catalogs are the place where a relational database
11    management system stores schema metadata, such as information about
12    tables and columns, and internal bookkeeping information.
13    <productname>PostgreSQL</productname>'s system catalogs are regular
14    tables.  You can drop and recreate the tables, add columns, insert
15    and update values, and severely mess up your system that way.
16    Normally, one should not change the system catalogs by hand, there
17    are normally SQL commands to do that.  (For example, <command>CREATE
18    DATABASE</command> inserts a row into the
19    <structname>pg_database</structname> catalog &mdash; and actually
20    creates the database on disk.)  There are some exceptions for
21    particularly esoteric operations, but many of those have been made
22    available as SQL commands over time, and so the need for direct manipulation
23    of the system catalogs is ever decreasing.
24   </para>
25
26  <sect1 id="catalogs-overview">
27   <title>Overview</title>
28
29   <para>
30    <xref linkend="catalog-table"> lists the system catalogs.
31    More detailed documentation of each catalog follows below.
32   </para>
33
34   <para>
35    Most system catalogs are copied from the template database during
36    database creation and are thereafter database-specific. A few
37    catalogs are physically shared across all databases in a cluster;
38    these are noted in the descriptions of the individual catalogs.
39   </para>
40
41   <table id="catalog-table">
42    <title>System Catalogs</title>
43
44    <tgroup cols="2">
45     <thead>
46      <row>
47       <entry>Catalog Name</entry>
48       <entry>Purpose</entry>
49      </row>
50     </thead>
51
52     <tbody>
53      <row>
54       <entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
55       <entry>aggregate functions</entry>
56      </row>
57
58      <row>
59       <entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
60       <entry>index access methods</entry>
61      </row>
62
63      <row>
64       <entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
65       <entry>access method operators</entry>
66      </row>
67
68      <row>
69       <entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
70       <entry>access method support procedures</entry>
71      </row>
72
73      <row>
74       <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
75       <entry>column default values</entry>
76      </row>
77
78      <row>
79       <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
80       <entry>table columns (<quote>attributes</quote>)</entry>
81      </row>
82
83      <row>
84       <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
85       <entry>authorization identifiers (roles)</entry>
86      </row>
87
88      <row>
89       <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
90       <entry>authorization identifier membership relationships</entry>
91      </row>
92
93      <row>
94       <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
95       <entry>casts (data type conversions)</entry>
96      </row>
97
98      <row>
99       <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
100       <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
101      </row>
102
103      <row>
104       <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
105       <entry>collations (locale information)</entry>
106      </row>
107
108      <row>
109       <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
110       <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
111      </row>
112
113      <row>
114       <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
115       <entry>encoding conversion information</entry>
116      </row>
117
118      <row>
119       <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
120       <entry>databases within this database cluster</entry>
121      </row>
122
123      <row>
124       <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
125       <entry>per-role and per-database settings</entry>
126      </row>
127
128      <row>
129       <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
130       <entry>default privileges for object types</entry>
131      </row>
132
133      <row>
134       <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
135       <entry>dependencies between database objects</entry>
136      </row>
137
138      <row>
139       <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
140       <entry>descriptions or comments on database objects</entry>
141      </row>
142
143      <row>
144       <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
145       <entry>enum label and value definitions</entry>
146      </row>
147
148      <row>
149       <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
150       <entry>event triggers</entry>
151      </row>
152
153      <row>
154       <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
155       <entry>installed extensions</entry>
156      </row>
157
158      <row>
159       <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
160       <entry>foreign-data wrapper definitions</entry>
161      </row>
162
163      <row>
164       <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
165       <entry>foreign server definitions</entry>
166      </row>
167
168      <row>
169       <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
170       <entry>additional foreign table information</entry>
171      </row>
172
173      <row>
174       <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
175       <entry>additional index information</entry>
176      </row>
177
178      <row>
179       <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
180       <entry>table inheritance hierarchy</entry>
181      </row>
182
183      <row>
184       <entry><link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link></entry>
185       <entry>object initial privileges</entry>
186      </row>
187
188      <row>
189       <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
190       <entry>languages for writing functions</entry>
191      </row>
192
193      <row>
194       <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
195       <entry>data pages for large objects</entry>
196      </row>
197
198      <row>
199       <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
200       <entry>metadata for large objects</entry>
201      </row>
202
203      <row>
204       <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
205       <entry>schemas</entry>
206      </row>
207
208      <row>
209       <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
210       <entry>access method operator classes</entry>
211      </row>
212
213      <row>
214       <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
215       <entry>operators</entry>
216      </row>
217
218      <row>
219       <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
220       <entry>access method operator families</entry>
221      </row>
222
223      <row>
224       <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
225       <entry>template data for procedural languages</entry>
226      </row>
227
228      <row>
229       <entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
230       <entry>information about partition key of tables</entry>
231      </row>
232
233      <row>
234       <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
235       <entry>row-security policies</entry>
236      </row>
237
238      <row>
239       <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
240       <entry>functions and procedures</entry>
241      </row>
242
243      <row>
244       <entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
245       <entry>publications for logical replication</entry>
246      </row>
247
248      <row>
249       <entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
250       <entry>relation to publication mapping</entry>
251      </row>
252
253      <row>
254       <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
255       <entry>information about range types</entry>
256      </row>
257
258      <row>
259       <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
260       <entry>registered replication origins</entry>
261      </row>
262
263      <row>
264       <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
265       <entry>query rewrite rules</entry>
266      </row>
267
268      <row>
269       <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
270       <entry>security labels on database objects</entry>
271      </row>
272
273      <row>
274       <entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
275       <entry>information about sequences</entry>
276      </row>
277
278      <row>
279       <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
280       <entry>dependencies on shared objects</entry>
281      </row>
282
283      <row>
284       <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
285       <entry>comments on shared objects</entry>
286      </row>
287
288      <row>
289       <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
290       <entry>security labels on shared database objects</entry>
291      </row>
292
293      <row>
294       <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
295       <entry>planner statistics</entry>
296      </row>
297
298      <row>
299       <entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
300       <entry>logical replication subscriptions</entry>
301      </row>
302
303      <row>
304       <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
305       <entry>tablespaces within this database cluster</entry>
306      </row>
307
308      <row>
309       <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
310       <entry>transforms (data type to procedural language conversions)</entry>
311      </row>
312
313      <row>
314       <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
315       <entry>triggers</entry>
316      </row>
317
318      <row>
319       <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
320       <entry>text search configurations</entry>
321      </row>
322
323      <row>
324       <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
325       <entry>text search configurations' token mappings</entry>
326      </row>
327
328      <row>
329       <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
330       <entry>text search dictionaries</entry>
331      </row>
332
333      <row>
334       <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
335       <entry>text search parsers</entry>
336      </row>
337
338      <row>
339       <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
340       <entry>text search templates</entry>
341      </row>
342
343      <row>
344       <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
345       <entry>data types</entry>
346      </row>
347
348      <row>
349       <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
350       <entry>mappings of users to foreign servers</entry>
351      </row>
352     </tbody>
353    </tgroup>
354   </table>
355  </sect1>
356
357
358  <sect1 id="catalog-pg-aggregate">
359   <title><structname>pg_aggregate</structname></title>
360
361   <indexterm zone="catalog-pg-aggregate">
362    <primary>pg_aggregate</primary>
363   </indexterm>
364
365   <para>
366    The catalog <structname>pg_aggregate</structname> stores information about
367    aggregate functions.  An aggregate function is a function that
368    operates on a set of values (typically one column from each row
369    that matches a query condition) and returns a single value computed
370    from all these values.  Typical aggregate functions are
371    <function>sum</function>, <function>count</function>, and
372    <function>max</function>.  Each entry in
373    <structname>pg_aggregate</structname> is an extension of an entry
374    in <structname>pg_proc</structname>.  The <structname>pg_proc</structname>
375    entry carries the aggregate's name, input and output data types, and
376    other information that is similar to ordinary functions.
377   </para>
378
379   <table>
380    <title><structname>pg_aggregate</> Columns</title>
381
382    <tgroup cols="4">
383     <thead>
384      <row>
385       <entry>Name</entry>
386       <entry>Type</entry>
387       <entry>References</entry>
388       <entry>Description</entry>
389      </row>
390     </thead>
391     <tbody>
392      <row>
393       <entry><structfield>aggfnoid</structfield></entry>
394       <entry><type>regproc</type></entry>
395       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
396       <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
397      </row>
398      <row>
399       <entry><structfield>aggkind</structfield></entry>
400       <entry><type>char</type></entry>
401       <entry></entry>
402       <entry>Aggregate kind:
403        <literal>n</literal> for <quote>normal</> aggregates,
404        <literal>o</literal> for <quote>ordered-set</> aggregates, or
405        <literal>h</literal> for <quote>hypothetical-set</> aggregates
406       </entry>
407      </row>
408      <row>
409       <entry><structfield>aggnumdirectargs</structfield></entry>
410       <entry><type>int2</type></entry>
411       <entry></entry>
412       <entry>Number of direct (non-aggregated) arguments of an ordered-set or
413        hypothetical-set aggregate, counting a variadic array as one argument.
414        If equal to <structfield>pronargs</>, the aggregate must be variadic
415        and the variadic array describes the aggregated arguments as well as
416        the final direct arguments.
417        Always zero for normal aggregates.</entry>
418      </row>
419      <row>
420       <entry><structfield>aggtransfn</structfield></entry>
421       <entry><type>regproc</type></entry>
422       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
423       <entry>Transition function</entry>
424      </row>
425      <row>
426       <entry><structfield>aggfinalfn</structfield></entry>
427       <entry><type>regproc</type></entry>
428       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
429       <entry>Final function (zero if none)</entry>
430      </row>
431      <row>
432       <entry><structfield>aggcombinefn</structfield></entry>
433       <entry><type>regproc</type></entry>
434       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
435       <entry>Combine function (zero if none)</entry>
436      </row>
437      <row>
438       <entry><structfield>aggserialfn</structfield></entry>
439       <entry><type>regproc</type></entry>
440       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
441       <entry>Serialization function (zero if none)</entry>
442      </row>
443      <row>
444       <entry><structfield>aggdeserialfn</structfield></entry>
445       <entry><type>regproc</type></entry>
446       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
447       <entry>Deserialization function (zero if none)</entry>
448      </row>
449      <row>
450       <entry><structfield>aggmtransfn</structfield></entry>
451       <entry><type>regproc</type></entry>
452       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
453       <entry>Forward transition function for moving-aggregate mode (zero if none)</entry>
454      </row>
455      <row>
456       <entry><structfield>aggminvtransfn</structfield></entry>
457       <entry><type>regproc</type></entry>
458       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
459       <entry>Inverse transition function for moving-aggregate mode (zero if none)</entry>
460      </row>
461      <row>
462       <entry><structfield>aggmfinalfn</structfield></entry>
463       <entry><type>regproc</type></entry>
464       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
465       <entry>Final function for moving-aggregate mode (zero if none)</entry>
466      </row>
467      <row>
468       <entry><structfield>aggfinalextra</structfield></entry>
469       <entry><type>bool</type></entry>
470       <entry></entry>
471       <entry>True to pass extra dummy arguments to <structfield>aggfinalfn</structfield></entry>
472      </row>
473      <row>
474       <entry><structfield>aggmfinalextra</structfield></entry>
475       <entry><type>bool</type></entry>
476       <entry></entry>
477       <entry>True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield></entry>
478      </row>
479      <row>
480       <entry><structfield>aggsortop</structfield></entry>
481       <entry><type>oid</type></entry>
482       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
483       <entry>Associated sort operator (zero if none)</entry>
484      </row>
485      <row>
486       <entry><structfield>aggtranstype</structfield></entry>
487       <entry><type>oid</type></entry>
488       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
489       <entry>Data type of the aggregate function's internal transition (state) data</entry>
490      </row>
491      <row>
492       <entry><structfield>aggtransspace</structfield></entry>
493       <entry><type>int4</type></entry>
494       <entry></entry>
495       <entry>Approximate average size (in bytes) of the transition state
496        data, or zero to use a default estimate</entry>
497      </row>
498      <row>
499       <entry><structfield>aggmtranstype</structfield></entry>
500       <entry><type>oid</type></entry>
501       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
502       <entry>Data type of the aggregate function's internal transition (state)
503        data for moving-aggregate mode (zero if none)</entry>
504      </row>
505      <row>
506       <entry><structfield>aggmtransspace</structfield></entry>
507       <entry><type>int4</type></entry>
508       <entry></entry>
509       <entry>Approximate average size (in bytes) of the transition state data
510        for moving-aggregate mode, or zero to use a default estimate</entry>
511      </row>
512      <row>
513       <entry><structfield>agginitval</structfield></entry>
514       <entry><type>text</type></entry>
515       <entry></entry>
516       <entry>
517        The initial value of the transition state.  This is a text
518        field containing the initial value in its external string
519        representation.  If this field is null, the transition state
520        value starts out null.
521       </entry>
522      </row>
523      <row>
524       <entry><structfield>aggminitval</structfield></entry>
525       <entry><type>text</type></entry>
526       <entry></entry>
527       <entry>
528        The initial value of the transition state for moving-aggregate mode.
529        This is a text field containing the initial value in its external
530        string representation.  If this field is null, the transition state
531        value starts out null.
532       </entry>
533      </row>
534     </tbody>
535    </tgroup>
536   </table>
537
538   <para>
539    New aggregate functions are registered with the <xref
540    linkend="sql-createaggregate">
541    command.  See <xref linkend="xaggr"> for more information about
542    writing aggregate functions and the meaning of the transition
543    functions, etc.
544   </para>
545
546  </sect1>
547
548
549  <sect1 id="catalog-pg-am">
550   <title><structname>pg_am</structname></title>
551
552   <indexterm zone="catalog-pg-am">
553    <primary>pg_am</primary>
554   </indexterm>
555
556   <para>
557    The catalog <structname>pg_am</structname> stores information about
558    relation access methods.  There is one row for each access method supported
559    by the system.
560    Currently, only indexes have access methods.  The requirements for index
561    access methods are discussed in detail in <xref linkend="indexam">.
562   </para>
563
564   <table>
565    <title><structname>pg_am</> Columns</title>
566
567    <tgroup cols="4">
568     <thead>
569      <row>
570       <entry>Name</entry>
571       <entry>Type</entry>
572       <entry>References</entry>
573       <entry>Description</entry>
574      </row>
575     </thead>
576     <tbody>
577
578      <row>
579       <entry><structfield>oid</structfield></entry>
580       <entry><type>oid</type></entry>
581       <entry></entry>
582       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
583      </row>
584
585      <row>
586       <entry><structfield>amname</structfield></entry>
587       <entry><type>name</type></entry>
588       <entry></entry>
589       <entry>Name of the access method</entry>
590      </row>
591
592      <row>
593       <entry><structfield>amhandler</structfield></entry>
594       <entry><type>regproc</type></entry>
595       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
596       <entry>
597        OID of a handler function that is responsible for supplying information
598        about the access method
599       </entry>
600      </row>
601
602      <row>
603       <entry><structfield>amtype</structfield></entry>
604       <entry><type>char</type></entry>
605       <entry></entry>
606       <entry>
607        Currently always <literal>i</literal> to indicate an index access
608        method; other values may be allowed in future
609       </entry>
610      </row>
611     </tbody>
612    </tgroup>
613   </table>
614
615   <note>
616    <para>
617     Before <productname>PostgreSQL</> 9.6, <structname>pg_am</structname>
618     contained many additional columns representing properties of index access
619     methods.  That data is now only directly visible at the C code level.
620     However, <function>pg_index_column_has_property()</function> and related
621     functions have been added to allow SQL queries to inspect index access
622     method properties; see <xref linkend="functions-info-catalog-table">.
623    </para>
624   </note>
625
626  </sect1>
627
628
629  <sect1 id="catalog-pg-amop">
630   <title><structname>pg_amop</structname></title>
631
632   <indexterm zone="catalog-pg-amop">
633    <primary>pg_amop</primary>
634   </indexterm>
635
636   <para>
637    The catalog <structname>pg_amop</structname> stores information about
638    operators associated with access method operator families.  There is one
639    row for each operator that is a member of an operator family.  A family
640    member can be either a <firstterm>search</> operator or an
641    <firstterm>ordering</> operator.  An operator
642    can appear in more than one family, but cannot appear in more than one
643    search position nor more than one ordering position within a family.
644    (It is allowed, though unlikely, for an operator to be used for both
645    search and ordering purposes.)
646   </para>
647
648   <table>
649    <title><structname>pg_amop</> Columns</title>
650
651    <tgroup cols="4">
652     <thead>
653      <row>
654       <entry>Name</entry>
655       <entry>Type</entry>
656       <entry>References</entry>
657       <entry>Description</entry>
658      </row>
659     </thead>
660     <tbody>
661
662      <row>
663       <entry><structfield>oid</structfield></entry>
664       <entry><type>oid</type></entry>
665       <entry></entry>
666       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
667      </row>
668
669      <row>
670       <entry><structfield>amopfamily</structfield></entry>
671       <entry><type>oid</type></entry>
672       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
673       <entry>The operator family this entry is for</entry>
674      </row>
675
676      <row>
677       <entry><structfield>amoplefttype</structfield></entry>
678       <entry><type>oid</type></entry>
679       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
680       <entry>Left-hand input data type of operator</entry>
681      </row>
682
683      <row>
684       <entry><structfield>amoprighttype</structfield></entry>
685       <entry><type>oid</type></entry>
686       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
687       <entry>Right-hand input data type of operator</entry>
688      </row>
689
690      <row>
691       <entry><structfield>amopstrategy</structfield></entry>
692       <entry><type>int2</type></entry>
693       <entry></entry>
694       <entry>Operator strategy number</entry>
695      </row>
696
697      <row>
698       <entry><structfield>amoppurpose</structfield></entry>
699       <entry><type>char</type></entry>
700       <entry></entry>
701       <entry>Operator purpose, either <literal>s</> for search or
702        <literal>o</> for ordering</entry>
703      </row>
704
705      <row>
706       <entry><structfield>amopopr</structfield></entry>
707       <entry><type>oid</type></entry>
708       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
709       <entry>OID of the operator</entry>
710      </row>
711
712      <row>
713       <entry><structfield>amopmethod</structfield></entry>
714       <entry><type>oid</type></entry>
715       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
716       <entry>Index access method operator family is for</entry>
717      </row>
718
719      <row>
720       <entry><structfield>amopsortfamily</structfield></entry>
721       <entry><type>oid</type></entry>
722       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
723       <entry>The B-tree operator family this entry sorts according to, if an
724        ordering operator; zero if a search operator</entry>
725      </row>
726
727     </tbody>
728    </tgroup>
729   </table>
730
731   <para>
732    A <quote>search</> operator entry indicates that an index of this operator
733    family can be searched to find all rows satisfying
734    <literal>WHERE</>
735    <replaceable>indexed_column</>
736    <replaceable>operator</>
737    <replaceable>constant</>.
738    Obviously, such an operator must return <type>boolean</type>, and its left-hand input
739    type must match the index's column data type.
740   </para>
741
742   <para>
743    An <quote>ordering</> operator entry indicates that an index of this
744    operator family can be scanned to return rows in the order represented by
745    <literal>ORDER BY</>
746    <replaceable>indexed_column</>
747    <replaceable>operator</>
748    <replaceable>constant</>.
749    Such an operator could return any sortable data type, though again
750    its left-hand input type must match the index's column data type.
751    The exact semantics of the <literal>ORDER BY</> are specified by the
752    <structfield>amopsortfamily</structfield> column, which must reference
753    a B-tree operator family for the operator's result type.
754   </para>
755
756   <note>
757    <para>
758     At present, it's assumed that the sort order for an ordering operator
759     is the default for the referenced operator family, i.e., <literal>ASC NULLS
760     LAST</>.  This might someday be relaxed by adding additional columns
761     to specify sort options explicitly.
762    </para>
763   </note>
764
765   <para>
766    An entry's <structfield>amopmethod</> must match the
767    <structname>opfmethod</> of its containing operator family (including
768    <structfield>amopmethod</> here is an intentional denormalization of the
769    catalog structure for performance reasons).  Also,
770    <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
771    the <structfield>oprleft</> and <structfield>oprright</> fields of the
772    referenced <structname>pg_operator</> entry.
773   </para>
774
775  </sect1>
776
777
778  <sect1 id="catalog-pg-amproc">
779   <title><structname>pg_amproc</structname></title>
780
781   <indexterm zone="catalog-pg-amproc">
782    <primary>pg_amproc</primary>
783   </indexterm>
784
785   <para>
786    The catalog <structname>pg_amproc</structname> stores information about
787    support procedures associated with access method operator families.  There
788    is one row for each support procedure belonging to an operator family.
789   </para>
790
791   <table>
792    <title><structname>pg_amproc</structname> Columns</title>
793
794    <tgroup cols="4">
795     <thead>
796      <row>
797       <entry>Name</entry>
798       <entry>Type</entry>
799       <entry>References</entry>
800       <entry>Description</entry>
801      </row>
802     </thead>
803     <tbody>
804
805      <row>
806       <entry><structfield>oid</structfield></entry>
807       <entry><type>oid</type></entry>
808       <entry></entry>
809       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
810      </row>
811
812      <row>
813       <entry><structfield>amprocfamily</structfield></entry>
814       <entry><type>oid</type></entry>
815       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
816       <entry>The operator family this entry is for</entry>
817      </row>
818
819      <row>
820       <entry><structfield>amproclefttype</structfield></entry>
821       <entry><type>oid</type></entry>
822       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
823       <entry>Left-hand input data type of associated operator</entry>
824      </row>
825
826      <row>
827       <entry><structfield>amprocrighttype</structfield></entry>
828       <entry><type>oid</type></entry>
829       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
830       <entry>Right-hand input data type of associated operator</entry>
831      </row>
832
833      <row>
834       <entry><structfield>amprocnum</structfield></entry>
835       <entry><type>int2</type></entry>
836       <entry></entry>
837       <entry>Support procedure number</entry>
838      </row>
839
840      <row>
841       <entry><structfield>amproc</structfield></entry>
842       <entry><type>regproc</type></entry>
843       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
844       <entry>OID of the procedure</entry>
845      </row>
846
847     </tbody>
848    </tgroup>
849   </table>
850
851   <para>
852    The usual interpretation of the
853    <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
854    is that they identify the left and right input types of the operator(s)
855    that a particular support procedure supports.  For some access methods
856    these match the input data type(s) of the support procedure itself, for
857    others not.  There is a notion of <quote>default</> support procedures for
858    an index, which are those with <structfield>amproclefttype</> and
859    <structfield>amprocrighttype</> both equal to the index operator class's
860    <structfield>opcintype</>.
861   </para>
862
863  </sect1>
864
865
866  <sect1 id="catalog-pg-attrdef">
867   <title><structname>pg_attrdef</structname></title>
868
869   <indexterm zone="catalog-pg-attrdef">
870    <primary>pg_attrdef</primary>
871   </indexterm>
872
873   <para>
874    The catalog <structname>pg_attrdef</structname> stores column default values.  The main information
875    about columns is stored in <structname>pg_attribute</structname>
876    (see below).  Only columns that explicitly specify a default value
877    (when the table is created or the column is added) will have an
878    entry here.
879   </para>
880
881   <table>
882    <title><structname>pg_attrdef</> Columns</title>
883
884    <tgroup cols="4">
885     <thead>
886      <row>
887       <entry>Name</entry>
888       <entry>Type</entry>
889       <entry>References</entry>
890       <entry>Description</entry>
891      </row>
892     </thead>
893
894     <tbody>
895      <row>
896       <entry><structfield>oid</structfield></entry>
897       <entry><type>oid</type></entry>
898       <entry></entry>
899       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
900      </row>
901
902      <row>
903       <entry><structfield>adrelid</structfield></entry>
904       <entry><type>oid</type></entry>
905       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
906       <entry>The table this column belongs to</entry>
907      </row>
908
909      <row>
910       <entry><structfield>adnum</structfield></entry>
911       <entry><type>int2</type></entry>
912       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
913       <entry>The number of the column</entry>
914      </row>
915
916      <row>
917       <entry><structfield>adbin</structfield></entry>
918       <entry><type>pg_node_tree</type></entry>
919       <entry></entry>
920       <entry>The internal representation of the column default value</entry>
921      </row>
922
923      <row>
924       <entry><structfield>adsrc</structfield></entry>
925       <entry><type>text</type></entry>
926       <entry></entry>
927       <entry>A human-readable representation of the default value</entry>
928      </row>
929     </tbody>
930    </tgroup>
931   </table>
932
933    <para>
934     The <structfield>adsrc</structfield> field is historical, and is best
935     not used, because it does not track outside changes that might affect
936     the representation of the default value.  Reverse-compiling the
937     <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
938     example) is a better way to display the default value.
939    </para>
940
941  </sect1>
942
943
944  <sect1 id="catalog-pg-attribute">
945   <title><structname>pg_attribute</structname></title>
946
947   <indexterm zone="catalog-pg-attribute">
948    <primary>pg_attribute</primary>
949   </indexterm>
950
951   <para>
952    The catalog <structname>pg_attribute</structname> stores information about
953    table columns.  There will be exactly one
954    <structname>pg_attribute</structname> row for every column in every
955    table in the database.  (There will also be attribute entries for
956    indexes, and indeed all objects that have <structname>pg_class</structname>
957    entries.)
958   </para>
959
960   <para>
961    The term attribute is equivalent to column and is used for
962    historical reasons.
963   </para>
964
965   <table>
966    <title><structname>pg_attribute</> Columns</title>
967
968    <tgroup cols="4">
969     <thead>
970      <row>
971       <entry>Name</entry>
972       <entry>Type</entry>
973       <entry>References</entry>
974       <entry>Description</entry>
975      </row>
976     </thead>
977
978     <tbody>
979      <row>
980       <entry><structfield>attrelid</structfield></entry>
981       <entry><type>oid</type></entry>
982       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
983       <entry>The table this column belongs to</entry>
984      </row>
985
986      <row>
987       <entry><structfield>attname</structfield></entry>
988       <entry><type>name</type></entry>
989       <entry></entry>
990       <entry>The column name</entry>
991      </row>
992
993      <row>
994       <entry><structfield>atttypid</structfield></entry>
995       <entry><type>oid</type></entry>
996       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
997       <entry>The data type of this column</entry>
998      </row>
999
1000      <row>
1001       <entry><structfield>attstattarget</structfield></entry>
1002       <entry><type>int4</type></entry>
1003       <entry></entry>
1004       <entry>
1005        <structfield>attstattarget</structfield> controls the level of detail
1006        of statistics accumulated for this column by
1007        <xref linkend="sql-analyze">.
1008        A zero value indicates that no statistics should be collected.
1009        A negative value says to use the system default statistics target.
1010        The exact meaning of positive values is data type-dependent.
1011        For scalar data types, <structfield>attstattarget</structfield>
1012        is both the target number of <quote>most common values</quote>
1013        to collect, and the target number of histogram bins to create.
1014       </entry>
1015      </row>
1016
1017      <row>
1018       <entry><structfield>attlen</structfield></entry>
1019       <entry><type>int2</type></entry>
1020       <entry></entry>
1021       <entry>
1022        A copy of <literal>pg_type.typlen</literal> of this column's
1023        type
1024       </entry>
1025      </row>
1026
1027      <row>
1028       <entry><structfield>attnum</structfield></entry>
1029       <entry><type>int2</type></entry>
1030       <entry></entry>
1031       <entry>
1032        The number of the column.  Ordinary columns are numbered from 1
1033        up.  System columns, such as <structfield>oid</structfield>,
1034        have (arbitrary) negative numbers.
1035       </entry>
1036      </row>
1037
1038      <row>
1039       <entry><structfield>attndims</structfield></entry>
1040       <entry><type>int4</type></entry>
1041       <entry></entry>
1042       <entry>
1043        Number of dimensions, if the column is an array type; otherwise 0.
1044        (Presently, the number of dimensions of an array is not enforced,
1045        so any nonzero value effectively means <quote>it's an array</>.)
1046       </entry>
1047      </row>
1048
1049      <row>
1050       <entry><structfield>attcacheoff</structfield></entry>
1051       <entry><type>int4</type></entry>
1052       <entry></entry>
1053       <entry>
1054        Always -1 in storage, but when loaded into a row descriptor
1055        in memory this might be updated to cache the offset of the attribute
1056        within the row
1057       </entry>
1058      </row>
1059
1060      <row>
1061       <entry><structfield>atttypmod</structfield></entry>
1062       <entry><type>int4</type></entry>
1063       <entry></entry>
1064       <entry>
1065        <structfield>atttypmod</structfield> records type-specific data
1066        supplied at table creation time (for example, the maximum
1067        length of a <type>varchar</type> column).  It is passed to
1068        type-specific input functions and length coercion functions.
1069        The value will generally be -1 for types that do not need <structfield>atttypmod</>.
1070       </entry>
1071      </row>
1072
1073      <row>
1074       <entry><structfield>attbyval</structfield></entry>
1075       <entry><type>bool</type></entry>
1076       <entry></entry>
1077       <entry>
1078        A copy of <literal>pg_type.typbyval</> of this column's type
1079       </entry>
1080      </row>
1081
1082      <row>
1083       <entry><structfield>attstorage</structfield></entry>
1084       <entry><type>char</type></entry>
1085       <entry></entry>
1086       <entry>
1087        Normally a copy of <literal>pg_type.typstorage</> of this
1088        column's type.  For TOAST-able data types, this can be altered
1089        after column creation to control storage policy.
1090       </entry>
1091      </row>
1092
1093      <row>
1094       <entry><structfield>attalign</structfield></entry>
1095       <entry><type>char</type></entry>
1096       <entry></entry>
1097       <entry>
1098        A copy of <literal>pg_type.typalign</> of this column's type
1099       </entry>
1100      </row>
1101
1102      <row>
1103       <entry><structfield>attnotnull</structfield></entry>
1104       <entry><type>bool</type></entry>
1105       <entry></entry>
1106       <entry>
1107        This represents a not-null constraint.
1108       </entry>
1109      </row>
1110
1111      <row>
1112       <entry><structfield>atthasdef</structfield></entry>
1113       <entry><type>bool</type></entry>
1114       <entry></entry>
1115       <entry>
1116        This column has a default value, in which case there will be a
1117        corresponding entry in the <structname>pg_attrdef</structname>
1118        catalog that actually defines the value.
1119       </entry>
1120      </row>
1121
1122      <row>
1123       <entry><structfield>attisdropped</structfield></entry>
1124       <entry><type>bool</type></entry>
1125       <entry></entry>
1126       <entry>
1127        This column has been dropped and is no longer valid.  A dropped
1128        column is still physically present in the table, but is
1129        ignored by the parser and so cannot be accessed via SQL.
1130       </entry>
1131      </row>
1132
1133      <row>
1134       <entry><structfield>attislocal</structfield></entry>
1135       <entry><type>bool</type></entry>
1136       <entry></entry>
1137       <entry>
1138        This column is defined locally in the relation.  Note that a column can
1139        be locally defined and inherited simultaneously.
1140       </entry>
1141      </row>
1142
1143      <row>
1144       <entry><structfield>attinhcount</structfield></entry>
1145       <entry><type>int4</type></entry>
1146       <entry></entry>
1147       <entry>
1148        The number of direct ancestors this column has.  A column with a
1149        nonzero number of ancestors cannot be dropped nor renamed.
1150       </entry>
1151      </row>
1152
1153      <row>
1154       <entry><structfield>attcollation</structfield></entry>
1155       <entry><type>oid</type></entry>
1156       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
1157       <entry>
1158        The defined collation of the column, or zero if the column is
1159        not of a collatable data type.
1160       </entry>
1161      </row>
1162
1163      <row>
1164       <entry><structfield>attacl</structfield></entry>
1165       <entry><type>aclitem[]</type></entry>
1166       <entry></entry>
1167       <entry>
1168        Column-level access privileges, if any have been granted specifically
1169        on this column
1170       </entry>
1171      </row>
1172
1173      <row>
1174       <entry><structfield>attoptions</structfield></entry>
1175       <entry><type>text[]</type></entry>
1176       <entry></entry>
1177       <entry>
1178        Attribute-level options, as <quote>keyword=value</> strings
1179       </entry>
1180      </row>
1181
1182      <row>
1183       <entry><structfield>attfdwoptions</structfield></entry>
1184       <entry><type>text[]</type></entry>
1185       <entry></entry>
1186       <entry>
1187        Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings
1188       </entry>
1189      </row>
1190
1191     </tbody>
1192    </tgroup>
1193   </table>
1194
1195   <para>
1196    In a dropped column's <structname>pg_attribute</structname> entry,
1197    <structfield>atttypid</structfield> is reset to zero, but
1198    <structfield>attlen</structfield> and the other fields copied from
1199    <structname>pg_type</> are still valid.  This arrangement is needed
1200    to cope with the situation where the dropped column's data type was
1201    later dropped, and so there is no <structname>pg_type</> row anymore.
1202    <structfield>attlen</structfield> and the other fields can be used
1203    to interpret the contents of a row of the table.
1204   </para>
1205  </sect1>
1206
1207
1208  <sect1 id="catalog-pg-authid">
1209   <title><structname>pg_authid</structname></title>
1210
1211   <indexterm zone="catalog-pg-authid">
1212    <primary>pg_authid</primary>
1213   </indexterm>
1214
1215   <para>
1216    The catalog <structname>pg_authid</structname> contains information about
1217    database authorization identifiers (roles).  A role subsumes the concepts
1218    of <quote>users</> and <quote>groups</>.  A user is essentially just a
1219    role with the <structfield>rolcanlogin</> flag set.  Any role (with or
1220    without <structfield>rolcanlogin</>) can have other roles as members; see
1221    <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1222   </para>
1223
1224   <para>
1225    Since this catalog contains passwords, it must not be publicly readable.
1226    <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1227    is a publicly readable view on
1228    <structname>pg_authid</structname> that blanks out the password field.
1229   </para>
1230
1231   <para>
1232    <xref linkend="user-manag"> contains detailed information about user and
1233    privilege management.
1234   </para>
1235
1236   <para>
1237    Because user identities are cluster-wide,
1238    <structname>pg_authid</structname>
1239    is shared across all databases of a cluster: there is only one
1240    copy of <structname>pg_authid</structname> per cluster, not
1241    one per database.
1242   </para>
1243
1244   <table>
1245    <title><structname>pg_authid</> Columns</title>
1246
1247    <tgroup cols="3">
1248     <thead>
1249      <row>
1250       <entry>Name</entry>
1251       <entry>Type</entry>
1252       <entry>Description</entry>
1253      </row>
1254     </thead>
1255
1256     <tbody>
1257
1258      <row>
1259       <entry><structfield>oid</structfield></entry>
1260       <entry><type>oid</type></entry>
1261       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1262      </row>
1263
1264      <row>
1265       <entry><structfield>rolname</structfield></entry>
1266       <entry><type>name</type></entry>
1267       <entry>Role name</entry>
1268      </row>
1269
1270      <row>
1271       <entry><structfield>rolsuper</structfield></entry>
1272       <entry><type>bool</type></entry>
1273       <entry>Role has superuser privileges</entry>
1274      </row>
1275
1276      <row>
1277       <entry><structfield>rolinherit</structfield></entry>
1278       <entry><type>bool</type></entry>
1279       <entry>Role automatically inherits privileges of roles it is a
1280        member of</entry>
1281      </row>
1282
1283      <row>
1284       <entry><structfield>rolcreaterole</structfield></entry>
1285       <entry><type>bool</type></entry>
1286       <entry>Role can create more roles</entry>
1287      </row>
1288
1289      <row>
1290       <entry><structfield>rolcreatedb</structfield></entry>
1291       <entry><type>bool</type></entry>
1292       <entry>Role can create databases</entry>
1293      </row>
1294
1295      <row>
1296       <entry><structfield>rolcanlogin</structfield></entry>
1297       <entry><type>bool</type></entry>
1298       <entry>
1299        Role can log in. That is, this role can be given as the initial
1300        session authorization identifier
1301       </entry>
1302      </row>
1303
1304      <row>
1305       <entry><structfield>rolreplication</structfield></entry>
1306       <entry><type>bool</type></entry>
1307       <entry>
1308        Role is a replication role. That is, this role can initiate streaming
1309        replication (see <xref linkend="streaming-replication">) and set/unset
1310        the system backup mode using <function>pg_start_backup</> and
1311        <function>pg_stop_backup</>
1312       </entry>
1313      </row>
1314
1315      <row>
1316       <entry><structfield>rolbypassrls</structfield></entry>
1317       <entry><type>bool</type></entry>
1318       <entry>
1319        Role bypasses every row level security policy, see
1320        <xref linkend="ddl-rowsecurity"> for more information.
1321       </entry>
1322      </row>
1323
1324      <row>
1325       <entry><structfield>rolconnlimit</structfield></entry>
1326       <entry><type>int4</type></entry>
1327       <entry>
1328        For roles that can log in, this sets maximum number of concurrent
1329        connections this role can make.  -1 means no limit.
1330       </entry>
1331      </row>
1332
1333      <row>
1334       <entry><structfield>rolpassword</structfield></entry>
1335       <entry><type>text</type></entry>
1336       <entry>
1337        Password (possibly encrypted); null if none.  If the password
1338        is encrypted, this column will begin with the string <literal>md5</>
1339        followed by a 32-character hexadecimal MD5 hash.  The MD5 hash
1340        will be of the user's password concatenated to their user name.
1341        For example, if user <literal>joe</> has password <literal>xyzzy</>,
1342        <productname>PostgreSQL</> will store the md5 hash of
1343        <literal>xyzzyjoe</>.  A password that does not follow that
1344        format is assumed to be unencrypted.
1345       </entry>
1346      </row>
1347
1348      <row>
1349       <entry><structfield>rolvaliduntil</structfield></entry>
1350       <entry><type>timestamptz</type></entry>
1351       <entry>Password expiry time (only used for password authentication);
1352        null if no expiration</entry>
1353      </row>
1354     </tbody>
1355    </tgroup>
1356   </table>
1357
1358  </sect1>
1359
1360
1361  <sect1 id="catalog-pg-auth-members">
1362   <title><structname>pg_auth_members</structname></title>
1363
1364   <indexterm zone="catalog-pg-auth-members">
1365    <primary>pg_auth_members</primary>
1366   </indexterm>
1367
1368   <para>
1369    The catalog <structname>pg_auth_members</structname> shows the membership
1370    relations between roles.  Any non-circular set of relationships is allowed.
1371   </para>
1372
1373   <para>
1374    Because user identities are cluster-wide,
1375    <structname>pg_auth_members</structname>
1376    is shared across all databases of a cluster: there is only one
1377    copy of <structname>pg_auth_members</structname> per cluster, not
1378    one per database.
1379   </para>
1380
1381   <table>
1382    <title><structname>pg_auth_members</> Columns</title>
1383
1384    <tgroup cols="4">
1385     <thead>
1386      <row>
1387       <entry>Name</entry>
1388       <entry>Type</entry>
1389       <entry>References</entry>
1390       <entry>Description</entry>
1391      </row>
1392     </thead>
1393
1394     <tbody>
1395      <row>
1396       <entry><structfield>roleid</structfield></entry>
1397       <entry><type>oid</type></entry>
1398       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1399       <entry>ID of a role that has a member</entry>
1400      </row>
1401
1402      <row>
1403       <entry><structfield>member</structfield></entry>
1404       <entry><type>oid</type></entry>
1405       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1406       <entry>ID of a role that is a member of <structfield>roleid</></entry>
1407      </row>
1408
1409      <row>
1410       <entry><structfield>grantor</structfield></entry>
1411       <entry><type>oid</type></entry>
1412       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1413       <entry>ID of the role that granted this membership</entry>
1414      </row>
1415
1416      <row>
1417       <entry><structfield>admin_option</structfield></entry>
1418       <entry><type>bool</type></entry>
1419       <entry></entry>
1420       <entry>True if <structfield>member</> can grant membership in
1421        <structfield>roleid</> to others</entry>
1422      </row>
1423     </tbody>
1424    </tgroup>
1425   </table>
1426
1427  </sect1>
1428
1429
1430  <sect1 id="catalog-pg-cast">
1431   <title><structname>pg_cast</structname></title>
1432
1433   <indexterm zone="catalog-pg-cast">
1434    <primary>pg_cast</primary>
1435   </indexterm>
1436
1437   <para>
1438    The catalog <structname>pg_cast</structname> stores data type conversion
1439    paths, both built-in and user-defined.
1440   </para>
1441
1442   <para>
1443    It should be noted that <structname>pg_cast</structname> does not represent
1444    every type conversion that the system knows how to perform; only those that
1445    cannot be deduced from some generic rule.  For example, casting between a
1446    domain and its base type is not explicitly represented in
1447    <structname>pg_cast</structname>.  Another important exception is that
1448    <quote>automatic I/O conversion casts</>, those performed using a data
1449    type's own I/O functions to convert to or from <type>text</> or other
1450    string types, are not explicitly represented in
1451    <structname>pg_cast</structname>.
1452   </para>
1453
1454   <table>
1455    <title><structname>pg_cast</> Columns</title>
1456
1457    <tgroup cols="4">
1458     <thead>
1459      <row>
1460       <entry>Name</entry>
1461       <entry>Type</entry>
1462       <entry>References</entry>
1463       <entry>Description</entry>
1464      </row>
1465     </thead>
1466
1467     <tbody>
1468      <row>
1469       <entry><structfield>oid</structfield></entry>
1470       <entry><type>oid</type></entry>
1471       <entry></entry>
1472       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1473      </row>
1474
1475      <row>
1476       <entry><structfield>castsource</structfield></entry>
1477       <entry><type>oid</type></entry>
1478       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1479       <entry>OID of the source data type</entry>
1480      </row>
1481
1482      <row>
1483       <entry><structfield>casttarget</structfield></entry>
1484       <entry><type>oid</type></entry>
1485       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1486       <entry>OID of the target data type</entry>
1487      </row>
1488
1489      <row>
1490       <entry><structfield>castfunc</structfield></entry>
1491       <entry><type>oid</type></entry>
1492       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1493       <entry>
1494        The OID of the function to use to perform this cast.  Zero is
1495        stored if the cast method doesn't require a function.
1496       </entry>
1497      </row>
1498
1499      <row>
1500       <entry><structfield>castcontext</structfield></entry>
1501       <entry><type>char</type></entry>
1502       <entry></entry>
1503       <entry>
1504        Indicates what contexts the cast can be invoked in.
1505        <literal>e</> means only as an explicit cast (using
1506        <literal>CAST</> or <literal>::</> syntax).
1507        <literal>a</> means implicitly in assignment
1508        to a target column, as well as explicitly.
1509        <literal>i</> means implicitly in expressions, as well as the
1510        other cases.
1511       </entry>
1512      </row>
1513      <row>
1514       <entry><structfield>castmethod</structfield></entry>
1515       <entry><type>char</type></entry>
1516       <entry></entry>
1517       <entry>
1518        Indicates how the cast is performed.
1519        <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1520        <literal>i</> means that the input/output functions are used.
1521        <literal>b</> means that the types are binary-coercible, thus no conversion is required.
1522       </entry>
1523      </row>
1524     </tbody>
1525    </tgroup>
1526   </table>
1527
1528   <para>
1529    The cast functions listed in <structname>pg_cast</structname> must
1530    always take the cast source type as their first argument type, and
1531    return the cast destination type as their result type.  A cast
1532    function can have up to three arguments.  The second argument,
1533    if present, must be type <type>integer</>; it receives the type
1534    modifier associated with the destination type, or -1
1535    if there is none.  The third argument,
1536    if present, must be type <type>boolean</>; it receives <literal>true</>
1537    if the cast is an explicit cast, <literal>false</> otherwise.
1538   </para>
1539
1540   <para>
1541    It is legitimate to create a <structname>pg_cast</structname> entry
1542    in which the source and target types are the same, if the associated
1543    function takes more than one argument.  Such entries represent
1544    <quote>length coercion functions</> that coerce values of the type
1545    to be legal for a particular type modifier value.
1546   </para>
1547
1548   <para>
1549    When a <structname>pg_cast</structname> entry has different source and
1550    target types and a function that takes more than one argument, it
1551    represents converting from one type to another and applying a length
1552    coercion in a single step.  When no such entry is available, coercion
1553    to a type that uses a type modifier involves two steps, one to
1554    convert between data types and a second to apply the modifier.
1555   </para>
1556  </sect1>
1557
1558  <sect1 id="catalog-pg-class">
1559   <title><structname>pg_class</structname></title>
1560
1561   <indexterm zone="catalog-pg-class">
1562    <primary>pg_class</primary>
1563   </indexterm>
1564
1565   <para>
1566    The catalog <structname>pg_class</structname> catalogs tables and most
1567    everything else that has columns or is otherwise similar to a
1568    table.  This includes indexes (but see also
1569    <structname>pg_index</structname>), sequences (but see also
1570    <structname>pg_sequence</structname>), views, materialized
1571    views, composite types, and TOAST tables; see <structfield>relkind</>.
1572    Below, when we mean all of these
1573    kinds of objects we speak of <quote>relations</quote>.  Not all
1574    columns are meaningful for all relation types.
1575   </para>
1576
1577   <table>
1578    <title><structname>pg_class</> Columns</title>
1579
1580    <tgroup cols="4">
1581     <thead>
1582      <row>
1583       <entry>Name</entry>
1584       <entry>Type</entry>
1585       <entry>References</entry>
1586       <entry>Description</entry>
1587      </row>
1588     </thead>
1589
1590     <tbody>
1591      <row>
1592       <entry><structfield>oid</structfield></entry>
1593       <entry><type>oid</type></entry>
1594       <entry></entry>
1595       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1596      </row>
1597
1598      <row>
1599       <entry><structfield>relname</structfield></entry>
1600       <entry><type>name</type></entry>
1601       <entry></entry>
1602       <entry>Name of the table, index, view, etc.</entry>
1603      </row>
1604
1605      <row>
1606       <entry><structfield>relnamespace</structfield></entry>
1607       <entry><type>oid</type></entry>
1608       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1609       <entry>
1610        The OID of the namespace that contains this relation
1611       </entry>
1612      </row>
1613
1614      <row>
1615       <entry><structfield>reltype</structfield></entry>
1616       <entry><type>oid</type></entry>
1617       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1618       <entry>
1619        The OID of the data type that corresponds to this table's row type,
1620        if any (zero for indexes, which have no <structname>pg_type</> entry)
1621       </entry>
1622      </row>
1623
1624      <row>
1625       <entry><structfield>reloftype</structfield></entry>
1626       <entry><type>oid</type></entry>
1627       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1628       <entry>
1629        For typed tables, the OID of the underlying composite type,
1630        zero for all other relations
1631       </entry>
1632      </row>
1633
1634      <row>
1635       <entry><structfield>relowner</structfield></entry>
1636       <entry><type>oid</type></entry>
1637       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1638       <entry>Owner of the relation</entry>
1639      </row>
1640
1641      <row>
1642       <entry><structfield>relam</structfield></entry>
1643       <entry><type>oid</type></entry>
1644       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1645       <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1646      </row>
1647
1648      <row>
1649       <entry><structfield>relfilenode</structfield></entry>
1650       <entry><type>oid</type></entry>
1651       <entry></entry>
1652       <entry>Name of the on-disk file of this relation; zero means this
1653        is a <quote>mapped</> relation whose disk file name is determined
1654        by low-level state</entry>
1655      </row>
1656
1657      <row>
1658       <entry><structfield>reltablespace</structfield></entry>
1659       <entry><type>oid</type></entry>
1660       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1661       <entry>
1662        The tablespace in which this relation is stored.  If zero,
1663        the database's default tablespace is implied.  (Not meaningful
1664        if the relation has no on-disk file.)
1665       </entry>
1666      </row>
1667
1668      <row>
1669       <entry><structfield>relpages</structfield></entry>
1670       <entry><type>int4</type></entry>
1671       <entry></entry>
1672       <entry>
1673        Size of the on-disk representation of this table in pages (of size
1674        <symbol>BLCKSZ</symbol>).  This is only an estimate used by the
1675        planner.  It is updated by <command>VACUUM</command>,
1676        <command>ANALYZE</command>, and a few DDL commands such as
1677        <command>CREATE INDEX</command>.
1678       </entry>
1679      </row>
1680
1681      <row>
1682       <entry><structfield>reltuples</structfield></entry>
1683       <entry><type>float4</type></entry>
1684       <entry></entry>
1685       <entry>
1686        Number of rows in the table.  This is only an estimate used by the
1687        planner.  It is updated by <command>VACUUM</command>,
1688        <command>ANALYZE</command>, and a few DDL commands such as
1689        <command>CREATE INDEX</command>.
1690       </entry>
1691      </row>
1692
1693      <row>
1694       <entry><structfield>relallvisible</structfield></entry>
1695       <entry><type>int4</type></entry>
1696       <entry></entry>
1697       <entry>
1698        Number of pages that are marked all-visible in the table's
1699        visibility map.  This is only an estimate used by the
1700        planner.  It is updated by <command>VACUUM</command>,
1701        <command>ANALYZE</command>, and a few DDL commands such as
1702        <command>CREATE INDEX</command>.
1703       </entry>
1704      </row>
1705
1706      <row>
1707       <entry><structfield>reltoastrelid</structfield></entry>
1708       <entry><type>oid</type></entry>
1709       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1710       <entry>
1711        OID of the TOAST table associated with this table, 0 if none.  The
1712        TOAST table stores large attributes <quote>out of line</quote> in a
1713        secondary table.
1714       </entry>
1715      </row>
1716
1717      <row>
1718       <entry><structfield>relhasindex</structfield></entry>
1719       <entry><type>bool</type></entry>
1720       <entry></entry>
1721       <entry>
1722        True if this is a table and it has (or recently had) any indexes
1723       </entry>
1724      </row>
1725
1726      <row>
1727       <entry><structfield>relisshared</structfield></entry>
1728       <entry><type>bool</type></entry>
1729       <entry></entry>
1730       <entry>
1731        True if this table is shared across all databases in the cluster.  Only
1732        certain system catalogs (such as <structname>pg_database</structname>)
1733        are shared.
1734       </entry>
1735      </row>
1736
1737      <row>
1738       <entry><structfield>relpersistence</structfield></entry>
1739       <entry><type>char</type></entry>
1740       <entry></entry>
1741       <entry>
1742        <literal>p</> = permanent table, <literal>u</> = unlogged table,
1743        <literal>t</> = temporary table
1744       </entry>
1745      </row>
1746
1747      <row>
1748       <entry><structfield>relkind</structfield></entry>
1749       <entry><type>char</type></entry>
1750       <entry></entry>
1751       <entry>
1752        <literal>r</> = ordinary table, <literal>P</> = partitioned table,
1753        <literal>i</> = index
1754        <literal>S</> = sequence, <literal>v</> = view,
1755        <literal>m</> = materialized view,
1756        <literal>c</> = composite type, <literal>t</> = TOAST table,
1757        <literal>f</> = foreign table
1758       </entry>
1759      </row>
1760
1761      <row>
1762       <entry><structfield>relnatts</structfield></entry>
1763       <entry><type>int2</type></entry>
1764       <entry></entry>
1765       <entry>
1766        Number of user columns in the relation (system columns not
1767        counted).  There must be this many corresponding entries in
1768        <structname>pg_attribute</structname>.  See also
1769        <literal>pg_attribute.attnum</literal>.
1770       </entry>
1771      </row>
1772
1773      <row>
1774       <entry><structfield>relchecks</structfield></entry>
1775       <entry><type>int2</type></entry>
1776       <entry></entry>
1777       <entry>
1778        Number of <literal>CHECK</> constraints on the table; see
1779        <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1780       </entry>
1781      </row>
1782
1783      <row>
1784       <entry><structfield>relhasoids</structfield></entry>
1785       <entry><type>bool</type></entry>
1786       <entry></entry>
1787       <entry>
1788        True if we generate an OID for each row of the relation
1789       </entry>
1790      </row>
1791
1792      <row>
1793       <entry><structfield>relhaspkey</structfield></entry>
1794       <entry><type>bool</type></entry>
1795       <entry></entry>
1796       <entry>
1797        True if the table has (or once had) a primary key
1798       </entry>
1799      </row>
1800
1801      <row>
1802       <entry><structfield>relhasrules</structfield></entry>
1803       <entry><type>bool</type></entry>
1804       <entry></entry>
1805       <entry>
1806        True if table has (or once had) rules; see
1807        <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1808       </entry>
1809      </row>
1810
1811      <row>
1812       <entry><structfield>relhastriggers</structfield></entry>
1813       <entry><type>bool</type></entry>
1814       <entry></entry>
1815       <entry>
1816        True if table has (or once had) triggers; see
1817        <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1818       </entry>
1819      </row>
1820
1821      <row>
1822       <entry><structfield>relhassubclass</structfield></entry>
1823       <entry><type>bool</type></entry>
1824       <entry></entry>
1825       <entry>True if table has (or once had) any inheritance children</entry>
1826      </row>
1827
1828      <row>
1829       <entry><structfield>relrowsecurity</structfield></entry>
1830       <entry><type>bool</type></entry>
1831       <entry></entry>
1832       <entry>
1833        True if table has row level security enabled; see
1834        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1835       </entry>
1836      </row>
1837
1838      <row>
1839       <entry><structfield>relforcerowsecurity</structfield></entry>
1840       <entry><type>bool</type></entry>
1841       <entry></entry>
1842       <entry>
1843        True if row level security (when enabled) will also apply to table owner; see
1844        <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
1845       </entry>
1846      </row>
1847
1848      <row>
1849       <entry><structfield>relispopulated</structfield></entry>
1850       <entry><type>bool</type></entry>
1851       <entry></entry>
1852       <entry>True if relation is populated (this is true for all
1853        relations other than some materialized views)</entry>
1854      </row>
1855
1856      <row>
1857       <entry><structfield>relreplident</structfield></entry>
1858       <entry><type>char</type></entry>
1859       <entry></entry>
1860       <entry>
1861        Columns used to form <quote>replica identity</> for rows:
1862        <literal>d</> = default (primary key, if any),
1863        <literal>n</> = nothing,
1864        <literal>f</> = all columns
1865        <literal>i</> = index with <structfield>indisreplident</structfield> set, or default
1866       </entry>
1867      </row>
1868
1869      <row>
1870       <entry><structfield>relispartition</structfield></entry>
1871       <entry><type>bool</type></entry>
1872       <entry></entry>
1873       <entry>True if table is a partition</entry>
1874      </row>
1875
1876      <row>
1877       <entry><structfield>relfrozenxid</structfield></entry>
1878       <entry><type>xid</type></entry>
1879       <entry></entry>
1880       <entry>
1881        All transaction IDs before this one have been replaced with a permanent
1882        (<quote>frozen</>) transaction ID in this table.  This is used to track
1883        whether the table needs to be vacuumed in order to prevent transaction
1884        ID wraparound or to allow <literal>pg_clog</> to be shrunk.  Zero
1885        (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
1886       </entry>
1887      </row>
1888
1889      <row>
1890       <entry><structfield>relminmxid</structfield></entry>
1891       <entry><type>xid</type></entry>
1892       <entry></entry>
1893       <entry>
1894        All multixact IDs before this one have been replaced by a
1895        transaction ID in this table.  This is used to track
1896        whether the table needs to be vacuumed in order to prevent multixact ID
1897        wraparound or to allow <literal>pg_multixact</> to be shrunk.  Zero
1898        (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
1899       </entry>
1900      </row>
1901
1902      <row>
1903       <entry><structfield>relacl</structfield></entry>
1904       <entry><type>aclitem[]</type></entry>
1905       <entry></entry>
1906       <entry>
1907        Access privileges; see
1908        <xref linkend="sql-grant"> and
1909        <xref linkend="sql-revoke">
1910        for details
1911       </entry>
1912      </row>
1913
1914      <row>
1915       <entry><structfield>reloptions</structfield></entry>
1916       <entry><type>text[]</type></entry>
1917       <entry></entry>
1918       <entry>
1919        Access-method-specific options, as <quote>keyword=value</> strings
1920       </entry>
1921      </row>
1922
1923      <row>
1924       <entry><structfield>relpartbound</structfield></entry>
1925       <entry><type>pg_node_tree</type></entry>
1926       <entry></entry>
1927       <entry>
1928        If table is a partition (see <structfield>relispartition</structfield>),
1929        internal representation of the partition bound
1930       </entry>
1931      </row>
1932     </tbody>
1933    </tgroup>
1934   </table>
1935
1936   <para>
1937    Several of the Boolean flags in <structname>pg_class</> are maintained
1938    lazily: they are guaranteed to be true if that's the correct state, but
1939    may not be reset to false immediately when the condition is no longer
1940    true.  For example, <structfield>relhasindex</> is set by
1941    <command>CREATE INDEX</command>, but it is never cleared by
1942    <command>DROP INDEX</command>.  Instead, <command>VACUUM</command> clears
1943    <structfield>relhasindex</> if it finds the table has no indexes.  This
1944    arrangement avoids race conditions and improves concurrency.
1945   </para>
1946  </sect1>
1947
1948  <sect1 id="catalog-pg-collation">
1949   <title><structname>pg_collation</structname></title>
1950
1951   <indexterm zone="catalog-pg-collation">
1952    <primary>pg_collation</primary>
1953   </indexterm>
1954
1955   <para>
1956    The catalog <structname>pg_collation</structname> describes the
1957    available collations, which are essentially mappings from an SQL
1958    name to operating system locale categories.
1959    See <xref linkend="collation"> for more information.
1960   </para>
1961
1962   <table>
1963    <title><structname>pg_collation</> Columns</title>
1964
1965    <tgroup cols="4">
1966     <thead>
1967      <row>
1968       <entry>Name</entry>
1969       <entry>Type</entry>
1970       <entry>References</entry>
1971       <entry>Description</entry>
1972      </row>
1973     </thead>
1974
1975     <tbody>
1976      <row>
1977       <entry><structfield>oid</structfield></entry>
1978       <entry><type>oid</type></entry>
1979       <entry></entry>
1980       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
1981      </row>
1982
1983      <row>
1984       <entry><structfield>collname</structfield></entry>
1985       <entry><type>name</type></entry>
1986       <entry></entry>
1987       <entry>Collation name (unique per namespace and encoding)</entry>
1988      </row>
1989
1990      <row>
1991       <entry><structfield>collnamespace</structfield></entry>
1992       <entry><type>oid</type></entry>
1993       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1994       <entry>
1995        The OID of the namespace that contains this collation
1996       </entry>
1997      </row>
1998
1999      <row>
2000       <entry><structfield>collowner</structfield></entry>
2001       <entry><type>oid</type></entry>
2002       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2003       <entry>Owner of the collation</entry>
2004      </row>
2005
2006      <row>
2007       <entry><structfield>collencoding</structfield></entry>
2008       <entry><type>int4</type></entry>
2009       <entry></entry>
2010       <entry>Encoding in which the collation is applicable, or -1 if it
2011        works for any encoding</entry>
2012      </row>
2013
2014      <row>
2015       <entry><structfield>collcollate</structfield></entry>
2016       <entry><type>name</type></entry>
2017       <entry></entry>
2018       <entry><symbol>LC_COLLATE</> for this collation object</entry>
2019      </row>
2020
2021      <row>
2022       <entry><structfield>collctype</structfield></entry>
2023       <entry><type>name</type></entry>
2024       <entry></entry>
2025       <entry><symbol>LC_CTYPE</> for this collation object</entry>
2026      </row>
2027     </tbody>
2028    </tgroup>
2029   </table>
2030
2031   <para>
2032    Note that the unique key on this catalog is (<structfield>collname</>,
2033    <structfield>collencoding</>, <structfield>collnamespace</>) not just
2034    (<structfield>collname</>, <structfield>collnamespace</>).
2035    <productname>PostgreSQL</productname> generally ignores all
2036    collations that do not have <structfield>collencoding</> equal to
2037    either the current database's encoding or -1, and creation of new entries
2038    with the same name as an entry with <structfield>collencoding</> = -1
2039    is forbidden.  Therefore it is sufficient to use a qualified SQL name
2040    (<replaceable>schema</>.<replaceable>name</>) to identify a collation,
2041    even though this is not unique according to the catalog definition.
2042    The reason for defining the catalog this way is that
2043    <application>initdb</> fills it in at cluster initialization time with
2044    entries for all locales available on the system, so it must be able to
2045    hold entries for all encodings that might ever be used in the cluster.
2046   </para>
2047
2048   <para>
2049    In the <literal>template0</> database, it could be useful to create
2050    collations whose encoding does not match the database encoding,
2051    since they could match the encodings of databases later cloned from
2052    <literal>template0</>.  This would currently have to be done manually.
2053   </para>
2054  </sect1>
2055
2056  <sect1 id="catalog-pg-constraint">
2057   <title><structname>pg_constraint</structname></title>
2058
2059   <indexterm zone="catalog-pg-constraint">
2060    <primary>pg_constraint</primary>
2061   </indexterm>
2062
2063   <para>
2064    The catalog <structname>pg_constraint</structname> stores check, primary
2065    key, unique, foreign key, and exclusion constraints on tables.
2066    (Column constraints are not treated specially.  Every column constraint is
2067    equivalent to some table constraint.)
2068    Not-null constraints are represented in the <structname>pg_attribute</>
2069    catalog, not here.
2070   </para>
2071
2072   <para>
2073    User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2074    TRIGGER</>) also give rise to an entry in this table.
2075   </para>
2076
2077   <para>
2078    Check constraints on domains are stored here, too.
2079   </para>
2080
2081   <table>
2082    <title><structname>pg_constraint</> Columns</title>
2083
2084    <tgroup cols="4">
2085     <thead>
2086      <row>
2087       <entry>Name</entry>
2088       <entry>Type</entry>
2089       <entry>References</entry>
2090       <entry>Description</entry>
2091      </row>
2092     </thead>
2093
2094     <tbody>
2095      <row>
2096       <entry><structfield>oid</structfield></entry>
2097       <entry><type>oid</type></entry>
2098       <entry></entry>
2099       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2100      </row>
2101
2102      <row>
2103       <entry><structfield>conname</structfield></entry>
2104       <entry><type>name</type></entry>
2105       <entry></entry>
2106       <entry>Constraint name (not necessarily unique!)</entry>
2107      </row>
2108
2109      <row>
2110       <entry><structfield>connamespace</structfield></entry>
2111       <entry><type>oid</type></entry>
2112       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2113       <entry>
2114        The OID of the namespace that contains this constraint
2115       </entry>
2116      </row>
2117
2118      <row>
2119       <entry><structfield>contype</structfield></entry>
2120       <entry><type>char</type></entry>
2121       <entry></entry>
2122       <entry>
2123         <literal>c</> = check constraint,
2124         <literal>f</> = foreign key constraint,
2125         <literal>p</> = primary key constraint,
2126         <literal>u</> = unique constraint,
2127         <literal>t</> = constraint trigger,
2128         <literal>x</> = exclusion constraint
2129       </entry>
2130      </row>
2131
2132      <row>
2133       <entry><structfield>condeferrable</structfield></entry>
2134       <entry><type>bool</type></entry>
2135       <entry></entry>
2136       <entry>Is the constraint deferrable?</entry>
2137      </row>
2138
2139      <row>
2140       <entry><structfield>condeferred</structfield></entry>
2141       <entry><type>bool</type></entry>
2142       <entry></entry>
2143       <entry>Is the constraint deferred by default?</entry>
2144      </row>
2145
2146      <row>
2147       <entry><structfield>convalidated</structfield></entry>
2148       <entry><type>bool</type></entry>
2149       <entry></entry>
2150       <entry>Has the constraint been validated?
2151        Currently, can only be false for foreign keys and CHECK constraints</entry>
2152      </row>
2153
2154      <row>
2155       <entry><structfield>conrelid</structfield></entry>
2156       <entry><type>oid</type></entry>
2157       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2158       <entry>The table this constraint is on; 0 if not a table constraint</entry>
2159      </row>
2160
2161      <row>
2162       <entry><structfield>contypid</structfield></entry>
2163       <entry><type>oid</type></entry>
2164       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2165       <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
2166      </row>
2167
2168      <row>
2169       <entry><structfield>conindid</structfield></entry>
2170       <entry><type>oid</type></entry>
2171       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2172       <entry>The index supporting this constraint, if it's a unique, primary
2173        key, foreign key, or exclusion constraint; else 0</entry>
2174      </row>
2175
2176      <row>
2177       <entry><structfield>confrelid</structfield></entry>
2178       <entry><type>oid</type></entry>
2179       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2180       <entry>If a foreign key, the referenced table; else 0</entry>
2181      </row>
2182
2183      <row>
2184       <entry><structfield>confupdtype</structfield></entry>
2185       <entry><type>char</type></entry>
2186       <entry></entry>
2187       <entry>Foreign key update action code:
2188             <literal>a</> = no action,
2189             <literal>r</> = restrict,
2190             <literal>c</> = cascade,
2191             <literal>n</> = set null,
2192             <literal>d</> = set default
2193           </entry>
2194      </row>
2195
2196      <row>
2197       <entry><structfield>confdeltype</structfield></entry>
2198       <entry><type>char</type></entry>
2199       <entry></entry>
2200       <entry>Foreign key deletion action code:
2201             <literal>a</> = no action,
2202             <literal>r</> = restrict,
2203             <literal>c</> = cascade,
2204             <literal>n</> = set null,
2205             <literal>d</> = set default
2206           </entry>
2207      </row>
2208
2209      <row>
2210       <entry><structfield>confmatchtype</structfield></entry>
2211       <entry><type>char</type></entry>
2212       <entry></entry>
2213       <entry>Foreign key match type:
2214             <literal>f</> = full,
2215             <literal>p</> = partial,
2216             <literal>s</> = simple
2217           </entry>
2218      </row>
2219
2220      <row>
2221       <entry><structfield>conislocal</structfield></entry>
2222       <entry><type>bool</type></entry>
2223       <entry></entry>
2224       <entry>
2225        This constraint is defined locally for the relation.  Note that a
2226        constraint can be locally defined and inherited simultaneously.
2227       </entry>
2228      </row>
2229
2230      <row>
2231       <entry><structfield>coninhcount</structfield></entry>
2232       <entry><type>int4</type></entry>
2233       <entry></entry>
2234       <entry>
2235        The number of direct inheritance ancestors this constraint has.
2236        A constraint with
2237        a nonzero number of ancestors cannot be dropped nor renamed.
2238       </entry>
2239      </row>
2240
2241      <row>
2242       <entry><structfield>connoinherit</structfield></entry>
2243       <entry><type>bool</type></entry>
2244       <entry></entry>
2245       <entry>
2246        This constraint is defined locally for the relation.  It is a
2247        non-inheritable constraint.
2248       </entry>
2249      </row>
2250
2251      <row>
2252       <entry><structfield>conkey</structfield></entry>
2253       <entry><type>int2[]</type></entry>
2254       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2255       <entry>If a table constraint (including foreign keys, but not constraint
2256        triggers), list of the constrained columns</entry>
2257      </row>
2258
2259      <row>
2260       <entry><structfield>confkey</structfield></entry>
2261       <entry><type>int2[]</type></entry>
2262       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
2263       <entry>If a foreign key, list of the referenced columns</entry>
2264      </row>
2265
2266      <row>
2267       <entry><structfield>conpfeqop</structfield></entry>
2268       <entry><type>oid[]</type></entry>
2269       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2270       <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2271      </row>
2272
2273      <row>
2274       <entry><structfield>conppeqop</structfield></entry>
2275       <entry><type>oid[]</type></entry>
2276       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2277       <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2278      </row>
2279
2280      <row>
2281       <entry><structfield>conffeqop</structfield></entry>
2282       <entry><type>oid[]</type></entry>
2283       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2284       <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2285      </row>
2286
2287      <row>
2288       <entry><structfield>conexclop</structfield></entry>
2289       <entry><type>oid[]</type></entry>
2290       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2291       <entry>If an exclusion constraint, list of the per-column exclusion operators</entry>
2292      </row>
2293
2294      <row>
2295       <entry><structfield>conbin</structfield></entry>
2296       <entry><type>pg_node_tree</type></entry>
2297       <entry></entry>
2298       <entry>If a check constraint, an internal representation of the expression</entry>
2299      </row>
2300
2301      <row>
2302       <entry><structfield>consrc</structfield></entry>
2303       <entry><type>text</type></entry>
2304       <entry></entry>
2305       <entry>If a check constraint, a human-readable representation of the expression</entry>
2306      </row>
2307     </tbody>
2308    </tgroup>
2309   </table>
2310
2311   <para>
2312    In the case of an exclusion constraint, <structfield>conkey</structfield>
2313    is only useful for constraint elements that are simple column references.
2314    For other cases, a zero appears in <structfield>conkey</structfield>
2315    and the associated index must be consulted to discover the expression
2316    that is constrained.  (<structfield>conkey</structfield> thus has the
2317    same contents as <structname>pg_index</>.<structfield>indkey</> for the
2318    index.)
2319   </para>
2320
2321   <note>
2322    <para>
2323     <structfield>consrc</structfield> is not updated when referenced objects
2324     change; for example, it won't track renaming of columns.  Rather than
2325     relying on this field, it's best to use <function>pg_get_constraintdef()</>
2326     to extract the definition of a check constraint.
2327    </para>
2328   </note>
2329
2330   <note>
2331    <para>
2332     <literal>pg_class.relchecks</literal> needs to agree with the
2333     number of check-constraint entries found in this table for each
2334     relation.
2335    </para>
2336   </note>
2337  </sect1>
2338
2339
2340  <sect1 id="catalog-pg-conversion">
2341   <title><structname>pg_conversion</structname></title>
2342
2343   <indexterm zone="catalog-pg-conversion">
2344    <primary>pg_conversion</primary>
2345   </indexterm>
2346
2347   <para>
2348    The catalog <structname>pg_conversion</structname> describes
2349    encoding conversion procedures.  See <xref linkend="sql-createconversion">
2350    for more information.
2351   </para>
2352
2353   <table>
2354    <title><structname>pg_conversion</> Columns</title>
2355
2356    <tgroup cols="4">
2357     <thead>
2358      <row>
2359       <entry>Name</entry>
2360       <entry>Type</entry>
2361       <entry>References</entry>
2362       <entry>Description</entry>
2363      </row>
2364     </thead>
2365
2366     <tbody>
2367      <row>
2368       <entry><structfield>oid</structfield></entry>
2369       <entry><type>oid</type></entry>
2370       <entry></entry>
2371       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2372      </row>
2373
2374      <row>
2375       <entry><structfield>conname</structfield></entry>
2376       <entry><type>name</type></entry>
2377       <entry></entry>
2378       <entry>Conversion name (unique within a namespace)</entry>
2379      </row>
2380
2381      <row>
2382       <entry><structfield>connamespace</structfield></entry>
2383       <entry><type>oid</type></entry>
2384       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2385       <entry>
2386        The OID of the namespace that contains this conversion
2387       </entry>
2388      </row>
2389
2390      <row>
2391       <entry><structfield>conowner</structfield></entry>
2392       <entry><type>oid</type></entry>
2393       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2394       <entry>Owner of the conversion</entry>
2395      </row>
2396
2397      <row>
2398       <entry><structfield>conforencoding</structfield></entry>
2399       <entry><type>int4</type></entry>
2400       <entry></entry>
2401       <entry>Source encoding ID</entry>
2402      </row>
2403
2404      <row>
2405       <entry><structfield>contoencoding</structfield></entry>
2406       <entry><type>int4</type></entry>
2407       <entry></entry>
2408       <entry>Destination encoding ID</entry>
2409      </row>
2410
2411      <row>
2412       <entry><structfield>conproc</structfield></entry>
2413       <entry><type>regproc</type></entry>
2414       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2415       <entry>Conversion procedure</entry>
2416      </row>
2417
2418      <row>
2419       <entry><structfield>condefault</structfield></entry>
2420       <entry><type>bool</type></entry>
2421       <entry></entry>
2422       <entry>True if this is the default conversion</entry>
2423      </row>
2424
2425     </tbody>
2426    </tgroup>
2427   </table>
2428
2429  </sect1>
2430
2431  <sect1 id="catalog-pg-database">
2432   <title><structname>pg_database</structname></title>
2433
2434   <indexterm zone="catalog-pg-database">
2435    <primary>pg_database</primary>
2436   </indexterm>
2437
2438   <para>
2439    The catalog <structname>pg_database</structname> stores information about
2440    the available databases.  Databases are created with the <xref
2441    linkend="sql-createdatabase"> command.
2442    Consult <xref linkend="managing-databases"> for details about the meaning
2443    of some of the parameters.
2444   </para>
2445
2446   <para>
2447    Unlike most system catalogs, <structname>pg_database</structname>
2448    is shared across all databases of a cluster: there is only one
2449    copy of <structname>pg_database</structname> per cluster, not
2450    one per database.
2451   </para>
2452
2453   <table>
2454    <title><structname>pg_database</> Columns</title>
2455
2456    <tgroup cols="4">
2457     <thead>
2458      <row>
2459       <entry>Name</entry>
2460       <entry>Type</entry>
2461       <entry>References</entry>
2462       <entry>Description</entry>
2463      </row>
2464     </thead>
2465
2466     <tbody>
2467      <row>
2468       <entry><structfield>oid</structfield></entry>
2469       <entry><type>oid</type></entry>
2470       <entry></entry>
2471       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2472      </row>
2473
2474      <row>
2475       <entry><structfield>datname</structfield></entry>
2476       <entry><type>name</type></entry>
2477       <entry></entry>
2478       <entry>Database name</entry>
2479      </row>
2480
2481      <row>
2482       <entry><structfield>datdba</structfield></entry>
2483       <entry><type>oid</type></entry>
2484       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2485       <entry>Owner of the database, usually the user who created it</entry>
2486      </row>
2487
2488      <row>
2489       <entry><structfield>encoding</structfield></entry>
2490       <entry><type>int4</type></entry>
2491       <entry></entry>
2492       <entry>Character encoding for this database
2493           (<function>pg_encoding_to_char()</function> can translate
2494            this number to the encoding name)</entry>
2495      </row>
2496
2497      <row>
2498       <entry><structfield>datcollate</structfield></entry>
2499       <entry><type>name</type></entry>
2500       <entry></entry>
2501       <entry>LC_COLLATE for this database</entry>
2502      </row>
2503
2504      <row>
2505       <entry><structfield>datctype</structfield></entry>
2506       <entry><type>name</type></entry>
2507       <entry></entry>
2508       <entry>LC_CTYPE for this database</entry>
2509      </row>
2510
2511      <row>
2512       <entry><structfield>datistemplate</structfield></entry>
2513       <entry><type>bool</type></entry>
2514       <entry></entry>
2515       <entry>
2516        If true, then this database can be cloned by
2517        any user with <literal>CREATEDB</> privileges;
2518        if false, then only superusers or the owner of
2519        the database can clone it.
2520       </entry>
2521      </row>
2522
2523      <row>
2524       <entry><structfield>datallowconn</structfield></entry>
2525       <entry><type>bool</type></entry>
2526       <entry></entry>
2527       <entry>
2528        If false then no one can connect to this database.  This is
2529        used to protect the <literal>template0</> database from being altered.
2530       </entry>
2531      </row>
2532
2533      <row>
2534       <entry><structfield>datconnlimit</structfield></entry>
2535       <entry><type>int4</type></entry>
2536       <entry></entry>
2537       <entry>
2538        Sets maximum number of concurrent connections that can be made
2539        to this database.  -1 means no limit.
2540       </entry>
2541      </row>
2542
2543      <row>
2544       <entry><structfield>datlastsysoid</structfield></entry>
2545       <entry><type>oid</type></entry>
2546       <entry></entry>
2547       <entry>
2548        Last system OID in the database; useful
2549        particularly to <application>pg_dump</application>
2550       </entry>
2551      </row>
2552
2553      <row>
2554       <entry><structfield>datfrozenxid</structfield></entry>
2555       <entry><type>xid</type></entry>
2556       <entry></entry>
2557       <entry>
2558        All transaction IDs before this one have been replaced with a permanent
2559        (<quote>frozen</>) transaction ID in this database.  This is used to
2560        track whether the database needs to be vacuumed in order to prevent
2561        transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2562        It is the minimum of the per-table
2563        <structname>pg_class</>.<structfield>relfrozenxid</> values.
2564       </entry>
2565      </row>
2566
2567      <row>
2568       <entry><structfield>datminmxid</structfield></entry>
2569       <entry><type>xid</type></entry>
2570       <entry></entry>
2571       <entry>
2572        All multixact IDs before this one have been replaced with a
2573        transaction ID in this database.  This is used to
2574        track whether the database needs to be vacuumed in order to prevent
2575        multixact ID wraparound or to allow <literal>pg_multixact</> to be shrunk.
2576        It is the minimum of the per-table
2577        <structname>pg_class</>.<structfield>relminmxid</> values.
2578       </entry>
2579      </row>
2580
2581      <row>
2582       <entry><structfield>dattablespace</structfield></entry>
2583       <entry><type>oid</type></entry>
2584       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2585       <entry>
2586        The default tablespace for the database.
2587        Within this database, all tables for which
2588        <structname>pg_class</>.<structfield>reltablespace</> is zero
2589        will be stored in this tablespace; in particular, all the non-shared
2590        system catalogs will be there.
2591       </entry>
2592      </row>
2593
2594      <row>
2595       <entry><structfield>datacl</structfield></entry>
2596       <entry><type>aclitem[]</type></entry>
2597       <entry></entry>
2598       <entry>
2599        Access privileges; see
2600        <xref linkend="sql-grant"> and
2601        <xref linkend="sql-revoke">
2602        for details
2603       </entry>
2604      </row>
2605     </tbody>
2606    </tgroup>
2607   </table>
2608  </sect1>
2609
2610
2611  <sect1 id="catalog-pg-db-role-setting">
2612   <title><structname>pg_db_role_setting</structname></title>
2613
2614   <indexterm zone="catalog-pg-db-role-setting">
2615    <primary>pg_db_role_setting</primary>
2616   </indexterm>
2617
2618   <para>
2619    The catalog <structname>pg_db_role_setting</structname> records the default
2620    values that have been set for run-time configuration variables,
2621    for each role and database combination.
2622   </para>
2623
2624   <para>
2625    Unlike most system catalogs, <structname>pg_db_role_setting</structname>
2626    is shared across all databases of a cluster: there is only one
2627    copy of <structname>pg_db_role_setting</structname> per cluster, not
2628    one per database.
2629   </para>
2630
2631   <table>
2632    <title><structname>pg_db_role_setting</> Columns</title>
2633
2634    <tgroup cols="4">
2635     <thead>
2636      <row>
2637       <entry>Name</entry>
2638       <entry>Type</entry>
2639       <entry>References</entry>
2640       <entry>Description</entry>
2641      </row>
2642     </thead>
2643
2644     <tbody>
2645      <row>
2646       <entry><structfield>setdatabase</structfield></entry>
2647       <entry><type>oid</type></entry>
2648       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
2649       <entry>The OID of the database the setting is applicable to, or zero if not database-specific</entry>
2650      </row>
2651
2652      <row>
2653       <entry><structfield>setrole</structfield></entry>
2654       <entry><type>oid</type></entry>
2655       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2656       <entry>The OID of the role the setting is applicable to, or zero if not role-specific</entry>
2657      </row>
2658
2659      <row>
2660       <entry><structfield>setconfig</structfield></entry>
2661       <entry><type>text[]</type></entry>
2662       <entry></entry>
2663       <entry>Defaults for run-time configuration variables</entry>
2664      </row>
2665     </tbody>
2666    </tgroup>
2667   </table>
2668  </sect1>
2669
2670
2671  <sect1 id="catalog-pg-default-acl">
2672   <title><structname>pg_default_acl</structname></title>
2673
2674   <indexterm zone="catalog-pg-default-acl">
2675    <primary>pg_default_acl</primary>
2676   </indexterm>
2677
2678   <para>
2679    The catalog <structname>pg_default_acl</> stores initial
2680    privileges to be assigned to newly created objects.
2681   </para>
2682
2683   <table>
2684    <title><structname>pg_default_acl</> Columns</title>
2685
2686    <tgroup cols="4">
2687     <thead>
2688      <row>
2689       <entry>Name</entry>
2690       <entry>Type</entry>
2691       <entry>References</entry>
2692       <entry>Description</entry>
2693      </row>
2694     </thead>
2695
2696     <tbody>
2697      <row>
2698       <entry><structfield>oid</structfield></entry>
2699       <entry><type>oid</type></entry>
2700       <entry></entry>
2701       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
2702      </row>
2703
2704      <row>
2705       <entry><structfield>defaclrole</structfield></entry>
2706       <entry><type>oid</type></entry>
2707       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2708       <entry>The OID of the role associated with this entry</entry>
2709      </row>
2710
2711      <row>
2712       <entry><structfield>defaclnamespace</structfield></entry>
2713       <entry><type>oid</type></entry>
2714       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2715       <entry>The OID of the namespace associated with this entry,
2716        or 0 if none</entry>
2717      </row>
2718
2719      <row>
2720       <entry><structfield>defaclobjtype</structfield></entry>
2721       <entry><type>char</type></entry>
2722       <entry></entry>
2723       <entry>
2724        Type of object this entry is for:
2725        <literal>r</> = relation (table, view),
2726        <literal>S</> = sequence,
2727        <literal>f</> = function,
2728        <literal>T</> = type
2729       </entry>
2730      </row>
2731
2732      <row>
2733       <entry><structfield>defaclacl</structfield></entry>
2734       <entry><type>aclitem[]</type></entry>
2735       <entry></entry>
2736       <entry>
2737        Access privileges that this type of object should have on creation
2738       </entry>
2739      </row>
2740     </tbody>
2741    </tgroup>
2742   </table>
2743
2744   <para>
2745    A <structname>pg_default_acl</> entry shows the initial privileges to
2746    be assigned to an object belonging to the indicated user.  There are
2747    currently two types of entry: <quote>global</> entries with
2748    <structfield>defaclnamespace</> = 0, and <quote>per-schema</> entries
2749    that reference a particular schema.  If a global entry is present then
2750    it <emphasis>overrides</> the normal hard-wired default privileges
2751    for the object type.  A per-schema entry, if present, represents privileges
2752    to be <emphasis>added to</> the global or hard-wired default privileges.
2753   </para>
2754
2755   <para>
2756    Note that when an ACL entry in another catalog is null, it is taken
2757    to represent the hard-wired default privileges for its object,
2758    <emphasis>not</> whatever might be in <structname>pg_default_acl</>
2759    at the moment.  <structname>pg_default_acl</> is only consulted during
2760    object creation.
2761   </para>
2762
2763  </sect1>
2764
2765
2766  <sect1 id="catalog-pg-depend">
2767   <title><structname>pg_depend</structname></title>
2768
2769   <indexterm zone="catalog-pg-depend">
2770    <primary>pg_depend</primary>
2771   </indexterm>
2772
2773   <para>
2774    The catalog <structname>pg_depend</structname> records the dependency
2775    relationships between database objects.  This information allows
2776    <command>DROP</> commands to find which other objects must be dropped
2777    by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2778    RESTRICT</> case.
2779   </para>
2780
2781   <para>
2782    See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2783    which performs a similar function for dependencies involving objects
2784    that are shared across a database cluster.
2785   </para>
2786
2787   <table>
2788    <title><structname>pg_depend</> Columns</title>
2789
2790    <tgroup cols="4">
2791     <thead>
2792      <row>
2793       <entry>Name</entry>
2794       <entry>Type</entry>
2795       <entry>References</entry>
2796       <entry>Description</entry>
2797      </row>
2798     </thead>
2799
2800     <tbody>
2801      <row>
2802       <entry><structfield>classid</structfield></entry>
2803       <entry><type>oid</type></entry>
2804       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2805       <entry>The OID of the system catalog the dependent object is in</entry>
2806      </row>
2807
2808      <row>
2809       <entry><structfield>objid</structfield></entry>
2810       <entry><type>oid</type></entry>
2811       <entry>any OID column</entry>
2812       <entry>The OID of the specific dependent object</entry>
2813      </row>
2814
2815      <row>
2816       <entry><structfield>objsubid</structfield></entry>
2817       <entry><type>int4</type></entry>
2818       <entry></entry>
2819       <entry>
2820        For a table column, this is the column number (the
2821        <structfield>objid</> and <structfield>classid</> refer to the
2822        table itself).  For all other object types, this column is
2823        zero.
2824       </entry>
2825      </row>
2826
2827      <row>
2828       <entry><structfield>refclassid</structfield></entry>
2829       <entry><type>oid</type></entry>
2830       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2831       <entry>The OID of the system catalog the referenced object is in</entry>
2832      </row>
2833
2834      <row>
2835       <entry><structfield>refobjid</structfield></entry>
2836       <entry><type>oid</type></entry>
2837       <entry>any OID column</entry>
2838       <entry>The OID of the specific referenced object</entry>
2839      </row>
2840
2841      <row>
2842       <entry><structfield>refobjsubid</structfield></entry>
2843       <entry><type>int4</type></entry>
2844       <entry></entry>
2845       <entry>
2846        For a table column, this is the column number (the
2847        <structfield>refobjid</> and <structfield>refclassid</> refer
2848        to the table itself).  For all other object types, this column
2849        is zero.
2850       </entry>
2851      </row>
2852
2853      <row>
2854       <entry><structfield>deptype</structfield></entry>
2855       <entry><type>char</type></entry>
2856       <entry></entry>
2857       <entry>
2858        A code defining the specific semantics of this dependency relationship; see text
2859       </entry>
2860      </row>
2861
2862     </tbody>
2863    </tgroup>
2864   </table>
2865
2866   <para>
2867    In all cases, a <structname>pg_depend</structname> entry indicates that the
2868    referenced object cannot be dropped without also dropping the dependent
2869    object.  However, there are several subflavors identified by
2870    <structfield>deptype</>:
2871
2872    <variablelist>
2873     <varlistentry>
2874      <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2875      <listitem>
2876       <para>
2877        A normal relationship between separately-created objects.  The
2878        dependent object can be dropped without affecting the
2879        referenced object.  The referenced object can only be dropped
2880        by specifying <literal>CASCADE</>, in which case the dependent
2881        object is dropped, too.  Example: a table column has a normal
2882        dependency on its data type.
2883       </para>
2884      </listitem>
2885     </varlistentry>
2886
2887     <varlistentry>
2888      <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2889      <listitem>
2890       <para>
2891        The dependent object can be dropped separately from the
2892        referenced object, and should be automatically dropped
2893        (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2894        mode) if the referenced object is dropped.  Example: a named
2895        constraint on a table is made autodependent on the table, so
2896        that it will go away if the table is dropped.
2897       </para>
2898      </listitem>
2899     </varlistentry>
2900
2901     <varlistentry>
2902      <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2903      <listitem>
2904       <para>
2905        The dependent object was created as part of creation of the
2906        referenced object, and is really just a part of its internal
2907        implementation.  A <command>DROP</> of the dependent object
2908        will be disallowed outright (we'll tell the user to issue a
2909        <command>DROP</> against the referenced object, instead).  A
2910        <command>DROP</> of the referenced object will be propagated
2911        through to drop the dependent object whether
2912        <command>CASCADE</> is specified or not.  Example: a trigger
2913        that's created to enforce a foreign-key constraint is made
2914        internally dependent on the constraint's
2915        <structname>pg_constraint</> entry.
2916       </para>
2917      </listitem>
2918     </varlistentry>
2919
2920     <varlistentry>
2921      <term><symbol>DEPENDENCY_EXTENSION</> (<literal>e</>)</term>
2922      <listitem>
2923       <para>
2924        The dependent object is a member of the <firstterm>extension</> that is
2925        the referenced object (see
2926        <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
2927        The dependent object can be dropped only via
2928        <command>DROP EXTENSION</> on the referenced object.  Functionally
2929        this dependency type acts the same as an internal dependency, but
2930        it's kept separate for clarity and to simplify <application>pg_dump</>.
2931       </para>
2932      </listitem>
2933     </varlistentry>
2934
2935     <varlistentry>
2936      <term><symbol>DEPENDENCY_AUTO_EXTENSION</> (<literal>x</>)</term>
2937      <listitem>
2938       <para>
2939        The dependent object is not a member of the extension that is the
2940        referenced object (and so should not be ignored by pg_dump), but
2941        cannot function without it and should be dropped when the
2942        extension itself is. The dependent object may be dropped on its
2943        own as well.
2944       </para>
2945      </listitem>
2946     </varlistentry>
2947
2948     <varlistentry>
2949      <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2950      <listitem>
2951       <para>
2952        There is no dependent object; this type of entry is a signal
2953        that the system itself depends on the referenced object, and so
2954        that object must never be deleted.  Entries of this type are
2955        created only by <command>initdb</command>.  The columns for the
2956        dependent object contain zeroes.
2957       </para>
2958      </listitem>
2959     </varlistentry>
2960    </variablelist>
2961
2962    Other dependency flavors might be needed in future.
2963   </para>
2964
2965  </sect1>
2966
2967
2968  <sect1 id="catalog-pg-description">
2969   <title><structname>pg_description</structname></title>
2970
2971   <indexterm zone="catalog-pg-description">
2972    <primary>pg_description</primary>
2973   </indexterm>
2974
2975   <para>
2976    The catalog <structname>pg_description</> stores optional descriptions
2977    (comments) for each database object.  Descriptions can be manipulated
2978    with the <xref linkend="sql-comment"> command and viewed with
2979    <application>psql</application>'s <literal>\d</literal> commands.
2980    Descriptions of many built-in system objects are provided in the initial
2981    contents of <structname>pg_description</structname>.
2982   </para>
2983
2984   <para>
2985    See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2986    which performs a similar function for descriptions involving objects that
2987    are shared across a database cluster.
2988   </para>
2989
2990   <table>
2991    <title><structname>pg_description</> Columns</title>
2992
2993    <tgroup cols="4">
2994     <thead>
2995      <row>
2996       <entry>Name</entry>
2997       <entry>Type</entry>
2998       <entry>References</entry>
2999       <entry>Description</entry>
3000      </row>
3001     </thead>
3002
3003     <tbody>
3004      <row>
3005       <entry><structfield>objoid</structfield></entry>
3006       <entry><type>oid</type></entry>
3007       <entry>any OID column</entry>
3008       <entry>The OID of the object this description pertains to</entry>
3009      </row>
3010
3011      <row>
3012       <entry><structfield>classoid</structfield></entry>
3013       <entry><type>oid</type></entry>
3014       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3015       <entry>The OID of the system catalog this object appears in</entry>
3016      </row>
3017
3018      <row>
3019       <entry><structfield>objsubid</structfield></entry>
3020       <entry><type>int4</type></entry>
3021       <entry></entry>
3022       <entry>
3023        For a comment on a table column, this is the column number (the
3024        <structfield>objoid</> and <structfield>classoid</> refer to
3025        the table itself).  For all other object types, this column is
3026        zero.
3027       </entry>
3028      </row>
3029
3030      <row>
3031       <entry><structfield>description</structfield></entry>
3032       <entry><type>text</type></entry>
3033       <entry></entry>
3034       <entry>Arbitrary text that serves as the description of this object</entry>
3035      </row>
3036     </tbody>
3037    </tgroup>
3038   </table>
3039
3040  </sect1>
3041
3042
3043  <sect1 id="catalog-pg-enum">
3044   <title><structname>pg_enum</structname></title>
3045
3046   <indexterm zone="catalog-pg-enum">
3047    <primary>pg_enum</primary>
3048   </indexterm>
3049
3050   <para>
3051    The <structname>pg_enum</structname> catalog contains entries
3052    showing the values and labels for each enum type. The
3053    internal representation of a given enum value is actually the OID
3054    of its associated row in <structname>pg_enum</structname>.
3055   </para>
3056
3057   <table>
3058    <title><structname>pg_enum</> Columns</title>
3059
3060    <tgroup cols="4">
3061     <thead>
3062      <row>
3063       <entry>Name</entry>
3064       <entry>Type</entry>
3065       <entry>References</entry>
3066       <entry>Description</entry>
3067      </row>
3068     </thead>
3069
3070     <tbody>
3071      <row>
3072       <entry><structfield>oid</structfield></entry>
3073       <entry><type>oid</type></entry>
3074       <entry></entry>
3075       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3076      </row>
3077
3078      <row>
3079       <entry><structfield>enumtypid</structfield></entry>
3080       <entry><type>oid</type></entry>
3081       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3082       <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
3083      </row>
3084
3085      <row>
3086       <entry><structfield>enumsortorder</structfield></entry>
3087       <entry><type>float4</type></entry>
3088       <entry></entry>
3089       <entry>The sort position of this enum value within its enum type</entry>
3090      </row>
3091
3092      <row>
3093       <entry><structfield>enumlabel</structfield></entry>
3094       <entry><type>name</type></entry>
3095       <entry></entry>
3096       <entry>The textual label for this enum value</entry>
3097      </row>
3098     </tbody>
3099    </tgroup>
3100   </table>
3101
3102   <para>
3103    The OIDs for <structname>pg_enum</structname> rows follow a special
3104    rule: even-numbered OIDs are guaranteed to be ordered in the same way
3105    as the sort ordering of their enum type.  That is, if two even OIDs
3106    belong to the same enum type, the smaller OID must have the smaller
3107    <structfield>enumsortorder</structfield> value.  Odd-numbered OID values
3108    need bear no relationship to the sort order.  This rule allows the
3109    enum comparison routines to avoid catalog lookups in many common cases.
3110    The routines that create and alter enum types attempt to assign even
3111    OIDs to enum values whenever possible.
3112   </para>
3113
3114   <para>
3115    When an enum type is created, its members are assigned sort-order
3116    positions 1..<replaceable>n</>.  But members added later might be given
3117    negative or fractional values of <structfield>enumsortorder</structfield>.
3118    The only requirement on these values is that they be correctly
3119    ordered and unique within each enum type.
3120   </para>
3121  </sect1>
3122
3123
3124  <sect1 id="catalog-pg-event-trigger">
3125   <title><structname>pg_event_trigger</structname></title>
3126
3127   <indexterm zone="catalog-pg-event-trigger">
3128    <primary>pg_event_trigger</primary>
3129   </indexterm>
3130
3131   <para>
3132    The catalog <structname>pg_event_trigger</structname> stores event triggers.
3133    See <xref linkend="event-triggers"> for more information.
3134   </para>
3135
3136   <table>
3137    <title><structname>pg_event_trigger</> Columns</title>
3138
3139    <tgroup cols="4">
3140     <thead>
3141      <row>
3142       <entry>Name</entry>
3143       <entry>Type</entry>
3144       <entry>References</entry>
3145       <entry>Description</entry>
3146      </row>
3147     </thead>
3148
3149     <tbody>
3150      <row>
3151       <entry><structfield>evtname</structfield></entry>
3152       <entry><type>name</type></entry>
3153       <entry></entry>
3154       <entry>Trigger name (must be unique)</entry>
3155      </row>
3156
3157      <row>
3158       <entry><structfield>evtevent</structfield></entry>
3159       <entry><type>name</type></entry>
3160       <entry></entry>
3161       <entry>Identifies the event for which this trigger fires</entry>
3162      </row>
3163
3164      <row>
3165       <entry><structfield>evtowner</structfield></entry>
3166       <entry><type>oid</type></entry>
3167       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3168       <entry>Owner of the event trigger</entry>
3169      </row>
3170
3171      <row>
3172       <entry><structfield>evtfoid</structfield></entry>
3173       <entry><type>oid</type></entry>
3174       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3175       <entry>The function to be called</entry>
3176      </row>
3177
3178      <row>
3179       <entry><structfield>evtenabled</structfield></entry>
3180       <entry><type>char</type></entry>
3181       <entry></entry>
3182       <entry>
3183        Controls in which <xref linkend="guc-session-replication-role"> modes
3184        the event trigger fires.
3185        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
3186        <literal>D</> = trigger is disabled,
3187        <literal>R</> = trigger fires in <quote>replica</> mode,
3188        <literal>A</> = trigger fires always.
3189       </entry>
3190      </row>
3191
3192      <row>
3193       <entry><structfield>evttags</structfield></entry>
3194       <entry><type>text[]</type></entry>
3195       <entry></entry>
3196       <entry>
3197         Command tags for which this trigger will fire.  If NULL, the firing
3198         of this trigger is not restricted on the basis of the command tag.
3199       </entry>
3200      </row>
3201     </tbody>
3202    </tgroup>
3203   </table>
3204  </sect1>
3205
3206
3207  <sect1 id="catalog-pg-extension">
3208   <title><structname>pg_extension</structname></title>
3209
3210   <indexterm zone="catalog-pg-extension">
3211    <primary>pg_extension</primary>
3212   </indexterm>
3213
3214   <para>
3215    The catalog <structname>pg_extension</structname> stores information
3216    about the installed extensions.  See <xref linkend="extend-extensions">
3217    for details about extensions.
3218   </para>
3219
3220   <table>
3221    <title><structname>pg_extension</> Columns</title>
3222
3223    <tgroup cols="4">
3224     <thead>
3225      <row>
3226       <entry>Name</entry>
3227       <entry>Type</entry>
3228       <entry>References</entry>
3229       <entry>Description</entry>
3230      </row>
3231     </thead>
3232
3233     <tbody>
3234      <row>
3235       <entry><structfield>oid</structfield></entry>
3236       <entry><type>oid</type></entry>
3237       <entry></entry>
3238       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3239      </row>
3240
3241      <row>
3242       <entry><structfield>extname</structfield></entry>
3243       <entry><type>name</type></entry>
3244       <entry></entry>
3245       <entry>Name of the extension</entry>
3246      </row>
3247
3248      <row>
3249       <entry><structfield>extowner</structfield></entry>
3250       <entry><type>oid</type></entry>
3251       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3252       <entry>Owner of the extension</entry>
3253      </row>
3254
3255      <row>
3256       <entry><structfield>extnamespace</structfield></entry>
3257       <entry><type>oid</type></entry>
3258       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3259       <entry>Schema containing the extension's exported objects</entry>
3260      </row>
3261
3262      <row>
3263       <entry><structfield>extrelocatable</structfield></entry>
3264       <entry><type>bool</type></entry>
3265       <entry></entry>
3266       <entry>True if extension can be relocated to another schema</entry>
3267      </row>
3268
3269      <row>
3270       <entry><structfield>extversion</structfield></entry>
3271       <entry><type>text</type></entry>
3272       <entry></entry>
3273       <entry>Version name for the extension</entry>
3274      </row>
3275
3276      <row>
3277       <entry><structfield>extconfig</structfield></entry>
3278       <entry><type>oid[]</type></entry>
3279       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3280       <entry>Array of <type>regclass</> OIDs for the extension's configuration
3281        table(s), or <literal>NULL</> if none</entry>
3282      </row>
3283
3284      <row>
3285       <entry><structfield>extcondition</structfield></entry>
3286       <entry><type>text[]</type></entry>
3287       <entry></entry>
3288       <entry>Array of <literal>WHERE</>-clause filter conditions for the
3289        extension's configuration table(s), or <literal>NULL</> if none</entry>
3290      </row>
3291
3292     </tbody>
3293    </tgroup>
3294   </table>
3295
3296   <para>
3297    Note that unlike most catalogs with a <quote>namespace</> column,
3298    <structfield>extnamespace</structfield> is not meant to imply
3299    that the extension belongs to that schema.  Extension names are never
3300    schema-qualified.  Rather, <structfield>extnamespace</structfield>
3301    indicates the schema that contains most or all of the extension's
3302    objects.  If <structfield>extrelocatable</structfield> is true, then
3303    this schema must in fact contain all schema-qualifiable objects
3304    belonging to the extension.
3305   </para>
3306  </sect1>
3307
3308
3309  <sect1 id="catalog-pg-foreign-data-wrapper">
3310   <title><structname>pg_foreign_data_wrapper</structname></title>
3311
3312   <indexterm zone="catalog-pg-foreign-data-wrapper">
3313    <primary>pg_foreign_data_wrapper</primary>
3314   </indexterm>
3315
3316   <para>
3317    The catalog <structname>pg_foreign_data_wrapper</structname> stores
3318    foreign-data wrapper definitions.  A foreign-data wrapper is the
3319    mechanism by which external data, residing on foreign servers, is
3320    accessed.
3321   </para>
3322
3323   <table>
3324    <title><structname>pg_foreign_data_wrapper</> Columns</title>
3325
3326    <tgroup cols="4">
3327     <thead>
3328      <row>
3329       <entry>Name</entry>
3330       <entry>Type</entry>
3331       <entry>References</entry>
3332       <entry>Description</entry>
3333      </row>
3334     </thead>
3335
3336     <tbody>
3337      <row>
3338       <entry><structfield>oid</structfield></entry>
3339       <entry><type>oid</type></entry>
3340       <entry></entry>
3341       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3342      </row>
3343
3344      <row>
3345       <entry><structfield>fdwname</structfield></entry>
3346       <entry><type>name</type></entry>
3347       <entry></entry>
3348       <entry>Name of the foreign-data wrapper</entry>
3349      </row>
3350
3351      <row>
3352       <entry><structfield>fdwowner</structfield></entry>
3353       <entry><type>oid</type></entry>
3354       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3355       <entry>Owner of the foreign-data wrapper</entry>
3356      </row>
3357
3358      <row>
3359       <entry><structfield>fdwhandler</structfield></entry>
3360       <entry><type>oid</type></entry>
3361       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3362       <entry>
3363        References a handler function that is responsible for
3364        supplying execution routines for the foreign-data wrapper.
3365        Zero if no handler is provided
3366       </entry>
3367      </row>
3368
3369      <row>
3370       <entry><structfield>fdwvalidator</structfield></entry>
3371       <entry><type>oid</type></entry>
3372       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3373       <entry>
3374        References a validator function that is responsible for
3375        checking the validity of the options given to the
3376        foreign-data wrapper, as well as options for foreign servers and user
3377        mappings using the foreign-data wrapper.  Zero if no validator
3378        is provided
3379       </entry>
3380      </row>
3381
3382      <row>
3383       <entry><structfield>fdwacl</structfield></entry>
3384       <entry><type>aclitem[]</type></entry>
3385       <entry></entry>
3386       <entry>
3387        Access privileges; see
3388        <xref linkend="sql-grant"> and
3389        <xref linkend="sql-revoke">
3390        for details
3391       </entry>
3392      </row>
3393
3394      <row>
3395       <entry><structfield>fdwoptions</structfield></entry>
3396       <entry><type>text[]</type></entry>
3397       <entry></entry>
3398       <entry>
3399        Foreign-data wrapper specific options, as <quote>keyword=value</> strings
3400       </entry>
3401      </row>
3402     </tbody>
3403    </tgroup>
3404   </table>
3405  </sect1>
3406
3407
3408  <sect1 id="catalog-pg-foreign-server">
3409   <title><structname>pg_foreign_server</structname></title>
3410
3411   <indexterm zone="catalog-pg-foreign-server">
3412    <primary>pg_foreign_server</primary>
3413   </indexterm>
3414
3415   <para>
3416    The catalog <structname>pg_foreign_server</structname> stores
3417    foreign server definitions.  A foreign server describes a source
3418    of external data, such as a remote server.  Foreign
3419    servers are accessed via foreign-data wrappers.
3420   </para>
3421
3422   <table>
3423    <title><structname>pg_foreign_server</> Columns</title>
3424
3425    <tgroup cols="4">
3426     <thead>
3427      <row>
3428       <entry>Name</entry>
3429       <entry>Type</entry>
3430       <entry>References</entry>
3431       <entry>Description</entry>
3432      </row>
3433     </thead>
3434
3435     <tbody>
3436      <row>
3437       <entry><structfield>oid</structfield></entry>
3438       <entry><type>oid</type></entry>
3439       <entry></entry>
3440       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3441      </row>
3442
3443      <row>
3444       <entry><structfield>srvname</structfield></entry>
3445       <entry><type>name</type></entry>
3446       <entry></entry>
3447       <entry>Name of the foreign server</entry>
3448      </row>
3449
3450      <row>
3451       <entry><structfield>srvowner</structfield></entry>
3452       <entry><type>oid</type></entry>
3453       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3454       <entry>Owner of the foreign server</entry>
3455      </row>
3456
3457      <row>
3458       <entry><structfield>srvfdw</structfield></entry>
3459       <entry><type>oid</type></entry>
3460       <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
3461       <entry>OID of the foreign-data wrapper of this foreign server</entry>
3462      </row>
3463
3464      <row>
3465       <entry><structfield>srvtype</structfield></entry>
3466       <entry><type>text</type></entry>
3467       <entry></entry>
3468       <entry>Type of the server (optional)</entry>
3469      </row>
3470
3471      <row>
3472       <entry><structfield>srvversion</structfield></entry>
3473       <entry><type>text</type></entry>
3474       <entry></entry>
3475       <entry>Version of the server (optional)</entry>
3476      </row>
3477
3478      <row>
3479       <entry><structfield>srvacl</structfield></entry>
3480       <entry><type>aclitem[]</type></entry>
3481       <entry></entry>
3482       <entry>
3483        Access privileges; see
3484        <xref linkend="sql-grant"> and
3485        <xref linkend="sql-revoke">
3486        for details
3487       </entry>
3488      </row>
3489
3490      <row>
3491       <entry><structfield>srvoptions</structfield></entry>
3492       <entry><type>text[]</type></entry>
3493       <entry></entry>
3494       <entry>
3495        Foreign server specific options, as <quote>keyword=value</> strings
3496       </entry>
3497      </row>
3498     </tbody>
3499    </tgroup>
3500   </table>
3501  </sect1>
3502
3503
3504  <sect1 id="catalog-pg-foreign-table">
3505   <title><structname>pg_foreign_table</structname></title>
3506
3507   <indexterm zone="catalog-pg-foreign-table">
3508    <primary>pg_foreign_table</primary>
3509   </indexterm>
3510
3511   <para>
3512    The catalog <structname>pg_foreign_table</structname> contains
3513    auxiliary information about foreign tables.  A foreign table is
3514    primarily represented by a <structname>pg_class</structname> entry,
3515    just like a regular table.  Its <structname>pg_foreign_table</structname>
3516    entry contains the information that is pertinent only to foreign tables
3517    and not any other kind of relation.
3518   </para>
3519
3520   <table>
3521    <title><structname>pg_foreign_table</> Columns</title>
3522
3523    <tgroup cols="4">
3524     <thead>
3525      <row>
3526       <entry>Name</entry>
3527       <entry>Type</entry>
3528       <entry>References</entry>
3529       <entry>Description</entry>
3530      </row>
3531     </thead>
3532
3533     <tbody>
3534      <row>
3535       <entry><structfield>ftrelid</structfield></entry>
3536       <entry><type>oid</type></entry>
3537       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3538       <entry>OID of the <structname>pg_class</> entry for this foreign table</entry>
3539      </row>
3540
3541      <row>
3542       <entry><structfield>ftserver</structfield></entry>
3543       <entry><type>oid</type></entry>
3544       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
3545       <entry>OID of the foreign server for this foreign table</entry>
3546      </row>
3547
3548      <row>
3549       <entry><structfield>ftoptions</structfield></entry>
3550       <entry><type>text[]</type></entry>
3551       <entry></entry>
3552       <entry>
3553        Foreign table options, as <quote>keyword=value</> strings
3554       </entry>
3555      </row>
3556     </tbody>
3557    </tgroup>
3558   </table>
3559  </sect1>
3560
3561
3562  <sect1 id="catalog-pg-index">
3563   <title><structname>pg_index</structname></title>
3564
3565   <indexterm zone="catalog-pg-index">
3566    <primary>pg_index</primary>
3567   </indexterm>
3568
3569   <para>
3570    The catalog <structname>pg_index</structname> contains part of the information
3571    about indexes.  The rest is mostly in
3572    <structname>pg_class</structname>.
3573   </para>
3574
3575   <table>
3576    <title><structname>pg_index</> Columns</title>
3577
3578    <tgroup cols="4">
3579     <thead>
3580      <row>
3581       <entry>Name</entry>
3582       <entry>Type</entry>
3583       <entry>References</entry>
3584       <entry>Description</entry>
3585      </row>
3586     </thead>
3587
3588     <tbody>
3589      <row>
3590       <entry><structfield>indexrelid</structfield></entry>
3591       <entry><type>oid</type></entry>
3592       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3593       <entry>The OID of the <structname>pg_class</> entry for this index</entry>
3594      </row>
3595
3596      <row>
3597       <entry><structfield>indrelid</structfield></entry>
3598       <entry><type>oid</type></entry>
3599       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3600       <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
3601      </row>
3602
3603      <row>
3604       <entry><structfield>indnatts</structfield></entry>
3605       <entry><type>int2</type></entry>
3606       <entry></entry>
3607       <entry>The number of columns in the index (duplicates
3608       <literal>pg_class.relnatts</literal>)</entry>
3609      </row>
3610
3611      <row>
3612       <entry><structfield>indisunique</structfield></entry>
3613       <entry><type>bool</type></entry>
3614       <entry></entry>
3615       <entry>If true, this is a unique index</entry>
3616      </row>
3617
3618      <row>
3619       <entry><structfield>indisprimary</structfield></entry>
3620       <entry><type>bool</type></entry>
3621       <entry></entry>
3622       <entry>If true, this index represents the primary key of the table
3623       (<structfield>indisunique</> should always be true when this is true)</entry>
3624      </row>
3625
3626      <row>
3627       <entry><structfield>indisexclusion</structfield></entry>
3628       <entry><type>bool</type></entry>
3629       <entry></entry>
3630       <entry>If true, this index supports an exclusion constraint</entry>
3631      </row>
3632
3633      <row>
3634       <entry><structfield>indimmediate</structfield></entry>
3635       <entry><type>bool</type></entry>
3636       <entry></entry>
3637       <entry>If true, the uniqueness check is enforced immediately on
3638        insertion
3639        (irrelevant if <structfield>indisunique</> is not true)</entry>
3640      </row>
3641
3642      <row>
3643       <entry><structfield>indisclustered</structfield></entry>
3644       <entry><type>bool</type></entry>
3645       <entry></entry>
3646       <entry>If true, the table was last clustered on this index</entry>
3647      </row>
3648
3649      <row>
3650       <entry><structfield>indisvalid</structfield></entry>
3651       <entry><type>bool</type></entry>
3652       <entry></entry>
3653       <entry>
3654        If true, the index is currently valid for queries.  False means the
3655        index is possibly incomplete: it must still be modified by
3656        <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
3657        be used for queries. If it is unique, the uniqueness property is not
3658        guaranteed true either.
3659       </entry>
3660      </row>
3661
3662      <row>
3663       <entry><structfield>indcheckxmin</structfield></entry>
3664       <entry><type>bool</type></entry>
3665       <entry></entry>
3666       <entry>
3667        If true, queries must not use the index until the <structfield>xmin</>
3668        of this <structname>pg_index</> row is below their <symbol>TransactionXmin</symbol>
3669        event horizon, because the table may contain broken HOT chains with
3670        incompatible rows that they can see
3671       </entry>
3672      </row>
3673
3674      <row>
3675       <entry><structfield>indisready</structfield></entry>
3676       <entry><type>bool</type></entry>
3677       <entry></entry>
3678       <entry>
3679        If true, the index is currently ready for inserts.  False means the
3680        index must be ignored by <command>INSERT</>/<command>UPDATE</>
3681        operations.
3682       </entry>
3683      </row>
3684
3685      <row>
3686       <entry><structfield>indislive</structfield></entry>
3687       <entry><type>bool</type></entry>
3688       <entry></entry>
3689       <entry>
3690        If false, the index is in process of being dropped, and should be
3691        ignored for all purposes (including HOT-safety decisions)
3692       </entry>
3693      </row>
3694
3695      <row>
3696       <entry><structfield>indisreplident</structfield></entry>
3697       <entry><type>bool</type></entry>
3698       <entry></entry>
3699       <entry>
3700        If true this index has been chosen as <quote>replica identity</>
3701        using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
3702        ...</>
3703       </entry>
3704      </row>
3705
3706      <row>
3707       <entry><structfield>indkey</structfield></entry>
3708       <entry><type>int2vector</type></entry>
3709       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
3710       <entry>
3711        This is an array of <structfield>indnatts</structfield> values that
3712        indicate which table columns this index indexes.  For example a value
3713        of <literal>1 3</literal> would mean that the first and the third table
3714        columns make up the index key.  A zero in this array indicates that the
3715        corresponding index attribute is an expression over the table columns,
3716        rather than a simple column reference.
3717       </entry>
3718      </row>
3719
3720      <row>
3721       <entry><structfield>indcollation</structfield></entry>
3722       <entry><type>oidvector</type></entry>
3723       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
3724       <entry>
3725        For each column in the index key, this contains the OID of the
3726        collation to use for the index.
3727       </entry>
3728      </row>
3729
3730      <row>
3731       <entry><structfield>indclass</structfield></entry>
3732       <entry><type>oidvector</type></entry>
3733       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
3734       <entry>
3735        For each column in the index key, this contains the OID of
3736        the operator class to use.  See
3737        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
3738       </entry>
3739      </row>
3740
3741      <row>
3742       <entry><structfield>indoption</structfield></entry>
3743       <entry><type>int2vector</type></entry>
3744       <entry></entry>
3745       <entry>
3746        This is an array of <structfield>indnatts</structfield> values that
3747        store per-column flag bits.  The meaning of the bits is defined by
3748        the index's access method.
3749       </entry>
3750      </row>
3751
3752      <row>
3753       <entry><structfield>indexprs</structfield></entry>
3754       <entry><type>pg_node_tree</type></entry>
3755       <entry></entry>
3756       <entry>
3757        Expression trees (in <function>nodeToString()</function>
3758        representation) for index attributes that are not simple column
3759        references.  This is a list with one element for each zero
3760        entry in <structfield>indkey</>.  Null if all index attributes
3761        are simple references.
3762       </entry>
3763      </row>
3764
3765      <row>
3766       <entry><structfield>indpred</structfield></entry>
3767       <entry><type>pg_node_tree</type></entry>
3768       <entry></entry>
3769       <entry>
3770        Expression tree (in <function>nodeToString()</function>
3771        representation) for partial index predicate.  Null if not a
3772        partial index.
3773       </entry>
3774      </row>
3775     </tbody>
3776    </tgroup>
3777   </table>
3778
3779  </sect1>
3780
3781
3782  <sect1 id="catalog-pg-inherits">
3783   <title><structname>pg_inherits</structname></title>
3784
3785   <indexterm zone="catalog-pg-inherits">
3786    <primary>pg_inherits</primary>
3787   </indexterm>
3788
3789   <para>
3790    The catalog <structname>pg_inherits</> records information about
3791    table inheritance hierarchies.  There is one entry for each direct
3792    child table in the database.  (Indirect inheritance can be determined
3793    by following chains of entries.)
3794   </para>
3795
3796   <table>
3797    <title><structname>pg_inherits</> Columns</title>
3798
3799    <tgroup cols="4">
3800     <thead>
3801      <row>
3802       <entry>Name</entry>
3803       <entry>Type</entry>
3804       <entry>References</entry>
3805       <entry>Description</entry>
3806      </row>
3807     </thead>
3808
3809     <tbody>
3810      <row>
3811       <entry><structfield>inhrelid</structfield></entry>
3812       <entry><type>oid</type></entry>
3813       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3814       <entry>
3815        The OID of the child table
3816       </entry>
3817      </row>
3818
3819      <row>
3820       <entry><structfield>inhparent</structfield></entry>
3821       <entry><type>oid</type></entry>
3822       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3823       <entry>
3824        The OID of the parent table
3825       </entry>
3826      </row>
3827
3828      <row>
3829       <entry><structfield>inhseqno</structfield></entry>
3830       <entry><type>int4</type></entry>
3831       <entry></entry>
3832       <entry>
3833        If there is more than one direct parent for a child table (multiple
3834        inheritance), this number tells the order in which the
3835        inherited columns are to be arranged.  The count starts at 1.
3836       </entry>
3837      </row>
3838     </tbody>
3839    </tgroup>
3840   </table>
3841
3842  </sect1>
3843
3844  <sect1 id="catalog-pg-init-privs">
3845   <title><structname>pg_init_privs</structname></title>
3846
3847   <indexterm zone="catalog-pg-init-privs">
3848    <primary>pg_init_privs</primary>
3849   </indexterm>
3850
3851   <para>
3852    The catalog <structname>pg_init_privs</> records information about
3853    the initial privileges of objects in the system.  There is one entry
3854    for each object in the database which has a non-default (non-NULL)
3855    initial set of privileges.
3856   </para>
3857
3858   <para>
3859    Objects can have initial privileges either by having those privileges set
3860    when the system is initialized (by <application>initdb</>) or when the
3861    object is created during a <command>CREATE EXTENSION</command> and the
3862    extension script sets initial privileges using the <command>GRANT</command>
3863    system.  Note that the system will automatically handle recording of the
3864    privileges during the extension script and that extension authors need
3865    only use the <command>GRANT</command> and <command>REVOKE</command>
3866    statements in their script to have the privileges recorded.  The
3867    <literal>privtype</literal> column indicates if the initial privilege was
3868    set by <application>initdb</> or during a
3869    <command>CREATE EXTENSION</command> command.
3870   </para>
3871
3872   <para>
3873    Objects which have initial privileges set by <application>initdb</> will
3874    have entries where <literal>privtype</literal> is
3875    <literal>'i'</literal>, while objects which have initial privileges set
3876    by <command>CREATE EXTENSION</command> will have entries where
3877    <literal>privtype</literal> is <literal>'e'</literal>.
3878   </para>
3879
3880   <table>
3881    <title><structname>pg_init_privs</> Columns</title>
3882
3883    <tgroup cols="4">
3884     <thead>
3885      <row>
3886       <entry>Name</entry>
3887       <entry>Type</entry>
3888       <entry>References</entry>
3889       <entry>Description</entry>
3890      </row>
3891     </thead>
3892
3893     <tbody>
3894      <row>
3895       <entry><structfield>objoid</structfield></entry>
3896       <entry><type>oid</type></entry>
3897       <entry>any OID column</entry>
3898       <entry>The OID of the specific object</entry>
3899      </row>
3900
3901      <row>
3902       <entry><structfield>classoid</structfield></entry>
3903       <entry><type>oid</type></entry>
3904       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
3905       <entry>The OID of the system catalog the object is in</entry>
3906      </row>
3907
3908      <row>
3909       <entry><structfield>objsubid</structfield></entry>
3910       <entry><type>int4</type></entry>
3911       <entry></entry>
3912       <entry>
3913        For a table column, this is the column number (the
3914        <structfield>objoid</> and <structfield>classoid</> refer to the
3915        table itself).  For all other object types, this column is
3916        zero.
3917       </entry>
3918      </row>
3919
3920      <row>
3921       <entry><structfield>privtype</structfield></entry>
3922       <entry><type>char</type></entry>
3923       <entry></entry>
3924       <entry>
3925        A code defining the type of initial privilege of this object; see text
3926       </entry>
3927      </row>
3928
3929      <row>
3930       <entry><structfield>initprivs</structfield></entry>
3931       <entry><type>aclitem[]</type></entry>
3932       <entry></entry>
3933       <entry>
3934        The initial access privileges; see
3935        <xref linkend="sql-grant"> and
3936        <xref linkend="sql-revoke">
3937        for details
3938       </entry>
3939      </row>
3940
3941     </tbody>
3942    </tgroup>
3943   </table>
3944
3945  </sect1>
3946
3947
3948  <sect1 id="catalog-pg-language">
3949   <title><structname>pg_language</structname></title>
3950
3951   <indexterm zone="catalog-pg-language">
3952    <primary>pg_language</primary>
3953   </indexterm>
3954
3955   <para>
3956    The catalog <structname>pg_language</structname> registers
3957    languages in which you can write functions or stored procedures.
3958    See <xref linkend="sql-createlanguage">
3959    and <xref linkend="xplang"> for more information about language handlers.
3960   </para>
3961
3962   <table>
3963    <title><structname>pg_language</> Columns</title>
3964
3965    <tgroup cols="4">
3966     <thead>
3967      <row>
3968       <entry>Name</entry>
3969       <entry>Type</entry>
3970       <entry>References</entry>
3971       <entry>Description</entry>
3972      </row>
3973     </thead>
3974
3975     <tbody>
3976      <row>
3977       <entry><structfield>oid</structfield></entry>
3978       <entry><type>oid</type></entry>
3979       <entry></entry>
3980       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
3981      </row>
3982
3983      <row>
3984       <entry><structfield>lanname</structfield></entry>
3985       <entry><type>name</type></entry>
3986       <entry></entry>
3987       <entry>Name of the language</entry>
3988      </row>
3989
3990      <row>
3991       <entry><structfield>lanowner</structfield></entry>
3992       <entry><type>oid</type></entry>
3993       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3994       <entry>Owner of the language</entry>
3995      </row>
3996
3997      <row>
3998       <entry><structfield>lanispl</structfield></entry>
3999       <entry><type>bool</type></entry>
4000       <entry></entry>
4001       <entry>
4002        This is false for internal languages (such as
4003        <acronym>SQL</acronym>) and true for user-defined languages.
4004        Currently, <application>pg_dump</application> still uses this
4005        to determine which languages need to be dumped, but this might be
4006        replaced by a different mechanism in the future.
4007       </entry>
4008      </row>
4009
4010      <row>
4011       <entry><structfield>lanpltrusted</structfield></entry>
4012       <entry><type>bool</type></entry>
4013       <entry></entry>
4014       <entry>
4015        True if this is a trusted language, which means that it is believed
4016        not to grant access to anything outside the normal SQL execution
4017        environment.  Only superusers can create functions in untrusted
4018        languages.
4019       </entry>
4020      </row>
4021
4022      <row>
4023       <entry><structfield>lanplcallfoid</structfield></entry>
4024       <entry><type>oid</type></entry>
4025       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4026       <entry>
4027        For noninternal languages this references the language
4028        handler, which is a special function that is responsible for
4029        executing all functions that are written in the particular
4030        language
4031       </entry>
4032      </row>
4033
4034      <row>
4035       <entry><structfield>laninline</structfield></entry>
4036       <entry><type>oid</type></entry>
4037       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4038       <entry>
4039        This references a function that is responsible for executing
4040        <quote>inline</> anonymous code blocks
4041        (<xref linkend="sql-do"> blocks).
4042        Zero if inline blocks are not supported.
4043       </entry>
4044      </row>
4045
4046      <row>
4047       <entry><structfield>lanvalidator</structfield></entry>
4048       <entry><type>oid</type></entry>
4049       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4050       <entry>
4051        This references a language validator function that is responsible
4052        for checking the syntax and validity of new functions when they
4053        are created.  Zero if no validator is provided.
4054       </entry>
4055      </row>
4056
4057      <row>
4058       <entry><structfield>lanacl</structfield></entry>
4059       <entry><type>aclitem[]</type></entry>
4060       <entry></entry>
4061       <entry>
4062        Access privileges; see
4063        <xref linkend="sql-grant"> and
4064        <xref linkend="sql-revoke">
4065        for details
4066       </entry>
4067      </row>
4068     </tbody>
4069    </tgroup>
4070   </table>
4071
4072  </sect1>
4073
4074
4075  <sect1 id="catalog-pg-largeobject">
4076   <title><structname>pg_largeobject</structname></title>
4077
4078   <indexterm zone="catalog-pg-largeobject">
4079    <primary>pg_largeobject</primary>
4080   </indexterm>
4081
4082   <para>
4083    The catalog <structname>pg_largeobject</structname> holds the data making up
4084    <quote>large objects</quote>.  A large object is identified by an OID
4085    assigned when it is created.  Each large object is broken into
4086    segments or <quote>pages</> small enough to be conveniently stored as rows
4087    in <structname>pg_largeobject</structname>.
4088    The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
4089    <literal>BLCKSZ/4</>, or typically 2 kB).
4090   </para>
4091
4092   <para>
4093    Prior to <productname>PostgreSQL</> 9.0, there was no permission structure
4094    associated with large objects.  As a result,
4095    <structname>pg_largeobject</structname> was publicly readable and could be
4096    used to obtain the OIDs (and contents) of all large objects in the system.
4097    This is no longer the case; use
4098    <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</></link>
4099    to obtain a list of large object OIDs.
4100   </para>
4101
4102   <table>
4103    <title><structname>pg_largeobject</> Columns</title>
4104
4105    <tgroup cols="4">
4106     <thead>
4107      <row>
4108       <entry>Name</entry>
4109       <entry>Type</entry>
4110       <entry>References</entry>
4111       <entry>Description</entry>
4112      </row>
4113     </thead>
4114
4115     <tbody>
4116      <row>
4117       <entry><structfield>loid</structfield></entry>
4118       <entry><type>oid</type></entry>
4119       <entry><literal><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.oid</literal></entry>
4120       <entry>Identifier of the large object that includes this page</entry>
4121      </row>
4122
4123      <row>
4124       <entry><structfield>pageno</structfield></entry>
4125       <entry><type>int4</type></entry>
4126       <entry></entry>
4127       <entry>Page number of this page within its large object
4128       (counting from zero)</entry>
4129      </row>
4130
4131      <row>
4132       <entry><structfield>data</structfield></entry>
4133       <entry><type>bytea</type></entry>
4134       <entry></entry>
4135       <entry>
4136        Actual data stored in the large object.
4137        This will never be more than <symbol>LOBLKSIZE</> bytes and might be less.
4138       </entry>
4139      </row>
4140     </tbody>
4141    </tgroup>
4142   </table>
4143
4144   <para>
4145    Each row of <structname>pg_largeobject</structname> holds data
4146    for one page of a large object, beginning at
4147    byte offset (<literal>pageno * LOBLKSIZE</>) within the object.  The implementation
4148    allows sparse storage: pages might be missing, and might be shorter than
4149    <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
4150    Missing regions within a large object read as zeroes.
4151   </para>
4152
4153  </sect1>
4154
4155  <sect1 id="catalog-pg-largeobject-metadata">
4156   <title><structname>pg_largeobject_metadata</structname></title>
4157
4158   <indexterm zone="catalog-pg-largeobject-metadata">
4159    <primary>pg_largeobject_metadata</primary>
4160   </indexterm>
4161
4162   <para>
4163    The catalog <structname>pg_largeobject_metadata</structname>
4164    holds metadata associated with large objects.  The actual large object
4165    data is stored in
4166    <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</></link>.
4167   </para>
4168
4169   <table>
4170    <title><structname>pg_largeobject_metadata</> Columns</title>
4171
4172    <tgroup cols="4">
4173     <thead>
4174      <row>
4175       <entry>Name</entry>
4176       <entry>Type</entry>
4177       <entry>References</entry>
4178       <entry>Description</entry>
4179      </row>
4180     </thead>
4181
4182     <tbody>
4183      <row>
4184       <entry><structfield>oid</structfield></entry>
4185       <entry><type>oid</type></entry>
4186       <entry></entry>
4187       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4188      </row>
4189
4190      <row>
4191       <entry><structfield>lomowner</structfield></entry>
4192       <entry><type>oid</type></entry>
4193       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4194       <entry>Owner of the large object</entry>
4195      </row>
4196
4197      <row>
4198       <entry><structfield>lomacl</structfield></entry>
4199       <entry><type>aclitem[]</type></entry>
4200       <entry></entry>
4201       <entry>
4202        Access privileges; see
4203        <xref linkend="sql-grant"> and
4204        <xref linkend="sql-revoke">
4205        for details
4206       </entry>
4207      </row>
4208
4209     </tbody>
4210    </tgroup>
4211   </table>
4212  </sect1>
4213
4214  <sect1 id="catalog-pg-namespace">
4215   <title><structname>pg_namespace</structname></title>
4216
4217   <indexterm zone="catalog-pg-namespace">
4218    <primary>pg_namespace</primary>
4219   </indexterm>
4220
4221   <para>
4222    The catalog <structname>pg_namespace</> stores namespaces.
4223    A namespace is the structure underlying SQL schemas: each namespace
4224    can have a separate collection of relations, types, etc. without name
4225    conflicts.
4226   </para>
4227
4228   <table>
4229    <title><structname>pg_namespace</> Columns</title>
4230
4231    <tgroup cols="4">
4232     <thead>
4233      <row>
4234       <entry>Name</entry>
4235       <entry>Type</entry>
4236       <entry>References</entry>
4237       <entry>Description</entry>
4238      </row>
4239     </thead>
4240
4241     <tbody>
4242      <row>
4243       <entry><structfield>oid</structfield></entry>
4244       <entry><type>oid</type></entry>
4245       <entry></entry>
4246       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4247      </row>
4248
4249      <row>
4250       <entry><structfield>nspname</structfield></entry>
4251       <entry><type>name</type></entry>
4252       <entry></entry>
4253       <entry>Name of the namespace</entry>
4254      </row>
4255
4256      <row>
4257       <entry><structfield>nspowner</structfield></entry>
4258       <entry><type>oid</type></entry>
4259       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4260       <entry>Owner of the namespace</entry>
4261      </row>
4262
4263      <row>
4264       <entry><structfield>nspacl</structfield></entry>
4265       <entry><type>aclitem[]</type></entry>
4266       <entry></entry>
4267       <entry>
4268        Access privileges; see
4269        <xref linkend="sql-grant"> and
4270        <xref linkend="sql-revoke">
4271        for details
4272       </entry>
4273      </row>
4274     </tbody>
4275    </tgroup>
4276   </table>
4277
4278  </sect1>
4279
4280
4281  <sect1 id="catalog-pg-opclass">
4282   <title><structname>pg_opclass</structname></title>
4283
4284   <indexterm zone="catalog-pg-opclass">
4285    <primary>pg_opclass</primary>
4286   </indexterm>
4287
4288   <para>
4289    The catalog <structname>pg_opclass</structname> defines
4290    index access method operator classes.  Each operator class defines
4291    semantics for index columns of a particular data type and a particular
4292    index access method.  An operator class essentially specifies that a
4293    particular operator family is applicable to a particular indexable column
4294    data type.  The set of operators from the family that are actually usable
4295    with the indexed column are whichever ones accept the column's data type
4296    as their left-hand input.
4297   </para>
4298
4299   <para>
4300    Operator classes are described at length in <xref linkend="xindex">.
4301   </para>
4302
4303   <table>
4304    <title><structname>pg_opclass</> Columns</title>
4305
4306    <tgroup cols="4">
4307     <thead>
4308      <row>
4309       <entry>Name</entry>
4310       <entry>Type</entry>
4311       <entry>References</entry>
4312       <entry>Description</entry>
4313      </row>
4314     </thead>
4315     <tbody>
4316
4317      <row>
4318       <entry><structfield>oid</structfield></entry>
4319       <entry><type>oid</type></entry>
4320       <entry></entry>
4321       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4322      </row>
4323
4324      <row>
4325       <entry><structfield>opcmethod</structfield></entry>
4326       <entry><type>oid</type></entry>
4327       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4328       <entry>Index access method operator class is for</entry>
4329      </row>
4330
4331      <row>
4332       <entry><structfield>opcname</structfield></entry>
4333       <entry><type>name</type></entry>
4334       <entry></entry>
4335       <entry>Name of this operator class</entry>
4336      </row>
4337
4338      <row>
4339       <entry><structfield>opcnamespace</structfield></entry>
4340       <entry><type>oid</type></entry>
4341       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4342       <entry>Namespace of this operator class</entry>
4343      </row>
4344
4345      <row>
4346       <entry><structfield>opcowner</structfield></entry>
4347       <entry><type>oid</type></entry>
4348       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4349       <entry>Owner of the operator class</entry>
4350      </row>
4351
4352      <row>
4353       <entry><structfield>opcfamily</structfield></entry>
4354       <entry><type>oid</type></entry>
4355       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
4356       <entry>Operator family containing the operator class</entry>
4357      </row>
4358
4359      <row>
4360       <entry><structfield>opcintype</structfield></entry>
4361       <entry><type>oid</type></entry>
4362       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4363       <entry>Data type that the operator class indexes</entry>
4364      </row>
4365
4366      <row>
4367       <entry><structfield>opcdefault</structfield></entry>
4368       <entry><type>bool</type></entry>
4369       <entry></entry>
4370       <entry>True if this operator class is the default for <structfield>opcintype</></entry>
4371      </row>
4372
4373      <row>
4374       <entry><structfield>opckeytype</structfield></entry>
4375       <entry><type>oid</type></entry>
4376       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4377       <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
4378      </row>
4379
4380     </tbody>
4381    </tgroup>
4382   </table>
4383
4384   <para>
4385    An operator class's <structfield>opcmethod</> must match the
4386    <structname>opfmethod</> of its containing operator family.
4387    Also, there must be no more than one <structname>pg_opclass</structname>
4388    row having <structname>opcdefault</> true for any given combination of
4389    <structname>opcmethod</> and <structname>opcintype</>.
4390   </para>
4391
4392  </sect1>
4393
4394
4395  <sect1 id="catalog-pg-operator">
4396   <title><structname>pg_operator</structname></title>
4397
4398   <indexterm zone="catalog-pg-operator">
4399    <primary>pg_operator</primary>
4400   </indexterm>
4401
4402   <para>
4403    The catalog <structname>pg_operator</> stores information about operators.
4404    See <xref linkend="sql-createoperator">
4405    and <xref linkend="xoper"> for more information.
4406   </para>
4407
4408   <table>
4409    <title><structname>pg_operator</> Columns</title>
4410
4411    <tgroup cols="4">
4412     <thead>
4413      <row>
4414       <entry>Name</entry>
4415       <entry>Type</entry>
4416       <entry>References</entry>
4417       <entry>Description</entry>
4418      </row>
4419     </thead>
4420
4421     <tbody>
4422      <row>
4423       <entry><structfield>oid</structfield></entry>
4424       <entry><type>oid</type></entry>
4425       <entry></entry>
4426       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4427      </row>
4428
4429      <row>
4430       <entry><structfield>oprname</structfield></entry>
4431       <entry><type>name</type></entry>
4432       <entry></entry>
4433       <entry>Name of the operator</entry>
4434      </row>
4435
4436      <row>
4437       <entry><structfield>oprnamespace</structfield></entry>
4438       <entry><type>oid</type></entry>
4439       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4440       <entry>
4441        The OID of the namespace that contains this operator
4442       </entry>
4443      </row>
4444
4445      <row>
4446       <entry><structfield>oprowner</structfield></entry>
4447       <entry><type>oid</type></entry>
4448       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4449       <entry>Owner of the operator</entry>
4450      </row>
4451
4452      <row>
4453       <entry><structfield>oprkind</structfield></entry>
4454       <entry><type>char</type></entry>
4455       <entry></entry>
4456       <entry>
4457        <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
4458        (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
4459       </entry>
4460      </row>
4461
4462      <row>
4463       <entry><structfield>oprcanmerge</structfield></entry>
4464       <entry><type>bool</type></entry>
4465       <entry></entry>
4466       <entry>This operator supports merge joins</entry>
4467      </row>
4468
4469      <row>
4470       <entry><structfield>oprcanhash</structfield></entry>
4471       <entry><type>bool</type></entry>
4472       <entry></entry>
4473       <entry>This operator supports hash joins</entry>
4474      </row>
4475
4476      <row>
4477       <entry><structfield>oprleft</structfield></entry>
4478       <entry><type>oid</type></entry>
4479       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4480       <entry>Type of the left operand</entry>
4481      </row>
4482
4483      <row>
4484       <entry><structfield>oprright</structfield></entry>
4485       <entry><type>oid</type></entry>
4486       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4487       <entry>Type of the right operand</entry>
4488      </row>
4489
4490      <row>
4491       <entry><structfield>oprresult</structfield></entry>
4492       <entry><type>oid</type></entry>
4493       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
4494       <entry>Type of the result</entry>
4495      </row>
4496
4497      <row>
4498       <entry><structfield>oprcom</structfield></entry>
4499       <entry><type>oid</type></entry>
4500       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4501       <entry>Commutator of this operator, if any</entry>
4502      </row>
4503
4504      <row>
4505       <entry><structfield>oprnegate</structfield></entry>
4506       <entry><type>oid</type></entry>
4507       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4508       <entry>Negator of this operator, if any</entry>
4509      </row>
4510
4511      <row>
4512       <entry><structfield>oprcode</structfield></entry>
4513       <entry><type>regproc</type></entry>
4514       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4515       <entry>Function that implements this operator</entry>
4516      </row>
4517
4518      <row>
4519       <entry><structfield>oprrest</structfield></entry>
4520       <entry><type>regproc</type></entry>
4521       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4522       <entry>Restriction selectivity estimation function for this operator</entry>
4523      </row>
4524
4525      <row>
4526       <entry><structfield>oprjoin</structfield></entry>
4527       <entry><type>regproc</type></entry>
4528       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4529       <entry>Join selectivity estimation function for this operator</entry>
4530      </row>
4531     </tbody>
4532    </tgroup>
4533   </table>
4534
4535   <para>
4536    Unused column contain zeroes. For example, <structfield>oprleft</structfield>
4537    is zero for a prefix operator.
4538   </para>
4539
4540  </sect1>
4541
4542
4543  <sect1 id="catalog-pg-opfamily">
4544   <title><structname>pg_opfamily</structname></title>
4545
4546   <indexterm zone="catalog-pg-opfamily">
4547    <primary>pg_opfamily</primary>
4548   </indexterm>
4549
4550   <para>
4551    The catalog <structname>pg_opfamily</structname> defines operator families.
4552    Each operator family is a collection of operators and associated
4553    support routines that implement the semantics specified for a particular
4554    index access method.  Furthermore, the operators in a family are all
4555    <quote>compatible</>, in a way that is specified by the access method.
4556    The operator family concept allows cross-data-type operators to be used
4557    with indexes and to be reasoned about using knowledge of access method
4558    semantics.
4559   </para>
4560
4561   <para>
4562    Operator families are described at length in <xref linkend="xindex">.
4563   </para>
4564
4565   <table>
4566    <title><structname>pg_opfamily</> Columns</title>
4567
4568    <tgroup cols="4">
4569     <thead>
4570      <row>
4571       <entry>Name</entry>
4572       <entry>Type</entry>
4573       <entry>References</entry>
4574       <entry>Description</entry>
4575      </row>
4576     </thead>
4577     <tbody>
4578
4579      <row>
4580       <entry><structfield>oid</structfield></entry>
4581       <entry><type>oid</type></entry>
4582       <entry></entry>
4583       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4584      </row>
4585
4586      <row>
4587       <entry><structfield>opfmethod</structfield></entry>
4588       <entry><type>oid</type></entry>
4589       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
4590       <entry>Index access method operator family is for</entry>
4591      </row>
4592
4593      <row>
4594       <entry><structfield>opfname</structfield></entry>
4595       <entry><type>name</type></entry>
4596       <entry></entry>
4597       <entry>Name of this operator family</entry>
4598      </row>
4599
4600      <row>
4601       <entry><structfield>opfnamespace</structfield></entry>
4602       <entry><type>oid</type></entry>
4603       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4604       <entry>Namespace of this operator family</entry>
4605      </row>
4606
4607      <row>
4608       <entry><structfield>opfowner</structfield></entry>
4609       <entry><type>oid</type></entry>
4610       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4611       <entry>Owner of the operator family</entry>
4612      </row>
4613
4614     </tbody>
4615    </tgroup>
4616   </table>
4617
4618   <para>
4619    The majority of the information defining an operator family is not in its
4620    <structname>pg_opfamily</structname> row, but in the associated rows in
4621    <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
4622    <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
4623    and
4624    <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
4625   </para>
4626
4627  </sect1>
4628
4629
4630  <sect1 id="catalog-pg-pltemplate">
4631   <title><structname>pg_pltemplate</structname></title>
4632
4633   <indexterm zone="catalog-pg-pltemplate">
4634    <primary>pg_pltemplate</primary>
4635   </indexterm>
4636
4637   <para>
4638    The catalog <structname>pg_pltemplate</structname> stores
4639    <quote>template</> information for procedural languages.
4640    A template for a language allows the language to be created in a
4641    particular database by a simple <command>CREATE LANGUAGE</> command,
4642    with no need to specify implementation details.
4643   </para>
4644
4645   <para>
4646    Unlike most system catalogs, <structname>pg_pltemplate</structname>
4647    is shared across all databases of a cluster: there is only one
4648    copy of <structname>pg_pltemplate</structname> per cluster, not
4649    one per database.  This allows the information to be accessible in
4650    each database as it is needed.
4651   </para>
4652
4653   <table>
4654    <title><structname>pg_pltemplate</> Columns</title>
4655
4656    <tgroup cols="3">
4657     <thead>
4658      <row>
4659       <entry>Name</entry>
4660       <entry>Type</entry>
4661       <entry>Description</entry>
4662      </row>
4663     </thead>
4664
4665     <tbody>
4666      <row>
4667       <entry><structfield>tmplname</structfield></entry>
4668       <entry><type>name</type></entry>
4669       <entry>Name of the language this template is for</entry>
4670      </row>
4671
4672      <row>
4673       <entry><structfield>tmpltrusted</structfield></entry>
4674       <entry><type>boolean</type></entry>
4675       <entry>True if language is considered trusted</entry>
4676      </row>
4677
4678      <row>
4679       <entry><structfield>tmpldbacreate</structfield></entry>
4680       <entry><type>boolean</type></entry>
4681       <entry>True if language may be created by a database owner</entry>
4682      </row>
4683
4684      <row>
4685       <entry><structfield>tmplhandler</structfield></entry>
4686       <entry><type>text</type></entry>
4687       <entry>Name of call handler function</entry>
4688      </row>
4689
4690      <row>
4691       <entry><structfield>tmplinline</structfield></entry>
4692       <entry><type>text</type></entry>
4693       <entry>Name of anonymous-block handler function, or null if none</entry>
4694      </row>
4695
4696      <row>
4697       <entry><structfield>tmplvalidator</structfield></entry>
4698       <entry><type>text</type></entry>
4699       <entry>Name of validator function, or null if none</entry>
4700      </row>
4701
4702      <row>
4703       <entry><structfield>tmpllibrary</structfield></entry>
4704       <entry><type>text</type></entry>
4705       <entry>Path of shared library that implements language</entry>
4706      </row>
4707
4708      <row>
4709       <entry><structfield>tmplacl</structfield></entry>
4710       <entry><type>aclitem[]</type></entry>
4711       <entry>Access privileges for template (not actually used)</entry>
4712      </row>
4713
4714     </tbody>
4715    </tgroup>
4716   </table>
4717
4718   <para>
4719    There are not currently any commands that manipulate procedural language
4720    templates; to change the built-in information, a superuser must modify
4721    the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
4722    or <command>UPDATE</command> commands.
4723   </para>
4724
4725   <note>
4726    <para>
4727     It is likely that <structname>pg_pltemplate</> will be removed in some
4728     future release of <productname>PostgreSQL</productname>, in favor of
4729     keeping this knowledge about procedural languages in their respective
4730     extension installation scripts.
4731    </para>
4732   </note>
4733
4734  </sect1>
4735
4736  <sect1 id="catalog-pg-partitioned-table">
4737   <title><structname>pg_partitioned_table</structname></title>
4738
4739   <indexterm zone="catalog-pg-partitioned-table">
4740    <primary>pg_partitioned_table</primary>
4741   </indexterm>
4742
4743   <para>
4744    The catalog <structname>pg_partitioned_table</structname> stores
4745    information about how tables are partitioned.
4746   </para>
4747
4748   <table>
4749    <title><structname>pg_partitioned_table</> Columns</title>
4750
4751    <tgroup cols="4">
4752     <thead>
4753      <row>
4754       <entry>Name</entry>
4755       <entry>Type</entry>
4756       <entry>References</entry>
4757       <entry>Description</entry>
4758      </row>
4759     </thead>
4760
4761     <tbody>
4762
4763      <row>
4764       <entry><structfield>partrelid</structfield></entry>
4765       <entry><type>oid</type></entry>
4766       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4767       <entry>The OID of the <structname>pg_class</> entry for this partitioned table</entry>
4768      </row>
4769
4770      <row>
4771       <entry><structfield>partstrat</structfield></entry>
4772       <entry><type>char</type></entry>
4773       <entry></entry>
4774       <entry>
4775        Partitioning strategy; <literal>l</> = list partitioned table,
4776        <literal>r</> = range partitioned table
4777       </entry>
4778      </row>
4779
4780      <row>
4781       <entry><structfield>partnatts</structfield></entry>
4782       <entry><type>int2</type></entry>
4783       <entry></entry>
4784       <entry>The number of columns in partition key</entry>
4785      </row>
4786
4787      <row>
4788       <entry><structfield>partattrs</structfield></entry>
4789       <entry><type>int2vector</type></entry>
4790       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4791       <entry>
4792        This is an array of <structfield>partnatts</structfield> values that
4793        indicate which table columns are part of the partition key.  For
4794        example, a value of <literal>1 3</literal> would mean that the first
4795        and the third table columns make up the partition key.  A zero in this
4796        array indicates that the corresponding partition key column is an
4797        expression, rather than a simple column reference.
4798       </entry>
4799      </row>
4800
4801      <row>
4802       <entry><structfield>partclass</structfield></entry>
4803       <entry><type>oidvector</type></entry>
4804       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4805       <entry>
4806        For each column in the partition key, this contains the OID of the
4807        operator class to use.  See
4808        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4809       </entry>
4810      </row>
4811
4812      <row>
4813       <entry><structfield>partcollation</structfield></entry>
4814       <entry><type>oidvector</type></entry>
4815       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
4816       <entry>
4817        For each column in the partition key, this contains the OID of the
4818        the collation to use for partitioning.
4819       </entry>
4820      </row>
4821
4822      <row>
4823       <entry><structfield>partexprs</structfield></entry>
4824       <entry><type>pg_node_tree</type></entry>
4825       <entry></entry>
4826       <entry>
4827        Expression trees (in <function>nodeToString()</function>
4828        representation) for partition key columns that are not simple column
4829        references.  This is a list with one element for each zero
4830        entry in <structfield>partattrs</>.  Null if all partition key columns
4831        are simple references.
4832       </entry>
4833      </row>
4834
4835     </tbody>
4836    </tgroup>
4837   </table>
4838  </sect1>
4839
4840  <sect1 id="catalog-pg-policy">
4841   <title><structname>pg_policy</structname></title>
4842
4843   <indexterm zone="catalog-pg-policy">
4844    <primary>pg_policy</primary>
4845   </indexterm>
4846
4847   <para>
4848    The catalog <structname>pg_policy</structname> stores row level
4849    security policies for tables.  A policy includes the kind of
4850    command that it applies to (possibly all commands), the roles that it
4851    applies to, the expression to be added as a security-barrier
4852    qualification to queries that include the table, and the expression
4853    to be added as a <literal>WITH CHECK</> option for queries that attempt to
4854    add new records to the table.
4855   </para>
4856
4857   <table>
4858
4859    <title><structname>pg_policy</structname> Columns</title>
4860
4861    <tgroup cols="4">
4862     <thead>
4863      <row>
4864       <entry>Name</entry>
4865       <entry>Type</entry>
4866       <entry>References</entry>
4867       <entry>Description</entry>
4868      </row>
4869     </thead>
4870
4871     <tbody>
4872      <row>
4873       <entry><structfield>polname</structfield></entry>
4874       <entry><type>name</type></entry>
4875       <entry></entry>
4876       <entry>The name of the policy</entry>
4877      </row>
4878
4879      <row>
4880       <entry><structfield>polrelid</structfield></entry>
4881       <entry><type>oid</type></entry>
4882       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4883       <entry>The table to which the policy applies</entry>
4884      </row>
4885
4886      <row>
4887       <entry><structfield>polcmd</structfield></entry>
4888       <entry><type>char</type></entry>
4889       <entry></entry>
4890       <entry>The command type to which the policy is applied:
4891        <literal>r</> for <command>SELECT</>,
4892        <literal>a</> for <command>INSERT</>,
4893        <literal>w</> for <command>UPDATE</>,
4894        <literal>d</> for <command>DELETE</>,
4895        or <literal>*</> for all</entry>
4896      </row>
4897
4898      <row>
4899       <entry><structfield>polpermissive</structfield></entry>
4900       <entry><type>boolean</type></entry>
4901       <entry></entry>
4902       <entry>Is the policy permissive or restrictive?</entry>
4903      </row>
4904
4905      <row>
4906       <entry><structfield>polroles</structfield></entry>
4907       <entry><type>oid[]</type></entry>
4908       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4909       <entry>The roles to which the policy is applied</entry>
4910      </row>
4911
4912      <row>
4913       <entry><structfield>polqual</structfield></entry>
4914       <entry><type>pg_node_tree</type></entry>
4915       <entry></entry>
4916       <entry>The expression tree to be added to the security barrier qualifications for queries that use the table</entry>
4917      </row>
4918
4919      <row>
4920       <entry><structfield>polwithcheck</structfield></entry>
4921       <entry><type>pg_node_tree</type></entry>
4922       <entry></entry>
4923       <entry>The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table</entry>
4924      </row>
4925
4926     </tbody>
4927    </tgroup>
4928   </table>
4929
4930   <note>
4931    <para>
4932     Policies stored in <structname>pg_policy</> are applied only when
4933     <structname>pg_class</>.<structfield>relrowsecurity</> is set for
4934     their table.
4935    </para>
4936   </note>
4937
4938  </sect1>
4939
4940  <sect1 id="catalog-pg-proc">
4941   <title><structname>pg_proc</structname></title>
4942
4943   <indexterm zone="catalog-pg-proc">
4944    <primary>pg_proc</primary>
4945   </indexterm>
4946
4947   <para>
4948    The catalog <structname>pg_proc</> stores information about functions (or procedures).
4949    See <xref linkend="sql-createfunction">
4950    and <xref linkend="xfunc"> for more information.
4951   </para>
4952
4953   <para>
4954    The table contains data for aggregate functions as well as plain functions.
4955    If <structfield>proisagg</structfield> is true, there should be a matching
4956    row in <structfield>pg_aggregate</structfield>.
4957   </para>
4958
4959   <table>
4960    <title><structname>pg_proc</> Columns</title>
4961
4962    <tgroup cols="4">
4963     <thead>
4964      <row>
4965       <entry>Name</entry>
4966       <entry>Type</entry>
4967       <entry>References</entry>
4968       <entry>Description</entry>
4969      </row>
4970     </thead>
4971
4972     <tbody>
4973      <row>
4974       <entry><structfield>oid</structfield></entry>
4975       <entry><type>oid</type></entry>
4976       <entry></entry>
4977       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
4978      </row>
4979
4980      <row>
4981       <entry><structfield>proname</structfield></entry>
4982       <entry><type>name</type></entry>
4983       <entry></entry>
4984       <entry>Name of the function</entry>
4985      </row>
4986
4987      <row>
4988       <entry><structfield>pronamespace</structfield></entry>
4989       <entry><type>oid</type></entry>
4990       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4991       <entry>
4992        The OID of the namespace that contains this function
4993       </entry>
4994      </row>
4995
4996      <row>
4997       <entry><structfield>proowner</structfield></entry>
4998       <entry><type>oid</type></entry>
4999       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5000       <entry>Owner of the function</entry>
5001      </row>
5002
5003      <row>
5004       <entry><structfield>prolang</structfield></entry>
5005       <entry><type>oid</type></entry>
5006       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
5007       <entry>Implementation language or call interface of this function</entry>
5008      </row>
5009
5010      <row>
5011       <entry><structfield>procost</structfield></entry>
5012       <entry><type>float4</type></entry>
5013       <entry></entry>
5014       <entry>Estimated execution cost (in units of
5015        <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
5016        this is cost per row returned</entry>
5017      </row>
5018
5019      <row>
5020       <entry><structfield>prorows</structfield></entry>
5021       <entry><type>float4</type></entry>
5022       <entry></entry>
5023       <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
5024      </row>
5025
5026      <row>
5027       <entry><structfield>provariadic</structfield></entry>
5028       <entry><type>oid</type></entry>
5029       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5030       <entry>Data type of the variadic array parameter's elements,
5031        or zero if the function does not have a variadic parameter</entry>
5032      </row>
5033
5034      <row>
5035       <entry><structfield>protransform</structfield></entry>
5036       <entry><type>regproc</type></entry>
5037       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5038       <entry>Calls to this function can be simplified by this other function
5039        (see <xref linkend="xfunc-transform-functions">)</entry>
5040      </row>
5041
5042      <row>
5043       <entry><structfield>proisagg</structfield></entry>
5044       <entry><type>bool</type></entry>
5045       <entry></entry>
5046       <entry>Function is an aggregate function</entry>
5047      </row>
5048
5049      <row>
5050       <entry><structfield>proiswindow</structfield></entry>
5051       <entry><type>bool</type></entry>
5052       <entry></entry>
5053       <entry>Function is a window function</entry>
5054      </row>
5055
5056      <row>
5057       <entry><structfield>prosecdef</structfield></entry>
5058       <entry><type>bool</type></entry>
5059       <entry></entry>
5060       <entry>Function is a security definer (i.e., a <quote>setuid</>
5061       function)</entry>
5062      </row>
5063
5064      <row>
5065       <entry><structfield>proleakproof</structfield></entry>
5066       <entry><type>bool</type></entry>
5067       <entry></entry>
5068       <entry>
5069        The function has no side effects.  No information about the
5070        arguments is conveyed except via the return value.  Any function
5071        that might throw an error depending on the values of its arguments
5072        is not leak-proof.
5073       </entry>
5074      </row>
5075
5076      <row>
5077       <entry><structfield>proisstrict</structfield></entry>
5078       <entry><type>bool</type></entry>
5079       <entry></entry>
5080       <entry>
5081        Function returns null if any call argument is null.  In that
5082        case the function won't actually be called at all.  Functions
5083        that are not <quote>strict</quote> must be prepared to handle
5084        null inputs.
5085       </entry>
5086      </row>
5087
5088      <row>
5089       <entry><structfield>proretset</structfield></entry>
5090       <entry><type>bool</type></entry>
5091       <entry></entry>
5092       <entry>Function returns a set (i.e., multiple values of the specified
5093       data type)</entry>
5094      </row>
5095
5096      <row>
5097       <entry><structfield>provolatile</structfield></entry>
5098       <entry><type>char</type></entry>
5099       <entry></entry>
5100       <entry>
5101        <structfield>provolatile</structfield> tells whether the function's
5102        result depends only on its input arguments, or is affected by outside
5103        factors.
5104        It is <literal>i</literal> for <quote>immutable</> functions,
5105        which always deliver the same result for the same inputs.
5106        It is <literal>s</literal> for <quote>stable</> functions,
5107        whose results (for fixed inputs) do not change within a scan.
5108        It is <literal>v</literal> for <quote>volatile</> functions,
5109        whose results might change at any time.  (Use <literal>v</literal> also
5110        for functions with side-effects, so that calls to them cannot get
5111        optimized away.)
5112       </entry>
5113      </row>
5114
5115      <row>
5116       <entry><structfield>proparallel</structfield></entry>
5117       <entry><type>char</type></entry>
5118       <entry></entry>
5119       <entry>
5120        <structfield>proparallel</structfield> tells whether the function
5121        can be safely run in parallel mode.
5122        It is <literal>s</literal> for functions which are safe to run in
5123        parallel mode without restriction.
5124        It is <literal>r</literal> for functions which can be run in parallel
5125        mode, but their execution is restricted to the parallel group leader;
5126        parallel worker processes cannot invoke these functions.
5127        It is <literal>u</literal> for functions which are unsafe in parallel
5128        mode; the presence of such a function forces a serial execution plan.
5129       </entry>
5130      </row>
5131
5132      <row>
5133       <entry><structfield>pronargs</structfield></entry>
5134       <entry><type>int2</type></entry>
5135       <entry></entry>
5136       <entry>Number of input arguments</entry>
5137      </row>
5138
5139      <row>
5140       <entry><structfield>pronargdefaults</structfield></entry>
5141       <entry><type>int2</type></entry>
5142       <entry></entry>
5143       <entry>Number of arguments that have defaults</entry>
5144      </row>
5145
5146      <row>
5147       <entry><structfield>prorettype</structfield></entry>
5148       <entry><type>oid</type></entry>
5149       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5150       <entry>Data type of the return value</entry>
5151      </row>
5152
5153      <row>
5154       <entry><structfield>proargtypes</structfield></entry>
5155       <entry><type>oidvector</type></entry>
5156       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5157       <entry>
5158        An array with the data types of the function arguments.  This includes
5159        only input arguments (including <literal>INOUT</literal> and
5160        <literal>VARIADIC</> arguments), and thus represents
5161        the call signature of the function.
5162       </entry>
5163      </row>
5164
5165      <row>
5166       <entry><structfield>proallargtypes</structfield></entry>
5167       <entry><type>oid[]</type></entry>
5168       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5169       <entry>
5170        An array with the data types of the function arguments.  This includes
5171        all arguments (including <literal>OUT</literal> and
5172        <literal>INOUT</literal> arguments); however, if all the
5173        arguments are <literal>IN</literal> arguments, this field will be null.
5174        Note that subscripting is 1-based, whereas for historical reasons
5175        <structfield>proargtypes</> is subscripted from 0.
5176       </entry>
5177      </row>
5178
5179      <row>
5180       <entry><structfield>proargmodes</structfield></entry>
5181       <entry><type>char[]</type></entry>
5182       <entry></entry>
5183       <entry>
5184         An array with the modes of the function arguments, encoded as
5185         <literal>i</literal> for <literal>IN</> arguments,
5186         <literal>o</literal> for <literal>OUT</> arguments,
5187         <literal>b</literal> for <literal>INOUT</> arguments,
5188         <literal>v</literal> for <literal>VARIADIC</> arguments,
5189         <literal>t</literal> for <literal>TABLE</> arguments.
5190         If all the arguments are <literal>IN</literal> arguments,
5191         this field will be null.
5192         Note that subscripts correspond to positions of
5193         <structfield>proallargtypes</> not <structfield>proargtypes</>.
5194       </entry>
5195      </row>
5196
5197      <row>
5198       <entry><structfield>proargnames</structfield></entry>
5199       <entry><type>text[]</type></entry>
5200       <entry></entry>
5201       <entry>
5202         An array with the names of the function arguments.
5203         Arguments without a name are set to empty strings in the array.
5204         If none of the arguments have a name, this field will be null.
5205         Note that subscripts correspond to positions of
5206         <structfield>proallargtypes</> not <structfield>proargtypes</>.
5207       </entry>
5208      </row>
5209
5210      <row>
5211       <entry><structfield>proargdefaults</structfield></entry>
5212       <entry><type>pg_node_tree</type></entry>
5213       <entry></entry>
5214       <entry>
5215        Expression trees (in <function>nodeToString()</function> representation)
5216        for default values.  This is a list with
5217        <structfield>pronargdefaults</> elements, corresponding to the last
5218        <replaceable>N</> <emphasis>input</> arguments (i.e., the last
5219        <replaceable>N</> <structfield>proargtypes</> positions).
5220        If none of the arguments have defaults, this field will be null.
5221       </entry>
5222      </row>
5223
5224      <row>
5225       <entry><structfield>protrftypes</structfield></entry>
5226       <entry><type>oid[]</type></entry>
5227       <entry></entry>
5228       <entry>
5229        Data type OIDs for which to apply transforms.
5230       </entry>
5231      </row>
5232
5233      <row>
5234       <entry><structfield>prosrc</structfield></entry>
5235       <entry><type>text</type></entry>
5236       <entry></entry>
5237       <entry>
5238        This tells the function handler how to invoke the function.  It
5239        might be the actual source code of the function for interpreted
5240        languages, a link symbol, a file name, or just about anything
5241        else, depending on the implementation language/call convention.
5242       </entry>
5243      </row>
5244
5245      <row>
5246       <entry><structfield>probin</structfield></entry>
5247       <entry><type>text</type></entry>
5248       <entry></entry>
5249       <entry>
5250        Additional information about how to invoke the function.
5251        Again, the interpretation is language-specific.
5252       </entry>
5253      </row>
5254
5255      <row>
5256       <entry><structfield>proconfig</structfield></entry>
5257       <entry><type>text[]</type></entry>
5258       <entry></entry>
5259       <entry>Function's local settings for run-time configuration variables</entry>
5260      </row>
5261
5262      <row>
5263       <entry><structfield>proacl</structfield></entry>
5264       <entry><type>aclitem[]</type></entry>
5265       <entry></entry>
5266       <entry>
5267        Access privileges; see
5268        <xref linkend="sql-grant"> and
5269        <xref linkend="sql-revoke">
5270        for details
5271       </entry>
5272      </row>
5273     </tbody>
5274    </tgroup>
5275   </table>
5276
5277   <para>
5278    For compiled functions, both built-in and dynamically loaded,
5279    <structfield>prosrc</structfield> contains the function's C-language
5280    name (link symbol).  For all other currently-known language types,
5281    <structfield>prosrc</structfield> contains the function's source
5282    text.  <structfield>probin</structfield> is unused except for
5283    dynamically-loaded C functions, for which it gives the name of the
5284    shared library file containing the function.
5285   </para>
5286
5287  </sect1>
5288
5289  <sect1 id="catalog-pg-publication">
5290   <title><structname>pg_publication</structname></title>
5291
5292   <indexterm zone="catalog-pg-publication">
5293    <primary>pg_publication</primary>
5294   </indexterm>
5295
5296   <para>
5297    The catalog <structname>pg_publication</structname> contains all
5298    publications created in the database.  For more on publications see
5299    <xref linkend="logical-replication-publication">.
5300   </para>
5301
5302   <table>
5303    <title><structname>pg_publication</structname> Columns</title>
5304
5305    <tgroup cols="4">
5306     <thead>
5307      <row>
5308       <entry>Name</entry>
5309       <entry>Type</entry>
5310       <entry>References</entry>
5311       <entry>Description</entry>
5312      </row>
5313     </thead>
5314
5315     <tbody>
5316      <row>
5317       <entry><structfield>oid</structfield></entry>
5318       <entry><type>oid</type></entry>
5319       <entry></entry>
5320       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5321      </row>
5322
5323      <row>
5324       <entry><structfield>pubname</structfield></entry>
5325       <entry><type>Name</type></entry>
5326       <entry></entry>
5327       <entry>Name of the publication</entry>
5328      </row>
5329
5330      <row>
5331       <entry><structfield>pubowner</structfield></entry>
5332       <entry><type>oid</type></entry>
5333       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5334       <entry>Owner of the publication</entry>
5335      </row>
5336
5337      <row>
5338       <entry><structfield>puballtables</structfield></entry>
5339       <entry><type>bool</type></entry>
5340       <entry></entry>
5341       <entry>If true, this publication automatically includes all tables
5342        in the database, including any that will be created in the future.
5343       </entry>
5344      </row>
5345
5346      <row>
5347       <entry><structfield>pubinsert</structfield></entry>
5348       <entry><type>bool</type></entry>
5349       <entry></entry>
5350       <entry>If true, <command>INSERT</command> operations are replicated for
5351        tables in the publication.</entry>
5352      </row>
5353
5354      <row>
5355       <entry><structfield>pubupdate</structfield></entry>
5356       <entry><type>bool</type></entry>
5357       <entry></entry>
5358       <entry>If true, <command>UPDATE</command> operations are replicated for
5359        tables in the publication.</entry>
5360      </row>
5361
5362      <row>
5363       <entry><structfield>pubdelete</structfield></entry>
5364       <entry><type>bool</type></entry>
5365       <entry></entry>
5366       <entry>If true, <command>DELETE</command> operations are replicated for
5367        tables in the publication.</entry>
5368      </row>
5369     </tbody>
5370    </tgroup>
5371   </table>
5372  </sect1>
5373
5374  <sect1 id="catalog-pg-publication-rel">
5375   <title><structname>pg_publication_rel</structname></title>
5376
5377   <indexterm zone="catalog-pg-publication-rel">
5378    <primary>pg_publication_rel</primary>
5379   </indexterm>
5380
5381   <para>
5382    The catalog <structname>pg_publication_rel</structname> contains the
5383    mapping between relations and publications in the database.  This is a
5384    many-to-many mapping.  See also <xref linkend="view-pg-publication-tables">
5385    for a more user-friendly view of this information.
5386   </para>
5387
5388   <table>
5389    <title><structname>pg_publication_rel</structname> Columns</title>
5390
5391    <tgroup cols="4">
5392     <thead>
5393      <row>
5394       <entry>Name</entry>
5395       <entry>Type</entry>
5396       <entry>References</entry>
5397       <entry>Description</entry>
5398      </row>
5399     </thead>
5400
5401     <tbody>
5402      <row>
5403       <entry><structfield>prpubid</structfield></entry>
5404       <entry><type>oid</type></entry>
5405       <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.oid</literal></entry>
5406       <entry>Reference to publication</entry>
5407      </row>
5408
5409      <row>
5410       <entry><structfield>prrelid</structfield></entry>
5411       <entry><type>oid</type></entry>
5412       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5413       <entry>Reference to relation</entry>
5414      </row>
5415     </tbody>
5416    </tgroup>
5417   </table>
5418  </sect1>
5419
5420  <sect1 id="catalog-pg-range">
5421   <title><structname>pg_range</structname></title>
5422
5423   <indexterm zone="catalog-pg-range">
5424    <primary>pg_range</primary>
5425   </indexterm>
5426
5427   <para>
5428    The catalog <structname>pg_range</structname> stores information about
5429    range types.  This is in addition to the types' entries in
5430    <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
5431   </para>
5432
5433   <table>
5434    <title><structname>pg_range</> Columns</title>
5435
5436    <tgroup cols="4">
5437     <thead>
5438      <row>
5439       <entry>Name</entry>
5440       <entry>Type</entry>
5441       <entry>References</entry>
5442       <entry>Description</entry>
5443      </row>
5444     </thead>
5445
5446     <tbody>
5447      <row>
5448       <entry><structfield>rngtypid</structfield></entry>
5449       <entry><type>oid</type></entry>
5450       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5451       <entry>OID of the range type</entry>
5452      </row>
5453
5454      <row>
5455       <entry><structfield>rngsubtype</structfield></entry>
5456       <entry><type>oid</type></entry>
5457       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5458       <entry>OID of the element type (subtype) of this range type</entry>
5459      </row>
5460
5461      <row>
5462       <entry><structfield>rngcollation</structfield></entry>
5463       <entry><type>oid</type></entry>
5464       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
5465       <entry>OID of the collation used for range comparisons, or 0 if none</entry>
5466      </row>
5467
5468      <row>
5469       <entry><structfield>rngsubopc</structfield></entry>
5470       <entry><type>oid</type></entry>
5471       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
5472       <entry>OID of the subtype's operator class used for range comparisons</entry>
5473      </row>
5474
5475      <row>
5476       <entry><structfield>rngcanonical</structfield></entry>
5477       <entry><type>regproc</type></entry>
5478       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5479       <entry>OID of the function to convert a range value into canonical form,
5480       or 0 if none</entry>
5481      </row>
5482
5483      <row>
5484       <entry><structfield>rngsubdiff</structfield></entry>
5485       <entry><type>regproc</type></entry>
5486       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5487       <entry>OID of the function to return the difference between two element
5488       values as <type>double precision</type>, or 0 if none</entry>
5489      </row>
5490     </tbody>
5491    </tgroup>
5492   </table>
5493
5494   <para>
5495    <structfield>rngsubopc</> (plus <structfield>rngcollation</>, if the
5496    element type is collatable) determines the sort ordering used by the range
5497    type.  <structfield>rngcanonical</> is used when the element type is
5498    discrete.  <structfield>rngsubdiff</> is optional but should be supplied to
5499    improve performance of GiST indexes on the range type.
5500   </para>
5501
5502  </sect1>
5503
5504  <sect1 id="catalog-pg-replication-origin">
5505   <title><structname>pg_replication_origin</structname></title>
5506
5507   <indexterm zone="catalog-pg-replication-origin">
5508    <primary>pg_replication_origin</primary>
5509   </indexterm>
5510
5511   <para>
5512    The <structname>pg_replication_origin</structname> catalog contains
5513    all replication origins created.  For more on replication origins
5514    see <xref linkend="replication-origins">.
5515   </para>
5516
5517   <table>
5518
5519    <title><structname>pg_replication_origin</structname> Columns</title>
5520
5521    <tgroup cols="4">
5522     <thead>
5523      <row>
5524       <entry>Name</entry>
5525       <entry>Type</entry>
5526       <entry>References</entry>
5527       <entry>Description</entry>
5528      </row>
5529     </thead>
5530
5531     <tbody>
5532      <row>
5533       <entry><structfield>roident</structfield></entry>
5534       <entry><type>Oid</type></entry>
5535       <entry></entry>
5536       <entry>A unique, cluster-wide identifier for the replication
5537       origin. Should never leave the system.</entry>
5538      </row>
5539
5540      <row>
5541       <entry><structfield>roname</structfield></entry>
5542       <entry><type>text</type></entry>
5543       <entry></entry>
5544       <entry>The external, user defined, name of a replication
5545       origin.</entry>
5546      </row>
5547     </tbody>
5548    </tgroup>
5549   </table>
5550  </sect1>
5551
5552  <sect1 id="catalog-pg-rewrite">
5553   <title><structname>pg_rewrite</structname></title>
5554
5555   <indexterm zone="catalog-pg-rewrite">
5556    <primary>pg_rewrite</primary>
5557   </indexterm>
5558
5559   <para>
5560    The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
5561   </para>
5562
5563   <table>
5564    <title><structname>pg_rewrite</> Columns</title>
5565
5566    <tgroup cols="4">
5567     <thead>
5568      <row>
5569       <entry>Name</entry>
5570       <entry>Type</entry>
5571       <entry>References</entry>
5572       <entry>Description</entry>
5573      </row>
5574     </thead>
5575
5576     <tbody>
5577      <row>
5578       <entry><structfield>oid</structfield></entry>
5579       <entry><type>oid</type></entry>
5580       <entry></entry>
5581       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
5582      </row>
5583
5584      <row>
5585       <entry><structfield>rulename</structfield></entry>
5586       <entry><type>name</type></entry>
5587       <entry></entry>
5588       <entry>Rule name</entry>
5589      </row>
5590
5591      <row>
5592       <entry><structfield>ev_class</structfield></entry>
5593       <entry><type>oid</type></entry>
5594       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5595       <entry>The table this rule is for</entry>
5596      </row>
5597
5598      <row>
5599       <entry><structfield>ev_type</structfield></entry>
5600       <entry><type>char</type></entry>
5601       <entry></entry>
5602       <entry>
5603        Event type that the rule is for: 1 = <command>SELECT</>, 2 =
5604        <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
5605        <command>DELETE</>
5606       </entry>
5607      </row>
5608
5609      <row>
5610       <entry><structfield>ev_enabled</structfield></entry>
5611       <entry><type>char</type></entry>
5612       <entry></entry>
5613       <entry>
5614        Controls in which <xref linkend="guc-session-replication-role"> modes
5615        the rule fires.
5616        <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
5617        <literal>D</> = rule is disabled,
5618        <literal>R</> = rule fires in <quote>replica</> mode,
5619        <literal>A</> = rule fires always.
5620       </entry>
5621      </row>
5622
5623      <row>
5624       <entry><structfield>is_instead</structfield></entry>
5625       <entry><type>bool</type></entry>
5626       <entry></entry>
5627       <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
5628      </row>
5629
5630      <row>
5631       <entry><structfield>ev_qual</structfield></entry>
5632       <entry><type>pg_node_tree</type></entry>
5633       <entry></entry>
5634       <entry>
5635        Expression tree (in the form of a
5636        <function>nodeToString()</function> representation) for the
5637        rule's qualifying condition
5638       </entry>
5639      </row>
5640
5641      <row>
5642       <entry><structfield>ev_action</structfield></entry>
5643       <entry><type>pg_node_tree</type></entry>
5644       <entry></entry>
5645       <entry>
5646        Query tree (in the form of a
5647        <function>nodeToString()</function> representation) for the
5648        rule's action
5649       </entry>
5650      </row>
5651     </tbody>
5652    </tgroup>
5653   </table>
5654
5655   <note>
5656    <para>
5657     <literal>pg_class.relhasrules</literal>
5658     must be true if a table has any rules in this catalog.
5659    </para>
5660   </note>
5661
5662  </sect1>
5663
5664  <sect1 id="catalog-pg-seclabel">
5665   <title><structname>pg_seclabel</structname></title>
5666
5667   <indexterm zone="catalog-pg-seclabel">
5668    <primary>pg_seclabel</primary>
5669   </indexterm>
5670
5671   <para>
5672    The catalog <structname>pg_seclabel</structname> stores security
5673    labels on database objects.  Security labels can be manipulated
5674    with the <xref linkend="sql-security-label"> command.  For an easier
5675    way to view security labels, see <xref linkend="view-pg-seclabels">.
5676   </para>
5677
5678   <para>
5679    See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
5680    which performs a similar function for security labels of database objects
5681    that are shared across a database cluster.
5682   </para>
5683
5684   <table>
5685    <title><structname>pg_seclabel</structname> Columns</title>
5686
5687    <tgroup cols="4">
5688     <thead>
5689      <row>
5690       <entry>Name</entry>
5691       <entry>Type</entry>
5692       <entry>References</entry>
5693       <entry>Description</entry>
5694      </row>
5695     </thead>
5696
5697     <tbody>
5698      <row>
5699       <entry><structfield>objoid</structfield></entry>
5700       <entry><type>oid</type></entry>
5701       <entry>any OID column</entry>
5702       <entry>The OID of the object this security label pertains to</entry>
5703      </row>
5704
5705      <row>
5706       <entry><structfield>classoid</structfield></entry>
5707       <entry><type>oid</type></entry>
5708       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5709       <entry>The OID of the system catalog this object appears in</entry>
5710      </row>
5711
5712      <row>
5713       <entry><structfield>objsubid</structfield></entry>
5714       <entry><type>int4</type></entry>
5715       <entry></entry>
5716       <entry>
5717        For a security label on a table column, this is the column number (the
5718        <structfield>objoid</> and <structfield>classoid</> refer to
5719        the table itself).  For all other object types, this column is
5720        zero.
5721       </entry>
5722      </row>
5723
5724      <row>
5725       <entry><structfield>provider</structfield></entry>
5726       <entry><type>text</type></entry>
5727       <entry></entry>
5728       <entry>The label provider associated with this label.</entry>
5729      </row>
5730
5731      <row>
5732       <entry><structfield>label</structfield></entry>
5733       <entry><type>text</type></entry>
5734       <entry></entry>
5735       <entry>The security label applied to this object.</entry>
5736      </row>
5737     </tbody>
5738    </tgroup>
5739   </table>
5740  </sect1>
5741
5742  <sect1 id="catalog-pg-sequence">
5743   <title><structname>pg_sequence</structname></title>
5744
5745   <indexterm zone="catalog-pg-sequence">
5746    <primary>pg_sequence</primary>
5747   </indexterm>
5748
5749   <para>
5750    The catalog <structname>pg_sequence</structname> contains information about
5751    sequences.  Some of the information about sequences, such as the name and
5752    the schema, is in <structname>pg_class</structname>.
5753   </para>
5754
5755   <table>
5756    <title><structname>pg_sequence</> Columns</title>
5757
5758    <tgroup cols="4">
5759     <thead>
5760      <row>
5761       <entry>Name</entry>
5762       <entry>Type</entry>
5763       <entry>References</entry>
5764       <entry>Description</entry>
5765      </row>
5766     </thead>
5767
5768     <tbody>
5769      <row>
5770       <entry><structfield>seqrelid</structfield></entry>
5771       <entry><type>oid</type></entry>
5772       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5773       <entry>The OID of the <structname>pg_class</> entry for this sequence</entry>
5774      </row>
5775
5776      <row>
5777       <entry><structfield>seqcycle</structfield></entry>
5778       <entry><type>bool</type></entry>
5779       <entry></entry>
5780       <entry>Whether the sequence cycles</entry>
5781      </row>
5782
5783      <row>
5784       <entry><structfield>seqstart</structfield></entry>
5785       <entry><type>int8</type></entry>
5786       <entry></entry>
5787       <entry>Start value of the sequence</entry>
5788      </row>
5789
5790      <row>
5791       <entry><structfield>seqincrement</structfield></entry>
5792       <entry><type>int8</type></entry>
5793       <entry></entry>
5794       <entry>Increment value of the sequence</entry>
5795      </row>
5796
5797      <row>
5798       <entry><structfield>seqmax</structfield></entry>
5799       <entry><type>int8</type></entry>
5800       <entry></entry>
5801       <entry>Maximum value of the sequence</entry>
5802      </row>
5803
5804      <row>
5805       <entry><structfield>seqmin</structfield></entry>
5806       <entry><type>int8</type></entry>
5807       <entry></entry>
5808       <entry>Minimum value of the sequence</entry>
5809      </row>
5810
5811      <row>
5812       <entry><structfield>seqcache</structfield></entry>
5813       <entry><type>int8</type></entry>
5814       <entry></entry>
5815       <entry>Cache size of the sequence</entry>
5816      </row>
5817     </tbody>
5818    </tgroup>
5819   </table>
5820  </sect1>
5821
5822  <sect1 id="catalog-pg-shdepend">
5823   <title><structname>pg_shdepend</structname></title>
5824
5825   <indexterm zone="catalog-pg-shdepend">
5826    <primary>pg_shdepend</primary>
5827   </indexterm>
5828
5829   <para>
5830    The catalog <structname>pg_shdepend</structname> records the
5831    dependency relationships between database objects and shared objects,
5832    such as roles.  This information allows
5833    <productname>PostgreSQL</productname> to ensure that those objects are
5834    unreferenced before attempting to delete them.
5835   </para>
5836
5837   <para>
5838    See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
5839    which performs a similar function for dependencies involving objects
5840    within a single database.
5841   </para>
5842
5843   <para>
5844    Unlike most system catalogs, <structname>pg_shdepend</structname>
5845    is shared across all databases of a cluster: there is only one
5846    copy of <structname>pg_shdepend</structname> per cluster, not
5847    one per database.
5848   </para>
5849
5850   <table>
5851    <title><structname>pg_shdepend</> Columns</title>
5852
5853    <tgroup cols="4">
5854     <thead>
5855      <row>
5856       <entry>Name</entry>
5857       <entry>Type</entry>
5858       <entry>References</entry>
5859       <entry>Description</entry>
5860      </row>
5861     </thead>
5862
5863     <tbody>
5864      <row>
5865       <entry><structfield>dbid</structfield></entry>
5866       <entry><type>oid</type></entry>
5867       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
5868       <entry>The OID of the database the dependent object is in,
5869        or zero for a shared object</entry>
5870      </row>
5871
5872      <row>
5873       <entry><structfield>classid</structfield></entry>
5874       <entry><type>oid</type></entry>
5875       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5876       <entry>The OID of the system catalog the dependent object is in</entry>
5877      </row>
5878
5879      <row>
5880       <entry><structfield>objid</structfield></entry>
5881       <entry><type>oid</type></entry>
5882       <entry>any OID column</entry>
5883       <entry>The OID of the specific dependent object</entry>
5884      </row>
5885
5886      <row>
5887       <entry><structfield>objsubid</structfield></entry>
5888       <entry><type>int4</type></entry>
5889       <entry></entry>
5890       <entry>
5891        For a table column, this is the column number (the
5892        <structfield>objid</> and <structfield>classid</> refer to the
5893        table itself).  For all other object types, this column is zero.
5894       </entry>
5895      </row>
5896
5897      <row>
5898       <entry><structfield>refclassid</structfield></entry>
5899       <entry><type>oid</type></entry>
5900       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5901       <entry>The OID of the system catalog the referenced object is in
5902        (must be a shared catalog)</entry>
5903      </row>
5904
5905      <row>
5906       <entry><structfield>refobjid</structfield></entry>
5907       <entry><type>oid</type></entry>
5908       <entry>any OID column</entry>
5909       <entry>The OID of the specific referenced object</entry>
5910      </row>
5911
5912      <row>
5913       <entry><structfield>deptype</structfield></entry>
5914       <entry><type>char</type></entry>
5915       <entry></entry>
5916       <entry>
5917        A code defining the specific semantics of this dependency relationship; see text
5918       </entry>
5919      </row>
5920
5921     </tbody>
5922    </tgroup>
5923   </table>
5924
5925   <para>
5926    In all cases, a <structname>pg_shdepend</structname> entry indicates that
5927    the referenced object cannot be dropped without also dropping the dependent
5928    object.  However, there are several subflavors identified by
5929    <structfield>deptype</>:
5930
5931    <variablelist>
5932     <varlistentry>
5933      <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
5934      <listitem>
5935       <para>
5936        The referenced object (which must be a role) is the owner of the
5937        dependent object.
5938       </para>
5939      </listitem>
5940     </varlistentry>
5941
5942     <varlistentry>
5943      <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
5944      <listitem>
5945       <para>
5946        The referenced object (which must be a role) is mentioned in the
5947        ACL (access control list, i.e., privileges list) of the
5948        dependent object.  (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
5949        not made for the owner of the object, since the owner will have
5950        a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
5951       </para>
5952      </listitem>
5953     </varlistentry>
5954
5955     <varlistentry>
5956      <term><symbol>SHARED_DEPENDENCY_POLICY</> (<literal>r</>)</term>
5957      <listitem>
5958       <para>
5959        The referenced object (which must be a role) is mentioned as the
5960        target of a dependent policy object.
5961       </para>
5962      </listitem>
5963     </varlistentry>
5964
5965     <varlistentry>
5966      <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
5967      <listitem>
5968       <para>
5969        There is no dependent object; this type of entry is a signal
5970        that the system itself depends on the referenced object, and so
5971        that object must never be deleted.  Entries of this type are
5972        created only by <command>initdb</command>.  The columns for the
5973        dependent object contain zeroes.
5974       </para>
5975      </listitem>
5976     </varlistentry>
5977    </variablelist>
5978
5979    Other dependency flavors might be needed in future.  Note in particular
5980    that the current definition only supports roles as referenced objects.
5981   </para>
5982
5983  </sect1>
5984
5985  <sect1 id="catalog-pg-shdescription">
5986   <title><structname>pg_shdescription</structname></title>
5987
5988   <indexterm zone="catalog-pg-shdescription">
5989    <primary>pg_shdescription</primary>
5990   </indexterm>
5991
5992   <para>
5993    The catalog <structname>pg_shdescription</structname> stores optional
5994    descriptions (comments) for shared database objects.  Descriptions can be
5995    manipulated with the <xref linkend="sql-comment"> command and viewed with
5996    <application>psql</application>'s <literal>\d</literal> commands.
5997   </para>
5998
5999   <para>
6000    See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6001    which performs a similar function for descriptions involving objects
6002    within a single database.
6003   </para>
6004
6005   <para>
6006    Unlike most system catalogs, <structname>pg_shdescription</structname>
6007    is shared across all databases of a cluster: there is only one
6008    copy of <structname>pg_shdescription</structname> per cluster, not
6009    one per database.
6010   </para>
6011
6012   <table>
6013    <title><structname>pg_shdescription</> Columns</title>
6014
6015    <tgroup cols="4">
6016     <thead>
6017      <row>
6018       <entry>Name</entry>
6019       <entry>Type</entry>
6020       <entry>References</entry>
6021       <entry>Description</entry>
6022      </row>
6023     </thead>
6024
6025     <tbody>
6026      <row>
6027       <entry><structfield>objoid</structfield></entry>
6028       <entry><type>oid</type></entry>
6029       <entry>any OID column</entry>
6030       <entry>The OID of the object this description pertains to</entry>
6031      </row>
6032
6033      <row>
6034       <entry><structfield>classoid</structfield></entry>
6035       <entry><type>oid</type></entry>
6036       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6037       <entry>The OID of the system catalog this object appears in</entry>
6038      </row>
6039
6040      <row>
6041       <entry><structfield>description</structfield></entry>
6042       <entry><type>text</type></entry>
6043       <entry></entry>
6044       <entry>Arbitrary text that serves as the description of this object</entry>
6045      </row>
6046     </tbody>
6047    </tgroup>
6048   </table>
6049
6050  </sect1>
6051
6052  <sect1 id="catalog-pg-shseclabel">
6053   <title><structname>pg_shseclabel</structname></title>
6054
6055   <indexterm zone="catalog-pg-shseclabel">
6056    <primary>pg_shseclabel</primary>
6057   </indexterm>
6058
6059   <para>
6060    The catalog <structname>pg_shseclabel</structname> stores security
6061    labels on shared database objects.  Security labels can be manipulated
6062    with the <xref linkend="sql-security-label"> command.  For an easier
6063    way to view security labels, see <xref linkend="view-pg-seclabels">.
6064   </para>
6065
6066   <para>
6067    See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6068    which performs a similar function for security labels involving objects
6069    within a single database.
6070   </para>
6071
6072   <para>
6073    Unlike most system catalogs, <structname>pg_shseclabel</structname>
6074    is shared across all databases of a cluster: there is only one
6075    copy of <structname>pg_shseclabel</structname> per cluster, not
6076    one per database.
6077   </para>
6078
6079   <table>
6080    <title><structname>pg_shseclabel</structname> Columns</title>
6081    <tgroup cols="4">
6082     <thead>
6083      <row>
6084       <entry>Name</entry>
6085       <entry>Type</entry>
6086       <entry>References</entry>
6087       <entry>Description</entry>
6088      </row>
6089     </thead>
6090     <tbody>
6091      <row>
6092       <entry><structfield>objoid</structfield></entry>
6093       <entry><type>oid</type></entry>
6094       <entry>any OID column</entry>
6095       <entry>The OID of the object this security label pertains to</entry>
6096      </row>
6097      <row>
6098       <entry><structfield>classoid</structfield></entry>
6099       <entry><type>oid</type></entry>
6100       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6101       <entry>The OID of the system catalog this object appears in</entry>
6102      </row>
6103      <row>
6104       <entry><structfield>provider</structfield></entry>
6105       <entry><type>text</type></entry>
6106       <entry></entry>
6107       <entry>The label provider associated with this label.</entry>
6108      </row>
6109      <row>
6110       <entry><structfield>label</structfield></entry>
6111       <entry><type>text</type></entry>
6112       <entry></entry>
6113       <entry>The security label applied to this object.</entry>
6114      </row>
6115     </tbody>
6116    </tgroup>
6117   </table>
6118  </sect1>
6119
6120  <sect1 id="catalog-pg-statistic">
6121   <title><structname>pg_statistic</structname></title>
6122
6123   <indexterm zone="catalog-pg-statistic">
6124    <primary>pg_statistic</primary>
6125   </indexterm>
6126
6127   <para>
6128    The catalog <structname>pg_statistic</structname> stores
6129    statistical data about the contents of the database.  Entries are
6130    created by <xref linkend="sql-analyze">
6131    and subsequently used by the query planner.  Note that all the
6132    statistical data is inherently approximate, even assuming that it
6133    is up-to-date.
6134   </para>
6135
6136   <para>
6137    Normally there is one entry, with <structfield>stainherit</> =
6138    <literal>false</>, for each table column that has been analyzed.
6139    If the table has inheritance children, a second entry with
6140    <structfield>stainherit</> = <literal>true</> is also created.  This row
6141    represents the column's statistics over the inheritance tree, i.e.,
6142    statistics for the data you'd see with
6143    <literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
6144    whereas the <structfield>stainherit</> = <literal>false</> row represents
6145    the results of
6146    <literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
6147   </para>
6148
6149   <para>
6150    <structname>pg_statistic</structname> also stores statistical data about
6151    the values of index expressions.  These are described as if they were
6152    actual data columns; in particular, <structfield>starelid</structfield>
6153    references the index.  No entry is made for an ordinary non-expression
6154    index column, however, since it would be redundant with the entry
6155    for the underlying table column.  Currently, entries for index expressions
6156    always have <structfield>stainherit</> = <literal>false</>.
6157   </para>
6158
6159   <para>
6160    Since different kinds of statistics might be appropriate for different
6161    kinds of data, <structname>pg_statistic</structname> is designed not
6162    to assume very much about what sort of statistics it stores.  Only
6163    extremely general statistics (such as nullness) are given dedicated
6164    columns in <structname>pg_statistic</structname>.  Everything else
6165    is stored in <quote>slots</quote>, which are groups of associated columns
6166    whose content is identified by a code number in one of the slot's columns.
6167    For more information see
6168    <filename>src/include/catalog/pg_statistic.h</filename>.
6169   </para>
6170
6171   <para>
6172    <structname>pg_statistic</structname> should not be readable by the
6173    public, since even statistical information about a table's contents
6174    might be considered sensitive.  (Example: minimum and maximum values
6175    of a salary column might be quite interesting.)
6176    <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
6177    is a publicly readable view on
6178    <structname>pg_statistic</structname> that only exposes information
6179    about those tables that are readable by the current user.
6180   </para>
6181
6182   <table>
6183    <title><structname>pg_statistic</> Columns</title>
6184
6185    <tgroup cols="4">
6186     <thead>
6187      <row>
6188       <entry>Name</entry>
6189       <entry>Type</entry>
6190       <entry>References</entry>
6191       <entry>Description</entry>
6192      </row>
6193     </thead>
6194
6195     <tbody>
6196      <row>
6197       <entry><structfield>starelid</structfield></entry>
6198       <entry><type>oid</type></entry>
6199       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6200       <entry>The table or index that the described column belongs to</entry>
6201      </row>
6202
6203      <row>
6204       <entry><structfield>staattnum</structfield></entry>
6205       <entry><type>int2</type></entry>
6206       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6207       <entry>The number of the described column</entry>
6208      </row>
6209
6210      <row>
6211       <entry><structfield>stainherit</structfield></entry>
6212       <entry><type>bool</type></entry>
6213       <entry></entry>
6214       <entry>If true, the stats include inheritance child columns, not just the
6215        values in the specified relation</entry>
6216      </row>
6217
6218      <row>
6219       <entry><structfield>stanullfrac</structfield></entry>
6220       <entry><type>float4</type></entry>
6221       <entry></entry>
6222       <entry>The fraction of the column's entries that are null</entry>
6223      </row>
6224
6225      <row>
6226       <entry><structfield>stawidth</structfield></entry>
6227       <entry><type>int4</type></entry>
6228       <entry></entry>
6229       <entry>The average stored width, in bytes, of nonnull entries</entry>
6230      </row>
6231
6232      <row>
6233       <entry><structfield>stadistinct</structfield></entry>
6234       <entry><type>float4</type></entry>
6235       <entry></entry>
6236       <entry>The number of distinct nonnull data values in the column.
6237       A value greater than zero is the actual number of distinct values.
6238       A value less than zero is the negative of a multiplier for the number
6239       of rows in the table; for example, a column in which about 80% of the
6240       values are nonnull and each nonnull value appears about twice on
6241       average could be represented by <structfield>stadistinct</> = -0.4.
6242       A zero value means the number of distinct values is unknown.
6243       </entry>
6244      </row>
6245
6246      <row>
6247       <entry><structfield>stakind<replaceable>N</></structfield></entry>
6248       <entry><type>int2</type></entry>
6249       <entry></entry>
6250       <entry>
6251        A code number indicating the kind of statistics stored in the
6252        <replaceable>N</>th <quote>slot</quote> of the
6253        <structname>pg_statistic</structname> row.
6254       </entry>
6255      </row>
6256
6257      <row>
6258       <entry><structfield>staop<replaceable>N</></structfield></entry>
6259       <entry><type>oid</type></entry>
6260       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
6261       <entry>
6262        An operator used to derive the statistics stored in the
6263        <replaceable>N</>th <quote>slot</quote>.  For example, a
6264        histogram slot would show the <literal>&lt;</literal> operator
6265        that defines the sort order of the data.
6266       </entry>
6267      </row>
6268
6269      <row>
6270       <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
6271       <entry><type>float4[]</type></entry>
6272       <entry></entry>
6273       <entry>
6274        Numerical statistics of the appropriate kind for the
6275        <replaceable>N</>th <quote>slot</quote>, or null if the slot
6276        kind does not involve numerical values
6277       </entry>
6278      </row>
6279
6280      <row>
6281       <entry><structfield>stavalues<replaceable>N</></structfield></entry>
6282       <entry><type>anyarray</type></entry>
6283       <entry></entry>
6284       <entry>
6285        Column data values of the appropriate kind for the
6286        <replaceable>N</>th <quote>slot</quote>, or null if the slot
6287        kind does not store any data values.  Each array's element
6288        values are actually of the specific column's data type, or a related
6289        type such as an array's element type, so there is no way to define
6290        these columns' type more specifically than <type>anyarray</>.
6291       </entry>
6292      </row>
6293     </tbody>
6294    </tgroup>
6295   </table>
6296
6297  </sect1>
6298
6299  <sect1 id="catalog-pg-subscription">
6300   <title><structname>pg_subscription</structname></title>
6301
6302   <indexterm zone="catalog-pg-subscription">
6303    <primary>pg_subscription</primary>
6304   </indexterm>
6305
6306   <para>
6307    The catalog <structname>pg_subscription</structname> contains all existing
6308    logical replication subscriptions.  For more information about logical
6309    replication see <xref linkend="logical-replication">.
6310   </para>
6311
6312   <para>
6313    Unlike most system catalogs, <structname>pg_subscription</structname> is
6314    shared across all databases of a cluster: There is only one copy
6315    of <structname>pg_subscription</structname> per cluster, not one per
6316    database.
6317   </para>
6318
6319   <para>
6320    Access to this catalog is restricted from normal users.  Normal users can
6321    use the view <xref linkend="pg-stat-subscription"> to get some information
6322    about subscriptions.
6323   </para>
6324
6325   <table>
6326    <title><structname>pg_subscription</structname> Columns</title>
6327
6328    <tgroup cols="4">
6329     <thead>
6330      <row>
6331       <entry>Name</entry>
6332       <entry>Type</entry>
6333       <entry>References</entry>
6334       <entry>Description</entry>
6335      </row>
6336     </thead>
6337
6338     <tbody>
6339      <row>
6340       <entry><structfield>oid</structfield></entry>
6341       <entry><type>oid</type></entry>
6342       <entry></entry>
6343       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6344      </row>
6345
6346      <row>
6347       <entry><structfield>subdbid</structfield></entry>
6348       <entry><type>oid</type></entry>
6349       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6350       <entry>OID of the database which the subscription resides in</entry>
6351      </row>
6352
6353      <row>
6354       <entry><structfield>subname</structfield></entry>
6355       <entry><type>name</type></entry>
6356       <entry></entry>
6357       <entry>Name of the subscription</entry>
6358      </row>
6359
6360      <row>
6361       <entry><structfield>subowner</structfield></entry>
6362       <entry><type>oid</type></entry>
6363       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6364       <entry>Owner of the subscription</entry>
6365      </row>
6366
6367      <row>
6368       <entry><structfield>subenabled</structfield></entry>
6369       <entry><type>bool</type></entry>
6370       <entry></entry>
6371       <entry>If true, the subscription is enabled and should be replicating.</entry>
6372      </row>
6373
6374      <row>
6375       <entry><structfield>subconninfo</structfield></entry>
6376       <entry><type>text</type></entry>
6377       <entry></entry>
6378       <entry>Connection string to the upstream database</entry>
6379      </row>
6380
6381      <row>
6382       <entry><structfield>subslotname</structfield></entry>
6383       <entry><type>name</type></entry>
6384       <entry></entry>
6385       <entry>Name of the replication slot in the upstream database. Also used
6386        for local replication origin name.</entry>
6387      </row>
6388
6389      <row>
6390       <entry><structfield>subpublications</structfield></entry>
6391       <entry><type>text[]</type></entry>
6392       <entry></entry>
6393       <entry>Array of subscribed publication names. These reference the
6394        publications on the publisher server. For more on publications
6395        see <xref linkend="logical-replication-publication">.
6396       </entry>
6397      </row>
6398     </tbody>
6399    </tgroup>
6400   </table>
6401  </sect1>
6402
6403  <sect1 id="catalog-pg-tablespace">
6404   <title><structname>pg_tablespace</structname></title>
6405
6406   <indexterm zone="catalog-pg-tablespace">
6407    <primary>pg_tablespace</primary>
6408   </indexterm>
6409
6410   <para>
6411    The catalog <structname>pg_tablespace</structname> stores information
6412    about the available tablespaces.  Tables can be placed in particular
6413    tablespaces to aid administration of disk layout.
6414   </para>
6415
6416   <para>
6417    Unlike most system catalogs, <structname>pg_tablespace</structname>
6418    is shared across all databases of a cluster: there is only one
6419    copy of <structname>pg_tablespace</structname> per cluster, not
6420    one per database.
6421   </para>
6422
6423   <table>
6424    <title><structname>pg_tablespace</> Columns</title>
6425
6426    <tgroup cols="4">
6427     <thead>
6428      <row>
6429       <entry>Name</entry>
6430       <entry>Type</entry>
6431       <entry>References</entry>
6432       <entry>Description</entry>
6433      </row>
6434     </thead>
6435
6436     <tbody>
6437      <row>
6438       <entry><structfield>oid</structfield></entry>
6439       <entry><type>oid</type></entry>
6440       <entry></entry>
6441       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6442      </row>
6443
6444      <row>
6445       <entry><structfield>spcname</structfield></entry>
6446       <entry><type>name</type></entry>
6447       <entry></entry>
6448       <entry>Tablespace name</entry>
6449      </row>
6450
6451      <row>
6452       <entry><structfield>spcowner</structfield></entry>
6453       <entry><type>oid</type></entry>
6454       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6455       <entry>Owner of the tablespace, usually the user who created it</entry>
6456      </row>
6457
6458      <row>
6459       <entry><structfield>spcacl</structfield></entry>
6460       <entry><type>aclitem[]</type></entry>
6461       <entry></entry>
6462       <entry>
6463        Access privileges; see
6464        <xref linkend="sql-grant"> and
6465        <xref linkend="sql-revoke">
6466        for details
6467       </entry>
6468      </row>
6469
6470      <row>
6471       <entry><structfield>spcoptions</structfield></entry>
6472       <entry><type>text[]</type></entry>
6473       <entry></entry>
6474       <entry>
6475        Tablespace-level options, as <quote>keyword=value</> strings
6476       </entry>
6477      </row>
6478     </tbody>
6479    </tgroup>
6480   </table>
6481  </sect1>
6482
6483
6484  <sect1 id="catalog-pg-transform">
6485   <title><structname>pg_transform</structname></title>
6486
6487   <indexterm zone="catalog-pg-transform">
6488    <primary>pg_transform</primary>
6489   </indexterm>
6490
6491   <para>
6492    The catalog <structname>pg_transform</structname> stores information about
6493    transforms, which are a mechanism to adapt data types to procedural
6494    languages.  See <xref linkend="sql-createtransform"> for more information.
6495   </para>
6496
6497   <table>
6498    <title><structname>pg_transform</> Columns</title>
6499
6500    <tgroup cols="4">
6501     <thead>
6502      <row>
6503       <entry>Name</entry>
6504       <entry>Type</entry>
6505       <entry>References</entry>
6506       <entry>Description</entry>
6507      </row>
6508     </thead>
6509
6510     <tbody>
6511      <row>
6512       <entry><structfield>trftype</structfield></entry>
6513       <entry><type>oid</type></entry>
6514       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
6515       <entry>OID of the data type this transform is for</entry>
6516      </row>
6517
6518      <row>
6519       <entry><structfield>trflang</structfield></entry>
6520       <entry><type>oid</type></entry>
6521       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
6522       <entry>OID of the language this transform is for</entry>
6523      </row>
6524
6525      <row>
6526       <entry><structfield>trffromsql</structfield></entry>
6527       <entry><type>regproc</type></entry>
6528       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6529       <entry>
6530        The OID of the function to use when converting the data type for input
6531        to the procedural language (e.g., function parameters).  Zero is stored
6532        if this operation is not supported.
6533       </entry>
6534      </row>
6535
6536      <row>
6537       <entry><structfield>trftosql</structfield></entry>
6538       <entry><type>regproc</type></entry>
6539       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6540       <entry>
6541        The OID of the function to use when converting output from the
6542        procedural language (e.g., return values) to the data type.  Zero is
6543        stored if this operation is not supported.
6544       </entry>
6545      </row>
6546     </tbody>
6547    </tgroup>
6548   </table>
6549  </sect1>
6550
6551
6552  <sect1 id="catalog-pg-trigger">
6553   <title><structname>pg_trigger</structname></title>
6554
6555   <indexterm zone="catalog-pg-trigger">
6556    <primary>pg_trigger</primary>
6557   </indexterm>
6558
6559   <para>
6560    The catalog <structname>pg_trigger</structname> stores triggers on tables
6561    and views.
6562    See <xref linkend="sql-createtrigger">
6563    for more information.
6564   </para>
6565
6566   <table>
6567    <title><structname>pg_trigger</> Columns</title>
6568
6569    <tgroup cols="4">
6570     <thead>
6571      <row>
6572       <entry>Name</entry>
6573       <entry>Type</entry>
6574       <entry>References</entry>
6575       <entry>Description</entry>
6576      </row>
6577     </thead>
6578
6579     <tbody>
6580      <row>
6581       <entry><structfield>oid</structfield></entry>
6582       <entry><type>oid</type></entry>
6583       <entry></entry>
6584       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6585      </row>
6586
6587      <row>
6588       <entry><structfield>tgrelid</structfield></entry>
6589       <entry><type>oid</type></entry>
6590       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6591       <entry>The table this trigger is on</entry>
6592      </row>
6593
6594      <row>
6595       <entry><structfield>tgname</structfield></entry>
6596       <entry><type>name</type></entry>
6597       <entry></entry>
6598       <entry>Trigger name (must be unique among triggers of same table)</entry>
6599      </row>
6600
6601      <row>
6602       <entry><structfield>tgfoid</structfield></entry>
6603       <entry><type>oid</type></entry>
6604       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
6605       <entry>The function to be called</entry>
6606      </row>
6607
6608      <row>
6609       <entry><structfield>tgtype</structfield></entry>
6610       <entry><type>int2</type></entry>
6611       <entry></entry>
6612       <entry>Bit mask identifying trigger firing conditions</entry>
6613      </row>
6614
6615      <row>
6616       <entry><structfield>tgenabled</structfield></entry>
6617       <entry><type>char</type></entry>
6618       <entry></entry>
6619       <entry>
6620        Controls in which <xref linkend="guc-session-replication-role"> modes
6621        the trigger fires.
6622        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
6623        <literal>D</> = trigger is disabled,
6624        <literal>R</> = trigger fires in <quote>replica</> mode,
6625        <literal>A</> = trigger fires always.
6626       </entry>
6627      </row>
6628
6629      <row>
6630       <entry><structfield>tgisinternal</structfield></entry>
6631       <entry><type>bool</type></entry>
6632       <entry></entry>
6633       <entry>True if trigger is internally generated (usually, to enforce
6634        the constraint identified by <structfield>tgconstraint</>)</entry>
6635      </row>
6636
6637      <row>
6638       <entry><structfield>tgconstrrelid</structfield></entry>
6639       <entry><type>oid</type></entry>
6640       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6641       <entry>The table referenced by a referential integrity constraint</entry>
6642      </row>
6643
6644      <row>
6645       <entry><structfield>tgconstrindid</structfield></entry>
6646       <entry><type>oid</type></entry>
6647       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6648       <entry>The index supporting a unique, primary key, referential integrity,
6649        or exclusion constraint</entry>
6650      </row>
6651
6652      <row>
6653       <entry><structfield>tgconstraint</structfield></entry>
6654       <entry><type>oid</type></entry>
6655       <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
6656       <entry>The <structname>pg_constraint</> entry associated with the trigger, if any</entry>
6657      </row>
6658
6659      <row>
6660       <entry><structfield>tgdeferrable</structfield></entry>
6661       <entry><type>bool</type></entry>
6662       <entry></entry>
6663       <entry>True if constraint trigger is deferrable</entry>
6664      </row>
6665
6666      <row>
6667       <entry><structfield>tginitdeferred</structfield></entry>
6668       <entry><type>bool</type></entry>
6669       <entry></entry>
6670       <entry>True if constraint trigger is initially deferred</entry>
6671      </row>
6672
6673      <row>
6674       <entry><structfield>tgnargs</structfield></entry>
6675       <entry><type>int2</type></entry>
6676       <entry></entry>
6677       <entry>Number of argument strings passed to trigger function</entry>
6678      </row>
6679
6680      <row>
6681       <entry><structfield>tgattr</structfield></entry>
6682       <entry><type>int2vector</type></entry>
6683       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
6684       <entry>Column numbers, if trigger is column-specific; otherwise an
6685        empty array</entry>
6686      </row>
6687
6688      <row>
6689       <entry><structfield>tgargs</structfield></entry>
6690       <entry><type>bytea</type></entry>
6691       <entry></entry>
6692       <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
6693      </row>
6694
6695      <row>
6696       <entry><structfield>tgqual</structfield></entry>
6697       <entry><type>pg_node_tree</type></entry>
6698       <entry></entry>
6699       <entry>Expression tree (in <function>nodeToString()</function>
6700        representation) for the trigger's <literal>WHEN</> condition, or null
6701        if none</entry>
6702      </row>
6703
6704      <row>
6705       <entry><structfield>tgoldtable</structfield></entry>
6706       <entry><type>name</type></entry>
6707       <entry></entry>
6708       <entry><literal>REFERENCING</> clause name for <literal>OLD TABLE</>,
6709        or null if none</entry>
6710      </row>
6711
6712      <row>
6713       <entry><structfield>tgnewtable</structfield></entry>
6714       <entry><type>name</type></entry>
6715       <entry></entry>
6716       <entry><literal>REFERENCING</> clause name for <literal>NEW TABLE</>,
6717        or null if none</entry>
6718      </row>
6719     </tbody>
6720    </tgroup>
6721   </table>
6722
6723   <para>
6724    Currently, column-specific triggering is supported only for
6725    <literal>UPDATE</> events, and so <structfield>tgattr</> is relevant
6726    only for that event type.  <structfield>tgtype</structfield> might
6727    contain bits for other event types as well, but those are presumed
6728    to be table-wide regardless of what is in <structfield>tgattr</>.
6729   </para>
6730
6731   <note>
6732    <para>
6733     When <structfield>tgconstraint</> is nonzero,
6734     <structfield>tgconstrrelid</>, <structfield>tgconstrindid</>,
6735     <structfield>tgdeferrable</>, and <structfield>tginitdeferred</> are
6736     largely redundant with the referenced <structname>pg_constraint</> entry.
6737     However, it is possible for a non-deferrable trigger to be associated
6738     with a deferrable constraint: foreign key constraints can have some
6739     deferrable and some non-deferrable triggers.
6740    </para>
6741   </note>
6742
6743   <note>
6744    <para>
6745     <literal>pg_class.relhastriggers</literal>
6746     must be true if a relation has any triggers in this catalog.
6747    </para>
6748   </note>
6749
6750  </sect1>
6751
6752
6753  <sect1 id="catalog-pg-ts-config">
6754   <title><structname>pg_ts_config</structname></title>
6755
6756   <indexterm zone="catalog-pg-ts-config">
6757    <primary>pg_ts_config</primary>
6758   </indexterm>
6759
6760   <para>
6761    The <structname>pg_ts_config</structname> catalog contains entries
6762    representing text search configurations.  A configuration specifies
6763    a particular text search parser and a list of dictionaries to use
6764    for each of the parser's output token types.  The parser is shown
6765    in the <structname>pg_ts_config</structname> entry, but the
6766    token-to-dictionary mapping is defined by subsidiary entries in <link
6767    linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
6768   </para>
6769
6770   <para>
6771    <productname>PostgreSQL</productname>'s text search features are
6772    described at length in <xref linkend="textsearch">.
6773   </para>
6774
6775   <table>
6776    <title><structname>pg_ts_config</> Columns</title>
6777
6778    <tgroup cols="4">
6779     <thead>
6780      <row>
6781       <entry>Name</entry>
6782       <entry>Type</entry>
6783       <entry>References</entry>
6784       <entry>Description</entry>
6785      </row>
6786     </thead>
6787
6788     <tbody>
6789      <row>
6790       <entry><structfield>oid</structfield></entry>
6791       <entry><type>oid</type></entry>
6792       <entry></entry>
6793       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6794      </row>
6795
6796      <row>
6797       <entry><structfield>cfgname</structfield></entry>
6798       <entry><type>name</type></entry>
6799       <entry></entry>
6800       <entry>Text search configuration name</entry>
6801      </row>
6802
6803      <row>
6804       <entry><structfield>cfgnamespace</structfield></entry>
6805       <entry><type>oid</type></entry>
6806       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6807       <entry>
6808        The OID of the namespace that contains this configuration
6809       </entry>
6810      </row>
6811
6812      <row>
6813       <entry><structfield>cfgowner</structfield></entry>
6814       <entry><type>oid</type></entry>
6815       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6816       <entry>Owner of the configuration</entry>
6817      </row>
6818
6819      <row>
6820       <entry><structfield>cfgparser</structfield></entry>
6821       <entry><type>oid</type></entry>
6822       <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
6823       <entry>The OID of the text search parser for this configuration</entry>
6824      </row>
6825     </tbody>
6826    </tgroup>
6827   </table>
6828  </sect1>
6829
6830
6831  <sect1 id="catalog-pg-ts-config-map">
6832   <title><structname>pg_ts_config_map</structname></title>
6833
6834   <indexterm zone="catalog-pg-ts-config-map">
6835    <primary>pg_ts_config_map</primary>
6836   </indexterm>
6837
6838   <para>
6839    The <structname>pg_ts_config_map</structname> catalog contains entries
6840    showing which text search dictionaries should be consulted, and in
6841    what order, for each output token type of each text search configuration's
6842    parser.
6843   </para>
6844
6845   <para>
6846    <productname>PostgreSQL</productname>'s text search features are
6847    described at length in <xref linkend="textsearch">.
6848   </para>
6849
6850   <table>
6851    <title><structname>pg_ts_config_map</> Columns</title>
6852
6853    <tgroup cols="4">
6854     <thead>
6855      <row>
6856       <entry>Name</entry>
6857       <entry>Type</entry>
6858       <entry>References</entry>
6859       <entry>Description</entry>
6860      </row>
6861     </thead>
6862
6863     <tbody>
6864      <row>
6865       <entry><structfield>mapcfg</structfield></entry>
6866       <entry><type>oid</type></entry>
6867       <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
6868       <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
6869      </row>
6870
6871      <row>
6872       <entry><structfield>maptokentype</structfield></entry>
6873       <entry><type>integer</type></entry>
6874       <entry></entry>
6875       <entry>A token type emitted by the configuration's parser</entry>
6876      </row>
6877
6878      <row>
6879       <entry><structfield>mapseqno</structfield></entry>
6880       <entry><type>integer</type></entry>
6881       <entry></entry>
6882       <entry>Order in which to consult this entry (lower
6883        <structfield>mapseqno</>s first)</entry>
6884      </row>
6885
6886      <row>
6887       <entry><structfield>mapdict</structfield></entry>
6888       <entry><type>oid</type></entry>
6889       <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
6890       <entry>The OID of the text search dictionary to consult</entry>
6891      </row>
6892     </tbody>
6893    </tgroup>
6894   </table>
6895  </sect1>
6896
6897
6898  <sect1 id="catalog-pg-ts-dict">
6899   <title><structname>pg_ts_dict</structname></title>
6900
6901   <indexterm zone="catalog-pg-ts-dict">
6902    <primary>pg_ts_dict</primary>
6903   </indexterm>
6904
6905   <para>
6906    The <structname>pg_ts_dict</structname> catalog contains entries
6907    defining text search dictionaries.  A dictionary depends on a text
6908    search template, which specifies all the implementation functions
6909    needed; the dictionary itself provides values for the user-settable
6910    parameters supported by the template.  This division of labor allows
6911    dictionaries to be created by unprivileged users.  The parameters
6912    are specified by a text string <structfield>dictinitoption</>,
6913    whose format and meaning vary depending on the template.
6914   </para>
6915
6916   <para>
6917    <productname>PostgreSQL</productname>'s text search features are
6918    described at length in <xref linkend="textsearch">.
6919   </para>
6920
6921   <table>
6922    <title><structname>pg_ts_dict</> Columns</title>
6923
6924    <tgroup cols="4">
6925     <thead>
6926      <row>
6927       <entry>Name</entry>
6928       <entry>Type</entry>
6929       <entry>References</entry>
6930       <entry>Description</entry>
6931      </row>
6932     </thead>
6933
6934     <tbody>
6935      <row>
6936       <entry><structfield>oid</structfield></entry>
6937       <entry><type>oid</type></entry>
6938       <entry></entry>
6939       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
6940      </row>
6941
6942      <row>
6943       <entry><structfield>dictname</structfield></entry>
6944       <entry><type>name</type></entry>
6945       <entry></entry>
6946       <entry>Text search dictionary name</entry>
6947      </row>
6948
6949      <row>
6950       <entry><structfield>dictnamespace</structfield></entry>
6951       <entry><type>oid</type></entry>
6952       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
6953       <entry>
6954        The OID of the namespace that contains this dictionary
6955       </entry>
6956      </row>
6957
6958      <row>
6959       <entry><structfield>dictowner</structfield></entry>
6960       <entry><type>oid</type></entry>
6961       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6962       <entry>Owner of the dictionary</entry>
6963      </row>
6964
6965      <row>
6966       <entry><structfield>dicttemplate</structfield></entry>
6967       <entry><type>oid</type></entry>
6968       <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
6969       <entry>The OID of the text search template for this dictionary</entry>
6970      </row>
6971
6972      <row>
6973       <entry><structfield>dictinitoption</structfield></entry>
6974       <entry><type>text</type></entry>
6975       <entry></entry>
6976       <entry>Initialization option string for the template</entry>
6977      </row>
6978     </tbody>
6979    </tgroup>
6980   </table>
6981  </sect1>
6982
6983
6984  <sect1 id="catalog-pg-ts-parser">
6985   <title><structname>pg_ts_parser</structname></title>
6986
6987   <indexterm zone="catalog-pg-ts-parser">
6988    <primary>pg_ts_parser</primary>
6989   </indexterm>
6990
6991   <para>
6992    The <structname>pg_ts_parser</structname> catalog contains entries
6993    defining text search parsers.  A parser is responsible for splitting
6994    input text into lexemes and assigning a token type to each lexeme.
6995    Since a parser must be implemented by C-language-level functions,
6996    creation of new parsers is restricted to database superusers.
6997   </para>
6998
6999   <para>
7000    <productname>PostgreSQL</productname>'s text search features are
7001    described at length in <xref linkend="textsearch">.
7002   </para>
7003
7004   <table>
7005    <title><structname>pg_ts_parser</> Columns</title>
7006
7007    <tgroup cols="4">
7008     <thead>
7009      <row>
7010       <entry>Name</entry>
7011       <entry>Type</entry>
7012       <entry>References</entry>
7013       <entry>Description</entry>
7014      </row>
7015     </thead>
7016
7017     <tbody>
7018      <row>
7019       <entry><structfield>oid</structfield></entry>
7020       <entry><type>oid</type></entry>
7021       <entry></entry>
7022       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7023      </row>
7024
7025      <row>
7026       <entry><structfield>prsname</structfield></entry>
7027       <entry><type>name</type></entry>
7028       <entry></entry>
7029       <entry>Text search parser name</entry>
7030      </row>
7031
7032      <row>
7033       <entry><structfield>prsnamespace</structfield></entry>
7034       <entry><type>oid</type></entry>
7035       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7036       <entry>
7037        The OID of the namespace that contains this parser
7038       </entry>
7039      </row>
7040
7041      <row>
7042       <entry><structfield>prsstart</structfield></entry>
7043       <entry><type>regproc</type></entry>
7044       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7045       <entry>OID of the parser's startup function</entry>
7046      </row>
7047
7048      <row>
7049       <entry><structfield>prstoken</structfield></entry>
7050       <entry><type>regproc</type></entry>
7051       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7052       <entry>OID of the parser's next-token function</entry>
7053      </row>
7054
7055      <row>
7056       <entry><structfield>prsend</structfield></entry>
7057       <entry><type>regproc</type></entry>
7058       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7059       <entry>OID of the parser's shutdown function</entry>
7060      </row>
7061
7062      <row>
7063       <entry><structfield>prsheadline</structfield></entry>
7064       <entry><type>regproc</type></entry>
7065       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7066       <entry>OID of the parser's headline function</entry>
7067      </row>
7068
7069      <row>
7070       <entry><structfield>prslextype</structfield></entry>
7071       <entry><type>regproc</type></entry>
7072       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7073       <entry>OID of the parser's lextype function</entry>
7074      </row>
7075     </tbody>
7076    </tgroup>
7077   </table>
7078  </sect1>
7079
7080
7081  <sect1 id="catalog-pg-ts-template">
7082   <title><structname>pg_ts_template</structname></title>
7083
7084   <indexterm zone="catalog-pg-ts-template">
7085    <primary>pg_ts_template</primary>
7086   </indexterm>
7087
7088   <para>
7089    The <structname>pg_ts_template</structname> catalog contains entries
7090    defining text search templates.  A template is the implementation
7091    skeleton for a class of text search dictionaries.
7092    Since a template must be implemented by C-language-level functions,
7093    creation of new templates is restricted to database superusers.
7094   </para>
7095
7096   <para>
7097    <productname>PostgreSQL</productname>'s text search features are
7098    described at length in <xref linkend="textsearch">.
7099   </para>
7100
7101   <table>
7102    <title><structname>pg_ts_template</> Columns</title>
7103
7104    <tgroup cols="4">
7105     <thead>
7106      <row>
7107       <entry>Name</entry>
7108       <entry>Type</entry>
7109       <entry>References</entry>
7110       <entry>Description</entry>
7111      </row>
7112     </thead>
7113
7114     <tbody>
7115      <row>
7116       <entry><structfield>oid</structfield></entry>
7117       <entry><type>oid</type></entry>
7118       <entry></entry>
7119       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7120      </row>
7121
7122      <row>
7123       <entry><structfield>tmplname</structfield></entry>
7124       <entry><type>name</type></entry>
7125       <entry></entry>
7126       <entry>Text search template name</entry>
7127      </row>
7128
7129      <row>
7130       <entry><structfield>tmplnamespace</structfield></entry>
7131       <entry><type>oid</type></entry>
7132       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7133       <entry>
7134        The OID of the namespace that contains this template
7135       </entry>
7136      </row>
7137
7138      <row>
7139       <entry><structfield>tmplinit</structfield></entry>
7140       <entry><type>regproc</type></entry>
7141       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7142       <entry>OID of the template's initialization function</entry>
7143      </row>
7144
7145      <row>
7146       <entry><structfield>tmpllexize</structfield></entry>
7147       <entry><type>regproc</type></entry>
7148       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7149       <entry>OID of the template's lexize function</entry>
7150      </row>
7151     </tbody>
7152    </tgroup>
7153   </table>
7154  </sect1>
7155
7156
7157  <sect1 id="catalog-pg-type">
7158   <title><structname>pg_type</structname></title>
7159
7160   <indexterm zone="catalog-pg-type">
7161    <primary>pg_type</primary>
7162   </indexterm>
7163
7164   <para>
7165    The catalog <structname>pg_type</structname> stores information about data
7166    types.  Base types and enum types (scalar types) are created with
7167    <xref linkend="sql-createtype">, and
7168    domains with
7169    <xref linkend="sql-createdomain">.
7170    A composite type is automatically created for each table in the database, to
7171    represent the row structure of the table.  It is also possible to create
7172    composite types with <command>CREATE TYPE AS</command>.
7173   </para>
7174
7175   <table>
7176    <title><structname>pg_type</> Columns</title>
7177
7178    <tgroup cols="4">
7179     <thead>
7180      <row>
7181       <entry>Name</entry>
7182       <entry>Type</entry>
7183       <entry>References</entry>
7184       <entry>Description</entry>
7185      </row>
7186     </thead>
7187
7188     <tbody>
7189      <row>
7190       <entry><structfield>oid</structfield></entry>
7191       <entry><type>oid</type></entry>
7192       <entry></entry>
7193       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7194      </row>
7195
7196      <row>
7197       <entry><structfield>typname</structfield></entry>
7198       <entry><type>name</type></entry>
7199       <entry></entry>
7200       <entry>Data type name</entry>
7201      </row>
7202
7203      <row>
7204       <entry><structfield>typnamespace</structfield></entry>
7205       <entry><type>oid</type></entry>
7206       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
7207       <entry>
7208        The OID of the namespace that contains this type
7209       </entry>
7210      </row>
7211
7212      <row>
7213       <entry><structfield>typowner</structfield></entry>
7214       <entry><type>oid</type></entry>
7215       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7216       <entry>Owner of the type</entry>
7217      </row>
7218
7219      <row>
7220       <entry><structfield>typlen</structfield></entry>
7221       <entry><type>int2</type></entry>
7222       <entry></entry>
7223       <entry>
7224        For a fixed-size type, <structfield>typlen</structfield> is the number
7225        of bytes in the internal representation of the type.  But for a
7226        variable-length type, <structfield>typlen</structfield> is negative.
7227        -1 indicates a <quote>varlena</> type (one that has a length word),
7228        -2 indicates a null-terminated C string.
7229       </entry>
7230      </row>
7231
7232      <row>
7233       <entry><structfield>typbyval</structfield></entry>
7234       <entry><type>bool</type></entry>
7235       <entry></entry>
7236       <entry>
7237        <structfield>typbyval</structfield> determines whether internal
7238        routines pass a value of this type by value or by reference.
7239        <structfield>typbyval</structfield> had better be false if
7240        <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
7241        where Datum is 8 bytes).
7242        Variable-length types are always passed by reference. Note that
7243        <structfield>typbyval</structfield> can be false even if the
7244        length would allow pass-by-value.
7245       </entry>
7246      </row>
7247
7248      <row>
7249       <entry><structfield>typtype</structfield></entry>
7250       <entry><type>char</type></entry>
7251       <entry></entry>
7252       <entry>
7253        <structfield>typtype</structfield> is
7254        <literal>b</literal> for a base type,
7255        <literal>c</literal> for a composite type (e.g., a table's row type),
7256        <literal>d</literal> for a domain,
7257        <literal>e</literal> for an enum type,
7258        <literal>p</literal> for a pseudo-type, or
7259        <literal>r</literal> for a range type.
7260        See also <structfield>typrelid</structfield> and
7261        <structfield>typbasetype</structfield>.
7262       </entry>
7263      </row>
7264
7265      <row>
7266       <entry><structfield>typcategory</structfield></entry>
7267       <entry><type>char</type></entry>
7268       <entry></entry>
7269       <entry>
7270        <structfield>typcategory</structfield> is an arbitrary classification
7271        of data types that is used by the parser to determine which implicit
7272        casts should be <quote>preferred</>.
7273        See <xref linkend="catalog-typcategory-table">.
7274       </entry>
7275      </row>
7276
7277      <row>
7278       <entry><structfield>typispreferred</structfield></entry>
7279       <entry><type>bool</type></entry>
7280       <entry></entry>
7281       <entry>
7282        True if the type is a preferred cast target within its
7283        <structfield>typcategory</structfield>
7284       </entry>
7285      </row>
7286
7287      <row>
7288       <entry><structfield>typisdefined</structfield></entry>
7289       <entry><type>bool</type></entry>
7290       <entry></entry>
7291       <entry>
7292        True if the type is defined, false if this is a placeholder
7293        entry for a not-yet-defined type.  When
7294        <structfield>typisdefined</structfield> is false, nothing
7295        except the type name, namespace, and OID can be relied on.
7296       </entry>
7297      </row>
7298
7299      <row>
7300       <entry><structfield>typdelim</structfield></entry>
7301       <entry><type>char</type></entry>
7302       <entry></entry>
7303       <entry>
7304        Character that separates two values of this type when parsing
7305        array input.  Note that the delimiter is associated with the array
7306        element data type, not the array data type.
7307       </entry>
7308      </row>
7309
7310      <row>
7311       <entry><structfield>typrelid</structfield></entry>
7312       <entry><type>oid</type></entry>
7313       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
7314       <entry>
7315        If this is a composite type (see
7316        <structfield>typtype</structfield>), then this column points to
7317        the <structname>pg_class</structname> entry that defines the
7318        corresponding table.  (For a free-standing composite type, the
7319        <structname>pg_class</structname> entry doesn't really represent
7320        a table, but it is needed anyway for the type's
7321        <structname>pg_attribute</structname> entries to link to.)
7322        Zero for non-composite types.
7323       </entry>
7324      </row>
7325
7326      <row>
7327       <entry><structfield>typelem</structfield></entry>
7328       <entry><type>oid</type></entry>
7329       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7330       <entry>
7331        If <structfield>typelem</structfield> is not 0 then it
7332        identifies another row in <structname>pg_type</structname>.
7333        The current type can then be subscripted like an array yielding
7334        values of type <structfield>typelem</structfield>.  A
7335        <quote>true</quote> array type is variable length
7336        (<structfield>typlen</structfield> = -1),
7337        but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
7338        also have nonzero <structfield>typelem</structfield>, for example
7339        <type>name</type> and <type>point</type>.
7340        If a fixed-length type has a <structfield>typelem</structfield> then
7341        its internal representation must be some number of values of the
7342        <structfield>typelem</structfield> data type with no other data.
7343        Variable-length array types have a header defined by the array
7344        subroutines.
7345       </entry>
7346      </row>
7347
7348      <row>
7349       <entry><structfield>typarray</structfield></entry>
7350       <entry><type>oid</type></entry>
7351       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7352       <entry>
7353        If <structfield>typarray</structfield> is not 0 then it
7354        identifies another row in <structname>pg_type</structname>, which
7355        is the <quote>true</quote> array type having this type as element
7356       </entry>
7357      </row>
7358
7359      <row>
7360       <entry><structfield>typinput</structfield></entry>
7361       <entry><type>regproc</type></entry>
7362       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7363       <entry>Input conversion function (text format)</entry>
7364      </row>
7365
7366      <row>
7367       <entry><structfield>typoutput</structfield></entry>
7368       <entry><type>regproc</type></entry>
7369       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7370       <entry>Output conversion function (text format)</entry>
7371      </row>
7372
7373      <row>
7374       <entry><structfield>typreceive</structfield></entry>
7375       <entry><type>regproc</type></entry>
7376       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7377       <entry>Input conversion function (binary format), or 0 if none</entry>
7378      </row>
7379
7380      <row>
7381       <entry><structfield>typsend</structfield></entry>
7382       <entry><type>regproc</type></entry>
7383       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7384       <entry>Output conversion function (binary format), or 0 if none</entry>
7385      </row>
7386
7387      <row>
7388       <entry><structfield>typmodin</structfield></entry>
7389       <entry><type>regproc</type></entry>
7390       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7391       <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
7392      </row>
7393
7394      <row>
7395       <entry><structfield>typmodout</structfield></entry>
7396       <entry><type>regproc</type></entry>
7397       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7398       <entry>Type modifier output function, or 0 to use the standard format</entry>
7399      </row>
7400
7401      <row>
7402       <entry><structfield>typanalyze</structfield></entry>
7403       <entry><type>regproc</type></entry>
7404       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
7405       <entry>Custom <command>ANALYZE</command> function, or 0 to use the standard function</entry>
7406      </row>
7407
7408      <row>
7409       <entry><structfield>typalign</structfield></entry>
7410       <entry><type>char</type></entry>
7411       <entry></entry>
7412       <entry><para>
7413
7414        <structfield>typalign</structfield> is the alignment required
7415        when storing a value of this type.  It applies to storage on
7416        disk as well as most representations of the value inside
7417        <productname>PostgreSQL</>.
7418        When multiple values are stored consecutively, such
7419        as in the representation of a complete row on disk, padding is
7420        inserted before a datum of this type so that it begins on the
7421        specified boundary.  The alignment reference is the beginning
7422        of the first datum in the sequence.
7423       </para>
7424
7425       <para>
7426        Possible values are:
7427        <itemizedlist>
7428         <listitem>
7429          <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
7430         </listitem>
7431         <listitem>
7432          <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
7433         </listitem>
7434         <listitem>
7435          <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
7436         </listitem>
7437         <listitem>
7438          <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
7439         </listitem>
7440        </itemizedlist>
7441       </para><note>
7442        <para>
7443         For types used in system tables, it is critical that the size
7444         and alignment defined in <structname>pg_type</structname>
7445         agree with the way that the compiler will lay out the column in
7446         a structure representing a table row.
7447        </para>
7448       </note></entry>
7449      </row>
7450
7451      <row>
7452       <entry><structfield>typstorage</structfield></entry>
7453       <entry><type>char</type></entry>
7454       <entry></entry>
7455       <entry><para>
7456        <structfield>typstorage</structfield> tells for varlena
7457        types (those with <structfield>typlen</structfield> = -1) if
7458        the type is prepared for toasting and what the default strategy
7459        for attributes of this type should be.
7460        Possible values are
7461        <itemizedlist>
7462         <listitem>
7463          <para><literal>p</>: Value must always be stored plain.</para>
7464         </listitem>
7465         <listitem>
7466          <para>
7467           <literal>e</>: Value can be stored in a <quote>secondary</quote>
7468           relation (if relation has one, see
7469           <literal>pg_class.reltoastrelid</literal>).
7470          </para>
7471         </listitem>
7472         <listitem>
7473          <para><literal>m</>: Value can be stored compressed inline.</para>
7474         </listitem>
7475         <listitem>
7476          <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
7477         </listitem>
7478        </itemizedlist>
7479        Note that <literal>m</> columns can also be moved out to secondary
7480        storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
7481        moved first).
7482       </para></entry>
7483      </row>
7484
7485      <row>
7486       <entry><structfield>typnotnull</structfield></entry>
7487       <entry><type>bool</type></entry>
7488       <entry></entry>
7489       <entry><para>
7490        <structfield>typnotnull</structfield> represents a not-null
7491        constraint on a type.  Used for domains only.
7492       </para></entry>
7493      </row>
7494
7495      <row>
7496       <entry><structfield>typbasetype</structfield></entry>
7497       <entry><type>oid</type></entry>
7498       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
7499       <entry><para>
7500        If this is a domain (see <structfield>typtype</structfield>), then
7501        <structfield>typbasetype</structfield> identifies the type that this
7502        one is based on.  Zero if this type is not a domain.
7503       </para></entry>
7504      </row>
7505
7506      <row>
7507       <entry><structfield>typtypmod</structfield></entry>
7508       <entry><type>int4</type></entry>
7509       <entry></entry>
7510       <entry><para>
7511        Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
7512        to be applied to their base type (-1 if base type does not use a
7513        <literal>typmod</>).  -1 if this type is not a domain.
7514       </para></entry>
7515      </row>
7516
7517      <row>
7518       <entry><structfield>typndims</structfield></entry>
7519       <entry><type>int4</type></entry>
7520       <entry></entry>
7521       <entry><para>
7522        <structfield>typndims</structfield> is the number of array dimensions
7523        for a domain over an array (that is, <structfield>typbasetype</> is
7524        an array type).
7525        Zero for types other than domains over array types.
7526        </para></entry>
7527      </row>
7528
7529      <row>
7530       <entry><structfield>typcollation</structfield></entry>
7531       <entry><type>oid</type></entry>
7532       <entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
7533       <entry><para>
7534        <structfield>typcollation</structfield> specifies the collation
7535        of the type.  If the type does not support collations, this will
7536        be zero.  A base type that supports collations will have
7537        <symbol>DEFAULT_COLLATION_OID</symbol> here.  A domain over a
7538        collatable type can have some other collation OID, if one was
7539        specified for the domain.
7540       </para></entry>
7541      </row>
7542
7543      <row>
7544       <entry><structfield>typdefaultbin</structfield></entry>
7545       <entry><type>pg_node_tree</type></entry>
7546       <entry></entry>
7547       <entry><para>
7548        If <structfield>typdefaultbin</> is not null, it is the
7549        <function>nodeToString()</function>
7550        representation of a default expression for the type.  This is
7551        only used for domains.
7552       </para></entry>
7553      </row>
7554
7555      <row>
7556       <entry><structfield>typdefault</structfield></entry>
7557       <entry><type>text</type></entry>
7558       <entry></entry>
7559       <entry><para>
7560        <structfield>typdefault</> is null if the type has no associated
7561        default value. If <structfield>typdefaultbin</> is not null,
7562        <structfield>typdefault</> must contain a human-readable version of the
7563        default expression represented by <structfield>typdefaultbin</>.  If
7564        <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
7565        not, then <structfield>typdefault</> is the external representation of
7566        the type's default value, which can be fed to the type's input
7567        converter to produce a constant.
7568       </para></entry>
7569      </row>
7570
7571      <row>
7572       <entry><structfield>typacl</structfield></entry>
7573       <entry><type>aclitem[]</type></entry>
7574       <entry></entry>
7575       <entry>
7576        Access privileges; see
7577        <xref linkend="sql-grant"> and
7578        <xref linkend="sql-revoke">
7579        for details
7580       </entry>
7581      </row>
7582     </tbody>
7583    </tgroup>
7584   </table>
7585
7586   <para>
7587    <xref linkend="catalog-typcategory-table"> lists the system-defined values
7588    of <structfield>typcategory</>.  Any future additions to this list will
7589    also be upper-case ASCII letters.  All other ASCII characters are reserved
7590    for user-defined categories.
7591   </para>
7592
7593   <table id="catalog-typcategory-table">
7594    <title><structfield>typcategory</> Codes</title>
7595
7596    <tgroup cols="2">
7597     <thead>
7598      <row>
7599       <entry>Code</entry>
7600       <entry>Category</entry>
7601      </row>
7602     </thead>
7603
7604     <tbody>
7605      <row>
7606       <entry><literal>A</literal></entry>
7607       <entry>Array types</entry>
7608      </row>
7609      <row>
7610       <entry><literal>B</literal></entry>
7611       <entry>Boolean types</entry>
7612      </row>
7613      <row>
7614       <entry><literal>C</literal></entry>
7615       <entry>Composite types</entry>
7616      </row>
7617      <row>
7618       <entry><literal>D</literal></entry>
7619       <entry>Date/time types</entry>
7620      </row>
7621      <row>
7622       <entry><literal>E</literal></entry>
7623       <entry>Enum types</entry>
7624      </row>
7625      <row>
7626       <entry><literal>G</literal></entry>
7627       <entry>Geometric types</entry>
7628      </row>
7629      <row>
7630       <entry><literal>I</literal></entry>
7631       <entry>Network address types</entry>
7632      </row>
7633      <row>
7634       <entry><literal>N</literal></entry>
7635       <entry>Numeric types</entry>
7636      </row>
7637      <row>
7638       <entry><literal>P</literal></entry>
7639       <entry>Pseudo-types</entry>
7640      </row>
7641      <row>
7642       <entry><literal>R</literal></entry>
7643       <entry>Range types</entry>
7644      </row>
7645      <row>
7646       <entry><literal>S</literal></entry>
7647       <entry>String types</entry>
7648      </row>
7649      <row>
7650       <entry><literal>T</literal></entry>
7651       <entry>Timespan types</entry>
7652      </row>
7653      <row>
7654       <entry><literal>U</literal></entry>
7655       <entry>User-defined types</entry>
7656      </row>
7657      <row>
7658       <entry><literal>V</literal></entry>
7659       <entry>Bit-string types</entry>
7660      </row>
7661      <row>
7662       <entry><literal>X</literal></entry>
7663       <entry><type>unknown</> type</entry>
7664      </row>
7665     </tbody>
7666    </tgroup>
7667   </table>
7668
7669  </sect1>
7670
7671
7672  <sect1 id="catalog-pg-user-mapping">
7673   <title><structname>pg_user_mapping</structname></title>
7674
7675   <indexterm zone="catalog-pg-user-mapping">
7676    <primary>pg_user_mapping</primary>
7677   </indexterm>
7678
7679   <para>
7680    The catalog <structname>pg_user_mapping</structname> stores
7681    the mappings from local user to remote.  Access to this catalog is
7682    restricted from normal users, use the view
7683    <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
7684    instead.
7685   </para>
7686
7687   <table>
7688    <title><structname>pg_user_mapping</> Columns</title>
7689
7690    <tgroup cols="4">
7691     <thead>
7692      <row>
7693       <entry>Name</entry>
7694       <entry>Type</entry>
7695       <entry>References</entry>
7696       <entry>Description</entry>
7697      </row>
7698     </thead>
7699
7700     <tbody>
7701      <row>
7702       <entry><structfield>oid</structfield></entry>
7703       <entry><type>oid</type></entry>
7704       <entry></entry>
7705       <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
7706      </row>
7707
7708      <row>
7709       <entry><structfield>umuser</structfield></entry>
7710       <entry><type>oid</type></entry>
7711       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7712       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7713      </row>
7714
7715      <row>
7716       <entry><structfield>umserver</structfield></entry>
7717       <entry><type>oid</type></entry>
7718       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7719       <entry>
7720        The OID of the foreign server that contains this mapping
7721       </entry>
7722      </row>
7723
7724      <row>
7725       <entry><structfield>umoptions</structfield></entry>
7726       <entry><type>text[]</type></entry>
7727       <entry></entry>
7728       <entry>
7729        User mapping specific options, as <quote>keyword=value</> strings
7730       </entry>
7731      </row>
7732     </tbody>
7733    </tgroup>
7734   </table>
7735  </sect1>
7736
7737
7738  <sect1 id="views-overview">
7739   <title>System Views</title>
7740
7741   <para>
7742    In addition to the system catalogs, <productname>PostgreSQL</productname>
7743    provides a number of built-in views.  Some system views provide convenient
7744    access to some commonly used queries on the system catalogs.  Other views
7745    provide access to internal server state.
7746   </para>
7747
7748   <para>
7749    The information schema (<xref linkend="information-schema">) provides
7750    an alternative set of views which overlap the functionality of the system
7751    views.  Since the information schema is SQL-standard whereas the views
7752    described here are <productname>PostgreSQL</productname>-specific,
7753    it's usually better to use the information schema if it provides all
7754    the information you need.
7755   </para>
7756
7757   <para>
7758    <xref linkend="view-table"> lists the system views described here.
7759    More detailed documentation of each view follows below.
7760    There are some additional views that provide access to the results of
7761    the statistics collector; they are described in <xref
7762    linkend="monitoring-stats-views-table">.
7763   </para>
7764
7765   <para>
7766    Except where noted, all the views described here are read-only.
7767   </para>
7768
7769   <table id="view-table">
7770    <title>System Views</title>
7771
7772    <tgroup cols="2">
7773     <thead>
7774      <row>
7775       <entry>View Name</entry>
7776       <entry>Purpose</entry>
7777      </row>
7778     </thead>
7779
7780     <tbody>
7781      <row>
7782       <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
7783       <entry>available extensions</entry>
7784      </row>
7785
7786      <row>
7787       <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
7788       <entry>available versions of extensions</entry>
7789      </row>
7790
7791      <row>
7792       <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
7793       <entry>compile-time configuration parameters</entry>
7794      </row>
7795
7796      <row>
7797       <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
7798       <entry>open cursors</entry>
7799      </row>
7800
7801      <row>
7802       <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
7803       <entry>summary of configuration file contents</entry>
7804      </row>
7805
7806      <row>
7807       <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
7808       <entry>groups of database users</entry>
7809      </row>
7810
7811      <row>
7812       <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
7813       <entry>summary of client authentication configuration file contents</entry>
7814      </row>
7815
7816      <row>
7817       <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
7818       <entry>indexes</entry>
7819      </row>
7820
7821      <row>
7822       <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
7823       <entry>locks currently held or awaited</entry>
7824      </row>
7825
7826      <row>
7827       <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
7828       <entry>materialized views</entry>
7829      </row>
7830
7831      <row>
7832       <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
7833       <entry>policies</entry>
7834      </row>
7835
7836      <row>
7837       <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
7838       <entry>prepared statements</entry>
7839      </row>
7840
7841      <row>
7842       <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
7843       <entry>prepared transactions</entry>
7844      </row>
7845
7846      <row>
7847       <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
7848       <entry>publications and their associated tables</entry>
7849      </row>
7850
7851      <row>
7852       <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
7853       <entry>information about replication origins, including replication progress</entry>
7854      </row>
7855
7856      <row>
7857       <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
7858       <entry>replication slot information</entry>
7859      </row>
7860
7861      <row>
7862       <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
7863       <entry>database roles</entry>
7864      </row>
7865
7866      <row>
7867       <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
7868       <entry>rules</entry>
7869      </row>
7870
7871      <row>
7872       <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
7873       <entry>security labels</entry>
7874      </row>
7875
7876      <row>
7877       <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
7878       <entry>sequences</entry>
7879      </row>
7880
7881      <row>
7882       <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
7883       <entry>parameter settings</entry>
7884      </row>
7885
7886      <row>
7887       <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
7888       <entry>database users</entry>
7889      </row>
7890
7891      <row>
7892       <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
7893       <entry>planner statistics</entry>
7894      </row>
7895
7896      <row>
7897       <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
7898       <entry>tables</entry>
7899      </row>
7900
7901      <row>
7902       <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
7903       <entry>time zone abbreviations</entry>
7904      </row>
7905
7906      <row>
7907       <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
7908       <entry>time zone names</entry>
7909      </row>
7910
7911      <row>
7912       <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
7913       <entry>database users</entry>
7914      </row>
7915
7916      <row>
7917       <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
7918       <entry>user mappings</entry>
7919      </row>
7920
7921      <row>
7922       <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
7923       <entry>views</entry>
7924      </row>
7925
7926     </tbody>
7927    </tgroup>
7928   </table>
7929  </sect1>
7930
7931  <sect1 id="view-pg-available-extensions">
7932   <title><structname>pg_available_extensions</structname></title>
7933
7934   <indexterm zone="view-pg-available-extensions">
7935    <primary>pg_available_extensions</primary>
7936   </indexterm>
7937
7938   <para>
7939    The <structname>pg_available_extensions</structname> view lists the
7940    extensions that are available for installation.
7941    See also the
7942    <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
7943    catalog, which shows the extensions currently installed.
7944   </para>
7945
7946   <table>
7947    <title><structname>pg_available_extensions</> Columns</title>
7948
7949    <tgroup cols="3">
7950     <thead>
7951      <row>
7952       <entry>Name</entry>
7953       <entry>Type</entry>
7954       <entry>Description</entry>
7955      </row>
7956     </thead>
7957
7958     <tbody>
7959      <row>
7960       <entry><structfield>name</structfield></entry>
7961       <entry><type>name</type></entry>
7962       <entry>Extension name</entry>
7963      </row>
7964
7965      <row>
7966       <entry><structfield>default_version</structfield></entry>
7967       <entry><type>text</type></entry>
7968       <entry>Name of default version, or <literal>NULL</literal> if none is
7969        specified</entry>
7970      </row>
7971
7972      <row>
7973       <entry><structfield>installed_version</structfield></entry>
7974       <entry><type>text</type></entry>
7975       <entry>Currently installed version of the extension,
7976        or <literal>NULL</literal> if not installed</entry>
7977      </row>
7978
7979      <row>
7980       <entry><structfield>comment</structfield></entry>
7981       <entry><type>text</type></entry>
7982       <entry>Comment string from the extension's control file</entry>
7983      </row>
7984     </tbody>
7985    </tgroup>
7986   </table>
7987
7988   <para>
7989    The <structname>pg_available_extensions</structname> view is read only.
7990   </para>
7991  </sect1>
7992
7993  <sect1 id="view-pg-available-extension-versions">
7994   <title><structname>pg_available_extension_versions</structname></title>
7995
7996   <indexterm zone="view-pg-available-extension-versions">
7997    <primary>pg_available_extension_versions</primary>
7998   </indexterm>
7999
8000   <para>
8001    The <structname>pg_available_extension_versions</structname> view lists the
8002    specific extension versions that are available for installation.
8003    See also the <link
8004    linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
8005    catalog, which shows the extensions currently installed.
8006   </para>
8007
8008   <table>
8009    <title><structname>pg_available_extension_versions</> Columns</title>
8010
8011    <tgroup cols="3">
8012     <thead>
8013      <row>
8014       <entry>Name</entry>
8015       <entry>Type</entry>
8016       <entry>Description</entry>
8017      </row>
8018     </thead>
8019
8020     <tbody>
8021      <row>
8022       <entry><structfield>name</structfield></entry>
8023       <entry><type>name</type></entry>
8024       <entry>Extension name</entry>
8025      </row>
8026
8027      <row>
8028       <entry><structfield>version</structfield></entry>
8029       <entry><type>text</type></entry>
8030       <entry>Version name</entry>
8031      </row>
8032
8033      <row>
8034       <entry><structfield>installed</structfield></entry>
8035       <entry><type>bool</type></entry>
8036       <entry>True if this version of this extension is currently
8037        installed</entry>
8038      </row>
8039
8040      <row>
8041       <entry><structfield>superuser</structfield></entry>
8042       <entry><type>bool</type></entry>
8043       <entry>True if only superusers are allowed to install this extension</entry>
8044      </row>
8045
8046      <row>
8047       <entry><structfield>relocatable</structfield></entry>
8048       <entry><type>bool</type></entry>
8049       <entry>True if extension can be relocated to another schema</entry>
8050      </row>
8051
8052      <row>
8053       <entry><structfield>schema</structfield></entry>
8054       <entry><type>name</type></entry>
8055       <entry>Name of the schema that the extension must be installed into,
8056        or <literal>NULL</literal> if partially or fully relocatable</entry>
8057      </row>
8058
8059      <row>
8060       <entry><structfield>requires</structfield></entry>
8061       <entry><type>name[]</type></entry>
8062       <entry>Names of prerequisite extensions,
8063        or <literal>NULL</literal> if none</entry>
8064      </row>
8065
8066      <row>
8067       <entry><structfield>comment</structfield></entry>
8068       <entry><type>text</type></entry>
8069       <entry>Comment string from the extension's control file</entry>
8070      </row>
8071     </tbody>
8072    </tgroup>
8073   </table>
8074
8075   <para>
8076    The <structname>pg_available_extension_versions</structname> view is read
8077    only.
8078   </para>
8079  </sect1>
8080
8081  <sect1 id="view-pg-config">
8082   <title><structname>pg_config</structname></title>
8083
8084   <indexterm zone="view-pg-config">
8085    <primary>pg_config</primary>
8086   </indexterm>
8087
8088   <para>
8089    The view <structname>pg_config</structname> describes the
8090    compile-time configuration parameters of the currently installed
8091    version of <productname>PostgreSQL</>. It is intended, for example, to
8092    be used by software packages that want to interface to
8093    <productname>PostgreSQL</> to facilitate finding the required header
8094    files and libraries. It provides the same basic information as the
8095    <xref linkend="app-pgconfig"> <productname>PostgreSQL</> client
8096    application.
8097   </para>
8098
8099   <para>
8100    By default, the <structname>pg_config</structname> view can be read
8101    only by superusers.
8102   </para>
8103
8104   <table>
8105    <title><structname>pg_config</> Columns</title>
8106    <tgroup cols="3">
8107     <thead>
8108      <row>
8109       <entry>Name</entry>
8110       <entry>Type</entry>
8111       <entry>Description</entry>
8112      </row>
8113     </thead>
8114
8115     <tbody>
8116      <row>
8117       <entry><structfield>name</structfield></entry>
8118       <entry><type>text</type></entry>
8119       <entry>The parameter name</entry>
8120      </row>
8121
8122      <row>
8123       <entry><structfield>setting</structfield></entry>
8124       <entry><type>text</type></entry>
8125       <entry>The parameter value</entry>
8126      </row>
8127     </tbody>
8128    </tgroup>
8129   </table>
8130
8131  </sect1>
8132
8133  <sect1 id="view-pg-cursors">
8134   <title><structname>pg_cursors</structname></title>
8135
8136   <indexterm zone="view-pg-cursors">
8137    <primary>pg_cursors</primary>
8138   </indexterm>
8139
8140   <para>
8141    The <structname>pg_cursors</structname> view lists the cursors that
8142    are currently available. Cursors can be defined in several ways:
8143    <itemizedlist>
8144     <listitem>
8145      <para>
8146       via the <xref linkend="sql-declare">
8147       statement in SQL
8148      </para>
8149     </listitem>
8150
8151     <listitem>
8152      <para>
8153       via the Bind message in the frontend/backend protocol, as
8154       described in <xref linkend="protocol-flow-ext-query">
8155      </para>
8156     </listitem>
8157
8158     <listitem>
8159      <para>
8160       via the Server Programming Interface (SPI), as described in
8161       <xref linkend="spi-interface">
8162      </para>
8163     </listitem>
8164    </itemizedlist>
8165
8166    The <structname>pg_cursors</structname> view displays cursors
8167    created by any of these means. Cursors only exist for the duration
8168    of the transaction that defines them, unless they have been
8169    declared <literal>WITH HOLD</literal>. Therefore non-holdable
8170    cursors are only present in the view until the end of their
8171    creating transaction.
8172
8173    <note>
8174     <para>
8175      Cursors are used internally to implement some of the components
8176      of <productname>PostgreSQL</>, such as procedural languages.
8177      Therefore, the <structname>pg_cursors</> view might include cursors
8178      that have not been explicitly created by the user.
8179     </para>
8180    </note>
8181   </para>
8182
8183   <table>
8184    <title><structname>pg_cursors</> Columns</title>
8185
8186    <tgroup cols="3">
8187     <thead>
8188      <row>
8189       <entry>Name</entry>
8190       <entry>Type</entry>
8191       <entry>Description</entry>
8192      </row>
8193     </thead>
8194
8195     <tbody>
8196      <row>
8197       <entry><structfield>name</structfield></entry>
8198       <entry><type>text</type></entry>
8199       <entry>The name of the cursor</entry>
8200      </row>
8201
8202      <row>
8203       <entry><structfield>statement</structfield></entry>
8204       <entry><type>text</type></entry>
8205       <entry>The verbatim query string submitted to declare this cursor</entry>
8206      </row>
8207
8208      <row>
8209       <entry><structfield>is_holdable</structfield></entry>
8210       <entry><type>boolean</type></entry>
8211       <entry>
8212        <literal>true</literal> if the cursor is holdable (that is, it
8213        can be accessed after the transaction that declared the cursor
8214        has committed); <literal>false</literal> otherwise
8215        </entry>
8216      </row>
8217
8218      <row>
8219       <entry><structfield>is_binary</structfield></entry>
8220       <entry><type>boolean</type></entry>
8221       <entry>
8222        <literal>true</literal> if the cursor was declared
8223        <literal>BINARY</literal>; <literal>false</literal>
8224        otherwise
8225        </entry>
8226      </row>
8227
8228      <row>
8229       <entry><structfield>is_scrollable</structfield></entry>
8230       <entry><type>boolean</type></entry>
8231       <entry>
8232        <literal>true</> if the cursor is scrollable (that is, it
8233        allows rows to be retrieved in a nonsequential manner);
8234        <literal>false</literal> otherwise
8235        </entry>
8236      </row>
8237
8238      <row>
8239       <entry><structfield>creation_time</structfield></entry>
8240       <entry><type>timestamptz</type></entry>
8241       <entry>The time at which the cursor was declared</entry>
8242      </row>
8243     </tbody>
8244    </tgroup>
8245   </table>
8246
8247   <para>
8248    The <structname>pg_cursors</structname> view is read only.
8249   </para>
8250
8251  </sect1>
8252
8253  <sect1 id="view-pg-file-settings">
8254   <title><structname>pg_file_settings</structname></title>
8255
8256   <indexterm zone="view-pg-file-settings">
8257    <primary>pg_file_settings</primary>
8258   </indexterm>
8259
8260   <para>
8261    The view <structname>pg_file_settings</structname> provides a summary of
8262    the contents of the server's configuration file(s).  A row appears in
8263    this view for each <quote>name = value</> entry appearing in the files,
8264    with annotations indicating whether the value could be applied
8265    successfully.  Additional row(s) may appear for problems not linked to
8266    a <quote>name = value</> entry, such as syntax errors in the files.
8267   </para>
8268
8269   <para>
8270    This view is helpful for checking whether planned changes in the
8271    configuration files will work, or for diagnosing a previous failure.
8272    Note that this view reports on the <emphasis>current</> contents of the
8273    files, not on what was last applied by the server.  (The
8274    <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
8275    view is usually sufficient to determine that.)
8276   </para>
8277
8278   <para>
8279    By default, the <structname>pg_file_settings</structname> view can be read
8280    only by superusers.
8281   </para>
8282
8283   <table>
8284    <title><structname>pg_file_settings</> Columns</title>
8285
8286   <tgroup cols="3">
8287    <thead>
8288     <row>
8289      <entry>Name</entry>
8290      <entry>Type</entry>
8291      <entry>Description</entry>
8292     </row>
8293    </thead>
8294    <tbody>
8295     <row>
8296      <entry><structfield>sourcefile</structfield></entry>
8297      <entry><structfield>text</structfield></entry>
8298      <entry>Full path name of the configuration file</entry>
8299     </row>
8300     <row>
8301      <entry><structfield>sourceline</structfield></entry>
8302      <entry><structfield>integer</structfield></entry>
8303      <entry>
8304       Line number within the configuration file where the entry appears
8305      </entry>
8306     </row>
8307     <row>
8308      <entry><structfield>seqno</structfield></entry>
8309      <entry><structfield>integer</structfield></entry>
8310      <entry>Order in which the entries are processed (1..<replaceable>n</>)</entry>
8311     </row>
8312     <row>
8313      <entry><structfield>name</structfield></entry>
8314      <entry><structfield>text</structfield></entry>
8315      <entry>Configuration parameter name</entry>
8316     </row>
8317     <row>
8318      <entry><structfield>setting</structfield></entry>
8319      <entry><structfield>text</structfield></entry>
8320      <entry>Value to be assigned to the parameter</entry>
8321     </row>
8322     <row>
8323      <entry><structfield>applied</structfield></entry>
8324      <entry><structfield>boolean</structfield></entry>
8325      <entry>True if the value can be applied successfully</entry>
8326     </row>
8327     <row>
8328      <entry><structfield>error</structfield></entry>
8329      <entry><structfield>text</structfield></entry>
8330      <entry>If not null, an error message indicating why this entry could
8331       not be applied</entry>
8332     </row>
8333    </tbody>
8334   </tgroup>
8335   </table>
8336
8337   <para>
8338    If the configuration file contains syntax errors or invalid parameter
8339    names, the server will not attempt to apply any settings from it, and
8340    therefore all the <structfield>applied</> fields will read as false.
8341    In such a case there will be one or more rows with
8342    non-null <structfield>error</structfield> fields indicating the
8343    problem(s).  Otherwise, individual settings will be applied if possible.
8344    If an individual setting cannot be applied (e.g., invalid value, or the
8345    setting cannot be changed after server start) it will have an appropriate
8346    message in the <structfield>error</structfield> field.  Another way that
8347    an entry might have <structfield>applied</> = false is that it is
8348    overridden by a later entry for the same parameter name; this case is not
8349    considered an error so nothing appears in
8350    the <structfield>error</structfield> field.
8351   </para>
8352
8353   <para>
8354    See <xref linkend="config-setting"> for more information about the various
8355    ways to change run-time parameters.
8356   </para>
8357
8358 </sect1>
8359
8360  <sect1 id="view-pg-group">
8361   <title><structname>pg_group</structname></title>
8362
8363   <indexterm zone="view-pg-group">
8364    <primary>pg_group</primary>
8365   </indexterm>
8366
8367   <para>
8368    The view <structname>pg_group</structname> exists for backwards
8369    compatibility: it emulates a catalog that existed in
8370    <productname>PostgreSQL</productname> before version 8.1.
8371    It shows the names and members of all roles that are marked as not
8372    <structfield>rolcanlogin</>, which is an approximation to the set
8373    of roles that are being used as groups.
8374   </para>
8375
8376   <table>
8377    <title><structname>pg_group</> Columns</title>
8378
8379    <tgroup cols="4">
8380     <thead>
8381      <row>
8382       <entry>Name</entry>
8383       <entry>Type</entry>
8384       <entry>References</entry>
8385       <entry>Description</entry>
8386      </row>
8387     </thead>
8388
8389     <tbody>
8390      <row>
8391       <entry><structfield>groname</structfield></entry>
8392       <entry><type>name</type></entry>
8393       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8394       <entry>Name of the group</entry>
8395      </row>
8396
8397      <row>
8398       <entry><structfield>grosysid</structfield></entry>
8399       <entry><type>oid</type></entry>
8400       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8401       <entry>ID of this group</entry>
8402      </row>
8403
8404      <row>
8405       <entry><structfield>grolist</structfield></entry>
8406       <entry><type>oid[]</type></entry>
8407       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
8408       <entry>An array containing the IDs of the roles in this group</entry>
8409      </row>
8410     </tbody>
8411    </tgroup>
8412   </table>
8413
8414  </sect1>
8415
8416  <sect1 id="view-pg-hba-file-rules">
8417   <title><structname>pg_hba_file_rules</structname></title>
8418
8419   <indexterm zone="view-pg-hba-file-rules">
8420    <primary>pg_hba_file_rules</primary>
8421   </indexterm>
8422
8423   <para>
8424    The view <structname>pg_hba_file_rules</structname> provides a summary of
8425    the contents of the client authentication configuration
8426    file, <filename>pg_hba.conf</>.  A row appears in this view for each
8427    non-empty, non-comment line in the file, with annotations indicating
8428    whether the rule could be applied successfully.
8429   </para>
8430
8431   <para>
8432    This view can be helpful for checking whether planned changes in the
8433    authentication configuration file will work, or for diagnosing a previous
8434    failure.  Note that this view reports on the <emphasis>current</> contents
8435    of the file, not on what was last loaded by the server.
8436   </para>
8437
8438   <para>
8439    By default, the <structname>pg_hba_file_rules</structname> view can be read
8440    only by superusers.
8441   </para>
8442
8443   <table>
8444    <title><structname>pg_hba_file_rules</> Columns</title>
8445
8446   <tgroup cols="3">
8447    <thead>
8448     <row>
8449      <entry>Name</entry>
8450      <entry>Type</entry>
8451      <entry>Description</entry>
8452     </row>
8453    </thead>
8454    <tbody>
8455     <row>
8456      <entry><structfield>line_number</structfield></entry>
8457      <entry><structfield>integer</structfield></entry>
8458      <entry>
8459       Line number of this rule in <filename>pg_hba.conf</>
8460      </entry>
8461     </row>
8462     <row>
8463      <entry><structfield>type</structfield></entry>
8464      <entry><structfield>text</structfield></entry>
8465      <entry>Type of connection</entry>
8466     </row>
8467     <row>
8468      <entry><structfield>database</structfield></entry>
8469      <entry><structfield>text[]</structfield></entry>
8470      <entry>List of database name(s) to which this rule applies</entry>
8471     </row>
8472     <row>
8473      <entry><structfield>user_name</structfield></entry>
8474      <entry><structfield>text[]</structfield></entry>
8475      <entry>List of user and group name(s) to which this rule applies</entry>
8476     </row>
8477     <row>
8478      <entry><structfield>address</structfield></entry>
8479      <entry><structfield>text</structfield></entry>
8480      <entry>
8481       Host name or IP address, or one
8482       of <literal>all</literal>, <literal>samehost</literal>,
8483       or <literal>samenet</literal>, or null for local connections
8484      </entry>
8485     </row>
8486     <row>
8487      <entry><structfield>netmask</structfield></entry>
8488      <entry><structfield>text</structfield></entry>
8489      <entry>IP address mask, or null if not applicable</entry>
8490     </row>
8491     <row>
8492      <entry><structfield>auth_method</structfield></entry>
8493      <entry><type>text</type></entry>
8494      <entry>Authentication method</entry>
8495     </row>
8496     <row>
8497      <entry><structfield>options</structfield></entry>
8498      <entry><type>text[]</type></entry>
8499      <entry>Options specified for authentication method, if any</entry>
8500     </row>
8501     <row>
8502      <entry><structfield>error</structfield></entry>
8503      <entry><structfield>text</structfield></entry>
8504      <entry>
8505       If not null, an error message indicating why this
8506       line could not be processed
8507      </entry>
8508     </row>
8509    </tbody>
8510   </tgroup>
8511   </table>
8512
8513   <para>
8514    Usually, a row reflecting an incorrect entry will have values for only
8515    the <structfield>line_number</> and <structfield>error</> fields.
8516   </para>
8517
8518   <para>
8519    See <xref linkend="client-authentication"> for more information about
8520    client authentication configuration.
8521   </para>
8522  </sect1>
8523
8524  <sect1 id="view-pg-indexes">
8525   <title><structname>pg_indexes</structname></title>
8526
8527   <indexterm zone="view-pg-indexes">
8528    <primary>pg_indexes</primary>
8529   </indexterm>
8530
8531   <para>
8532    The view <structname>pg_indexes</structname> provides access to
8533    useful information about each index in the database.
8534   </para>
8535
8536   <table>
8537    <title><structname>pg_indexes</> Columns</title>
8538
8539    <tgroup cols="4">
8540     <thead>
8541      <row>
8542       <entry>Name</entry>
8543       <entry>Type</entry>
8544       <entry>References</entry>
8545       <entry>Description</entry>
8546      </row>
8547     </thead>
8548     <tbody>
8549      <row>
8550       <entry><structfield>schemaname</structfield></entry>
8551       <entry><type>name</type></entry>
8552       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8553       <entry>Name of schema containing table and index</entry>
8554      </row>
8555      <row>
8556       <entry><structfield>tablename</structfield></entry>
8557       <entry><type>name</type></entry>
8558       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8559       <entry>Name of table the index is for</entry>
8560      </row>
8561      <row>
8562       <entry><structfield>indexname</structfield></entry>
8563       <entry><type>name</type></entry>
8564       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8565       <entry>Name of index</entry>
8566      </row>
8567      <row>
8568       <entry><structfield>tablespace</structfield></entry>
8569       <entry><type>name</type></entry>
8570       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8571       <entry>Name of tablespace containing index (null if default for database)</entry>
8572      </row>
8573      <row>
8574       <entry><structfield>indexdef</structfield></entry>
8575       <entry><type>text</type></entry>
8576       <entry></entry>
8577       <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
8578       command)</entry>
8579      </row>
8580     </tbody>
8581    </tgroup>
8582   </table>
8583
8584  </sect1>
8585
8586  <sect1 id="view-pg-locks">
8587   <title><structname>pg_locks</structname></title>
8588
8589   <indexterm zone="view-pg-locks">
8590    <primary>pg_locks</primary>
8591   </indexterm>
8592
8593   <para>
8594    The view <structname>pg_locks</structname> provides access to
8595    information about the locks held by active processes within the
8596    database server.  See <xref linkend="mvcc"> for more discussion
8597    of locking.
8598   </para>
8599
8600   <para>
8601    <structname>pg_locks</structname> contains one row per active lockable
8602    object, requested lock mode, and relevant process.  Thus, the same
8603    lockable object might
8604    appear many times, if multiple processes are holding or waiting
8605    for locks on it.  However, an object that currently has no locks on it
8606    will not appear at all.
8607   </para>
8608
8609   <para>
8610    There are several distinct types of lockable objects:
8611    whole relations (e.g., tables), individual pages of relations,
8612    individual tuples of relations,
8613    transaction IDs (both virtual and permanent IDs),
8614    and general database objects (identified by class OID and object OID,
8615    in the same way as in <structname>pg_description</structname> or
8616    <structname>pg_depend</structname>).  Also, the right to extend a
8617    relation is represented as a separate lockable object.
8618    Also, <quote>advisory</> locks can be taken on numbers that have
8619    user-defined meanings.
8620   </para>
8621
8622   <table>
8623    <title><structname>pg_locks</> Columns</title>
8624
8625    <tgroup cols="4">
8626     <thead>
8627      <row>
8628       <entry>Name</entry>
8629       <entry>Type</entry>
8630       <entry>References</entry>
8631       <entry>Description</entry>
8632      </row>
8633     </thead>
8634     <tbody>
8635      <row>
8636       <entry><structfield>locktype</structfield></entry>
8637       <entry><type>text</type></entry>
8638       <entry></entry>
8639       <entry>
8640        Type of the lockable object:
8641        <literal>relation</>,
8642        <literal>extend</>,
8643        <literal>page</>,
8644        <literal>tuple</>,
8645        <literal>transactionid</>,
8646        <literal>virtualxid</>,
8647        <literal>object</>,
8648        <literal>userlock</>, or
8649        <literal>advisory</>
8650       </entry>
8651      </row>
8652      <row>
8653       <entry><structfield>database</structfield></entry>
8654       <entry><type>oid</type></entry>
8655       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
8656       <entry>
8657        OID of the database in which the lock target exists, or
8658        zero if the target is a shared object, or
8659        null if the target is a transaction ID
8660       </entry>
8661      </row>
8662      <row>
8663       <entry><structfield>relation</structfield></entry>
8664       <entry><type>oid</type></entry>
8665       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8666       <entry>
8667        OID of the relation targeted by the lock, or null if the target is not
8668        a relation or part of a relation
8669       </entry>
8670      </row>
8671      <row>
8672       <entry><structfield>page</structfield></entry>
8673       <entry><type>integer</type></entry>
8674       <entry></entry>
8675       <entry>
8676        Page number targeted by the lock within the relation,
8677        or null if the target is not a relation page or tuple
8678       </entry>
8679      </row>
8680      <row>
8681       <entry><structfield>tuple</structfield></entry>
8682       <entry><type>smallint</type></entry>
8683       <entry></entry>
8684       <entry>
8685        Tuple number targeted by the lock within the page,
8686        or null if the target is not a tuple
8687       </entry>
8688      </row>
8689      <row>
8690       <entry><structfield>virtualxid</structfield></entry>
8691       <entry><type>text</type></entry>
8692       <entry></entry>
8693       <entry>
8694        Virtual ID of the transaction targeted by the lock,
8695        or null if the target is not a virtual transaction ID
8696       </entry>
8697      </row>
8698      <row>
8699       <entry><structfield>transactionid</structfield></entry>
8700       <entry><type>xid</type></entry>
8701       <entry></entry>
8702       <entry>
8703        ID of the transaction targeted by the lock,
8704        or null if the target is not a transaction ID
8705       </entry>
8706      </row>
8707      <row>
8708       <entry><structfield>classid</structfield></entry>
8709       <entry><type>oid</type></entry>
8710       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
8711       <entry>
8712        OID of the system catalog containing the lock target, or null if the
8713        target is not a general database object
8714       </entry>
8715      </row>
8716      <row>
8717       <entry><structfield>objid</structfield></entry>
8718       <entry><type>oid</type></entry>
8719       <entry>any OID column</entry>
8720       <entry>
8721        OID of the lock target within its system catalog, or null if the
8722        target is not a general database object
8723       </entry>
8724      </row>
8725      <row>
8726       <entry><structfield>objsubid</structfield></entry>
8727       <entry><type>smallint</type></entry>
8728       <entry></entry>
8729       <entry>
8730        Column number targeted by the lock (the
8731        <structfield>classid</> and <structfield>objid</> refer to the
8732        table itself),
8733        or zero if the target is some other general database object,
8734        or null if the target is not a general database object
8735       </entry>
8736      </row>
8737      <row>
8738       <entry><structfield>virtualtransaction</structfield></entry>
8739       <entry><type>text</type></entry>
8740       <entry></entry>
8741       <entry>
8742        Virtual ID of the transaction that is holding or awaiting this lock
8743       </entry>
8744      </row>
8745      <row>
8746       <entry><structfield>pid</structfield></entry>
8747       <entry><type>integer</type></entry>
8748       <entry></entry>
8749       <entry>
8750        Process ID of the server process holding or awaiting this
8751        lock, or null if the lock is held by a prepared transaction
8752       </entry>
8753      </row>
8754      <row>
8755       <entry><structfield>mode</structfield></entry>
8756       <entry><type>text</type></entry>
8757       <entry></entry>
8758       <entry>Name of the lock mode held or desired by this process (see <xref
8759       linkend="locking-tables"> and <xref linkend="xact-serializable">)</entry>
8760      </row>
8761      <row>
8762       <entry><structfield>granted</structfield></entry>
8763       <entry><type>boolean</type></entry>
8764       <entry></entry>
8765       <entry>True if lock is held, false if lock is awaited</entry>
8766      </row>
8767      <row>
8768       <entry><structfield>fastpath</structfield></entry>
8769       <entry><type>boolean</type></entry>
8770       <entry></entry>
8771       <entry>True if lock was taken via fast path, false if taken via main
8772        lock table</entry>
8773      </row>
8774     </tbody>
8775    </tgroup>
8776   </table>
8777
8778   <para>
8779    <structfield>granted</structfield> is true in a row representing a lock
8780    held by the indicated process.  False indicates that this process is
8781    currently waiting to acquire this lock, which implies that at least one
8782    other process is holding or waiting for a conflicting lock mode on the same
8783    lockable object.  The waiting process will sleep until the other lock is
8784    released (or a deadlock situation is detected).  A single process can be
8785    waiting to acquire at most one lock at a time.
8786   </para>
8787
8788   <para>
8789    Throughout running a transaction, a server process holds an exclusive lock
8790    on the transaction's virtual transaction ID.  If a permanent ID is assigned
8791    to the transaction (which normally happens only if the transaction changes
8792    the state of the database), it also holds an exclusive lock on the
8793    transaction's permanent transaction ID until it ends.  When a process finds
8794    it necessary to wait specifically for another transaction to end, it does
8795    so by attempting to acquire share lock on the other transaction's ID
8796    (either virtual or permanent ID depending on the situation). That will
8797    succeed only when the other transaction terminates and releases its locks.
8798   </para>
8799
8800   <para>
8801    Although tuples are a lockable type of object,
8802    information about row-level locks is stored on disk, not in memory,
8803    and therefore row-level locks normally do not appear in this view.
8804    If a process is waiting for a
8805    row-level lock, it will usually appear in the view as waiting for the
8806    permanent transaction ID of the current holder of that row lock.
8807   </para>
8808
8809   <para>
8810    Advisory locks can be acquired on keys consisting of either a single
8811    <type>bigint</type> value or two integer values.
8812    A <type>bigint</type> key is displayed with its
8813    high-order half in the <structfield>classid</> column, its low-order half
8814    in the <structfield>objid</> column, and <structfield>objsubid</> equal
8815    to 1. The original <type>bigint</type> value can be reassembled with the
8816    expression <literal>(classid::bigint &lt;&lt; 32) |
8817    objid::bigint</literal>. Integer keys are displayed with the
8818    first key in the
8819    <structfield>classid</> column, the second key in the <structfield>objid</>
8820    column, and <structfield>objsubid</> equal to 2.  The actual meaning of
8821    the keys is up to the user.  Advisory locks are local to each database,
8822    so the <structfield>database</> column is meaningful for an advisory lock.
8823   </para>
8824
8825   <para>
8826    <structname>pg_locks</structname> provides a global view of all locks
8827    in the database cluster, not only those relevant to the current database.
8828    Although its <structfield>relation</structfield> column can be joined
8829    against <structname>pg_class</>.<structfield>oid</> to identify locked
8830    relations, this will only work correctly for relations in the current
8831    database (those for which the <structfield>database</structfield> column
8832    is either the current database's OID or zero).
8833   </para>
8834
8835   <para>
8836    The <structfield>pid</structfield> column can be joined to the
8837    <structfield>pid</structfield> column of the <link
8838    linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
8839    view to get more
8840    information on the session holding or awaiting each lock,
8841    for example
8842 <programlisting>
8843 SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
8844     ON pl.pid = psa.pid;
8845 </programlisting>
8846    Also, if you are using prepared transactions, the
8847    <structfield>virtualtransaction</> column can be joined to the
8848    <structfield>transaction</structfield> column of the <link
8849    linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
8850    view to get more information on prepared transactions that hold locks.
8851    (A prepared transaction can never be waiting for a lock,
8852    but it continues to hold the locks it acquired while running.)
8853    For example:
8854 <programlisting>
8855 SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
8856     ON pl.virtualtransaction = '-1/' || ppx.transaction;
8857 </programlisting>
8858   </para>
8859
8860   <para>
8861    While it is possible to obtain information about which processes block
8862    which other processes by joining <structname>pg_locks</structname> against
8863    itself, this is very difficult to get right in detail.  Such a query would
8864    have to encode knowledge about which lock modes conflict with which
8865    others.  Worse, the <structname>pg_locks</structname> view does not expose
8866    information about which processes are ahead of which others in lock wait
8867    queues, nor information about which processes are parallel workers running
8868    on behalf of which other client sessions.  It is better to use
8869    the <function>pg_blocking_pids()</> function
8870    (see <xref linkend="functions-info-session-table">) to identify which
8871    process(es) a waiting process is blocked behind.
8872   </para>
8873
8874   <para>
8875    The <structname>pg_locks</structname> view displays data from both the
8876    regular lock manager and the predicate lock manager, which are
8877    separate systems; in addition, the regular lock manager subdivides its
8878    locks into regular and <firstterm>fast-path</> locks.
8879    This data is not guaranteed to be entirely consistent.
8880    When the view is queried,
8881    data on fast-path locks (with <structfield>fastpath</> = <literal>true</>)
8882    is gathered from each backend one at a time, without freezing the state of
8883    the entire lock manager, so it is possible for locks to be taken or
8884    released while information is gathered.  Note, however, that these locks are
8885    known not to conflict with any other lock currently in place.  After
8886    all backends have been queried for fast-path locks, the remainder of the
8887    regular lock manager is locked as a unit, and a consistent snapshot of all
8888    remaining locks is collected as an atomic action.  After unlocking the
8889    regular lock manager, the predicate lock manager is similarly locked and all
8890    predicate locks are collected as an atomic action.  Thus, with the exception
8891    of fast-path locks, each lock manager will deliver a consistent set of
8892    results, but as we do not lock both lock managers simultaneously, it is
8893    possible for locks to be taken or released after we interrogate the regular
8894    lock manager and before we interrogate the predicate lock manager.
8895   </para>
8896
8897   <para>
8898    Locking the regular and/or predicate lock manager could have some
8899    impact on database performance if this view is very frequently accessed.
8900    The locks are held only for the minimum amount of time necessary to
8901    obtain data from the lock managers, but this does not completely eliminate
8902    the possibility of a performance impact.
8903   </para>
8904
8905  </sect1>
8906
8907  <sect1 id="view-pg-matviews">
8908   <title><structname>pg_matviews</structname></title>
8909
8910   <indexterm zone="view-pg-matviews">
8911    <primary>pg_matviews</primary>
8912   </indexterm>
8913
8914   <indexterm zone="view-pg-matviews">
8915    <primary>materialized views</primary>
8916   </indexterm>
8917
8918   <para>
8919    The view <structname>pg_matviews</structname> provides access to
8920    useful information about each materialized view in the database.
8921   </para>
8922
8923   <table>
8924    <title><structname>pg_matviews</> Columns</title>
8925
8926    <tgroup cols="4">
8927     <thead>
8928      <row>
8929       <entry>Name</entry>
8930       <entry>Type</entry>
8931       <entry>References</entry>
8932       <entry>Description</entry>
8933      </row>
8934     </thead>
8935     <tbody>
8936      <row>
8937       <entry><structfield>schemaname</structfield></entry>
8938       <entry><type>name</type></entry>
8939       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
8940       <entry>Name of schema containing materialized view</entry>
8941      </row>
8942      <row>
8943       <entry><structfield>matviewname</structfield></entry>
8944       <entry><type>name</type></entry>
8945       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
8946       <entry>Name of materialized view</entry>
8947      </row>
8948      <row>
8949       <entry><structfield>matviewowner</structfield></entry>
8950       <entry><type>name</type></entry>
8951       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
8952       <entry>Name of materialized view's owner</entry>
8953      </row>
8954      <row>
8955       <entry><structfield>tablespace</structfield></entry>
8956       <entry><type>name</type></entry>
8957       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
8958       <entry>Name of tablespace containing materialized view (null if default for database)</entry>
8959      </row>
8960      <row>
8961       <entry><structfield>hasindexes</structfield></entry>
8962       <entry><type>boolean</type></entry>
8963       <entry></entry>
8964       <entry>True if materialized view has (or recently had) any indexes</entry>
8965      </row>
8966      <row>
8967       <entry><structfield>ispopulated</structfield></entry>
8968       <entry><type>boolean</type></entry>
8969       <entry></entry>
8970       <entry>True if materialized view is currently populated</entry>
8971      </row>
8972      <row>
8973       <entry><structfield>definition</structfield></entry>
8974       <entry><type>text</type></entry>
8975       <entry></entry>
8976       <entry>Materialized view definition (a reconstructed <command>SELECT</command> query)</entry>
8977      </row>
8978     </tbody>
8979    </tgroup>
8980   </table>
8981
8982  </sect1>
8983
8984  <sect1 id="view-pg-policies">
8985   <title><structname>pg_policies</structname></title>
8986
8987   <indexterm zone="view-pg-policies">
8988    <primary>pg_policies</primary>
8989   </indexterm>
8990
8991   <para>
8992    The view <structname>pg_policies</structname> provides access to
8993    useful information about each row-level security policy in the database.
8994   </para>
8995
8996   <table>
8997    <title><structname>pg_policies</> Columns</title>
8998
8999    <tgroup cols="4">
9000     <thead>
9001      <row>
9002       <entry>Name</entry>
9003       <entry>Type</entry>
9004       <entry>References</entry>
9005       <entry>Description</entry>
9006      </row>
9007     </thead>
9008     <tbody>
9009      <row>
9010       <entry><structfield>schemaname</structfield></entry>
9011       <entry><type>name</type></entry>
9012       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9013       <entry>Name of schema containing table policy is on</entry>
9014      </row>
9015      <row>
9016       <entry><structfield>tablename</structfield></entry>
9017       <entry><type>name</type></entry>
9018       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9019       <entry>Name of table policy is on</entry>
9020      </row>
9021      <row>
9022       <entry><structfield>policyname</structfield></entry>
9023       <entry><type>name</type></entry>
9024       <entry><literal><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.polname</literal></entry>
9025       <entry>Name of policy</entry>
9026      </row>
9027      <row>
9028       <entry><structfield>polpermissive</structfield></entry>
9029       <entry><type>text</type></entry>
9030       <entry></entry>
9031       <entry>Is the policy permissive or restrictive?</entry>
9032      </row>
9033      <row>
9034       <entry><structfield>roles</structfield></entry>
9035       <entry><type>name[]</type></entry>
9036       <entry></entry>
9037       <entry>The roles to which this policy applies</entry>
9038      </row>
9039      <row>
9040       <entry><structfield>cmd</structfield></entry>
9041       <entry><type>text</type></entry>
9042       <entry></entry>
9043       <entry>The command type to which the policy is applied</entry>
9044      </row>
9045      <row>
9046       <entry><structfield>qual</structfield></entry>
9047       <entry><type>text</type></entry>
9048       <entry></entry>
9049       <entry>The expression added to the security barrier qualifications for
9050       queries that this policy applies to</entry>
9051      </row>
9052      <row>
9053       <entry><structfield>with_check</structfield></entry>
9054       <entry><type>text</type></entry>
9055       <entry></entry>
9056       <entry>The expression added to the WITH CHECK qualifications for
9057       queries that attempt to add rows to this table</entry>
9058      </row>
9059     </tbody>
9060    </tgroup>
9061   </table>
9062
9063  </sect1>
9064
9065  <sect1 id="view-pg-prepared-statements">
9066   <title><structname>pg_prepared_statements</structname></title>
9067
9068   <indexterm zone="view-pg-prepared-statements">
9069    <primary>pg_prepared_statements</primary>
9070   </indexterm>
9071
9072   <para>
9073    The <structname>pg_prepared_statements</structname> view displays
9074    all the prepared statements that are available in the current
9075    session. See <xref linkend="sql-prepare"> for more information about prepared
9076    statements.
9077   </para>
9078
9079   <para>
9080    <structname>pg_prepared_statements</structname> contains one row
9081    for each prepared statement. Rows are added to the view when a new
9082    prepared statement is created and removed when a prepared statement
9083    is released (for example, via the <xref linkend="sql-deallocate"> command).
9084   </para>
9085
9086   <table>
9087    <title><structname>pg_prepared_statements</> Columns</title>
9088
9089    <tgroup cols="3">
9090     <thead>
9091      <row>
9092       <entry>Name</entry>
9093       <entry>Type</entry>
9094       <entry>Description</entry>
9095      </row>
9096     </thead>
9097     <tbody>
9098      <row>
9099       <entry><structfield>name</structfield></entry>
9100       <entry><type>text</type></entry>
9101       <entry>
9102        The identifier of the prepared statement
9103       </entry>
9104      </row>
9105      <row>
9106       <entry><structfield>statement</structfield></entry>
9107       <entry><type>text</type></entry>
9108       <entry>
9109        The query string submitted by the client to create this
9110        prepared statement. For prepared statements created via SQL,
9111        this is the <command>PREPARE</command> statement submitted by
9112        the client. For prepared statements created via the
9113        frontend/backend protocol, this is the text of the prepared
9114        statement itself.
9115       </entry>
9116      </row>
9117      <row>
9118       <entry><structfield>prepare_time</structfield></entry>
9119       <entry><type>timestamptz</type></entry>
9120       <entry>
9121        The time at which the prepared statement was created
9122       </entry>
9123      </row>
9124      <row>
9125       <entry><structfield>parameter_types</structfield></entry>
9126       <entry><type>regtype[]</type></entry>
9127       <entry>
9128        The expected parameter types for the prepared statement in the
9129        form of an array of <type>regtype</type>. The OID corresponding
9130        to an element of this array can be obtained by casting the
9131        <type>regtype</type> value to <type>oid</type>.
9132       </entry>
9133      </row>
9134      <row>
9135       <entry><structfield>from_sql</structfield></entry>
9136       <entry><type>boolean</type></entry>
9137       <entry>
9138        <literal>true</literal> if the prepared statement was created
9139        via the <command>PREPARE</command> SQL command;
9140        <literal>false</literal> if the statement was prepared via the
9141        frontend/backend protocol
9142       </entry>
9143      </row>
9144     </tbody>
9145    </tgroup>
9146   </table>
9147
9148   <para>
9149    The <structname>pg_prepared_statements</structname> view is read only.
9150   </para>
9151  </sect1>
9152
9153  <sect1 id="view-pg-prepared-xacts">
9154   <title><structname>pg_prepared_xacts</structname></title>
9155
9156   <indexterm zone="view-pg-prepared-xacts">
9157    <primary>pg_prepared_xacts</primary>
9158   </indexterm>
9159
9160   <para>
9161    The view <structname>pg_prepared_xacts</structname> displays
9162    information about transactions that are currently prepared for two-phase
9163    commit (see <xref linkend="sql-prepare-transaction"> for details).
9164   </para>
9165
9166   <para>
9167    <structname>pg_prepared_xacts</structname> contains one row per prepared
9168    transaction.  An entry is removed when the transaction is committed or
9169    rolled back.
9170   </para>
9171
9172   <table>
9173    <title><structname>pg_prepared_xacts</> Columns</title>
9174
9175    <tgroup cols="4">
9176     <thead>
9177      <row>
9178       <entry>Name</entry>
9179       <entry>Type</entry>
9180       <entry>References</entry>
9181       <entry>Description</entry>
9182      </row>
9183     </thead>
9184     <tbody>
9185      <row>
9186       <entry><structfield>transaction</structfield></entry>
9187       <entry><type>xid</type></entry>
9188       <entry></entry>
9189       <entry>
9190        Numeric transaction identifier of the prepared transaction
9191       </entry>
9192      </row>
9193      <row>
9194       <entry><structfield>gid</structfield></entry>
9195       <entry><type>text</type></entry>
9196       <entry></entry>
9197       <entry>
9198        Global transaction identifier that was assigned to the transaction
9199       </entry>
9200      </row>
9201      <row>
9202       <entry><structfield>prepared</structfield></entry>
9203       <entry><type>timestamp with time zone</type></entry>
9204       <entry></entry>
9205       <entry>
9206        Time at which the transaction was prepared for commit
9207       </entry>
9208      </row>
9209      <row>
9210       <entry><structfield>owner</structfield></entry>
9211       <entry><type>name</type></entry>
9212       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9213       <entry>
9214        Name of the user that executed the transaction
9215       </entry>
9216      </row>
9217      <row>
9218       <entry><structfield>database</structfield></entry>
9219       <entry><type>name</type></entry>
9220       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9221       <entry>
9222        Name of the database in which the transaction was executed
9223       </entry>
9224      </row>
9225     </tbody>
9226    </tgroup>
9227   </table>
9228
9229   <para>
9230    When the <structname>pg_prepared_xacts</structname> view is accessed, the
9231    internal transaction manager data structures are momentarily locked, and
9232    a copy is made for the view to display.  This ensures that the
9233    view produces a consistent set of results, while not blocking
9234    normal operations longer than necessary.  Nonetheless
9235    there could be some impact on database performance if this view is
9236    frequently accessed.
9237   </para>
9238
9239  </sect1>
9240
9241  <sect1 id="view-pg-publication-tables">
9242   <title><structname>pg_publication_tables</structname></title>
9243
9244   <indexterm zone="view-pg-publication-tables">
9245    <primary>pg_publication_tables</primary>
9246   </indexterm>
9247
9248   <para>
9249    The view <structname>pg_publication_tables</structname> provides
9250    information about the mapping between publications and the tables they
9251    contain.  Unlike the underlying
9252    catalog <structname>pg_publication_rel</structname>, this view expands
9253    publications defined as <literal>FOR ALL TABLES</literal>, so for such
9254    publications there will be a row for each eligible table.
9255   </para>
9256
9257   <table>
9258    <title><structname>pg_publication_tables</structname> Columns</title>
9259
9260    <tgroup cols="4">
9261     <thead>
9262      <row>
9263       <entry>Name</entry>
9264       <entry>Type</entry>
9265       <entry>References</entry>
9266       <entry>Description</entry>
9267      </row>
9268     </thead>
9269
9270     <tbody>
9271      <row>
9272       <entry><structfield>pubname</structfield></entry>
9273       <entry><type>name</type></entry>
9274       <entry><literal><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.pubname</literal></entry>
9275       <entry>Name of publication</entry>
9276      </row>
9277
9278      <row>
9279       <entry><structfield>schemaname</structfield></entry>
9280       <entry><type>name</type></entry>
9281       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9282       <entry>Name of schema containing table</entry>
9283      </row>
9284
9285      <row>
9286       <entry><structfield>tablename</structfield></entry>
9287       <entry><type>name</type></entry>
9288       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9289       <entry>Name of table</entry>
9290      </row>
9291     </tbody>
9292    </tgroup>
9293   </table>
9294  </sect1>
9295
9296   <sect1 id="view-pg-replication-origin-status">
9297   <title><structname>pg_replication_origin_status</structname></title>
9298
9299   <indexterm zone="view-pg-replication-origin-status">
9300    <primary>pg_replication_origin_status</primary>
9301   </indexterm>
9302
9303   <para>
9304    The <structname>pg_replication_origin_status</structname> view
9305    contains information about how far replay for a certain origin has
9306    progressed.  For more on replication origins
9307    see <xref linkend="replication-origins">.
9308   </para>
9309
9310   <table>
9311
9312    <title><structname>pg_replication_origin_status</structname> Columns</title>
9313
9314    <tgroup cols="4">
9315     <thead>
9316      <row>
9317       <entry>Name</entry>
9318       <entry>Type</entry>
9319       <entry>References</entry>
9320       <entry>Description</entry>
9321      </row>
9322     </thead>
9323
9324     <tbody>
9325      <row>
9326       <entry><structfield>local_id</structfield></entry>
9327       <entry><type>Oid</type></entry>
9328       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roident</literal></entry>
9329       <entry>internal node identifier</entry>
9330      </row>
9331
9332      <row>
9333       <entry><structfield>external_id</structfield></entry>
9334       <entry><type>text</type></entry>
9335       <entry><literal><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.roname</literal></entry>
9336       <entry>external node identifier</entry>
9337      </row>
9338
9339      <row>
9340       <entry><structfield>remote_lsn</structfield></entry>
9341       <entry><type>pg_lsn</type></entry>
9342       <entry></entry>
9343       <entry>The origin node's LSN up to which data has been replicated.</entry>
9344      </row>
9345
9346      <row>
9347       <entry><structfield>local_lsn</structfield></entry>
9348       <entry><type>pg_lsn</type></entry>
9349       <entry></entry>
9350       <entry>
9351        This node's LSN at which <literal>remote_lsn</literal> has
9352        been replicated. Used to flush commit records before persisting
9353        data to disk when using asynchronous commits.
9354       </entry>
9355      </row>
9356     </tbody>
9357    </tgroup>
9358   </table>
9359  </sect1>
9360
9361  <sect1 id="view-pg-replication-slots">
9362   <title><structname>pg_replication_slots</structname></title>
9363
9364   <indexterm zone="view-pg-replication-slots">
9365    <primary>pg_replication_slots</primary>
9366   </indexterm>
9367
9368   <para>
9369    The <structname>pg_replication_slots</structname> view provides a listing
9370    of all replication slots that currently exist on the database cluster,
9371    along with their current state.
9372   </para>
9373
9374   <para>
9375    For more on replication slots,
9376    see <xref linkend="streaming-replication-slots"> and <xref linkend="logicaldecoding">.
9377   </para>
9378
9379   <table>
9380
9381    <title><structname>pg_replication_slots</structname> Columns</title>
9382
9383    <tgroup cols="4">
9384     <thead>
9385      <row>
9386       <entry>Name</entry>
9387       <entry>Type</entry>
9388       <entry>References</entry>
9389       <entry>Description</entry>
9390      </row>
9391     </thead>
9392
9393     <tbody>
9394      <row>
9395       <entry><structfield>slot_name</structfield></entry>
9396       <entry><type>name</type></entry>
9397       <entry></entry>
9398       <entry>A unique, cluster-wide identifier for the replication slot</entry>
9399      </row>
9400
9401      <row>
9402       <entry><structfield>plugin</structfield></entry>
9403       <entry><type>name</type></entry>
9404       <entry></entry>
9405       <entry>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</entry>
9406      </row>
9407
9408      <row>
9409       <entry><structfield>slot_type</structfield></entry>
9410       <entry><type>text</type></entry>
9411       <entry></entry>
9412       <entry>The slot type - <literal>physical</> or <literal>logical</></entry>
9413      </row>
9414
9415      <row>
9416       <entry><structfield>datoid</structfield></entry>
9417       <entry><type>oid</type></entry>
9418       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
9419       <entry>The OID of the database this slot is associated with, or
9420       null. Only logical slots have an associated database.</entry>
9421      </row>
9422
9423      <row>
9424       <entry><structfield>database</structfield></entry>
9425       <entry><type>text</type></entry>
9426       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
9427       <entry>The name of the database this slot is associated with, or
9428       null. Only logical slots have an associated database.</entry>
9429      </row>
9430
9431      <row>
9432       <entry><structfield>temporary</structfield></entry>
9433       <entry><type>boolean</type></entry>
9434       <entry></entry>
9435       <entry>True if this is a temporary replication slot. Temporary slots are
9436       not saved to disk and are automatically dropped on error or when
9437       the session has finished.</entry>
9438      </row>
9439
9440      <row>
9441       <entry><structfield>active</structfield></entry>
9442       <entry><type>boolean</type></entry>
9443       <entry></entry>
9444       <entry>True if this slot is currently actively being used</entry>
9445      </row>
9446
9447      <row>
9448       <entry><structfield>active_pid</structfield></entry>
9449       <entry><type>integer</type></entry>
9450       <entry></entry>
9451       <entry>The process ID of the session using this slot if the slot
9452        is currently actively being used. <literal>NULL</literal> if
9453        inactive.
9454       </entry>
9455      </row>
9456
9457      <row>
9458       <entry><structfield>xmin</structfield></entry>
9459       <entry><type>xid</type></entry>
9460       <entry></entry>
9461       <entry>The oldest transaction that this slot needs the database to
9462       retain.  <literal>VACUUM</literal> cannot remove tuples deleted
9463       by any later transaction.
9464       </entry>
9465      </row>
9466
9467      <row>
9468       <entry><structfield>catalog_xmin</structfield></entry>
9469       <entry><type>xid</type></entry>
9470       <entry></entry>
9471       <entry>The oldest transaction affecting the system catalogs that this
9472       slot needs the database to retain.  <literal>VACUUM</literal> cannot
9473       remove catalog tuples deleted by any later transaction.
9474       </entry>
9475      </row>
9476
9477      <row>
9478       <entry><structfield>restart_lsn</structfield></entry>
9479       <entry><type>pg_lsn</type></entry>
9480       <entry></entry>
9481       <entry>The address (<literal>LSN</literal>) of oldest WAL which still
9482       might be required by the consumer of this slot and thus won't be
9483       automatically removed during checkpoints.
9484       </entry>
9485      </row>
9486
9487      <row>
9488       <entry><structfield>confirmed_flush_lsn</structfield></entry>
9489       <entry><type>pg_lsn</type></entry>
9490       <entry></entry>
9491       <entry>The address (<literal>LSN</literal>) up to which the logical
9492       slot's consumer has confirmed receiving data. Data older than this is
9493       not available anymore. <literal>NULL</> for physical slots.
9494       </entry>
9495      </row>
9496
9497     </tbody>
9498    </tgroup>
9499   </table>
9500  </sect1>
9501
9502  <sect1 id="view-pg-roles">
9503   <title><structname>pg_roles</structname></title>
9504
9505   <indexterm zone="view-pg-roles">
9506    <primary>pg_roles</primary>
9507   </indexterm>
9508
9509   <para>
9510    The view <structname>pg_roles</structname> provides access to
9511    information about database roles.  This is simply a publicly
9512    readable view of
9513    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
9514    that blanks out the password field.
9515   </para>
9516
9517   <para>
9518    This view explicitly exposes the OID column of the underlying table,
9519    since that is needed to do joins to other catalogs.
9520   </para>
9521
9522   <table>
9523    <title><structname>pg_roles</> Columns</title>
9524
9525    <tgroup cols="4">
9526     <thead>
9527      <row>
9528       <entry>Name</entry>
9529       <entry>Type</entry>
9530       <entry>References</entry>
9531       <entry>Description</entry>
9532      </row>
9533     </thead>
9534
9535     <tbody>
9536      <row>
9537       <entry><structfield>rolname</structfield></entry>
9538       <entry><type>name</type></entry>
9539       <entry></entry>
9540       <entry>Role name</entry>
9541      </row>
9542
9543      <row>
9544       <entry><structfield>rolsuper</structfield></entry>
9545       <entry><type>bool</type></entry>
9546       <entry></entry>
9547       <entry>Role has superuser privileges</entry>
9548      </row>
9549
9550      <row>
9551       <entry><structfield>rolinherit</structfield></entry>
9552       <entry><type>bool</type></entry>
9553       <entry></entry>
9554       <entry>Role automatically inherits privileges of roles it is a
9555        member of</entry>
9556      </row>
9557
9558      <row>
9559       <entry><structfield>rolcreaterole</structfield></entry>
9560       <entry><type>bool</type></entry>
9561       <entry></entry>
9562       <entry>Role can create more roles</entry>
9563      </row>
9564
9565      <row>
9566       <entry><structfield>rolcreatedb</structfield></entry>
9567       <entry><type>bool</type></entry>
9568       <entry></entry>
9569       <entry>Role can create databases</entry>
9570      </row>
9571
9572      <row>
9573       <entry><structfield>rolcanlogin</structfield></entry>
9574       <entry><type>bool</type></entry>
9575       <entry></entry>
9576       <entry>
9577        Role can log in. That is, this role can be given as the initial
9578        session authorization identifier
9579       </entry>
9580      </row>
9581
9582      <row>
9583       <entry><structfield>rolreplication</structfield></entry>
9584       <entry><type>bool</type></entry>
9585       <entry></entry>
9586       <entry>
9587        Role is a replication role. That is, this role can initiate streaming
9588        replication (see <xref linkend="streaming-replication">) and set/unset
9589        the system backup mode using <function>pg_start_backup</> and
9590        <function>pg_stop_backup</>
9591       </entry>
9592      </row>
9593
9594      <row>
9595       <entry><structfield>rolconnlimit</structfield></entry>
9596       <entry><type>int4</type></entry>
9597       <entry></entry>
9598       <entry>
9599        For roles that can log in, this sets maximum number of concurrent
9600        connections this role can make.  -1 means no limit.
9601       </entry>
9602      </row>
9603
9604      <row>
9605       <entry><structfield>rolpassword</structfield></entry>
9606       <entry><type>text</type></entry>
9607       <entry></entry>
9608       <entry>Not the password (always reads as <literal>********</>)</entry>
9609      </row>
9610
9611      <row>
9612       <entry><structfield>rolvaliduntil</structfield></entry>
9613       <entry><type>timestamptz</type></entry>
9614       <entry></entry>
9615       <entry>Password expiry time (only used for password authentication);
9616        null if no expiration</entry>
9617      </row>
9618
9619      <row>
9620       <entry><structfield>rolbypassrls</structfield></entry>
9621       <entry><type>bool</type></entry>
9622       <entry></entry>
9623       <entry>
9624        Role bypasses every row level security policy, see
9625        <xref linkend="ddl-rowsecurity"> for more information.
9626       </entry>
9627      </row>
9628
9629      <row>
9630       <entry><structfield>rolconfig</structfield></entry>
9631       <entry><type>text[]</type></entry>
9632       <entry></entry>
9633       <entry>Role-specific defaults for run-time configuration variables</entry>
9634      </row>
9635
9636      <row>
9637       <entry><structfield>oid</structfield></entry>
9638       <entry><type>oid</type></entry>
9639       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
9640       <entry>ID of role</entry>
9641      </row>
9642     </tbody>
9643    </tgroup>
9644   </table>
9645
9646  </sect1>
9647
9648  <sect1 id="view-pg-rules">
9649   <title><structname>pg_rules</structname></title>
9650
9651   <indexterm zone="view-pg-rules">
9652    <primary>pg_rules</primary>
9653   </indexterm>
9654
9655   <para>
9656    The view <structname>pg_rules</structname> provides access to
9657    useful information about query rewrite rules.
9658   </para>
9659
9660   <table>
9661    <title><structname>pg_rules</> Columns</title>
9662
9663    <tgroup cols="4">
9664     <thead>
9665      <row>
9666       <entry>Name</entry>
9667       <entry>Type</entry>
9668       <entry>References</entry>
9669       <entry>Description</entry>
9670      </row>
9671     </thead>
9672     <tbody>
9673      <row>
9674       <entry><structfield>schemaname</structfield></entry>
9675       <entry><type>name</type></entry>
9676       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9677       <entry>Name of schema containing table</entry>
9678      </row>
9679      <row>
9680       <entry><structfield>tablename</structfield></entry>
9681       <entry><type>name</type></entry>
9682       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9683       <entry>Name of table the rule is for</entry>
9684      </row>
9685      <row>
9686       <entry><structfield>rulename</structfield></entry>
9687       <entry><type>name</type></entry>
9688       <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
9689       <entry>Name of rule</entry>
9690      </row>
9691      <row>
9692       <entry><structfield>definition</structfield></entry>
9693       <entry><type>text</type></entry>
9694       <entry></entry>
9695       <entry>Rule definition (a reconstructed creation command)</entry>
9696      </row>
9697     </tbody>
9698    </tgroup>
9699   </table>
9700
9701   <para>
9702    The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
9703    of views and materialized views; those can be seen in
9704    <structname>pg_views</> and <structname>pg_matviews</>.
9705   </para>
9706
9707  </sect1>
9708
9709  <sect1 id="view-pg-seclabels">
9710   <title><structname>pg_seclabels</structname></title>
9711
9712   <indexterm zone="view-pg-seclabels">
9713    <primary>pg_seclabels</primary>
9714   </indexterm>
9715
9716   <para>
9717    The view <structname>pg_seclabels</structname> provides information about
9718    security labels.  It as an easier-to-query version of the
9719    <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</></> catalog.
9720   </para>
9721
9722   <table>
9723    <title><structname>pg_seclabels</> Columns</title>
9724
9725    <tgroup cols="4">
9726     <thead>
9727      <row>
9728       <entry>Name</entry>
9729       <entry>Type</entry>
9730       <entry>References</entry>
9731       <entry>Description</entry>
9732      </row>
9733     </thead>
9734     <tbody>
9735      <row>
9736       <entry><structfield>objoid</structfield></entry>
9737       <entry><type>oid</type></entry>
9738       <entry>any OID column</entry>
9739       <entry>The OID of the object this security label pertains to</entry>
9740      </row>
9741      <row>
9742       <entry><structfield>classoid</structfield></entry>
9743       <entry><type>oid</type></entry>
9744       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
9745       <entry>The OID of the system catalog this object appears in</entry>
9746      </row>
9747      <row>
9748       <entry><structfield>objsubid</structfield></entry>
9749       <entry><type>int4</type></entry>
9750       <entry></entry>
9751       <entry>
9752        For a security label on a table column, this is the column number (the
9753        <structfield>objoid</> and <structfield>classoid</> refer to
9754        the table itself).  For all other object types, this column is
9755        zero.
9756       </entry>
9757      </row>
9758      <row>
9759       <entry><structfield>objtype</structfield></entry>
9760       <entry><type>text</type></entry>
9761       <entry></entry>
9762       <entry>
9763          The type of object to which this label applies, as text.
9764       </entry>
9765      </row>
9766      <row>
9767       <entry><structfield>objnamespace</structfield></entry>
9768       <entry><type>oid</type></entry>
9769       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
9770       <entry>
9771        The OID of the namespace for this object, if applicable;
9772        otherwise NULL.
9773       </entry>
9774      </row>
9775      <row>
9776       <entry><structfield>objname</structfield></entry>
9777       <entry><type>text</type></entry>
9778       <entry></entry>
9779       <entry>
9780        The name of the object to which this label applies, as text.
9781       </entry>
9782      </row>
9783      <row>
9784       <entry><structfield>provider</structfield></entry>
9785       <entry><type>text</type></entry>
9786       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.provider</literal></entry>
9787       <entry>The label provider associated with this label.</entry>
9788      </row>
9789      <row>
9790       <entry><structfield>label</structfield></entry>
9791       <entry><type>text</type></entry>
9792       <entry><literal><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.label</literal></entry>
9793       <entry>The security label applied to this object.</entry>
9794      </row>
9795     </tbody>
9796    </tgroup>
9797   </table>
9798  </sect1>
9799
9800  <sect1 id="view-pg-sequences">
9801   <title><structname>pg_sequences</structname></title>
9802
9803   <indexterm zone="view-pg-sequences">
9804    <primary>pg_sequences</primary>
9805   </indexterm>
9806
9807   <para>
9808    The view <structname>pg_sequences</structname> provides access to
9809    useful information about each sequence in the database.
9810   </para>
9811
9812   <table>
9813    <title><structname>pg_sequences</> Columns</title>
9814
9815    <tgroup cols="4">
9816     <thead>
9817      <row>
9818       <entry>Name</entry>
9819       <entry>Type</entry>
9820       <entry>References</entry>
9821       <entry>Description</entry>
9822      </row>
9823     </thead>
9824     <tbody>
9825      <row>
9826       <entry><structfield>schemaname</structfield></entry>
9827       <entry><type>name</type></entry>
9828       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
9829       <entry>Name of schema containing sequence</entry>
9830      </row>
9831      <row>
9832       <entry><structfield>sequencename</structfield></entry>
9833       <entry><type>name</type></entry>
9834       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
9835       <entry>Name of sequence</entry>
9836      </row>
9837      <row>
9838       <entry><structfield>sequenceowner</structfield></entry>
9839       <entry><type>name</type></entry>
9840       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
9841       <entry>Name of sequence's owner</entry>
9842      </row>
9843      <row>
9844       <entry><structfield>start_value</structfield></entry>
9845       <entry><type>bigint</type></entry>
9846       <entry></entry>
9847       <entry>Start value of the sequence</entry>
9848      </row>
9849      <row>
9850       <entry><structfield>min_value</structfield></entry>
9851       <entry><type>bigint</type></entry>
9852       <entry></entry>
9853       <entry>Minimum value of the sequence</entry>
9854      </row>
9855      <row>
9856       <entry><structfield>max_value</structfield></entry>
9857       <entry><type>bigint</type></entry>
9858       <entry></entry>
9859       <entry>Maximum value of the sequence</entry>
9860      </row>
9861      <row>
9862       <entry><structfield>increment_by</structfield></entry>
9863       <entry><type>bigint</type></entry>
9864       <entry></entry>
9865       <entry>Increment value of the sequence</entry>
9866      </row>
9867      <row>
9868       <entry><structfield>cycle</structfield></entry>
9869       <entry><type>boolean</type></entry>
9870       <entry></entry>
9871       <entry>Whether the sequence cycles</entry>
9872      </row>
9873      <row>
9874       <entry><structfield>cache_size</structfield></entry>
9875       <entry><type>bigint</type></entry>
9876       <entry></entry>
9877       <entry>Cache size of the sequence</entry>
9878      </row>
9879      <row>
9880       <entry><structfield>last_value</structfield></entry>
9881       <entry><type>bigint</type></entry>
9882       <entry></entry>
9883       <entry>The last sequence value written to disk.  If caching is used,
9884        this value can be greater than the last value handed out from the
9885        sequence.  Null if the sequence has not been read from yet.</entry>
9886      </row>
9887     </tbody>
9888    </tgroup>
9889   </table>
9890  </sect1>
9891
9892  <sect1 id="view-pg-settings">
9893   <title><structname>pg_settings</structname></title>
9894
9895   <indexterm zone="view-pg-settings">
9896    <primary>pg_settings</primary>
9897   </indexterm>
9898
9899   <para>
9900    The view <structname>pg_settings</structname> provides access to
9901    run-time parameters of the server.  It is essentially an alternative
9902    interface to the <xref linkend="sql-show">
9903    and <xref linkend="sql-set"> commands.
9904    It also provides access to some facts about each parameter that are
9905    not directly available from <command>SHOW</>, such as minimum and
9906    maximum values.
9907   </para>
9908
9909   <table>
9910    <title><structname>pg_settings</> Columns</title>
9911
9912    <tgroup cols="3">
9913     <thead>
9914      <row>
9915       <entry>Name</entry>
9916       <entry>Type</entry>
9917       <entry>Description</entry>
9918      </row>
9919     </thead>
9920     <tbody>
9921      <row>
9922       <entry><structfield>name</structfield></entry>
9923       <entry><type>text</type></entry>
9924       <entry>Run-time configuration parameter name</entry>
9925      </row>
9926      <row>
9927       <entry><structfield>setting</structfield></entry>
9928       <entry><type>text</type></entry>
9929       <entry>Current value of the parameter</entry>
9930      </row>
9931      <row>
9932       <entry><structfield>unit</structfield></entry>
9933       <entry><type>text</type></entry>
9934       <entry>Implicit unit of the parameter</entry>
9935      </row>
9936      <row>
9937       <entry><structfield>category</structfield></entry>
9938       <entry><type>text</type></entry>
9939       <entry>Logical group of the parameter</entry>
9940      </row>
9941      <row>
9942       <entry><structfield>short_desc</structfield></entry>
9943       <entry><type>text</type></entry>
9944       <entry>A brief description of the parameter</entry>
9945      </row>
9946      <row>
9947       <entry><structfield>extra_desc</structfield></entry>
9948       <entry><type>text</type></entry>
9949       <entry>Additional, more detailed, description of the parameter</entry>
9950      </row>
9951      <row>
9952       <entry><structfield>context</structfield></entry>
9953       <entry><type>text</type></entry>
9954       <entry>Context required to set the parameter's value (see below)</entry>
9955      </row>
9956      <row>
9957       <entry><structfield>vartype</structfield></entry>
9958       <entry><type>text</type></entry>
9959       <entry>Parameter type (<literal>bool</>, <literal>enum</>,
9960        <literal>integer</>, <literal>real</>, or <literal>string</>)
9961       </entry>
9962      </row>
9963      <row>
9964       <entry><structfield>source</structfield></entry>
9965       <entry><type>text</type></entry>
9966       <entry>Source of the current parameter value</entry>
9967      </row>
9968      <row>
9969       <entry><structfield>min_val</structfield></entry>
9970       <entry><type>text</type></entry>
9971       <entry>Minimum allowed value of the parameter (null for non-numeric
9972       values)</entry>
9973      </row>
9974      <row>
9975       <entry><structfield>max_val</structfield></entry>
9976       <entry><type>text</type></entry>
9977       <entry>Maximum allowed value of the parameter (null for non-numeric
9978       values)</entry>
9979      </row>
9980      <row>
9981       <entry><structfield>enumvals</structfield></entry>
9982       <entry><type>text[]</type></entry>
9983       <entry>Allowed values of an enum parameter (null for non-enum
9984       values)</entry>
9985      </row>
9986      <row>
9987       <entry><structfield>boot_val</structfield></entry>
9988       <entry><type>text</type></entry>
9989       <entry>Parameter value assumed at server startup if the parameter is
9990       not otherwise set</entry>
9991      </row>
9992      <row>
9993       <entry><structfield>reset_val</structfield></entry>
9994       <entry><type>text</type></entry>
9995       <entry>Value that <command>RESET</command> would reset the parameter to
9996       in the current session</entry>
9997      </row>
9998      <row>
9999       <entry><structfield>sourcefile</structfield></entry>
10000       <entry><type>text</type></entry>
10001       <entry>Configuration file the current value was set in (null for
10002       values set from sources other than configuration files, or when
10003       examined by a non-superuser);
10004       helpful when using <literal>include</> directives in configuration files</entry>
10005      </row>
10006      <row>
10007       <entry><structfield>sourceline</structfield></entry>
10008       <entry><type>integer</type></entry>
10009       <entry>Line number within the configuration file the current value was
10010       set at (null for values set from sources other than configuration files,
10011       or when examined by a non-superuser)
10012       </entry>
10013      </row>
10014      <row>
10015       <entry><structfield>pending_restart</structfield></entry>
10016       <entry><type>boolean</type></entry>
10017       <entry><literal>true</literal> if the value has been changed in the
10018       configuration file but needs a restart; or <literal>false</literal>
10019       otherwise.
10020       </entry>
10021      </row>
10022     </tbody>
10023    </tgroup>
10024   </table>
10025
10026   <para>
10027    There are several possible values of <structfield>context</structfield>.
10028    In order of decreasing difficulty of changing the setting, they are:
10029   </para>
10030
10031   <variablelist>
10032    <varlistentry>
10033     <!-- PGC_INTERNAL -->
10034     <term><literal>internal</literal></term>
10035     <listitem>
10036      <para>
10037       These settings cannot be changed directly; they reflect internally
10038       determined values.  Some of them may be adjustable by rebuilding the
10039       server with different configuration options, or by changing options
10040       supplied to <command>initdb</command>.
10041      </para>
10042     </listitem>
10043    </varlistentry>
10044    <varlistentry>
10045     <!-- PGC_POSTMASTER -->
10046     <term><literal>postmaster</literal></term>
10047     <listitem>
10048      <para>
10049       These settings can only be applied when the server starts, so any change
10050       requires restarting the server.  Values for these settings are typically
10051       stored in the <filename>postgresql.conf</filename> file, or passed on
10052       the command line when starting the server.  Of course, settings with any
10053       of the lower <structfield>context</structfield> types can also be
10054       set at server start time.
10055      </para>
10056     </listitem>
10057    </varlistentry>
10058    <varlistentry>
10059     <!-- PGC_SIGHUP -->
10060     <term><literal>sighup</literal></term>
10061     <listitem>
10062      <para>
10063       Changes to these settings can be made in
10064       <filename>postgresql.conf</filename> without restarting the server.
10065       Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
10066       cause it to re-read <filename>postgresql.conf</filename> and apply
10067       the changes.  The postmaster will also forward the
10068       <systemitem>SIGHUP</systemitem> signal to its child processes so that
10069       they all pick up the new value.
10070      </para>
10071     </listitem>
10072    </varlistentry>
10073    <varlistentry>
10074     <!-- PGC_SU_BACKEND -->
10075     <term><literal>superuser-backend</literal></term>
10076     <listitem>
10077      <para>
10078       Changes to these settings can be made in
10079       <filename>postgresql.conf</filename> without restarting the server.
10080       They can also be set for a particular session in the connection request
10081       packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10082       environment variable), but only if the connecting user is a superuser.
10083       However, these settings never change in a session after it is started.
10084       If you change them in <filename>postgresql.conf</filename>, send a
10085       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10086       re-read <filename>postgresql.conf</filename>.  The new values will only
10087       affect subsequently-launched sessions.
10088      </para>
10089     </listitem>
10090    </varlistentry>
10091    <varlistentry>
10092     <!-- PGC_BACKEND -->
10093     <term><literal>backend</literal></term>
10094     <listitem>
10095      <para>
10096       Changes to these settings can be made in
10097       <filename>postgresql.conf</filename> without restarting the server.
10098       They can also be set for a particular session in the connection request
10099       packet (for example, via <application>libpq</>'s <literal>PGOPTIONS</>
10100       environment variable); any user can make such a change for their session.
10101       However, these settings never change in a session after it is started.
10102       If you change them in <filename>postgresql.conf</filename>, send a
10103       <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
10104       re-read <filename>postgresql.conf</filename>.  The new values will only
10105       affect subsequently-launched sessions.
10106      </para>
10107     </listitem>
10108    </varlistentry>
10109    <varlistentry>
10110     <!-- PGC_SUSET -->
10111     <term><literal>superuser</literal></term>
10112     <listitem>
10113      <para>
10114       These settings can be set from <filename>postgresql.conf</filename>,
10115       or within a session via the <command>SET</> command; but only superusers
10116       can change them via <command>SET</>.  Changes in
10117       <filename>postgresql.conf</filename> will affect existing sessions
10118       only if no session-local value has been established with <command>SET</>.
10119      </para>
10120     </listitem>
10121    </varlistentry>
10122    <varlistentry>
10123     <!-- PGC_USERSET -->
10124     <term><literal>user</literal></term>
10125     <listitem>
10126      <para>
10127       These settings can be set from <filename>postgresql.conf</filename>,
10128       or within a session via the <command>SET</> command.  Any user is
10129       allowed to change their session-local value.  Changes in
10130       <filename>postgresql.conf</filename> will affect existing sessions
10131       only if no session-local value has been established with <command>SET</>.
10132      </para>
10133     </listitem>
10134    </varlistentry>
10135   </variablelist>
10136
10137   <para>
10138    See <xref linkend="config-setting"> for more information about the various
10139    ways to change these parameters.
10140   </para>
10141
10142   <para>
10143    The <structname>pg_settings</structname> view cannot be inserted into or
10144    deleted from, but it can be updated.  An <command>UPDATE</command> applied
10145    to a row of <structname>pg_settings</structname> is equivalent to executing
10146    the <xref linkend="sql-set"> command on that named
10147    parameter. The change only affects the value used by the current
10148    session. If an <command>UPDATE</command> is issued within a transaction
10149    that is later aborted, the effects of the <command>UPDATE</command> command
10150    disappear when the transaction is rolled back. Once the surrounding
10151    transaction is committed, the effects will persist until the end of the
10152    session, unless overridden by another <command>UPDATE</command> or
10153    <command>SET</command>.
10154   </para>
10155
10156  </sect1>
10157
10158  <sect1 id="view-pg-shadow">
10159   <title><structname>pg_shadow</structname></title>
10160
10161   <indexterm zone="view-pg-shadow">
10162    <primary>pg_shadow</primary>
10163   </indexterm>
10164
10165   <para>
10166    The view <structname>pg_shadow</structname> exists for backwards
10167    compatibility: it emulates a catalog that existed in
10168    <productname>PostgreSQL</productname> before version 8.1.
10169    It shows properties of all roles that are marked as
10170    <structfield>rolcanlogin</> in
10171    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
10172   </para>
10173
10174   <para>
10175    The name stems from the fact that this table
10176    should not be readable by the public since it contains passwords.
10177    <link linkend="view-pg-user"><structname>pg_user</structname></link>
10178    is a publicly readable view on
10179    <structname>pg_shadow</structname> that blanks out the password field.
10180   </para>
10181
10182   <table>
10183    <title><structname>pg_shadow</> Columns</title>
10184
10185    <tgroup cols="4">
10186     <thead>
10187      <row>
10188       <entry>Name</entry>
10189       <entry>Type</entry>
10190       <entry>References</entry>
10191       <entry>Description</entry>
10192      </row>
10193     </thead>
10194
10195     <tbody>
10196      <row>
10197       <entry><structfield>usename</structfield></entry>
10198       <entry><type>name</type></entry>
10199       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10200       <entry>User name</entry>
10201      </row>
10202
10203      <row>
10204       <entry><structfield>usesysid</structfield></entry>
10205       <entry><type>oid</type></entry>
10206       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10207       <entry>ID of this user</entry>
10208      </row>
10209
10210      <row>
10211       <entry><structfield>usecreatedb</structfield></entry>
10212       <entry><type>bool</type></entry>
10213       <entry></entry>
10214       <entry>User can create databases</entry>
10215      </row>
10216
10217      <row>
10218       <entry><structfield>usesuper</structfield></entry>
10219       <entry><type>bool</type></entry>
10220       <entry></entry>
10221       <entry>User is a superuser</entry>
10222      </row>
10223
10224      <row>
10225       <entry><structfield>userepl</structfield></entry>
10226       <entry><type>bool</type></entry>
10227       <entry></entry>
10228       <entry>
10229        User can initiate streaming replication and put the system in and
10230        out of backup mode.
10231       </entry>
10232      </row>
10233
10234      <row>
10235       <entry><structfield>usebypassrls</structfield></entry>
10236       <entry><type>bool</type></entry>
10237       <entry></entry>
10238       <entry>
10239        User bypasses every row level security policy, see
10240        <xref linkend="ddl-rowsecurity"> for more information.
10241       </entry>
10242      </row>
10243
10244      <row>
10245       <entry><structfield>passwd</structfield></entry>
10246       <entry><type>text</type></entry>
10247       <entry></entry>
10248       <entry>Password (possibly encrypted); null if none.  See
10249       <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
10250       for details of how encrypted passwords are stored.</entry>
10251      </row>
10252
10253      <row>
10254       <entry><structfield>valuntil</structfield></entry>
10255       <entry><type>abstime</type></entry>
10256       <entry></entry>
10257       <entry>Password expiry time (only used for password authentication)</entry>
10258      </row>
10259
10260      <row>
10261       <entry><structfield>useconfig</structfield></entry>
10262       <entry><type>text[]</type></entry>
10263       <entry></entry>
10264       <entry>Session defaults for run-time configuration variables</entry>
10265      </row>
10266     </tbody>
10267    </tgroup>
10268   </table>
10269
10270  </sect1>
10271
10272  <sect1 id="view-pg-stats">
10273   <title><structname>pg_stats</structname></title>
10274
10275   <indexterm zone="view-pg-stats">
10276    <primary>pg_stats</primary>
10277   </indexterm>
10278
10279   <para>
10280    The view <structname>pg_stats</structname> provides access to
10281    the information stored in the <link
10282    linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
10283    catalog.  This view allows access only to rows of
10284    <structname>pg_statistic</structname> that correspond to tables the
10285    user has permission to read, and therefore it is safe to allow public
10286    read access to this view.
10287   </para>
10288
10289   <para>
10290    <structname>pg_stats</structname> is also designed to present the
10291    information in a more readable format than the underlying catalog
10292    &mdash; at the cost that its schema must be extended whenever new slot types
10293    are defined for <structname>pg_statistic</structname>.
10294   </para>
10295
10296   <table>
10297    <title><structname>pg_stats</> Columns</title>
10298
10299    <tgroup cols="4">
10300     <thead>
10301      <row>
10302       <entry>Name</entry>
10303       <entry>Type</entry>
10304       <entry>References</entry>
10305       <entry>Description</entry>
10306      </row>
10307     </thead>
10308     <tbody>
10309      <row>
10310       <entry><structfield>schemaname</structfield></entry>
10311       <entry><type>name</type></entry>
10312       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10313       <entry>Name of schema containing table</entry>
10314      </row>
10315
10316      <row>
10317       <entry><structfield>tablename</structfield></entry>
10318       <entry><type>name</type></entry>
10319       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10320       <entry>Name of table</entry>
10321      </row>
10322
10323      <row>
10324       <entry><structfield>attname</structfield></entry>
10325       <entry><type>name</type></entry>
10326       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
10327       <entry>Name of the column described by this row</entry>
10328      </row>
10329
10330      <row>
10331       <entry><structfield>inherited</structfield></entry>
10332       <entry><type>bool</type></entry>
10333       <entry></entry>
10334       <entry>If true, this row includes inheritance child columns, not just the
10335        values in the specified table</entry>
10336      </row>
10337
10338      <row>
10339       <entry><structfield>null_frac</structfield></entry>
10340       <entry><type>real</type></entry>
10341       <entry></entry>
10342       <entry>Fraction of column entries that are null</entry>
10343      </row>
10344
10345      <row>
10346       <entry><structfield>avg_width</structfield></entry>
10347       <entry><type>integer</type></entry>
10348       <entry></entry>
10349       <entry>Average width in bytes of column's entries</entry>
10350      </row>
10351
10352      <row>
10353       <entry><structfield>n_distinct</structfield></entry>
10354       <entry><type>real</type></entry>
10355       <entry></entry>
10356       <entry>
10357        If greater than zero, the estimated number of distinct values in the
10358        column.  If less than zero, the negative of the number of distinct
10359        values divided by the number of rows.  (The negated form is used when
10360        <command>ANALYZE</> believes that the number of distinct values is
10361        likely to increase as the table grows; the positive form is used when
10362        the column seems to have a fixed number of possible values.)  For
10363        example, -1 indicates a unique column in which the number of distinct
10364        values is the same as the number of rows.
10365       </entry>
10366      </row>
10367
10368      <row>
10369       <entry><structfield>most_common_vals</structfield></entry>
10370       <entry><type>anyarray</type></entry>
10371       <entry></entry>
10372       <entry>
10373        A list of the most common values in the column. (Null if
10374        no values seem to be more common than any others.)
10375       </entry>
10376      </row>
10377
10378      <row>
10379       <entry><structfield>most_common_freqs</structfield></entry>
10380       <entry><type>real[]</type></entry>
10381       <entry></entry>
10382       <entry>
10383        A list of the frequencies of the most common values,
10384        i.e., number of occurrences of each divided by total number of rows.
10385        (Null when <structfield>most_common_vals</structfield> is.)
10386       </entry>
10387      </row>
10388
10389      <row>
10390       <entry><structfield>histogram_bounds</structfield></entry>
10391       <entry><type>anyarray</type></entry>
10392       <entry></entry>
10393       <entry>
10394        A list of values that divide the column's values into groups of
10395        approximately equal population.  The values in
10396        <structfield>most_common_vals</>, if present, are omitted from this
10397        histogram calculation.  (This column is null if the column data type
10398        does not have a <literal>&lt;</> operator or if the
10399        <structfield>most_common_vals</> list accounts for the entire
10400        population.)
10401       </entry>
10402      </row>
10403
10404      <row>
10405       <entry><structfield>correlation</structfield></entry>
10406       <entry><type>real</type></entry>
10407       <entry></entry>
10408       <entry>
10409        Statistical correlation between physical row ordering and
10410        logical ordering of the column values.  This ranges from -1 to +1.
10411        When the value is near -1 or +1, an index scan on the column will
10412        be estimated to be cheaper than when it is near zero, due to reduction
10413        of random access to the disk.  (This column is null if the column data
10414        type does not have a <literal>&lt;</> operator.)
10415       </entry>
10416      </row>
10417
10418      <row>
10419       <entry><structfield>most_common_elems</structfield></entry>
10420       <entry><type>anyarray</type></entry>
10421       <entry></entry>
10422       <entry>
10423        A list of non-null element values most often appearing within values of
10424        the column. (Null for scalar types.)
10425       </entry>
10426      </row>
10427
10428      <row>
10429       <entry><structfield>most_common_elem_freqs</structfield></entry>
10430       <entry><type>real[]</type></entry>
10431       <entry></entry>
10432       <entry>
10433        A list of the frequencies of the most common element values, i.e., the
10434        fraction of rows containing at least one instance of the given value.
10435        Two or three additional values follow the per-element frequencies;
10436        these are the minimum and maximum of the preceding per-element
10437        frequencies, and optionally the frequency of null elements.
10438        (Null when <structfield>most_common_elems</structfield> is.)
10439       </entry>
10440      </row>
10441
10442      <row>
10443       <entry><structfield>elem_count_histogram</structfield></entry>
10444       <entry><type>real[]</type></entry>
10445       <entry></entry>
10446       <entry>
10447        A histogram of the counts of distinct non-null element values within the
10448        values of the column, followed by the average number of distinct
10449        non-null elements.  (Null for scalar types.)
10450       </entry>
10451      </row>
10452     </tbody>
10453    </tgroup>
10454   </table>
10455
10456   <para>
10457    The maximum number of entries in the array fields can be controlled on a
10458    column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
10459    command, or globally by setting the
10460    <xref linkend="guc-default-statistics-target"> run-time parameter.
10461   </para>
10462
10463  </sect1>
10464
10465  <sect1 id="view-pg-tables">
10466   <title><structname>pg_tables</structname></title>
10467
10468   <indexterm zone="view-pg-tables">
10469    <primary>pg_tables</primary>
10470   </indexterm>
10471
10472   <para>
10473    The view <structname>pg_tables</structname> provides access to
10474    useful information about each table in the database.
10475   </para>
10476
10477   <table>
10478    <title><structname>pg_tables</> Columns</title>
10479
10480    <tgroup cols="4">
10481     <thead>
10482      <row>
10483       <entry>Name</entry>
10484       <entry>Type</entry>
10485       <entry>References</entry>
10486       <entry>Description</entry>
10487      </row>
10488     </thead>
10489     <tbody>
10490      <row>
10491       <entry><structfield>schemaname</structfield></entry>
10492       <entry><type>name</type></entry>
10493       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10494       <entry>Name of schema containing table</entry>
10495      </row>
10496      <row>
10497       <entry><structfield>tablename</structfield></entry>
10498       <entry><type>name</type></entry>
10499       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10500       <entry>Name of table</entry>
10501      </row>
10502      <row>
10503       <entry><structfield>tableowner</structfield></entry>
10504       <entry><type>name</type></entry>
10505       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10506       <entry>Name of table's owner</entry>
10507      </row>
10508      <row>
10509       <entry><structfield>tablespace</structfield></entry>
10510       <entry><type>name</type></entry>
10511       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
10512       <entry>Name of tablespace containing table (null if default for database)</entry>
10513      </row>
10514      <row>
10515       <entry><structfield>hasindexes</structfield></entry>
10516       <entry><type>boolean</type></entry>
10517       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
10518       <entry>True if table has (or recently had) any indexes</entry>
10519      </row>
10520      <row>
10521       <entry><structfield>hasrules</structfield></entry>
10522       <entry><type>boolean</type></entry>
10523       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
10524       <entry>True if table has (or once had) rules</entry>
10525      </row>
10526      <row>
10527       <entry><structfield>hastriggers</structfield></entry>
10528       <entry><type>boolean</type></entry>
10529       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
10530       <entry>True if table has (or once had) triggers</entry>
10531      </row>
10532      <row>
10533       <entry><structfield>rowsecurity</structfield></entry>
10534       <entry><type>boolean</type></entry>
10535       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relrowsecurity</literal></entry>
10536       <entry>True if row security is enabled on the table</entry>
10537      </row>
10538     </tbody>
10539    </tgroup>
10540   </table>
10541
10542  </sect1>
10543
10544  <sect1 id="view-pg-timezone-abbrevs">
10545   <title><structname>pg_timezone_abbrevs</structname></title>
10546
10547   <indexterm zone="view-pg-timezone-abbrevs">
10548    <primary>pg_timezone_abbrevs</primary>
10549   </indexterm>
10550
10551   <para>
10552    The view <structname>pg_timezone_abbrevs</structname> provides a list
10553    of time zone abbreviations that are currently recognized by the datetime
10554    input routines.  The contents of this view change when the
10555    <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
10556   </para>
10557
10558   <table>
10559    <title><structname>pg_timezone_abbrevs</> Columns</title>
10560
10561    <tgroup cols="3">
10562     <thead>
10563      <row>
10564       <entry>Name</entry>
10565       <entry>Type</entry>
10566       <entry>Description</entry>
10567      </row>
10568     </thead>
10569     <tbody>
10570      <row>
10571       <entry><structfield>abbrev</structfield></entry>
10572       <entry><type>text</type></entry>
10573       <entry>Time zone abbreviation</entry>
10574      </row>
10575      <row>
10576       <entry><structfield>utc_offset</structfield></entry>
10577       <entry><type>interval</type></entry>
10578       <entry>Offset from UTC (positive means east of Greenwich)</entry>
10579      </row>
10580      <row>
10581       <entry><structfield>is_dst</structfield></entry>
10582       <entry><type>boolean</type></entry>
10583       <entry>True if this is a daylight-savings abbreviation</entry>
10584      </row>
10585     </tbody>
10586    </tgroup>
10587   </table>
10588
10589   <para>
10590    While most timezone abbreviations represent fixed offsets from UTC,
10591    there are some that have historically varied in value
10592    (see <xref linkend="datetime-config-files"> for more information).
10593    In such cases this view presents their current meaning.
10594   </para>
10595
10596  </sect1>
10597
10598  <sect1 id="view-pg-timezone-names">
10599   <title><structname>pg_timezone_names</structname></title>
10600
10601   <indexterm zone="view-pg-timezone-names">
10602    <primary>pg_timezone_names</primary>
10603   </indexterm>
10604
10605   <para>
10606    The view <structname>pg_timezone_names</structname> provides a list
10607    of time zone names that are recognized by <command>SET TIMEZONE</>,
10608    along with their associated abbreviations, UTC offsets,
10609    and daylight-savings status.  (Technically,
10610    <productname>PostgreSQL</productname> does not use UTC because leap
10611    seconds are not handled.)
10612    Unlike the abbreviations shown in <link
10613    linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
10614    date rules.  Therefore, the associated information changes across local DST
10615    boundaries.  The displayed information is computed based on the current
10616    value of <function>CURRENT_TIMESTAMP</>.
10617   </para>
10618
10619   <table>
10620    <title><structname>pg_timezone_names</> Columns</title>
10621
10622    <tgroup cols="3">
10623     <thead>
10624      <row>
10625       <entry>Name</entry>
10626       <entry>Type</entry>
10627       <entry>Description</entry>
10628      </row>
10629     </thead>
10630     <tbody>
10631      <row>
10632       <entry><structfield>name</structfield></entry>
10633       <entry><type>text</type></entry>
10634       <entry>Time zone name</entry>
10635      </row>
10636      <row>
10637       <entry><structfield>abbrev</structfield></entry>
10638       <entry><type>text</type></entry>
10639       <entry>Time zone abbreviation</entry>
10640      </row>
10641      <row>
10642       <entry><structfield>utc_offset</structfield></entry>
10643       <entry><type>interval</type></entry>
10644       <entry>Offset from UTC (positive means east of Greenwich)</entry>
10645      </row>
10646      <row>
10647       <entry><structfield>is_dst</structfield></entry>
10648       <entry><type>boolean</type></entry>
10649       <entry>True if currently observing daylight savings</entry>
10650      </row>
10651     </tbody>
10652    </tgroup>
10653   </table>
10654
10655  </sect1>
10656
10657  <sect1 id="view-pg-user">
10658   <title><structname>pg_user</structname></title>
10659
10660   <indexterm zone="view-pg-user">
10661    <primary>pg_user</primary>
10662   </indexterm>
10663
10664   <para>
10665    The view <structname>pg_user</structname> provides access to
10666    information about database users.  This is simply a publicly
10667    readable view of
10668    <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
10669    that blanks out the password field.
10670   </para>
10671
10672   <table>
10673    <title><structname>pg_user</> Columns</title>
10674
10675    <tgroup cols="3">
10676     <thead>
10677      <row>
10678       <entry>Name</entry>
10679       <entry>Type</entry>
10680       <entry>Description</entry>
10681      </row>
10682     </thead>
10683     <tbody>
10684      <row>
10685       <entry><structfield>usename</structfield></entry>
10686       <entry><type>name</type></entry>
10687       <entry>User name</entry>
10688      </row>
10689
10690      <row>
10691       <entry><structfield>usesysid</structfield></entry>
10692       <entry><type>oid</type></entry>
10693       <entry>ID of this user</entry>
10694      </row>
10695
10696      <row>
10697       <entry><structfield>usecreatedb</structfield></entry>
10698       <entry><type>bool</type></entry>
10699       <entry>User can create databases</entry>
10700      </row>
10701
10702      <row>
10703       <entry><structfield>usesuper</structfield></entry>
10704       <entry><type>bool</type></entry>
10705       <entry>User is a superuser</entry>
10706      </row>
10707
10708      <row>
10709       <entry><structfield>userepl</structfield></entry>
10710       <entry><type>bool</type></entry>
10711       <entry>
10712        User can initiate streaming replication and put the system in and
10713        out of backup mode.
10714       </entry>
10715      </row>
10716
10717      <row>
10718       <entry><structfield>usebypassrls</structfield></entry>
10719       <entry><type>bool</type></entry>
10720       <entry>
10721        User bypasses every row level security policy, see
10722        <xref linkend="ddl-rowsecurity"> for more information.
10723       </entry>
10724      </row>
10725
10726      <row>
10727       <entry><structfield>passwd</structfield></entry>
10728       <entry><type>text</type></entry>
10729       <entry>Not the password (always reads as <literal>********</>)</entry>
10730      </row>
10731
10732      <row>
10733       <entry><structfield>valuntil</structfield></entry>
10734       <entry><type>abstime</type></entry>
10735       <entry>Password expiry time (only used for password authentication)</entry>
10736      </row>
10737
10738      <row>
10739       <entry><structfield>useconfig</structfield></entry>
10740       <entry><type>text[]</type></entry>
10741       <entry>Session defaults for run-time configuration variables</entry>
10742      </row>
10743     </tbody>
10744    </tgroup>
10745   </table>
10746
10747  </sect1>
10748
10749  <sect1 id="view-pg-user-mappings">
10750   <title><structname>pg_user_mappings</structname></title>
10751
10752   <indexterm zone="view-pg-user-mappings">
10753    <primary>pg_user_mappings</primary>
10754   </indexterm>
10755
10756   <para>
10757    The view <structname>pg_user_mappings</structname> provides access
10758    to information about user mappings.  This is essentially a publicly
10759    readable view of
10760    <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
10761    that leaves out the options field if the user has no rights to use
10762    it.
10763   </para>
10764
10765   <table>
10766    <title><structname>pg_user_mappings</> Columns</title>
10767
10768    <tgroup cols="4">
10769     <thead>
10770      <row>
10771       <entry>Name</entry>
10772       <entry>Type</entry>
10773       <entry>References</entry>
10774       <entry>Description</entry>
10775      </row>
10776     </thead>
10777
10778     <tbody>
10779      <row>
10780       <entry><structfield>umid</structfield></entry>
10781       <entry><type>oid</type></entry>
10782       <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
10783       <entry>OID of the user mapping</entry>
10784      </row>
10785
10786      <row>
10787       <entry><structfield>srvid</structfield></entry>
10788       <entry><type>oid</type></entry>
10789       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
10790       <entry>
10791        The OID of the foreign server that contains this mapping
10792       </entry>
10793      </row>
10794
10795      <row>
10796       <entry><structfield>srvname</structfield></entry>
10797       <entry><type>name</type></entry>
10798       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.srvname</literal></entry>
10799       <entry>
10800        Name of the foreign server
10801       </entry>
10802      </row>
10803
10804      <row>
10805       <entry><structfield>umuser</structfield></entry>
10806       <entry><type>oid</type></entry>
10807       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
10808       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
10809      </row>
10810
10811      <row>
10812       <entry><structfield>usename</structfield></entry>
10813       <entry><type>name</type></entry>
10814       <entry></entry>
10815       <entry>Name of the local user to be mapped</entry>
10816      </row>
10817
10818      <row>
10819       <entry><structfield>umoptions</structfield></entry>
10820       <entry><type>text[]</type></entry>
10821       <entry></entry>
10822       <entry>
10823        User mapping specific options, as <quote>keyword=value</>
10824        strings, if the current user is the owner of the foreign
10825        server, else null
10826       </entry>
10827      </row>
10828     </tbody>
10829    </tgroup>
10830   </table>
10831  </sect1>
10832
10833
10834  <sect1 id="view-pg-views">
10835   <title><structname>pg_views</structname></title>
10836
10837   <indexterm zone="view-pg-views">
10838    <primary>pg_views</primary>
10839   </indexterm>
10840
10841   <para>
10842    The view <structname>pg_views</structname> provides access to
10843    useful information about each view in the database.
10844   </para>
10845
10846   <table>
10847    <title><structname>pg_views</> Columns</title>
10848
10849    <tgroup cols="4">
10850     <thead>
10851      <row>
10852       <entry>Name</entry>
10853       <entry>Type</entry>
10854       <entry>References</entry>
10855       <entry>Description</entry>
10856      </row>
10857     </thead>
10858     <tbody>
10859      <row>
10860       <entry><structfield>schemaname</structfield></entry>
10861       <entry><type>name</type></entry>
10862       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
10863       <entry>Name of schema containing view</entry>
10864      </row>
10865      <row>
10866       <entry><structfield>viewname</structfield></entry>
10867       <entry><type>name</type></entry>
10868       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
10869       <entry>Name of view</entry>
10870      </row>
10871      <row>
10872       <entry><structfield>viewowner</structfield></entry>
10873       <entry><type>name</type></entry>
10874       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
10875       <entry>Name of view's owner</entry>
10876      </row>
10877      <row>
10878       <entry><structfield>definition</structfield></entry>
10879       <entry><type>text</type></entry>
10880       <entry></entry>
10881       <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
10882      </row>
10883     </tbody>
10884    </tgroup>
10885   </table>
10886
10887  </sect1>
10888
10889 </chapter>