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>relation 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 functions</entry>
71     </row>
72
73     <row>
74      <entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
75      <entry>column default values</entry>
76     </row>
77
78     <row>
79      <entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
80      <entry>table columns (<quote>attributes</quote>)</entry>
81     </row>
82
83     <row>
84      <entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
85      <entry>authorization identifiers (roles)</entry>
86     </row>
87
88     <row>
89      <entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
90      <entry>authorization identifier membership relationships</entry>
91     </row>
92
93     <row>
94      <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
95      <entry>casts (data type conversions)</entry>
96     </row>
97
98     <row>
99      <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
100      <entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
101     </row>
102
103     <row>
104      <entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
105      <entry>collations (locale information)</entry>
106     </row>
107
108     <row>
109      <entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
110      <entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
111     </row>
112
113     <row>
114      <entry><link linkend="catalog-pg-conversion"><structname>pg_conversion</structname></link></entry>
115      <entry>encoding conversion information</entry>
116     </row>
117
118     <row>
119      <entry><link linkend="catalog-pg-database"><structname>pg_database</structname></link></entry>
120      <entry>databases within this database cluster</entry>
121     </row>
122
123     <row>
124      <entry><link linkend="catalog-pg-db-role-setting"><structname>pg_db_role_setting</structname></link></entry>
125      <entry>per-role and per-database settings</entry>
126     </row>
127
128     <row>
129      <entry><link linkend="catalog-pg-default-acl"><structname>pg_default_acl</structname></link></entry>
130      <entry>default privileges for object types</entry>
131     </row>
132
133     <row>
134      <entry><link linkend="catalog-pg-depend"><structname>pg_depend</structname></link></entry>
135      <entry>dependencies between database objects</entry>
136     </row>
137
138     <row>
139      <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
140      <entry>descriptions or comments on database objects</entry>
141     </row>
142
143     <row>
144      <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
145      <entry>enum label and value definitions</entry>
146     </row>
147
148     <row>
149      <entry><link linkend="catalog-pg-event-trigger"><structname>pg_event_trigger</structname></link></entry>
150      <entry>event triggers</entry>
151     </row>
152
153     <row>
154      <entry><link linkend="catalog-pg-extension"><structname>pg_extension</structname></link></entry>
155      <entry>installed extensions</entry>
156     </row>
157
158     <row>
159      <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
160      <entry>foreign-data wrapper definitions</entry>
161     </row>
162
163     <row>
164      <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
165      <entry>foreign server definitions</entry>
166     </row>
167
168     <row>
169      <entry><link linkend="catalog-pg-foreign-table"><structname>pg_foreign_table</structname></link></entry>
170      <entry>additional foreign table information</entry>
171     </row>
172
173     <row>
174      <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
175      <entry>additional index information</entry>
176     </row>
177
178     <row>
179      <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
180      <entry>table inheritance hierarchy</entry>
181     </row>
182
183     <row>
184      <entry><link linkend="catalog-pg-init-privs"><structname>pg_init_privs</structname></link></entry>
185      <entry>object initial privileges</entry>
186     </row>
187
188     <row>
189      <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
190      <entry>languages for writing functions</entry>
191     </row>
192
193     <row>
194      <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
195      <entry>data pages for large objects</entry>
196     </row>
197
198     <row>
199      <entry><link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link></entry>
200      <entry>metadata for large objects</entry>
201     </row>
202
203     <row>
204      <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
205      <entry>schemas</entry>
206     </row>
207
208     <row>
209      <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
210      <entry>access method operator classes</entry>
211     </row>
212
213     <row>
214      <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
215      <entry>operators</entry>
216     </row>
217
218     <row>
219      <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
220      <entry>access method operator families</entry>
221     </row>
222
223     <row>
224      <entry><link linkend="catalog-pg-partitioned-table"><structname>pg_partitioned_table</structname></link></entry>
225      <entry>information about partition key of tables</entry>
226     </row>
227
228     <row>
229      <entry><link linkend="catalog-pg-policy"><structname>pg_policy</structname></link></entry>
230      <entry>row-security policies</entry>
231     </row>
232
233     <row>
234      <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
235      <entry>functions and procedures</entry>
236     </row>
237
238     <row>
239      <entry><link linkend="catalog-pg-publication"><structname>pg_publication</structname></link></entry>
240      <entry>publications for logical replication</entry>
241     </row>
242
243     <row>
244      <entry><link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link></entry>
245      <entry>relation to publication mapping</entry>
246     </row>
247
248     <row>
249      <entry><link linkend="catalog-pg-range"><structname>pg_range</structname></link></entry>
250      <entry>information about range types</entry>
251     </row>
252
253     <row>
254      <entry><link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link></entry>
255      <entry>registered replication origins</entry>
256     </row>
257
258     <row>
259      <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
260      <entry>query rewrite rules</entry>
261     </row>
262
263     <row>
264      <entry><link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link></entry>
265      <entry>security labels on database objects</entry>
266     </row>
267
268     <row>
269      <entry><link linkend="catalog-pg-sequence"><structname>pg_sequence</structname></link></entry>
270      <entry>information about sequences</entry>
271     </row>
272
273     <row>
274      <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
275      <entry>dependencies on shared objects</entry>
276     </row>
277
278     <row>
279      <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
280      <entry>comments on shared objects</entry>
281     </row>
282
283     <row>
284      <entry><link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link></entry>
285      <entry>security labels on shared database objects</entry>
286     </row>
287
288     <row>
289      <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
290      <entry>planner statistics</entry>
291     </row>
292
293     <row>
294      <entry><link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link></entry>
295      <entry>extended planner statistics (definition)</entry>
296     </row>
297
298     <row>
299      <entry><link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link></entry>
300      <entry>extended planner statistics (built statistics)</entry>
301     </row>
302
303     <row>
304      <entry><link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link></entry>
305      <entry>logical replication subscriptions</entry>
306     </row>
307
308     <row>
309      <entry><link linkend="catalog-pg-subscription-rel"><structname>pg_subscription_rel</structname></link></entry>
310      <entry>relation state for subscriptions</entry>
311     </row>
312
313     <row>
314      <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
315      <entry>tablespaces within this database cluster</entry>
316     </row>
317
318     <row>
319      <entry><link linkend="catalog-pg-transform"><structname>pg_transform</structname></link></entry>
320      <entry>transforms (data type to procedural language conversions)</entry>
321     </row>
322
323     <row>
324      <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
325      <entry>triggers</entry>
326     </row>
327
328     <row>
329      <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
330      <entry>text search configurations</entry>
331     </row>
332
333     <row>
334      <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
335      <entry>text search configurations' token mappings</entry>
336     </row>
337
338     <row>
339      <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
340      <entry>text search dictionaries</entry>
341     </row>
342
343     <row>
344      <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
345      <entry>text search parsers</entry>
346     </row>
347
348     <row>
349      <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
350      <entry>text search templates</entry>
351     </row>
352
353     <row>
354      <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
355      <entry>data types</entry>
356     </row>
357
358     <row>
359      <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
360      <entry>mappings of users to foreign servers</entry>
361     </row>
362    </tbody>
363   </tgroup>
364  </table>
365 </sect1>
366
367
368 <sect1 id="catalog-pg-aggregate">
369  <title><structname>pg_aggregate</structname></title>
370
371  <indexterm zone="catalog-pg-aggregate">
372   <primary>pg_aggregate</primary>
373  </indexterm>
374
375  <para>
376   The catalog <structname>pg_aggregate</structname> stores information about
377   aggregate functions.  An aggregate function is a function that
378   operates on a set of values (typically one column from each row
379   that matches a query condition) and returns a single value computed
380   from all these values.  Typical aggregate functions are
381   <function>sum</function>, <function>count</function>, and
382   <function>max</function>.  Each entry in
383   <structname>pg_aggregate</structname> is an extension of an entry
384   in <structname>pg_proc</structname>.  The <structname>pg_proc</structname>
385   entry carries the aggregate's name, input and output data types, and
386   other information that is similar to ordinary functions.
387  </para>
388
389  <table>
390   <title><structname>pg_aggregate</structname> Columns</title>
391   <tgroup cols="1">
392    <thead>
393     <row>
394      <entry role="catalog_table_entry"><para role="column_definition">
395       Column Type
396      </para>
397      <para>
398       Description
399      </para></entry>
400     </row>
401    </thead>
402
403    <tbody>
404     <row>
405      <entry role="catalog_table_entry"><para role="column_definition">
406       <structfield>aggfnoid</structfield> <type>regproc</type>
407       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
408      </para>
409      <para>
410       <structname>pg_proc</structname> OID of the aggregate function
411      </para></entry>
412     </row>
413
414     <row>
415      <entry role="catalog_table_entry"><para role="column_definition">
416       <structfield>aggkind</structfield> <type>char</type>
417      </para>
418      <para>
419       Aggregate kind:
420       <literal>n</literal> for <quote>normal</quote> aggregates,
421       <literal>o</literal> for <quote>ordered-set</quote> aggregates, or
422       <literal>h</literal> for <quote>hypothetical-set</quote> aggregates
423      </para></entry>
424     </row>
425
426     <row>
427      <entry role="catalog_table_entry"><para role="column_definition">
428       <structfield>aggnumdirectargs</structfield> <type>int2</type>
429      </para>
430      <para>
431       Number of direct (non-aggregated) arguments of an ordered-set or
432       hypothetical-set aggregate, counting a variadic array as one argument.
433       If equal to <structfield>pronargs</structfield>, the aggregate must be variadic
434       and the variadic array describes the aggregated arguments as well as
435       the final direct arguments.
436       Always zero for normal aggregates.
437      </para></entry>
438     </row>
439
440     <row>
441      <entry role="catalog_table_entry"><para role="column_definition">
442       <structfield>aggtransfn</structfield> <type>regproc</type>
443       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
444      </para>
445      <para>
446       Transition function
447      </para></entry>
448     </row>
449
450     <row>
451      <entry role="catalog_table_entry"><para role="column_definition">
452       <structfield>aggfinalfn</structfield> <type>regproc</type>
453       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
454      </para>
455      <para>
456       Final function (zero if none)
457      </para></entry>
458     </row>
459
460     <row>
461      <entry role="catalog_table_entry"><para role="column_definition">
462       <structfield>aggcombinefn</structfield> <type>regproc</type>
463       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
464      </para>
465      <para>
466       Combine function (zero if none)
467      </para></entry>
468     </row>
469
470     <row>
471      <entry role="catalog_table_entry"><para role="column_definition">
472       <structfield>aggserialfn</structfield> <type>regproc</type>
473       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
474      </para>
475      <para>
476       Serialization function (zero if none)
477      </para></entry>
478     </row>
479
480     <row>
481      <entry role="catalog_table_entry"><para role="column_definition">
482       <structfield>aggdeserialfn</structfield> <type>regproc</type>
483       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
484      </para>
485      <para>
486       Deserialization function (zero if none)
487      </para></entry>
488     </row>
489
490     <row>
491      <entry role="catalog_table_entry"><para role="column_definition">
492       <structfield>aggmtransfn</structfield> <type>regproc</type>
493       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
494      </para>
495      <para>
496       Forward transition function for moving-aggregate mode (zero if none)
497      </para></entry>
498     </row>
499
500     <row>
501      <entry role="catalog_table_entry"><para role="column_definition">
502       <structfield>aggminvtransfn</structfield> <type>regproc</type>
503       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
504      </para>
505      <para>
506       Inverse transition function for moving-aggregate mode (zero if none)
507      </para></entry>
508     </row>
509
510     <row>
511      <entry role="catalog_table_entry"><para role="column_definition">
512       <structfield>aggmfinalfn</structfield> <type>regproc</type>
513       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
514      </para>
515      <para>
516       Final function for moving-aggregate mode (zero if none)
517      </para></entry>
518     </row>
519
520     <row>
521      <entry role="catalog_table_entry"><para role="column_definition">
522       <structfield>aggfinalextra</structfield> <type>bool</type>
523      </para>
524      <para>
525       True to pass extra dummy arguments to <structfield>aggfinalfn</structfield>
526      </para></entry>
527     </row>
528
529     <row>
530      <entry role="catalog_table_entry"><para role="column_definition">
531       <structfield>aggmfinalextra</structfield> <type>bool</type>
532      </para>
533      <para>
534       True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield>
535      </para></entry>
536     </row>
537
538     <row>
539      <entry role="catalog_table_entry"><para role="column_definition">
540       <structfield>aggfinalmodify</structfield> <type>char</type>
541      </para>
542      <para>
543       Whether <structfield>aggfinalfn</structfield> modifies the
544       transition state value:
545       <literal>r</literal> if it is read-only,
546       <literal>s</literal> if the <structfield>aggtransfn</structfield>
547       cannot be applied after the <structfield>aggfinalfn</structfield>, or
548       <literal>w</literal> if it writes on the value
549      </para></entry>
550     </row>
551
552     <row>
553      <entry role="catalog_table_entry"><para role="column_definition">
554       <structfield>aggmfinalmodify</structfield> <type>char</type>
555      </para>
556      <para>
557       Like <structfield>aggfinalmodify</structfield>, but for
558       the <structfield>aggmfinalfn</structfield>
559      </para></entry>
560     </row>
561
562     <row>
563      <entry role="catalog_table_entry"><para role="column_definition">
564       <structfield>aggsortop</structfield> <type>oid</type>
565       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
566      </para>
567      <para>
568       Associated sort operator (zero if none)
569      </para></entry>
570     </row>
571
572     <row>
573      <entry role="catalog_table_entry"><para role="column_definition">
574       <structfield>aggtranstype</structfield> <type>oid</type>
575       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
576      </para>
577      <para>
578       Data type of the aggregate function's internal transition (state) data
579      </para></entry>
580     </row>
581
582     <row>
583      <entry role="catalog_table_entry"><para role="column_definition">
584       <structfield>aggtransspace</structfield> <type>int4</type>
585      </para>
586      <para>
587       Approximate average size (in bytes) of the transition state
588       data, or zero to use a default estimate
589      </para></entry>
590     </row>
591
592     <row>
593      <entry role="catalog_table_entry"><para role="column_definition">
594       <structfield>aggmtranstype</structfield> <type>oid</type>
595       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
596      </para>
597      <para>
598       Data type of the aggregate function's internal transition (state)
599       data for moving-aggregate mode (zero if none)
600      </para></entry>
601     </row>
602
603     <row>
604      <entry role="catalog_table_entry"><para role="column_definition">
605       <structfield>aggmtransspace</structfield> <type>int4</type>
606      </para>
607      <para>
608       Approximate average size (in bytes) of the transition state data
609       for moving-aggregate mode, or zero to use a default estimate
610      </para></entry>
611     </row>
612
613     <row>
614      <entry role="catalog_table_entry"><para role="column_definition">
615       <structfield>agginitval</structfield> <type>text</type>
616      </para>
617      <para>
618       The initial value of the transition state.  This is a text
619       field containing the initial value in its external string
620       representation.  If this field is null, the transition state
621       value starts out null.
622      </para></entry>
623     </row>
624
625     <row>
626      <entry role="catalog_table_entry"><para role="column_definition">
627       <structfield>aggminitval</structfield> <type>text</type>
628      </para>
629      <para>
630       The initial value of the transition state for moving-aggregate mode.
631       This is a text field containing the initial value in its external
632       string representation.  If this field is null, the transition state
633       value starts out null.
634      </para></entry>
635     </row>
636    </tbody>
637   </tgroup>
638  </table>
639
640  <para>
641   New aggregate functions are registered with the <xref
642   linkend="sql-createaggregate"/>
643   command.  See <xref linkend="xaggr"/> for more information about
644   writing aggregate functions and the meaning of the transition
645   functions, etc.
646  </para>
647
648 </sect1>
649
650
651 <sect1 id="catalog-pg-am">
652  <title><structname>pg_am</structname></title>
653
654  <indexterm zone="catalog-pg-am">
655   <primary>pg_am</primary>
656  </indexterm>
657
658  <para>
659   The catalog <structname>pg_am</structname> stores information about
660   relation access methods.  There is one row for each access method supported
661   by the system.
662   Currently, only tables and indexes have access methods. The requirements for table
663   and index access methods are discussed in detail in <xref linkend="tableam"/> and
664   <xref linkend="indexam"/> respectively.
665  </para>
666
667  <table>
668   <title><structname>pg_am</structname> Columns</title>
669   <tgroup cols="1">
670    <thead>
671     <row>
672      <entry role="catalog_table_entry"><para role="column_definition">
673       Column Type
674      </para>
675      <para>
676       Description
677      </para></entry>
678     </row>
679    </thead>
680
681    <tbody>
682     <row>
683      <entry role="catalog_table_entry"><para role="column_definition">
684       <structfield>oid</structfield> <type>oid</type>
685      </para>
686      <para>
687       Row identifier
688      </para></entry>
689     </row>
690
691     <row>
692      <entry role="catalog_table_entry"><para role="column_definition">
693       <structfield>amname</structfield> <type>name</type>
694      </para>
695      <para>
696       Name of the access method
697      </para></entry>
698     </row>
699
700     <row>
701      <entry role="catalog_table_entry"><para role="column_definition">
702       <structfield>amhandler</structfield> <type>regproc</type>
703       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
704      </para>
705      <para>
706       OID of a handler function that is responsible for supplying information
707       about the access method
708      </para></entry>
709     </row>
710
711     <row>
712      <entry role="catalog_table_entry"><para role="column_definition">
713       <structfield>amtype</structfield> <type>char</type>
714      </para>
715      <para>
716       <literal>t</literal> = table (including materialized views),
717       <literal>i</literal> = index.
718      </para></entry>
719     </row>
720    </tbody>
721   </tgroup>
722  </table>
723
724  <note>
725   <para>
726    Before <productname>PostgreSQL</productname> 9.6, <structname>pg_am</structname>
727    contained many additional columns representing properties of index access
728    methods.  That data is now only directly visible at the C code level.
729    However, <function>pg_index_column_has_property()</function> and related
730    functions have been added to allow SQL queries to inspect index access
731    method properties; see <xref linkend="functions-info-catalog-table"/>.
732   </para>
733  </note>
734
735 </sect1>
736
737
738 <sect1 id="catalog-pg-amop">
739  <title><structname>pg_amop</structname></title>
740
741  <indexterm zone="catalog-pg-amop">
742   <primary>pg_amop</primary>
743  </indexterm>
744
745  <para>
746   The catalog <structname>pg_amop</structname> stores information about
747   operators associated with access method operator families.  There is one
748   row for each operator that is a member of an operator family.  A family
749   member can be either a <firstterm>search</firstterm> operator or an
750   <firstterm>ordering</firstterm> operator.  An operator
751   can appear in more than one family, but cannot appear in more than one
752   search position nor more than one ordering position within a family.
753   (It is allowed, though unlikely, for an operator to be used for both
754   search and ordering purposes.)
755  </para>
756
757  <table>
758   <title><structname>pg_amop</structname> Columns</title>
759   <tgroup cols="1">
760    <thead>
761     <row>
762      <entry role="catalog_table_entry"><para role="column_definition">
763       Column Type
764      </para>
765      <para>
766       Description
767      </para></entry>
768     </row>
769    </thead>
770
771    <tbody>
772     <row>
773      <entry role="catalog_table_entry"><para role="column_definition">
774       <structfield>oid</structfield> <type>oid</type>
775      </para>
776      <para>
777       Row identifier
778      </para></entry>
779     </row>
780
781     <row>
782      <entry role="catalog_table_entry"><para role="column_definition">
783       <structfield>amopfamily</structfield> <type>oid</type>
784       (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
785      </para>
786      <para>
787       The operator family this entry is for
788      </para></entry>
789     </row>
790
791     <row>
792      <entry role="catalog_table_entry"><para role="column_definition">
793       <structfield>amoplefttype</structfield> <type>oid</type>
794       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
795      </para>
796      <para>
797       Left-hand input data type of operator
798      </para></entry>
799     </row>
800
801     <row>
802      <entry role="catalog_table_entry"><para role="column_definition">
803       <structfield>amoprighttype</structfield> <type>oid</type>
804       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
805      </para>
806      <para>
807       Right-hand input data type of operator
808      </para></entry>
809     </row>
810
811     <row>
812      <entry role="catalog_table_entry"><para role="column_definition">
813       <structfield>amopstrategy</structfield> <type>int2</type>
814      </para>
815      <para>
816       Operator strategy number
817      </para></entry>
818     </row>
819
820     <row>
821      <entry role="catalog_table_entry"><para role="column_definition">
822       <structfield>amoppurpose</structfield> <type>char</type>
823      </para>
824      <para>
825       Operator purpose, either <literal>s</literal> for search or
826       <literal>o</literal> for ordering
827      </para></entry>
828     </row>
829
830     <row>
831      <entry role="catalog_table_entry"><para role="column_definition">
832       <structfield>amopopr</structfield> <type>oid</type>
833       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
834      </para>
835      <para>
836       OID of the operator
837      </para></entry>
838     </row>
839
840     <row>
841      <entry role="catalog_table_entry"><para role="column_definition">
842       <structfield>amopmethod</structfield> <type>oid</type>
843       (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
844      </para>
845      <para>
846       Index access method operator family is for
847      </para></entry>
848     </row>
849
850     <row>
851      <entry role="catalog_table_entry"><para role="column_definition">
852       <structfield>amopsortfamily</structfield> <type>oid</type>
853       (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
854      </para>
855      <para>
856       The B-tree operator family this entry sorts according to, if an
857       ordering operator; zero if a search operator
858      </para></entry>
859     </row>
860    </tbody>
861   </tgroup>
862  </table>
863
864  <para>
865   A <quote>search</quote> operator entry indicates that an index of this operator
866   family can be searched to find all rows satisfying
867   <literal>WHERE</literal>
868   <replaceable>indexed_column</replaceable>
869   <replaceable>operator</replaceable>
870   <replaceable>constant</replaceable>.
871   Obviously, such an operator must return <type>boolean</type>, and its left-hand input
872   type must match the index's column data type.
873  </para>
874
875  <para>
876   An <quote>ordering</quote> operator entry indicates that an index of this
877   operator family can be scanned to return rows in the order represented by
878   <literal>ORDER BY</literal>
879   <replaceable>indexed_column</replaceable>
880   <replaceable>operator</replaceable>
881   <replaceable>constant</replaceable>.
882   Such an operator could return any sortable data type, though again
883   its left-hand input type must match the index's column data type.
884   The exact semantics of the <literal>ORDER BY</literal> are specified by the
885   <structfield>amopsortfamily</structfield> column, which must reference
886   a B-tree operator family for the operator's result type.
887  </para>
888
889  <note>
890   <para>
891    At present, it's assumed that the sort order for an ordering operator
892    is the default for the referenced operator family, i.e., <literal>ASC NULLS
893    LAST</literal>.  This might someday be relaxed by adding additional columns
894    to specify sort options explicitly.
895   </para>
896  </note>
897
898  <para>
899   An entry's <structfield>amopmethod</structfield> must match the
900   <structname>opfmethod</structname> of its containing operator family (including
901   <structfield>amopmethod</structfield> here is an intentional denormalization of the
902   catalog structure for performance reasons).  Also,
903   <structfield>amoplefttype</structfield> and <structfield>amoprighttype</structfield> must match
904   the <structfield>oprleft</structfield> and <structfield>oprright</structfield> fields of the
905   referenced <structname>pg_operator</structname> entry.
906  </para>
907
908 </sect1>
909
910
911 <sect1 id="catalog-pg-amproc">
912  <title><structname>pg_amproc</structname></title>
913
914  <indexterm zone="catalog-pg-amproc">
915   <primary>pg_amproc</primary>
916  </indexterm>
917
918  <para>
919   The catalog <structname>pg_amproc</structname> stores information about
920   support functions associated with access method operator families.  There
921   is one row for each support function belonging to an operator family.
922  </para>
923
924  <table>
925   <title><structname>pg_amproc</structname> Columns</title>
926   <tgroup cols="1">
927    <thead>
928     <row>
929      <entry role="catalog_table_entry"><para role="column_definition">
930       Column Type
931      </para>
932      <para>
933       Description
934      </para></entry>
935     </row>
936    </thead>
937
938    <tbody>
939     <row>
940      <entry role="catalog_table_entry"><para role="column_definition">
941       <structfield>oid</structfield> <type>oid</type>
942      </para>
943      <para>
944       Row identifier
945      </para></entry>
946     </row>
947
948     <row>
949      <entry role="catalog_table_entry"><para role="column_definition">
950       <structfield>amprocfamily</structfield> <type>oid</type>
951       (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
952      </para>
953      <para>
954       The operator family this entry is for
955      </para></entry>
956     </row>
957
958     <row>
959      <entry role="catalog_table_entry"><para role="column_definition">
960       <structfield>amproclefttype</structfield> <type>oid</type>
961       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
962      </para>
963      <para>
964       Left-hand input data type of associated operator
965      </para></entry>
966     </row>
967
968     <row>
969      <entry role="catalog_table_entry"><para role="column_definition">
970       <structfield>amprocrighttype</structfield> <type>oid</type>
971       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
972      </para>
973      <para>
974       Right-hand input data type of associated operator
975      </para></entry>
976     </row>
977
978     <row>
979      <entry role="catalog_table_entry"><para role="column_definition">
980       <structfield>amprocnum</structfield> <type>int2</type>
981      </para>
982      <para>
983       Support function number
984      </para></entry>
985     </row>
986
987     <row>
988      <entry role="catalog_table_entry"><para role="column_definition">
989       <structfield>amproc</structfield> <type>regproc</type>
990       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
991      </para>
992      <para>
993       OID of the function
994      </para></entry>
995     </row>
996    </tbody>
997   </tgroup>
998  </table>
999
1000  <para>
1001   The usual interpretation of the
1002   <structfield>amproclefttype</structfield> and <structfield>amprocrighttype</structfield> fields
1003   is that they identify the left and right input types of the operator(s)
1004   that a particular support function supports.  For some access methods
1005   these match the input data type(s) of the support function itself, for
1006   others not.  There is a notion of <quote>default</quote> support functions for
1007   an index, which are those with <structfield>amproclefttype</structfield> and
1008   <structfield>amprocrighttype</structfield> both equal to the index operator class's
1009   <structfield>opcintype</structfield>.
1010  </para>
1011
1012 </sect1>
1013
1014
1015 <sect1 id="catalog-pg-attrdef">
1016  <title><structname>pg_attrdef</structname></title>
1017
1018  <indexterm zone="catalog-pg-attrdef">
1019   <primary>pg_attrdef</primary>
1020  </indexterm>
1021
1022  <para>
1023   The catalog <structname>pg_attrdef</structname> stores column default
1024   values.  The main information about columns is stored in
1025   <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.
1026   Only columns for which a default value has been explicitly set will have
1027   an entry here.
1028  </para>
1029
1030  <table>
1031   <title><structname>pg_attrdef</structname> Columns</title>
1032   <tgroup cols="1">
1033    <thead>
1034     <row>
1035      <entry role="catalog_table_entry"><para role="column_definition">
1036       Column Type
1037      </para>
1038      <para>
1039       Description
1040      </para></entry>
1041     </row>
1042    </thead>
1043
1044    <tbody>
1045     <row>
1046      <entry role="catalog_table_entry"><para role="column_definition">
1047       <structfield>oid</structfield> <type>oid</type>
1048      </para>
1049      <para>
1050       Row identifier
1051      </para></entry>
1052     </row>
1053
1054     <row>
1055      <entry role="catalog_table_entry"><para role="column_definition">
1056       <structfield>adrelid</structfield> <type>oid</type>
1057       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1058      </para>
1059      <para>
1060       The table this column belongs to
1061      </para></entry>
1062     </row>
1063
1064     <row>
1065      <entry role="catalog_table_entry"><para role="column_definition">
1066       <structfield>adnum</structfield> <type>int2</type>
1067       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
1068      </para>
1069      <para>
1070       The number of the column
1071      </para></entry>
1072     </row>
1073
1074     <row>
1075      <entry role="catalog_table_entry"><para role="column_definition">
1076       <structfield>adbin</structfield> <type>pg_node_tree</type>
1077      </para>
1078      <para>
1079       The column default value, in <function>nodeToString()</function>
1080       representation.  Use <literal>pg_get_expr(adbin, adrelid)</literal> to
1081       convert it to an SQL expression.
1082      </para></entry>
1083     </row>
1084    </tbody>
1085   </tgroup>
1086  </table>
1087 </sect1>
1088
1089
1090 <sect1 id="catalog-pg-attribute">
1091  <title><structname>pg_attribute</structname></title>
1092
1093  <indexterm zone="catalog-pg-attribute">
1094   <primary>pg_attribute</primary>
1095  </indexterm>
1096
1097  <para>
1098   The catalog <structname>pg_attribute</structname> stores information about
1099   table columns.  There will be exactly one
1100   <structname>pg_attribute</structname> row for every column in every
1101   table in the database.  (There will also be attribute entries for
1102   indexes, and indeed all objects that have <structname>pg_class</structname>
1103   entries.)
1104  </para>
1105
1106  <para>
1107   The term attribute is equivalent to column and is used for
1108   historical reasons.
1109  </para>
1110
1111  <table>
1112   <title><structname>pg_attribute</structname> Columns</title>
1113   <tgroup cols="1">
1114    <thead>
1115     <row>
1116      <entry role="catalog_table_entry"><para role="column_definition">
1117       Column Type
1118      </para>
1119      <para>
1120       Description
1121      </para></entry>
1122     </row>
1123    </thead>
1124
1125    <tbody>
1126     <row>
1127      <entry role="catalog_table_entry"><para role="column_definition">
1128       <structfield>attrelid</structfield> <type>oid</type>
1129       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1130      </para>
1131      <para>
1132       The table this column belongs to
1133      </para></entry>
1134     </row>
1135
1136     <row>
1137      <entry role="catalog_table_entry"><para role="column_definition">
1138       <structfield>attname</structfield> <type>name</type>
1139      </para>
1140      <para>
1141       The column name
1142      </para></entry>
1143     </row>
1144
1145     <row>
1146      <entry role="catalog_table_entry"><para role="column_definition">
1147       <structfield>atttypid</structfield> <type>oid</type>
1148       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1149      </para>
1150      <para>
1151       The data type of this column
1152      </para></entry>
1153     </row>
1154
1155     <row>
1156      <entry role="catalog_table_entry"><para role="column_definition">
1157       <structfield>attstattarget</structfield> <type>int4</type>
1158      </para>
1159      <para>
1160       <structfield>attstattarget</structfield> controls the level of detail
1161       of statistics accumulated for this column by
1162       <xref linkend="sql-analyze"/>.
1163       A zero value indicates that no statistics should be collected.
1164       A negative value says to use the system default statistics target.
1165       The exact meaning of positive values is data type-dependent.
1166       For scalar data types, <structfield>attstattarget</structfield>
1167       is both the target number of <quote>most common values</quote>
1168       to collect, and the target number of histogram bins to create.
1169      </para></entry>
1170     </row>
1171
1172     <row>
1173      <entry role="catalog_table_entry"><para role="column_definition">
1174       <structfield>attlen</structfield> <type>int2</type>
1175      </para>
1176      <para>
1177       A copy of <literal>pg_type.typlen</literal> of this column's
1178       type
1179      </para></entry>
1180     </row>
1181
1182     <row>
1183      <entry role="catalog_table_entry"><para role="column_definition">
1184       <structfield>attnum</structfield> <type>int2</type>
1185      </para>
1186      <para>
1187       The number of the column.  Ordinary columns are numbered from 1
1188       up.  System columns, such as <structfield>ctid</structfield>,
1189       have (arbitrary) negative numbers.
1190      </para></entry>
1191     </row>
1192
1193     <row>
1194      <entry role="catalog_table_entry"><para role="column_definition">
1195       <structfield>attndims</structfield> <type>int4</type>
1196      </para>
1197      <para>
1198       Number of dimensions, if the column is an array type; otherwise 0.
1199       (Presently, the number of dimensions of an array is not enforced,
1200       so any nonzero value effectively means <quote>it's an array</quote>.)
1201      </para></entry>
1202     </row>
1203
1204     <row>
1205      <entry role="catalog_table_entry"><para role="column_definition">
1206       <structfield>attcacheoff</structfield> <type>int4</type>
1207      </para>
1208      <para>
1209       Always -1 in storage, but when loaded into a row descriptor
1210       in memory this might be updated to cache the offset of the attribute
1211       within the row
1212      </para></entry>
1213     </row>
1214
1215     <row>
1216      <entry role="catalog_table_entry"><para role="column_definition">
1217       <structfield>atttypmod</structfield> <type>int4</type>
1218      </para>
1219      <para>
1220       <structfield>atttypmod</structfield> records type-specific data
1221       supplied at table creation time (for example, the maximum
1222       length of a <type>varchar</type> column).  It is passed to
1223       type-specific input functions and length coercion functions.
1224       The value will generally be -1 for types that do not need <structfield>atttypmod</structfield>.
1225      </para></entry>
1226     </row>
1227
1228     <row>
1229      <entry role="catalog_table_entry"><para role="column_definition">
1230       <structfield>attbyval</structfield> <type>bool</type>
1231      </para>
1232      <para>
1233       A copy of <literal>pg_type.typbyval</literal> of this column's type
1234      </para></entry>
1235     </row>
1236
1237     <row>
1238      <entry role="catalog_table_entry"><para role="column_definition">
1239       <structfield>attstorage</structfield> <type>char</type>
1240      </para>
1241      <para>
1242       Normally a copy of <literal>pg_type.typstorage</literal> of this
1243       column's type.  For TOAST-able data types, this can be altered
1244       after column creation to control storage policy.
1245      </para></entry>
1246     </row>
1247
1248     <row>
1249      <entry role="catalog_table_entry"><para role="column_definition">
1250       <structfield>attalign</structfield> <type>char</type>
1251      </para>
1252      <para>
1253       A copy of <literal>pg_type.typalign</literal> of this column's type
1254      </para></entry>
1255     </row>
1256
1257     <row>
1258      <entry role="catalog_table_entry"><para role="column_definition">
1259       <structfield>attnotnull</structfield> <type>bool</type>
1260      </para>
1261      <para>
1262       This represents a not-null constraint.
1263      </para></entry>
1264     </row>
1265
1266     <row>
1267      <entry role="catalog_table_entry"><para role="column_definition">
1268       <structfield>atthasdef</structfield> <type>bool</type>
1269      </para>
1270      <para>
1271       This column has a default expression or generation expression, in which
1272       case there will be a corresponding entry in the
1273       <structname>pg_attrdef</structname> catalog that actually defines the
1274       expression.  (Check <structfield>attgenerated</structfield> to
1275       determine whether this is a default or a generation expression.)
1276      </para></entry>
1277     </row>
1278
1279     <row>
1280      <entry role="catalog_table_entry"><para role="column_definition">
1281       <structfield>atthasmissing</structfield> <type>bool</type>
1282      </para>
1283      <para>
1284       This column has a value which is used where the column is entirely
1285       missing from the row, as happens when a column is added with a
1286       non-volatile <literal>DEFAULT</literal> value after the row is created.
1287       The actual value used is stored in the
1288       <structfield>attmissingval</structfield> column.
1289      </para></entry>
1290     </row>
1291
1292     <row>
1293      <entry role="catalog_table_entry"><para role="column_definition">
1294       <structfield>attidentity</structfield> <type>char</type>
1295      </para>
1296      <para>
1297       If a zero byte (<literal>''</literal>), then not an identity column.
1298       Otherwise, <literal>a</literal> = generated
1299       always, <literal>d</literal> = generated by default.
1300      </para></entry>
1301     </row>
1302
1303     <row>
1304      <entry role="catalog_table_entry"><para role="column_definition">
1305       <structfield>attgenerated</structfield> <type>char</type>
1306      </para>
1307      <para>
1308       If a zero byte (<literal>''</literal>), then not a generated column.
1309       Otherwise, <literal>s</literal> = stored.  (Other values might be added
1310       in the future.)
1311      </para></entry>
1312     </row>
1313
1314     <row>
1315      <entry role="catalog_table_entry"><para role="column_definition">
1316       <structfield>attisdropped</structfield> <type>bool</type>
1317      </para>
1318      <para>
1319       This column has been dropped and is no longer valid.  A dropped
1320       column is still physically present in the table, but is
1321       ignored by the parser and so cannot be accessed via SQL.
1322      </para></entry>
1323     </row>
1324
1325     <row>
1326      <entry role="catalog_table_entry"><para role="column_definition">
1327       <structfield>attislocal</structfield> <type>bool</type>
1328      </para>
1329      <para>
1330       This column is defined locally in the relation.  Note that a column can
1331       be locally defined and inherited simultaneously.
1332      </para></entry>
1333     </row>
1334
1335     <row>
1336      <entry role="catalog_table_entry"><para role="column_definition">
1337       <structfield>attinhcount</structfield> <type>int4</type>
1338      </para>
1339      <para>
1340       The number of direct ancestors this column has.  A column with a
1341       nonzero number of ancestors cannot be dropped nor renamed.
1342      </para></entry>
1343     </row>
1344
1345     <row>
1346      <entry role="catalog_table_entry"><para role="column_definition">
1347       <structfield>attcollation</structfield> <type>oid</type>
1348       (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
1349      </para>
1350      <para>
1351       The defined collation of the column, or zero if the column is
1352       not of a collatable data type.
1353      </para></entry>
1354     </row>
1355
1356     <row>
1357      <entry role="catalog_table_entry"><para role="column_definition">
1358       <structfield>attacl</structfield> <type>aclitem[]</type>
1359      </para>
1360      <para>
1361       Column-level access privileges, if any have been granted specifically
1362       on this column
1363      </para></entry>
1364     </row>
1365
1366     <row>
1367      <entry role="catalog_table_entry"><para role="column_definition">
1368       <structfield>attoptions</structfield> <type>text[]</type>
1369      </para>
1370      <para>
1371       Attribute-level options, as <quote>keyword=value</quote> strings
1372      </para></entry>
1373     </row>
1374
1375     <row>
1376      <entry role="catalog_table_entry"><para role="column_definition">
1377       <structfield>attfdwoptions</structfield> <type>text[]</type>
1378      </para>
1379      <para>
1380       Attribute-level foreign data wrapper options, as <quote>keyword=value</quote> strings
1381      </para></entry>
1382     </row>
1383
1384     <row>
1385      <entry role="catalog_table_entry"><para role="column_definition">
1386       <structfield>attmissingval</structfield> <type>anyarray</type>
1387      </para>
1388      <para>
1389       This column has a one element array containing the value used when the
1390       column is entirely missing from the row, as happens when the column is
1391       added with a non-volatile <literal>DEFAULT</literal> value after the
1392       row is created.  The value is only used when
1393       <structfield>atthasmissing</structfield> is true.  If there is no value
1394       the column is null.
1395      </para></entry>
1396     </row>
1397    </tbody>
1398   </tgroup>
1399  </table>
1400
1401  <para>
1402   In a dropped column's <structname>pg_attribute</structname> entry,
1403   <structfield>atttypid</structfield> is reset to zero, but
1404   <structfield>attlen</structfield> and the other fields copied from
1405   <structname>pg_type</structname> are still valid.  This arrangement is needed
1406   to cope with the situation where the dropped column's data type was
1407   later dropped, and so there is no <structname>pg_type</structname> row anymore.
1408   <structfield>attlen</structfield> and the other fields can be used
1409   to interpret the contents of a row of the table.
1410  </para>
1411 </sect1>
1412
1413
1414 <sect1 id="catalog-pg-authid">
1415  <title><structname>pg_authid</structname></title>
1416
1417  <indexterm zone="catalog-pg-authid">
1418   <primary>pg_authid</primary>
1419  </indexterm>
1420
1421  <para>
1422   The catalog <structname>pg_authid</structname> contains information about
1423   database authorization identifiers (roles).  A role subsumes the concepts
1424   of <quote>users</quote> and <quote>groups</quote>.  A user is essentially just a
1425   role with the <structfield>rolcanlogin</structfield> flag set.  Any role (with or
1426   without <structfield>rolcanlogin</structfield>) can have other roles as members; see
1427   <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1428  </para>
1429
1430  <para>
1431   Since this catalog contains passwords, it must not be publicly readable.
1432   <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1433   is a publicly readable view on
1434   <structname>pg_authid</structname> that blanks out the password field.
1435  </para>
1436
1437  <para>
1438   <xref linkend="user-manag"/> contains detailed information about user and
1439   privilege management.
1440  </para>
1441
1442  <para>
1443   Because user identities are cluster-wide,
1444   <structname>pg_authid</structname>
1445   is shared across all databases of a cluster: there is only one
1446   copy of <structname>pg_authid</structname> per cluster, not
1447   one per database.
1448  </para>
1449
1450  <table>
1451   <title><structname>pg_authid</structname> Columns</title>
1452   <tgroup cols="1">
1453    <thead>
1454     <row>
1455      <entry role="catalog_table_entry"><para role="column_definition">
1456       Column Type
1457      </para>
1458      <para>
1459       Description
1460      </para></entry>
1461     </row>
1462    </thead>
1463
1464    <tbody>
1465     <row>
1466      <entry role="catalog_table_entry"><para role="column_definition">
1467       <structfield>oid</structfield> <type>oid</type>
1468      </para>
1469      <para>
1470       Row identifier
1471      </para></entry>
1472     </row>
1473
1474     <row>
1475      <entry role="catalog_table_entry"><para role="column_definition">
1476       <structfield>rolname</structfield> <type>name</type>
1477      </para>
1478      <para>
1479       Role name
1480      </para></entry>
1481     </row>
1482
1483     <row>
1484      <entry role="catalog_table_entry"><para role="column_definition">
1485       <structfield>rolsuper</structfield> <type>bool</type>
1486      </para>
1487      <para>
1488       Role has superuser privileges
1489      </para></entry>
1490     </row>
1491
1492     <row>
1493      <entry role="catalog_table_entry"><para role="column_definition">
1494       <structfield>rolinherit</structfield> <type>bool</type>
1495      </para>
1496      <para>
1497       Role automatically inherits privileges of roles it is a
1498       member of
1499      </para></entry>
1500     </row>
1501
1502     <row>
1503      <entry role="catalog_table_entry"><para role="column_definition">
1504       <structfield>rolcreaterole</structfield> <type>bool</type>
1505      </para>
1506      <para>
1507       Role can create more roles
1508      </para></entry>
1509     </row>
1510
1511     <row>
1512      <entry role="catalog_table_entry"><para role="column_definition">
1513       <structfield>rolcreatedb</structfield> <type>bool</type>
1514      </para>
1515      <para>
1516       Role can create databases
1517      </para></entry>
1518     </row>
1519
1520     <row>
1521      <entry role="catalog_table_entry"><para role="column_definition">
1522       <structfield>rolcanlogin</structfield> <type>bool</type>
1523      </para>
1524      <para>
1525       Role can log in. That is, this role can be given as the initial
1526       session authorization identifier.
1527      </para></entry>
1528     </row>
1529
1530     <row>
1531      <entry role="catalog_table_entry"><para role="column_definition">
1532       <structfield>rolreplication</structfield> <type>bool</type>
1533      </para>
1534      <para>
1535       Role is a replication role. A replication role can initiate replication
1536       connections and create and drop replication slots.
1537      </para></entry>
1538     </row>
1539
1540     <row>
1541      <entry role="catalog_table_entry"><para role="column_definition">
1542       <structfield>rolbypassrls</structfield> <type>bool</type>
1543      </para>
1544      <para>
1545       Role bypasses every row level security policy, see
1546       <xref linkend="ddl-rowsecurity"/> for more information.
1547      </para></entry>
1548     </row>
1549
1550     <row>
1551      <entry role="catalog_table_entry"><para role="column_definition">
1552       <structfield>rolconnlimit</structfield> <type>int4</type>
1553      </para>
1554      <para>
1555       For roles that can log in, this sets maximum number of concurrent
1556       connections this role can make.  -1 means no limit.
1557      </para></entry>
1558     </row>
1559
1560     <row>
1561      <entry role="catalog_table_entry"><para role="column_definition">
1562       <structfield>rolpassword</structfield> <type>text</type>
1563      </para>
1564      <para>
1565       Password (possibly encrypted); null if none. The format depends
1566       on the form of encryption used.
1567      </para></entry>
1568     </row>
1569
1570     <row>
1571      <entry role="catalog_table_entry"><para role="column_definition">
1572       <structfield>rolvaliduntil</structfield> <type>timestamptz</type>
1573      </para>
1574      <para>
1575       Password expiry time (only used for password authentication);
1576       null if no expiration
1577      </para></entry>
1578     </row>
1579    </tbody>
1580   </tgroup>
1581  </table>
1582
1583  <para>
1584   For an MD5 encrypted password, <structfield>rolpassword</structfield>
1585   column will begin with the string <literal>md5</literal> followed by a
1586   32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
1587   password concatenated to their user name. For example, if user
1588   <literal>joe</literal> has password <literal>xyzzy</literal>, <productname>PostgreSQL</productname>
1589   will store the md5 hash of <literal>xyzzyjoe</literal>.
1590  </para>
1591
1592  <para>
1593   If the password is encrypted with SCRAM-SHA-256, it has the format:
1594<synopsis>
1595SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&lt;salt&gt;</replaceable>$<replaceable>&lt;StoredKey&gt;</replaceable>:<replaceable>&lt;ServerKey&gt;</replaceable>
1596</synopsis>
1597   where <replaceable>salt</replaceable>, <replaceable>StoredKey</replaceable> and
1598   <replaceable>ServerKey</replaceable> are in Base64 encoded format. This format is
1599   the same as that specified by RFC 5803.
1600  </para>
1601
1602  <para>
1603    A password that does not follow either of those formats is assumed to be
1604    unencrypted.
1605  </para>
1606 </sect1>
1607
1608
1609 <sect1 id="catalog-pg-auth-members">
1610  <title><structname>pg_auth_members</structname></title>
1611
1612  <indexterm zone="catalog-pg-auth-members">
1613   <primary>pg_auth_members</primary>
1614  </indexterm>
1615
1616  <para>
1617   The catalog <structname>pg_auth_members</structname> shows the membership
1618   relations between roles.  Any non-circular set of relationships is allowed.
1619  </para>
1620
1621  <para>
1622   Because user identities are cluster-wide,
1623   <structname>pg_auth_members</structname>
1624   is shared across all databases of a cluster: there is only one
1625   copy of <structname>pg_auth_members</structname> per cluster, not
1626   one per database.
1627  </para>
1628
1629  <table>
1630   <title><structname>pg_auth_members</structname> Columns</title>
1631   <tgroup cols="1">
1632    <thead>
1633     <row>
1634      <entry role="catalog_table_entry"><para role="column_definition">
1635       Column Type
1636      </para>
1637      <para>
1638       Description
1639      </para></entry>
1640     </row>
1641    </thead>
1642
1643    <tbody>
1644     <row>
1645      <entry role="catalog_table_entry"><para role="column_definition">
1646       <structfield>roleid</structfield> <type>oid</type>
1647       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1648      </para>
1649      <para>
1650       ID of a role that has a member
1651      </para></entry>
1652     </row>
1653
1654     <row>
1655      <entry role="catalog_table_entry"><para role="column_definition">
1656       <structfield>member</structfield> <type>oid</type>
1657       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1658      </para>
1659      <para>
1660       ID of a role that is a member of <structfield>roleid</structfield>
1661      </para></entry>
1662     </row>
1663
1664     <row>
1665      <entry role="catalog_table_entry"><para role="column_definition">
1666       <structfield>grantor</structfield> <type>oid</type>
1667       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1668      </para>
1669      <para>
1670       ID of the role that granted this membership
1671      </para></entry>
1672     </row>
1673
1674     <row>
1675      <entry role="catalog_table_entry"><para role="column_definition">
1676       <structfield>admin_option</structfield> <type>bool</type>
1677      </para>
1678      <para>
1679       True if <structfield>member</structfield> can grant membership in
1680       <structfield>roleid</structfield> to others
1681      </para></entry>
1682     </row>
1683    </tbody>
1684   </tgroup>
1685  </table>
1686
1687 </sect1>
1688
1689
1690 <sect1 id="catalog-pg-cast">
1691  <title><structname>pg_cast</structname></title>
1692
1693  <indexterm zone="catalog-pg-cast">
1694   <primary>pg_cast</primary>
1695  </indexterm>
1696
1697  <para>
1698   The catalog <structname>pg_cast</structname> stores data type conversion
1699   paths, both built-in and user-defined.
1700  </para>
1701
1702  <para>
1703   It should be noted that <structname>pg_cast</structname> does not represent
1704   every type conversion that the system knows how to perform; only those that
1705   cannot be deduced from some generic rule.  For example, casting between a
1706   domain and its base type is not explicitly represented in
1707   <structname>pg_cast</structname>.  Another important exception is that
1708   <quote>automatic I/O conversion casts</quote>, those performed using a data
1709   type's own I/O functions to convert to or from <type>text</type> or other
1710   string types, are not explicitly represented in
1711   <structname>pg_cast</structname>.
1712  </para>
1713
1714  <table>
1715   <title><structname>pg_cast</structname> Columns</title>
1716   <tgroup cols="1">
1717    <thead>
1718     <row>
1719      <entry role="catalog_table_entry"><para role="column_definition">
1720       Column Type
1721      </para>
1722      <para>
1723       Description
1724      </para></entry>
1725     </row>
1726    </thead>
1727
1728    <tbody>
1729     <row>
1730      <entry role="catalog_table_entry"><para role="column_definition">
1731       <structfield>oid</structfield> <type>oid</type>
1732      </para>
1733      <para>
1734       Row identifier
1735      </para></entry>
1736     </row>
1737
1738     <row>
1739      <entry role="catalog_table_entry"><para role="column_definition">
1740       <structfield>castsource</structfield> <type>oid</type>
1741       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1742      </para>
1743      <para>
1744       OID of the source data type
1745      </para></entry>
1746     </row>
1747
1748     <row>
1749      <entry role="catalog_table_entry"><para role="column_definition">
1750       <structfield>casttarget</structfield> <type>oid</type>
1751       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1752      </para>
1753      <para>
1754       OID of the target data type
1755      </para></entry>
1756     </row>
1757
1758     <row>
1759      <entry role="catalog_table_entry"><para role="column_definition">
1760       <structfield>castfunc</structfield> <type>oid</type>
1761       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
1762      </para>
1763      <para>
1764       The OID of the function to use to perform this cast.  Zero is
1765       stored if the cast method doesn't require a function.
1766      </para></entry>
1767     </row>
1768
1769     <row>
1770      <entry role="catalog_table_entry"><para role="column_definition">
1771       <structfield>castcontext</structfield> <type>char</type>
1772      </para>
1773      <para>
1774       Indicates what contexts the cast can be invoked in.
1775       <literal>e</literal> means only as an explicit cast (using
1776       <literal>CAST</literal> or <literal>::</literal> syntax).
1777       <literal>a</literal> means implicitly in assignment
1778       to a target column, as well as explicitly.
1779       <literal>i</literal> means implicitly in expressions, as well as the
1780       other cases.
1781      </para></entry>
1782     </row>
1783
1784     <row>
1785      <entry role="catalog_table_entry"><para role="column_definition">
1786       <structfield>castmethod</structfield> <type>char</type>
1787      </para>
1788      <para>
1789       Indicates how the cast is performed.
1790       <literal>f</literal> means that the function specified in the <structfield>castfunc</structfield> field is used.
1791       <literal>i</literal> means that the input/output functions are used.
1792       <literal>b</literal> means that the types are binary-coercible, thus no conversion is required.
1793      </para></entry>
1794     </row>
1795    </tbody>
1796   </tgroup>
1797  </table>
1798
1799  <para>
1800   The cast functions listed in <structname>pg_cast</structname> must
1801   always take the cast source type as their first argument type, and
1802   return the cast destination type as their result type.  A cast
1803   function can have up to three arguments.  The second argument,
1804   if present, must be type <type>integer</type>; it receives the type
1805   modifier associated with the destination type, or -1
1806   if there is none.  The third argument,
1807   if present, must be type <type>boolean</type>; it receives <literal>true</literal>
1808   if the cast is an explicit cast, <literal>false</literal> otherwise.
1809  </para>
1810
1811  <para>
1812   It is legitimate to create a <structname>pg_cast</structname> entry
1813   in which the source and target types are the same, if the associated
1814   function takes more than one argument.  Such entries represent
1815   <quote>length coercion functions</quote> that coerce values of the type
1816   to be legal for a particular type modifier value.
1817  </para>
1818
1819  <para>
1820   When a <structname>pg_cast</structname> entry has different source and
1821   target types and a function that takes more than one argument, it
1822   represents converting from one type to another and applying a length
1823   coercion in a single step.  When no such entry is available, coercion
1824   to a type that uses a type modifier involves two steps, one to
1825   convert between data types and a second to apply the modifier.
1826  </para>
1827 </sect1>
1828
1829 <sect1 id="catalog-pg-class">
1830  <title><structname>pg_class</structname></title>
1831
1832  <indexterm zone="catalog-pg-class">
1833   <primary>pg_class</primary>
1834  </indexterm>
1835
1836  <para>
1837   The catalog <structname>pg_class</structname> catalogs tables and most
1838   everything else that has columns or is otherwise similar to a
1839   table.  This includes indexes (but see also
1840   <structname>pg_index</structname>), sequences (but see also
1841   <structname>pg_sequence</structname>), views, materialized
1842   views, composite types, and TOAST tables; see <structfield>relkind</structfield>.
1843   Below, when we mean all of these
1844   kinds of objects we speak of <quote>relations</quote>.  Not all
1845   columns are meaningful for all relation types.
1846  </para>
1847
1848  <table>
1849   <title><structname>pg_class</structname> Columns</title>
1850   <tgroup cols="1">
1851    <thead>
1852     <row>
1853      <entry role="catalog_table_entry"><para role="column_definition">
1854       Column Type
1855      </para>
1856      <para>
1857       Description
1858      </para></entry>
1859     </row>
1860    </thead>
1861
1862    <tbody>
1863     <row>
1864      <entry role="catalog_table_entry"><para role="column_definition">
1865       <structfield>oid</structfield> <type>oid</type>
1866      </para>
1867      <para>
1868       Row identifier
1869      </para></entry>
1870     </row>
1871
1872     <row>
1873      <entry role="catalog_table_entry"><para role="column_definition">
1874       <structfield>relname</structfield> <type>name</type>
1875      </para>
1876      <para>
1877       Name of the table, index, view, etc.
1878      </para></entry>
1879     </row>
1880
1881     <row>
1882      <entry role="catalog_table_entry"><para role="column_definition">
1883       <structfield>relnamespace</structfield> <type>oid</type>
1884       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
1885      </para>
1886      <para>
1887       The OID of the namespace that contains this relation
1888      </para></entry>
1889     </row>
1890
1891     <row>
1892      <entry role="catalog_table_entry"><para role="column_definition">
1893       <structfield>reltype</structfield> <type>oid</type>
1894       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1895      </para>
1896      <para>
1897       The OID of the data type that corresponds to this table's row type,
1898       if any (zero for indexes, which have no <structname>pg_type</structname> entry)
1899      </para></entry>
1900     </row>
1901
1902     <row>
1903      <entry role="catalog_table_entry"><para role="column_definition">
1904       <structfield>reloftype</structfield> <type>oid</type>
1905       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
1906      </para>
1907      <para>
1908       For typed tables, the OID of the underlying composite type,
1909       zero for all other relations
1910      </para></entry>
1911     </row>
1912
1913     <row>
1914      <entry role="catalog_table_entry"><para role="column_definition">
1915       <structfield>relowner</structfield> <type>oid</type>
1916       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
1917      </para>
1918      <para>
1919       Owner of the relation
1920      </para></entry>
1921     </row>
1922
1923     <row>
1924      <entry role="catalog_table_entry"><para role="column_definition">
1925       <structfield>relam</structfield> <type>oid</type>
1926       (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
1927      </para>
1928      <para>
1929       If this is a table or an index, the access method used (heap,
1930       B-tree, hash, etc.)
1931      </para></entry>
1932     </row>
1933
1934     <row>
1935      <entry role="catalog_table_entry"><para role="column_definition">
1936       <structfield>relfilenode</structfield> <type>oid</type>
1937      </para>
1938      <para>
1939       Name of the on-disk file of this relation; zero means this
1940       is a <quote>mapped</quote> relation whose disk file name is determined
1941       by low-level state
1942      </para></entry>
1943     </row>
1944
1945     <row>
1946      <entry role="catalog_table_entry"><para role="column_definition">
1947       <structfield>reltablespace</structfield> <type>oid</type>
1948       (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>oid</structfield>)
1949      </para>
1950      <para>
1951       The tablespace in which this relation is stored.  If zero,
1952       the database's default tablespace is implied.  (Not meaningful
1953       if the relation has no on-disk file.)
1954      </para></entry>
1955     </row>
1956
1957     <row>
1958      <entry role="catalog_table_entry"><para role="column_definition">
1959       <structfield>relpages</structfield> <type>int4</type>
1960      </para>
1961      <para>
1962       Size of the on-disk representation of this table in pages (of size
1963       <symbol>BLCKSZ</symbol>).  This is only an estimate used by the
1964       planner.  It is updated by <command>VACUUM</command>,
1965       <command>ANALYZE</command>, and a few DDL commands such as
1966       <command>CREATE INDEX</command>.
1967      </para></entry>
1968     </row>
1969
1970     <row>
1971      <entry role="catalog_table_entry"><para role="column_definition">
1972       <structfield>reltuples</structfield> <type>float4</type>
1973      </para>
1974      <para>
1975       Number of live rows in the table.  This is only an estimate used by
1976       the planner.  It is updated by <command>VACUUM</command>,
1977       <command>ANALYZE</command>, and a few DDL commands such as
1978       <command>CREATE INDEX</command>.
1979      </para></entry>
1980     </row>
1981
1982     <row>
1983      <entry role="catalog_table_entry"><para role="column_definition">
1984       <structfield>relallvisible</structfield> <type>int4</type>
1985      </para>
1986      <para>
1987       Number of pages that are marked all-visible in the table's
1988       visibility map.  This is only an estimate used by the
1989       planner.  It is updated by <command>VACUUM</command>,
1990       <command>ANALYZE</command>, and a few DDL commands such as
1991       <command>CREATE INDEX</command>.
1992      </para></entry>
1993     </row>
1994
1995     <row>
1996      <entry role="catalog_table_entry"><para role="column_definition">
1997       <structfield>reltoastrelid</structfield> <type>oid</type>
1998       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
1999      </para>
2000      <para>
2001       OID of the TOAST table associated with this table, 0 if none.  The
2002       TOAST table stores large attributes <quote>out of line</quote> in a
2003       secondary table.
2004      </para></entry>
2005     </row>
2006
2007     <row>
2008      <entry role="catalog_table_entry"><para role="column_definition">
2009       <structfield>relhasindex</structfield> <type>bool</type>
2010      </para>
2011      <para>
2012       True if this is a table and it has (or recently had) any indexes
2013      </para></entry>
2014     </row>
2015
2016     <row>
2017      <entry role="catalog_table_entry"><para role="column_definition">
2018       <structfield>relisshared</structfield> <type>bool</type>
2019      </para>
2020      <para>
2021       True if this table is shared across all databases in the cluster.  Only
2022       certain system catalogs (such as <structname>pg_database</structname>)
2023       are shared.
2024      </para></entry>
2025     </row>
2026
2027     <row>
2028      <entry role="catalog_table_entry"><para role="column_definition">
2029       <structfield>relpersistence</structfield> <type>char</type>
2030      </para>
2031      <para>
2032       <literal>p</literal> = permanent table, <literal>u</literal> = unlogged table,
2033       <literal>t</literal> = temporary table
2034      </para></entry>
2035     </row>
2036
2037     <row>
2038      <entry role="catalog_table_entry"><para role="column_definition">
2039       <structfield>relkind</structfield> <type>char</type>
2040      </para>
2041      <para>
2042       <literal>r</literal> = ordinary table,
2043       <literal>i</literal> = index,
2044       <literal>S</literal> = sequence,
2045       <literal>t</literal> = TOAST table,
2046       <literal>v</literal> = view,
2047       <literal>m</literal> = materialized view,
2048       <literal>c</literal> = composite type,
2049       <literal>f</literal> = foreign table,
2050       <literal>p</literal> = partitioned table,
2051       <literal>I</literal> = partitioned index
2052      </para></entry>
2053     </row>
2054
2055     <row>
2056      <entry role="catalog_table_entry"><para role="column_definition">
2057       <structfield>relnatts</structfield> <type>int2</type>
2058      </para>
2059      <para>
2060       Number of user columns in the relation (system columns not
2061       counted).  There must be this many corresponding entries in
2062       <structname>pg_attribute</structname>.  See also
2063       <literal>pg_attribute.attnum</literal>.
2064      </para></entry>
2065     </row>
2066
2067     <row>
2068      <entry role="catalog_table_entry"><para role="column_definition">
2069       <structfield>relchecks</structfield> <type>int2</type>
2070      </para>
2071      <para>
2072       Number of <literal>CHECK</literal> constraints on the table; see
2073       <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
2074      </para></entry>
2075     </row>
2076
2077     <row>
2078      <entry role="catalog_table_entry"><para role="column_definition">
2079       <structfield>relhasrules</structfield> <type>bool</type>
2080      </para>
2081      <para>
2082       True if table has (or once had) rules; see
2083       <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
2084      </para></entry>
2085     </row>
2086
2087     <row>
2088      <entry role="catalog_table_entry"><para role="column_definition">
2089       <structfield>relhastriggers</structfield> <type>bool</type>
2090      </para>
2091      <para>
2092       True if table has (or once had) triggers; see
2093       <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
2094      </para></entry>
2095     </row>
2096
2097     <row>
2098      <entry role="catalog_table_entry"><para role="column_definition">
2099       <structfield>relhassubclass</structfield> <type>bool</type>
2100      </para>
2101      <para>
2102       True if table or index has (or once had) any inheritance children
2103      </para></entry>
2104     </row>
2105
2106     <row>
2107      <entry role="catalog_table_entry"><para role="column_definition">
2108       <structfield>relrowsecurity</structfield> <type>bool</type>
2109      </para>
2110      <para>
2111       True if table has row level security enabled; see
2112       <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
2113      </para></entry>
2114     </row>
2115
2116     <row>
2117      <entry role="catalog_table_entry"><para role="column_definition">
2118       <structfield>relforcerowsecurity</structfield> <type>bool</type>
2119      </para>
2120      <para>
2121       True if row level security (when enabled) will also apply to table owner; see
2122       <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link> catalog
2123      </para></entry>
2124     </row>
2125
2126     <row>
2127      <entry role="catalog_table_entry"><para role="column_definition">
2128       <structfield>relispopulated</structfield> <type>bool</type>
2129      </para>
2130      <para>
2131       True if relation is populated (this is true for all
2132       relations other than some materialized views)
2133      </para></entry>
2134     </row>
2135
2136     <row>
2137      <entry role="catalog_table_entry"><para role="column_definition">
2138       <structfield>relreplident</structfield> <type>char</type>
2139      </para>
2140      <para>
2141       Columns used to form <quote>replica identity</quote> for rows:
2142       <literal>d</literal> = default (primary key, if any),
2143       <literal>n</literal> = nothing,
2144       <literal>f</literal> = all columns,
2145       <literal>i</literal> = index with
2146       <structfield>indisreplident</structfield> set (same as nothing if the
2147       index used has been dropped)
2148      </para></entry>
2149     </row>
2150
2151     <row>
2152      <entry role="catalog_table_entry"><para role="column_definition">
2153       <structfield>relispartition</structfield> <type>bool</type>
2154      </para>
2155      <para>
2156       True if table or index is a partition
2157      </para></entry>
2158     </row>
2159
2160     <row>
2161      <entry role="catalog_table_entry"><para role="column_definition">
2162       <structfield>relrewrite</structfield> <type>oid</type>
2163       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2164      </para>
2165      <para>
2166       For new relations being written during a DDL operation that requires a
2167       table rewrite, this contains the OID of the original relation;
2168       otherwise 0.  That state is only visible internally; this field should
2169       never contain anything other than 0 for a user-visible relation.
2170      </para></entry>
2171     </row>
2172
2173     <row>
2174      <entry role="catalog_table_entry"><para role="column_definition">
2175       <structfield>relfrozenxid</structfield> <type>xid</type>
2176      </para>
2177      <para>
2178       All transaction IDs before this one have been replaced with a permanent
2179       (<quote>frozen</quote>) transaction ID in this table.  This is used to track
2180       whether the table needs to be vacuumed in order to prevent transaction
2181       ID wraparound or to allow <literal>pg_xact</literal> to be shrunk.  Zero
2182       (<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
2183      </para></entry>
2184     </row>
2185
2186     <row>
2187      <entry role="catalog_table_entry"><para role="column_definition">
2188       <structfield>relminmxid</structfield> <type>xid</type>
2189      </para>
2190      <para>
2191       All multixact IDs before this one have been replaced by a
2192       transaction ID in this table.  This is used to track
2193       whether the table needs to be vacuumed in order to prevent multixact ID
2194       wraparound or to allow <literal>pg_multixact</literal> to be shrunk.  Zero
2195       (<symbol>InvalidMultiXactId</symbol>) if the relation is not a table.
2196      </para></entry>
2197     </row>
2198
2199     <row>
2200      <entry role="catalog_table_entry"><para role="column_definition">
2201       <structfield>relacl</structfield> <type>aclitem[]</type>
2202      </para>
2203      <para>
2204       Access privileges; see <xref linkend="ddl-priv"/> for details
2205      </para></entry>
2206     </row>
2207
2208     <row>
2209      <entry role="catalog_table_entry"><para role="column_definition">
2210       <structfield>reloptions</structfield> <type>text[]</type>
2211      </para>
2212      <para>
2213       Access-method-specific options, as <quote>keyword=value</quote> strings
2214      </para></entry>
2215     </row>
2216
2217     <row>
2218      <entry role="catalog_table_entry"><para role="column_definition">
2219       <structfield>relpartbound</structfield> <type>pg_node_tree</type>
2220      </para>
2221      <para>
2222       If table is a partition (see <structfield>relispartition</structfield>),
2223       internal representation of the partition bound
2224      </para></entry>
2225     </row>
2226    </tbody>
2227   </tgroup>
2228  </table>
2229
2230  <para>
2231   Several of the Boolean flags in <structname>pg_class</structname> are maintained
2232   lazily: they are guaranteed to be true if that's the correct state, but
2233   may not be reset to false immediately when the condition is no longer
2234   true.  For example, <structfield>relhasindex</structfield> is set by
2235   <command>CREATE INDEX</command>, but it is never cleared by
2236   <command>DROP INDEX</command>.  Instead, <command>VACUUM</command> clears
2237   <structfield>relhasindex</structfield> if it finds the table has no indexes.  This
2238   arrangement avoids race conditions and improves concurrency.
2239  </para>
2240 </sect1>
2241
2242 <sect1 id="catalog-pg-collation">
2243  <title><structname>pg_collation</structname></title>
2244
2245  <indexterm zone="catalog-pg-collation">
2246   <primary>pg_collation</primary>
2247  </indexterm>
2248
2249  <para>
2250   The catalog <structname>pg_collation</structname> describes the
2251   available collations, which are essentially mappings from an SQL
2252   name to operating system locale categories.
2253   See <xref linkend="collation"/> for more information.
2254  </para>
2255
2256  <table>
2257   <title><structname>pg_collation</structname> Columns</title>
2258   <tgroup cols="1">
2259    <thead>
2260     <row>
2261      <entry role="catalog_table_entry"><para role="column_definition">
2262       Column Type
2263      </para>
2264      <para>
2265       Description
2266      </para></entry>
2267     </row>
2268    </thead>
2269
2270    <tbody>
2271     <row>
2272      <entry role="catalog_table_entry"><para role="column_definition">
2273       <structfield>oid</structfield> <type>oid</type>
2274      </para>
2275      <para>
2276       Row identifier
2277      </para></entry>
2278     </row>
2279
2280     <row>
2281      <entry role="catalog_table_entry"><para role="column_definition">
2282       <structfield>collname</structfield> <type>name</type>
2283      </para>
2284      <para>
2285       Collation name (unique per namespace and encoding)
2286      </para></entry>
2287     </row>
2288
2289     <row>
2290      <entry role="catalog_table_entry"><para role="column_definition">
2291       <structfield>collnamespace</structfield> <type>oid</type>
2292       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2293      </para>
2294      <para>
2295       The OID of the namespace that contains this collation
2296      </para></entry>
2297     </row>
2298
2299     <row>
2300      <entry role="catalog_table_entry"><para role="column_definition">
2301       <structfield>collowner</structfield> <type>oid</type>
2302       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
2303      </para>
2304      <para>
2305       Owner of the collation
2306      </para></entry>
2307     </row>
2308
2309     <row>
2310      <entry role="catalog_table_entry"><para role="column_definition">
2311       <structfield>collprovider</structfield> <type>char</type>
2312      </para>
2313      <para>
2314       Provider of the collation: <literal>d</literal> = database
2315       default, <literal>c</literal> = libc, <literal>i</literal> = icu
2316      </para></entry>
2317     </row>
2318
2319     <row>
2320      <entry role="catalog_table_entry"><para role="column_definition">
2321       <structfield>collisdeterministic</structfield> <type>bool</type>
2322      </para>
2323      <para>
2324       Is the collation deterministic?
2325      </para></entry>
2326     </row>
2327
2328     <row>
2329      <entry role="catalog_table_entry"><para role="column_definition">
2330       <structfield>collencoding</structfield> <type>int4</type>
2331      </para>
2332      <para>
2333       Encoding in which the collation is applicable, or -1 if it
2334       works for any encoding
2335      </para></entry>
2336     </row>
2337
2338     <row>
2339      <entry role="catalog_table_entry"><para role="column_definition">
2340       <structfield>collcollate</structfield> <type>name</type>
2341      </para>
2342      <para>
2343       <symbol>LC_COLLATE</symbol> for this collation object
2344      </para></entry>
2345     </row>
2346
2347     <row>
2348      <entry role="catalog_table_entry"><para role="column_definition">
2349       <structfield>collctype</structfield> <type>name</type>
2350      </para>
2351      <para>
2352       <symbol>LC_CTYPE</symbol> for this collation object
2353      </para></entry>
2354     </row>
2355
2356     <row>
2357      <entry role="catalog_table_entry"><para role="column_definition">
2358       <structfield>collversion</structfield> <type>text</type>
2359      </para>
2360      <para>
2361       Provider-specific version of the collation.  This is recorded when the
2362       collation is created and then checked when it is used, to detect
2363       changes in the collation definition that could lead to data corruption.
2364      </para></entry>
2365     </row>
2366    </tbody>
2367   </tgroup>
2368  </table>
2369
2370  <para>
2371   Note that the unique key on this catalog is (<structfield>collname</structfield>,
2372   <structfield>collencoding</structfield>, <structfield>collnamespace</structfield>) not just
2373   (<structfield>collname</structfield>, <structfield>collnamespace</structfield>).
2374   <productname>PostgreSQL</productname> generally ignores all
2375   collations that do not have <structfield>collencoding</structfield> equal to
2376   either the current database's encoding or -1, and creation of new entries
2377   with the same name as an entry with <structfield>collencoding</structfield> = -1
2378   is forbidden.  Therefore it is sufficient to use a qualified SQL name
2379   (<replaceable>schema</replaceable>.<replaceable>name</replaceable>) to identify a collation,
2380   even though this is not unique according to the catalog definition.
2381   The reason for defining the catalog this way is that
2382   <application>initdb</application> fills it in at cluster initialization time with
2383   entries for all locales available on the system, so it must be able to
2384   hold entries for all encodings that might ever be used in the cluster.
2385  </para>
2386
2387  <para>
2388   In the <literal>template0</literal> database, it could be useful to create
2389   collations whose encoding does not match the database encoding,
2390   since they could match the encodings of databases later cloned from
2391   <literal>template0</literal>.  This would currently have to be done manually.
2392  </para>
2393 </sect1>
2394
2395 <sect1 id="catalog-pg-constraint">
2396  <title><structname>pg_constraint</structname></title>
2397
2398  <indexterm zone="catalog-pg-constraint">
2399   <primary>pg_constraint</primary>
2400  </indexterm>
2401
2402  <para>
2403   The catalog <structname>pg_constraint</structname> stores check, primary
2404   key, unique, foreign key, and exclusion constraints on tables.
2405   (Column constraints are not treated specially.  Every column constraint is
2406   equivalent to some table constraint.)
2407   Not-null constraints are represented in the <structname>pg_attribute</structname>
2408   catalog, not here.
2409  </para>
2410
2411  <para>
2412   User-defined constraint triggers (created with <command>CREATE CONSTRAINT
2413   TRIGGER</command>) also give rise to an entry in this table.
2414  </para>
2415
2416  <para>
2417   Check constraints on domains are stored here, too.
2418  </para>
2419
2420  <table>
2421   <title><structname>pg_constraint</structname> Columns</title>
2422   <tgroup cols="1">
2423    <thead>
2424     <row>
2425      <entry role="catalog_table_entry"><para role="column_definition">
2426       Column Type
2427      </para>
2428      <para>
2429       Description
2430      </para></entry>
2431     </row>
2432    </thead>
2433
2434    <tbody>
2435     <row>
2436      <entry role="catalog_table_entry"><para role="column_definition">
2437       <structfield>oid</structfield> <type>oid</type>
2438      </para>
2439      <para>
2440       Row identifier
2441      </para></entry>
2442     </row>
2443
2444     <row>
2445      <entry role="catalog_table_entry"><para role="column_definition">
2446       <structfield>conname</structfield> <type>name</type>
2447      </para>
2448      <para>
2449       Constraint name (not necessarily unique!)
2450      </para></entry>
2451     </row>
2452
2453     <row>
2454      <entry role="catalog_table_entry"><para role="column_definition">
2455       <structfield>connamespace</structfield> <type>oid</type>
2456       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2457      </para>
2458      <para>
2459       The OID of the namespace that contains this constraint
2460      </para></entry>
2461     </row>
2462
2463     <row>
2464      <entry role="catalog_table_entry"><para role="column_definition">
2465       <structfield>contype</structfield> <type>char</type>
2466      </para>
2467      <para>
2468       <literal>c</literal> = check constraint,
2469       <literal>f</literal> = foreign key constraint,
2470       <literal>p</literal> = primary key constraint,
2471       <literal>u</literal> = unique constraint,
2472       <literal>t</literal> = constraint trigger,
2473       <literal>x</literal> = exclusion constraint
2474      </para></entry>
2475     </row>
2476
2477     <row>
2478      <entry role="catalog_table_entry"><para role="column_definition">
2479       <structfield>condeferrable</structfield> <type>bool</type>
2480      </para>
2481      <para>
2482       Is the constraint deferrable?
2483      </para></entry>
2484     </row>
2485
2486     <row>
2487      <entry role="catalog_table_entry"><para role="column_definition">
2488       <structfield>condeferred</structfield> <type>bool</type>
2489      </para>
2490      <para>
2491       Is the constraint deferred by default?
2492      </para></entry>
2493     </row>
2494
2495     <row>
2496      <entry role="catalog_table_entry"><para role="column_definition">
2497       <structfield>convalidated</structfield> <type>bool</type>
2498      </para>
2499      <para>
2500       Has the constraint been validated?
2501       Currently, can only be false for foreign keys and CHECK constraints
2502      </para></entry>
2503     </row>
2504
2505     <row>
2506      <entry role="catalog_table_entry"><para role="column_definition">
2507       <structfield>conrelid</structfield> <type>oid</type>
2508       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2509      </para>
2510      <para>
2511       The table this constraint is on; 0 if not a table constraint
2512      </para></entry>
2513     </row>
2514
2515     <row>
2516      <entry role="catalog_table_entry"><para role="column_definition">
2517       <structfield>contypid</structfield> <type>oid</type>
2518       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
2519      </para>
2520      <para>
2521       The domain this constraint is on; 0 if not a domain constraint
2522      </para></entry>
2523     </row>
2524
2525     <row>
2526      <entry role="catalog_table_entry"><para role="column_definition">
2527       <structfield>conindid</structfield> <type>oid</type>
2528       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2529      </para>
2530      <para>
2531       The index supporting this constraint, if it's a unique, primary
2532       key, foreign key, or exclusion constraint; else 0
2533      </para></entry>
2534     </row>
2535
2536     <row>
2537      <entry role="catalog_table_entry"><para role="column_definition">
2538       <structfield>conparentid</structfield> <type>oid</type>
2539       (references <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.<structfield>oid</structfield>)
2540      </para>
2541      <para>
2542       The corresponding constraint in the parent partitioned table,
2543       if this is a constraint in a partition; else 0
2544      </para></entry>
2545     </row>
2546
2547     <row>
2548      <entry role="catalog_table_entry"><para role="column_definition">
2549       <structfield>confrelid</structfield> <type>oid</type>
2550       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
2551      </para>
2552      <para>
2553       If a foreign key, the referenced table; else 0
2554      </para></entry>
2555     </row>
2556
2557     <row>
2558      <entry role="catalog_table_entry"><para role="column_definition">
2559       <structfield>confupdtype</structfield> <type>char</type>
2560      </para>
2561      <para>
2562       Foreign key update action code:
2563       <literal>a</literal> = no action,
2564       <literal>r</literal> = restrict,
2565       <literal>c</literal> = cascade,
2566       <literal>n</literal> = set null,
2567       <literal>d</literal> = set default
2568      </para></entry>
2569     </row>
2570
2571     <row>
2572      <entry role="catalog_table_entry"><para role="column_definition">
2573       <structfield>confdeltype</structfield> <type>char</type>
2574      </para>
2575      <para>
2576       Foreign key deletion action code:
2577       <literal>a</literal> = no action,
2578       <literal>r</literal> = restrict,
2579       <literal>c</literal> = cascade,
2580       <literal>n</literal> = set null,
2581       <literal>d</literal> = set default
2582      </para></entry>
2583     </row>
2584
2585     <row>
2586      <entry role="catalog_table_entry"><para role="column_definition">
2587       <structfield>confmatchtype</structfield> <type>char</type>
2588      </para>
2589      <para>
2590       Foreign key match type:
2591       <literal>f</literal> = full,
2592       <literal>p</literal> = partial,
2593       <literal>s</literal> = simple
2594      </para></entry>
2595     </row>
2596
2597     <row>
2598      <entry role="catalog_table_entry"><para role="column_definition">
2599       <structfield>conislocal</structfield> <type>bool</type>
2600      </para>
2601      <para>
2602       This constraint is defined locally for the relation.  Note that a
2603       constraint can be locally defined and inherited simultaneously.
2604      </para></entry>
2605     </row>
2606
2607     <row>
2608      <entry role="catalog_table_entry"><para role="column_definition">
2609       <structfield>coninhcount</structfield> <type>int4</type>
2610      </para>
2611      <para>
2612       The number of direct inheritance ancestors this constraint has.
2613       A constraint with
2614       a nonzero number of ancestors cannot be dropped nor renamed.
2615      </para></entry>
2616     </row>
2617
2618     <row>
2619      <entry role="catalog_table_entry"><para role="column_definition">
2620       <structfield>connoinherit</structfield> <type>bool</type>
2621      </para>
2622      <para>
2623       This constraint is defined locally for the relation.  It is a
2624       non-inheritable constraint.
2625      </para></entry>
2626     </row>
2627
2628     <row>
2629      <entry role="catalog_table_entry"><para role="column_definition">
2630       <structfield>conkey</structfield> <type>int2[]</type>
2631       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
2632      </para>
2633      <para>
2634       If a table constraint (including foreign keys, but not constraint
2635       triggers), list of the constrained columns
2636      </para></entry>
2637     </row>
2638
2639     <row>
2640      <entry role="catalog_table_entry"><para role="column_definition">
2641       <structfield>confkey</structfield> <type>int2[]</type>
2642       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
2643      </para>
2644      <para>
2645       If a foreign key, list of the referenced columns
2646      </para></entry>
2647     </row>
2648
2649     <row>
2650      <entry role="catalog_table_entry"><para role="column_definition">
2651       <structfield>conpfeqop</structfield> <type>oid[]</type>
2652       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2653      </para>
2654      <para>
2655       If a foreign key, list of the equality operators for PK = FK comparisons
2656      </para></entry>
2657     </row>
2658
2659     <row>
2660      <entry role="catalog_table_entry"><para role="column_definition">
2661       <structfield>conppeqop</structfield> <type>oid[]</type>
2662       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2663      </para>
2664      <para>
2665       If a foreign key, list of the equality operators for PK = PK comparisons
2666      </para></entry>
2667     </row>
2668
2669     <row>
2670      <entry role="catalog_table_entry"><para role="column_definition">
2671       <structfield>conffeqop</structfield> <type>oid[]</type>
2672       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2673      </para>
2674      <para>
2675       If a foreign key, list of the equality operators for FK = FK comparisons
2676      </para></entry>
2677     </row>
2678
2679     <row>
2680      <entry role="catalog_table_entry"><para role="column_definition">
2681       <structfield>conexclop</structfield> <type>oid[]</type>
2682       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
2683      </para>
2684      <para>
2685       If an exclusion constraint, list of the per-column exclusion operators
2686      </para></entry>
2687     </row>
2688
2689     <row>
2690      <entry role="catalog_table_entry"><para role="column_definition">
2691       <structfield>conbin</structfield> <type>pg_node_tree</type>
2692      </para>
2693      <para>
2694       If a check constraint, an internal representation of the
2695       expression.  (It's recommended to use
2696       <function>pg_get_constraintdef()</function> to extract the definition of
2697       a check constraint.)
2698      </para></entry>
2699     </row>
2700    </tbody>
2701   </tgroup>
2702  </table>
2703
2704  <para>
2705   In the case of an exclusion constraint, <structfield>conkey</structfield>
2706   is only useful for constraint elements that are simple column references.
2707   For other cases, a zero appears in <structfield>conkey</structfield>
2708   and the associated index must be consulted to discover the expression
2709   that is constrained.  (<structfield>conkey</structfield> thus has the
2710   same contents as <structname>pg_index</structname>.<structfield>indkey</structfield> for the
2711   index.)
2712  </para>
2713
2714  <note>
2715   <para>
2716    <literal>pg_class.relchecks</literal> needs to agree with the
2717    number of check-constraint entries found in this table for each
2718    relation.
2719   </para>
2720  </note>
2721 </sect1>
2722
2723
2724 <sect1 id="catalog-pg-conversion">
2725  <title><structname>pg_conversion</structname></title>
2726
2727  <indexterm zone="catalog-pg-conversion">
2728   <primary>pg_conversion</primary>
2729  </indexterm>
2730
2731  <para>
2732   The catalog <structname>pg_conversion</structname> describes
2733   encoding conversion functions.  See <xref linkend="sql-createconversion"/>
2734   for more information.
2735  </para>
2736
2737  <table>
2738   <title><structname>pg_conversion</structname> Columns</title>
2739   <tgroup cols="1">
2740    <thead>
2741     <row>
2742      <entry role="catalog_table_entry"><para role="column_definition">
2743       Column Type
2744      </para>
2745      <para>
2746       Description
2747      </para></entry>
2748     </row>
2749    </thead>
2750
2751    <tbody>
2752     <row>
2753      <entry role="catalog_table_entry"><para role="column_definition">
2754       <structfield>oid</structfield> <type>oid</type>
2755      </para>
2756      <para>
2757       Row identifier
2758      </para></entry>
2759     </row>
2760
2761     <row>
2762      <entry role="catalog_table_entry"><para role="column_definition">
2763       <structfield>conname</structfield> <type>name</type>
2764      </para>
2765      <para>
2766       Conversion name (unique within a namespace)
2767      </para></entry>
2768     </row>
2769
2770     <row>
2771      <entry role="catalog_table_entry"><para role="column_definition">
2772       <structfield>connamespace</structfield> <type>oid</type>
2773       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
2774      </para>
2775      <para>
2776       The OID of the namespace that contains this conversion
2777      </para></entry>
2778     </row>
2779
2780     <row>
2781      <entry role="catalog_table_entry"><para role="column_definition">
2782       <structfield>conowner</structfield> <type>oid</type>
2783       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
2784      </para>
2785      <para>
2786       Owner of the conversion
2787      </para></entry>
2788     </row>
2789
2790     <row>
2791      <entry role="catalog_table_entry"><para role="column_definition">
2792       <structfield>conforencoding</structfield> <type>int4</type>
2793      </para>
2794      <para>
2795       Source encoding ID
2796      </para></entry>
2797     </row>
2798
2799     <row>
2800      <entry role="catalog_table_entry"><para role="column_definition">
2801       <structfield>contoencoding</structfield> <type>int4</type>
2802      </para>
2803      <para>
2804       Destination encoding ID
2805      </para></entry>
2806     </row>
2807
2808     <row>
2809      <entry role="catalog_table_entry"><para role="column_definition">
2810       <structfield>conproc</structfield> <type>regproc</type>
2811       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
2812      </para>
2813      <para>
2814       Conversion function
2815      </para></entry>
2816     </row>
2817
2818     <row>
2819      <entry role="catalog_table_entry"><para role="column_definition">
2820       <structfield>condefault</structfield> <type>bool</type>
2821      </para>
2822      <para>
2823       True if this is the default conversion
2824      </para></entry>
2825     </row>
2826    </tbody>
2827   </tgroup>
2828  </table>
2829
2830 </sect1>
2831
2832 <sect1 id="catalog-pg-database">
2833  <title><structname>pg_database</structname></title>
2834
2835  <indexterm zone="catalog-pg-database">
2836   <primary>pg_database</primary>
2837  </indexterm>
2838
2839  <para>
2840   The catalog <structname>pg_database</structname> stores information about
2841   the available databases.  Databases are created with the <xref
2842   linkend="sql-createdatabase"/> command.
2843   Consult <xref linkend="managing-databases"/> for details about the meaning
2844   of some of the parameters.
2845  </para>
2846
2847  <para>
2848   Unlike most system catalogs, <structname>pg_database</structname>
2849   is shared across all databases of a cluster: there is only one
2850   copy of <structname>pg_database</structname> per cluster, not
2851   one per database.
2852  </para>
2853
2854  <table>
2855   <title><structname>pg_database</structname> Columns</title>
2856   <tgroup cols="1">
2857    <thead>
2858     <row>
2859      <entry role="catalog_table_entry"><para role="column_definition">
2860       Column Type
2861      </para>
2862      <para>
2863       Description
2864      </para></entry>
2865     </row>
2866    </thead>
2867
2868    <tbody>
2869     <row>
2870      <entry role="catalog_table_entry"><para role="column_definition">
2871       <structfield>oid</structfield> <type>oid</type>
2872      </para>
2873      <para>
2874       Row identifier
2875      </para></entry>
2876     </row>
2877
2878     <row>
2879      <entry role="catalog_table_entry"><para role="column_definition">
2880       <structfield>datname</structfield> <type>name</type>
2881      </para>
2882      <para>
2883       Database name
2884      </para></entry>
2885     </row>
2886
2887     <row>
2888      <entry role="catalog_table_entry"><para role="column_definition">
2889       <structfield>datdba</structfield> <type>oid</type>
2890       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
2891      </para>
2892      <para>
2893       Owner of the database, usually the user who created it
2894      </para></entry>
2895     </row>
2896
2897     <row>
2898      <entry role="catalog_table_entry"><para role="column_definition">
2899       <structfield>encoding</structfield> <type>int4</type>
2900      </para>
2901      <para>
2902       Character encoding for this database
2903       (<function>pg_encoding_to_char()</function> can translate
2904       this number to the encoding name)
2905      </para></entry>
2906     </row>
2907
2908     <row>
2909      <entry role="catalog_table_entry"><para role="column_definition">
2910       <structfield>datcollate</structfield> <type>name</type>
2911      </para>
2912      <para>
2913       LC_COLLATE for this database
2914      </para></entry>
2915     </row>
2916
2917     <row>
2918      <entry role="catalog_table_entry"><para role="column_definition">
2919       <structfield>datctype</structfield> <type>name</type>
2920      </para>
2921      <para>
2922       LC_CTYPE for this database
2923      </para></entry>
2924     </row>
2925
2926     <row>
2927      <entry role="catalog_table_entry"><para role="column_definition">
2928       <structfield>datistemplate</structfield> <type>bool</type>
2929      </para>
2930      <para>
2931       If true, then this database can be cloned by
2932       any user with <literal>CREATEDB</literal> privileges;
2933       if false, then only superusers or the owner of
2934       the database can clone it.
2935      </para></entry>
2936     </row>
2937
2938     <row>
2939      <entry role="catalog_table_entry"><para role="column_definition">
2940       <structfield>datallowconn</structfield> <type>bool</type>
2941      </para>
2942      <para>
2943       If false then no one can connect to this database.  This is
2944       used to protect the <literal>template0</literal> database from being altered.
2945      </para></entry>
2946     </row>
2947
2948     <row>
2949      <entry role="catalog_table_entry"><para role="column_definition">
2950       <structfield>datconnlimit</structfield> <type>int4</type>
2951      </para>
2952      <para>
2953       Sets maximum number of concurrent connections that can be made
2954       to this database.  -1 means no limit.
2955      </para></entry>
2956     </row>
2957
2958     <row>
2959      <entry role="catalog_table_entry"><para role="column_definition">
2960       <structfield>datlastsysoid</structfield> <type>oid</type>
2961      </para>
2962      <para>
2963       Last system OID in the database; useful
2964       particularly to <application>pg_dump</application>
2965      </para></entry>
2966     </row>
2967
2968     <row>
2969      <entry role="catalog_table_entry"><para role="column_definition">
2970       <structfield>datfrozenxid</structfield> <type>xid</type>
2971      </para>
2972      <para>
2973       All transaction IDs before this one have been replaced with a permanent
2974       (<quote>frozen</quote>) transaction ID in this database.  This is used to
2975       track whether the database needs to be vacuumed in order to prevent
2976       transaction ID wraparound or to allow <literal>pg_xact</literal> to be shrunk.
2977       It is the minimum of the per-table
2978       <structname>pg_class</structname>.<structfield>relfrozenxid</structfield> values.
2979      </para></entry>
2980     </row>
2981
2982     <row>
2983      <entry role="catalog_table_entry"><para role="column_definition">
2984       <structfield>datminmxid</structfield> <type>xid</type>
2985      </para>
2986      <para>
2987       All multixact IDs before this one have been replaced with a
2988       transaction ID in this database.  This is used to
2989       track whether the database needs to be vacuumed in order to prevent
2990       multixact ID wraparound or to allow <literal>pg_multixact</literal> to be shrunk.
2991       It is the minimum of the per-table
2992       <structname>pg_class</structname>.<structfield>relminmxid</structfield> values.
2993      </para></entry>
2994     </row>
2995
2996     <row>
2997      <entry role="catalog_table_entry"><para role="column_definition">
2998       <structfield>dattablespace</structfield> <type>oid</type>
2999       (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>oid</structfield>)
3000      </para>
3001      <para>
3002       The default tablespace for the database.
3003       Within this database, all tables for which
3004       <structname>pg_class</structname>.<structfield>reltablespace</structfield> is zero
3005       will be stored in this tablespace; in particular, all the non-shared
3006       system catalogs will be there.
3007      </para></entry>
3008     </row>
3009
3010     <row>
3011      <entry role="catalog_table_entry"><para role="column_definition">
3012       <structfield>datacl</structfield> <type>aclitem[]</type>
3013      </para>
3014      <para>
3015       Access privileges; see <xref linkend="ddl-priv"/> for details
3016      </para></entry>
3017     </row>
3018    </tbody>
3019   </tgroup>
3020  </table>
3021 </sect1>
3022
3023
3024 <sect1 id="catalog-pg-db-role-setting">
3025  <title><structname>pg_db_role_setting</structname></title>
3026
3027  <indexterm zone="catalog-pg-db-role-setting">
3028   <primary>pg_db_role_setting</primary>
3029  </indexterm>
3030
3031  <para>
3032   The catalog <structname>pg_db_role_setting</structname> records the default
3033   values that have been set for run-time configuration variables,
3034   for each role and database combination.
3035  </para>
3036
3037  <para>
3038   Unlike most system catalogs, <structname>pg_db_role_setting</structname>
3039   is shared across all databases of a cluster: there is only one
3040   copy of <structname>pg_db_role_setting</structname> per cluster, not
3041   one per database.
3042  </para>
3043
3044  <table>
3045   <title><structname>pg_db_role_setting</structname> Columns</title>
3046   <tgroup cols="1">
3047    <thead>
3048     <row>
3049      <entry role="catalog_table_entry"><para role="column_definition">
3050       Column Type
3051      </para>
3052      <para>
3053       Description
3054      </para></entry>
3055     </row>
3056    </thead>
3057
3058    <tbody>
3059     <row>
3060      <entry role="catalog_table_entry"><para role="column_definition">
3061       <structfield>setdatabase</structfield> <type>oid</type>
3062       (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
3063      </para>
3064      <para>
3065       The OID of the database the setting is applicable to, or zero if not database-specific
3066      </para></entry>
3067     </row>
3068
3069     <row>
3070      <entry role="catalog_table_entry"><para role="column_definition">
3071       <structfield>setrole</structfield> <type>oid</type>
3072       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3073      </para>
3074      <para>
3075       The OID of the role the setting is applicable to, or zero if not role-specific
3076      </para></entry>
3077     </row>
3078
3079     <row>
3080      <entry role="catalog_table_entry"><para role="column_definition">
3081       <structfield>setconfig</structfield> <type>text[]</type>
3082      </para>
3083      <para>
3084       Defaults for run-time configuration variables
3085      </para></entry>
3086     </row>
3087    </tbody>
3088   </tgroup>
3089  </table>
3090 </sect1>
3091
3092
3093 <sect1 id="catalog-pg-default-acl">
3094  <title><structname>pg_default_acl</structname></title>
3095
3096  <indexterm zone="catalog-pg-default-acl">
3097   <primary>pg_default_acl</primary>
3098  </indexterm>
3099
3100  <para>
3101   The catalog <structname>pg_default_acl</structname> stores initial
3102   privileges to be assigned to newly created objects.
3103  </para>
3104
3105  <table>
3106   <title><structname>pg_default_acl</structname> Columns</title>
3107   <tgroup cols="1">
3108    <thead>
3109     <row>
3110      <entry role="catalog_table_entry"><para role="column_definition">
3111       Column Type
3112      </para>
3113      <para>
3114       Description
3115      </para></entry>
3116     </row>
3117    </thead>
3118
3119    <tbody>
3120     <row>
3121      <entry role="catalog_table_entry"><para role="column_definition">
3122       <structfield>oid</structfield> <type>oid</type>
3123      </para>
3124      <para>
3125       Row identifier
3126      </para></entry>
3127     </row>
3128
3129     <row>
3130      <entry role="catalog_table_entry"><para role="column_definition">
3131       <structfield>defaclrole</structfield> <type>oid</type>
3132       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3133      </para>
3134      <para>
3135       The OID of the role associated with this entry
3136      </para></entry>
3137     </row>
3138
3139     <row>
3140      <entry role="catalog_table_entry"><para role="column_definition">
3141       <structfield>defaclnamespace</structfield> <type>oid</type>
3142       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
3143      </para>
3144      <para>
3145       The OID of the namespace associated with this entry,
3146       or 0 if none
3147      </para></entry>
3148     </row>
3149
3150     <row>
3151      <entry role="catalog_table_entry"><para role="column_definition">
3152       <structfield>defaclobjtype</structfield> <type>char</type>
3153      </para>
3154      <para>
3155       Type of object this entry is for:
3156       <literal>r</literal> = relation (table, view),
3157       <literal>S</literal> = sequence,
3158       <literal>f</literal> = function,
3159       <literal>T</literal> = type,
3160       <literal>n</literal> = schema
3161      </para></entry>
3162     </row>
3163
3164     <row>
3165      <entry role="catalog_table_entry"><para role="column_definition">
3166       <structfield>defaclacl</structfield> <type>aclitem[]</type>
3167      </para>
3168      <para>
3169       Access privileges that this type of object should have on creation
3170      </para></entry>
3171     </row>
3172    </tbody>
3173   </tgroup>
3174  </table>
3175
3176  <para>
3177   A <structname>pg_default_acl</structname> entry shows the initial privileges to
3178   be assigned to an object belonging to the indicated user.  There are
3179   currently two types of entry: <quote>global</quote> entries with
3180   <structfield>defaclnamespace</structfield> = 0, and <quote>per-schema</quote> entries
3181   that reference a particular schema.  If a global entry is present then
3182   it <emphasis>overrides</emphasis> the normal hard-wired default privileges
3183   for the object type.  A per-schema entry, if present, represents privileges
3184   to be <emphasis>added to</emphasis> the global or hard-wired default privileges.
3185  </para>
3186
3187  <para>
3188   Note that when an ACL entry in another catalog is null, it is taken
3189   to represent the hard-wired default privileges for its object,
3190   <emphasis>not</emphasis> whatever might be in <structname>pg_default_acl</structname>
3191   at the moment.  <structname>pg_default_acl</structname> is only consulted during
3192   object creation.
3193  </para>
3194
3195 </sect1>
3196
3197
3198 <sect1 id="catalog-pg-depend">
3199  <title><structname>pg_depend</structname></title>
3200
3201  <indexterm zone="catalog-pg-depend">
3202   <primary>pg_depend</primary>
3203  </indexterm>
3204
3205  <para>
3206   The catalog <structname>pg_depend</structname> records the dependency
3207   relationships between database objects.  This information allows
3208   <command>DROP</command> commands to find which other objects must be dropped
3209   by <command>DROP CASCADE</command> or prevent dropping in the <command>DROP
3210   RESTRICT</command> case.
3211  </para>
3212
3213  <para>
3214   See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
3215   which performs a similar function for dependencies involving objects
3216   that are shared across a database cluster.
3217  </para>
3218
3219  <table>
3220   <title><structname>pg_depend</structname> Columns</title>
3221   <tgroup cols="1">
3222    <thead>
3223     <row>
3224      <entry role="catalog_table_entry"><para role="column_definition">
3225       Column Type
3226      </para>
3227      <para>
3228       Description
3229      </para></entry>
3230     </row>
3231    </thead>
3232
3233    <tbody>
3234     <row>
3235      <entry role="catalog_table_entry"><para role="column_definition">
3236       <structfield>classid</structfield> <type>oid</type>
3237       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3238      </para>
3239      <para>
3240       The OID of the system catalog the dependent object is in
3241      </para></entry>
3242     </row>
3243
3244     <row>
3245      <entry role="catalog_table_entry"><para role="column_definition">
3246       <structfield>objid</structfield> <type>oid</type>
3247       (references any OID column)
3248      </para>
3249      <para>
3250       The OID of the specific dependent object
3251      </para></entry>
3252     </row>
3253
3254     <row>
3255      <entry role="catalog_table_entry"><para role="column_definition">
3256       <structfield>objsubid</structfield> <type>int4</type>
3257      </para>
3258      <para>
3259       For a table column, this is the column number (the
3260       <structfield>objid</structfield> and <structfield>classid</structfield> refer to the
3261       table itself).  For all other object types, this column is
3262       zero.
3263      </para></entry>
3264     </row>
3265
3266     <row>
3267      <entry role="catalog_table_entry"><para role="column_definition">
3268       <structfield>refclassid</structfield> <type>oid</type>
3269       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3270      </para>
3271      <para>
3272       The OID of the system catalog the referenced object is in
3273      </para></entry>
3274     </row>
3275
3276     <row>
3277      <entry role="catalog_table_entry"><para role="column_definition">
3278       <structfield>refobjid</structfield> <type>oid</type>
3279       (references any OID column)
3280      </para>
3281      <para>
3282       The OID of the specific referenced object
3283      </para></entry>
3284     </row>
3285
3286     <row>
3287      <entry role="catalog_table_entry"><para role="column_definition">
3288       <structfield>refobjsubid</structfield> <type>int4</type>
3289      </para>
3290      <para>
3291       For a table column, this is the column number (the
3292       <structfield>refobjid</structfield> and <structfield>refclassid</structfield> refer
3293       to the table itself).  For all other object types, this column
3294       is zero.
3295      </para></entry>
3296     </row>
3297
3298     <row>
3299      <entry role="catalog_table_entry"><para role="column_definition">
3300       <structfield>deptype</structfield> <type>char</type>
3301      </para>
3302      <para>
3303       A code defining the specific semantics of this dependency relationship; see text
3304      </para></entry>
3305     </row>
3306    </tbody>
3307   </tgroup>
3308  </table>
3309
3310  <para>
3311   In all cases, a <structname>pg_depend</structname> entry indicates that the
3312   referenced object cannot be dropped without also dropping the dependent
3313   object.  However, there are several subflavors identified by
3314   <structfield>deptype</structfield>:
3315
3316   <variablelist>
3317    <varlistentry>
3318     <term><symbol>DEPENDENCY_NORMAL</symbol> (<literal>n</literal>)</term>
3319     <listitem>
3320      <para>
3321       A normal relationship between separately-created objects.  The
3322       dependent object can be dropped without affecting the
3323       referenced object.  The referenced object can only be dropped
3324       by specifying <literal>CASCADE</literal>, in which case the dependent
3325       object is dropped, too.  Example: a table column has a normal
3326       dependency on its data type.
3327      </para>
3328     </listitem>
3329    </varlistentry>
3330
3331    <varlistentry>
3332     <term><symbol>DEPENDENCY_AUTO</symbol> (<literal>a</literal>)</term>
3333     <listitem>
3334      <para>
3335       The dependent object can be dropped separately from the
3336       referenced object, and should be automatically dropped
3337       (regardless of <literal>RESTRICT</literal> or <literal>CASCADE</literal>
3338       mode) if the referenced object is dropped.  Example: a named
3339       constraint on a table is made auto-dependent on the table, so
3340       that it will go away if the table is dropped.
3341      </para>
3342     </listitem>
3343    </varlistentry>
3344
3345    <varlistentry>
3346     <term><symbol>DEPENDENCY_INTERNAL</symbol> (<literal>i</literal>)</term>
3347     <listitem>
3348      <para>
3349       The dependent object was created as part of creation of the
3350       referenced object, and is really just a part of its internal
3351       implementation.  A direct <command>DROP</command> of the dependent
3352       object will be disallowed outright (we'll tell the user to issue
3353       a <command>DROP</command> against the referenced object, instead).
3354       A <command>DROP</command> of the referenced object will result in
3355       automatically dropping the dependent object
3356       whether <literal>CASCADE</literal> is specified or not.  If the
3357       dependent object has to be dropped due to a dependency on some other
3358       object being removed, its drop is converted to a drop of the referenced
3359       object, so that <literal>NORMAL</literal> and <literal>AUTO</literal>
3360       dependencies of the dependent object behave much like they were
3361       dependencies of the referenced object.
3362       Example: a view's <literal>ON SELECT</literal> rule is made
3363       internally dependent on the view, preventing it from being dropped
3364       while the view remains.  Dependencies of the rule (such as tables it
3365       refers to) act as if they were dependencies of the view.
3366      </para>
3367     </listitem>
3368    </varlistentry>
3369
3370    <varlistentry>
3371     <term><symbol>DEPENDENCY_PARTITION_PRI</symbol> (<literal>P</literal>)</term>
3372     <term><symbol>DEPENDENCY_PARTITION_SEC</symbol> (<literal>S</literal>)</term>
3373     <listitem>
3374      <para>
3375       The dependent object was created as part of creation of the
3376       referenced object, and is really just a part of its internal
3377       implementation; however, unlike <literal>INTERNAL</literal>,
3378       there is more than one such referenced object.  The dependent object
3379       must not be dropped unless at least one of these referenced objects
3380       is dropped; if any one is, the dependent object should be dropped
3381       whether or not <literal>CASCADE</literal> is specified.  Also
3382       unlike <literal>INTERNAL</literal>, a drop of some other object
3383       that the dependent object depends on does not result in automatic
3384       deletion of any partition-referenced object.  Hence, if the drop
3385       does not cascade to at least one of these objects via some other
3386       path, it will be refused.  (In most cases, the dependent object
3387       shares all its non-partition dependencies with at least one
3388       partition-referenced object, so that this restriction does not
3389       result in blocking any cascaded delete.)
3390       Primary and secondary partition dependencies behave identically
3391       except that the primary dependency is preferred for use in error
3392       messages; hence, a partition-dependent object should have one
3393       primary partition dependency and one or more secondary partition
3394       dependencies.
3395       Note that partition dependencies are made in addition to, not
3396       instead of, any dependencies the object would normally have.  This
3397       simplifies <command>ATTACH/DETACH PARTITION</command> operations:
3398       the partition dependencies need only be added or removed.
3399       Example: a child partitioned index is made partition-dependent
3400       on both the partition table it is on and the parent partitioned
3401       index, so that it goes away if either of those is dropped, but
3402       not otherwise.  The dependency on the parent index is primary,
3403       so that if the user tries to drop the child partitioned index,
3404       the error message will suggest dropping the parent index instead
3405       (not the table).
3406      </para>
3407     </listitem>
3408    </varlistentry>
3409
3410    <varlistentry>
3411     <term><symbol>DEPENDENCY_EXTENSION</symbol> (<literal>e</literal>)</term>
3412     <listitem>
3413      <para>
3414       The dependent object is a member of the <firstterm>extension</firstterm> that is
3415       the referenced object (see
3416       <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
3417       The dependent object can be dropped only via
3418       <command>DROP EXTENSION</command> on the referenced object.
3419       Functionally this dependency type acts the same as
3420       an <literal>INTERNAL</literal> dependency, but it's kept separate for
3421       clarity and to simplify <application>pg_dump</application>.
3422      </para>
3423     </listitem>
3424    </varlistentry>
3425
3426    <varlistentry>
3427     <term><symbol>DEPENDENCY_AUTO_EXTENSION</symbol> (<literal>x</literal>)</term>
3428     <listitem>
3429      <para>
3430       The dependent object is not a member of the extension that is the
3431       referenced object (and so it should not be ignored
3432       by <application>pg_dump</application>), but it cannot function
3433       without the extension and should be auto-dropped if the extension is.
3434       The dependent object may be dropped on its own as well.
3435       Functionally this dependency type acts the same as
3436       an <literal>AUTO</literal> dependency, but it's kept separate for
3437       clarity and to simplify <application>pg_dump</application>.
3438      </para>
3439     </listitem>
3440    </varlistentry>
3441
3442    <varlistentry>
3443     <term><symbol>DEPENDENCY_PIN</symbol> (<literal>p</literal>)</term>
3444     <listitem>
3445      <para>
3446       There is no dependent object; this type of entry is a signal
3447       that the system itself depends on the referenced object, and so
3448       that object must never be deleted.  Entries of this type are
3449       created only by <command>initdb</command>.  The columns for the
3450       dependent object contain zeroes.
3451      </para>
3452     </listitem>
3453    </varlistentry>
3454   </variablelist>
3455
3456   Other dependency flavors might be needed in future.
3457  </para>
3458
3459  <para>
3460   Note that it's quite possible for two objects to be linked by more than
3461   one <structname>pg_depend</structname> entry.  For example, a child
3462   partitioned index would have both a partition-type dependency on its
3463   associated partition table, and an auto dependency on each column of
3464   that table that it indexes.  This sort of situation expresses the union
3465   of multiple dependency semantics.  A dependent object can be dropped
3466   without <literal>CASCADE</literal> if any of its dependencies satisfies
3467   its condition for automatic dropping.  Conversely, all the
3468   dependencies' restrictions about which objects must be dropped together
3469   must be satisfied.
3470  </para>
3471
3472 </sect1>
3473
3474
3475 <sect1 id="catalog-pg-description">
3476  <title><structname>pg_description</structname></title>
3477
3478  <indexterm zone="catalog-pg-description">
3479   <primary>pg_description</primary>
3480  </indexterm>
3481
3482  <para>
3483   The catalog <structname>pg_description</structname> stores optional descriptions
3484   (comments) for each database object.  Descriptions can be manipulated
3485   with the <xref linkend="sql-comment"/> command and viewed with
3486   <application>psql</application>'s <literal>\d</literal> commands.
3487   Descriptions of many built-in system objects are provided in the initial
3488   contents of <structname>pg_description</structname>.
3489  </para>
3490
3491  <para>
3492   See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
3493   which performs a similar function for descriptions involving objects that
3494   are shared across a database cluster.
3495  </para>
3496
3497  <table>
3498   <title><structname>pg_description</structname> Columns</title>
3499   <tgroup cols="1">
3500    <thead>
3501     <row>
3502      <entry role="catalog_table_entry"><para role="column_definition">
3503       Column Type
3504      </para>
3505      <para>
3506       Description
3507      </para></entry>
3508     </row>
3509    </thead>
3510
3511    <tbody>
3512     <row>
3513      <entry role="catalog_table_entry"><para role="column_definition">
3514       <structfield>objoid</structfield> <type>oid</type>
3515       (references any OID column)
3516      </para>
3517      <para>
3518       The OID of the object this description pertains to
3519      </para></entry>
3520     </row>
3521
3522     <row>
3523      <entry role="catalog_table_entry"><para role="column_definition">
3524       <structfield>classoid</structfield> <type>oid</type>
3525       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3526      </para>
3527      <para>
3528       The OID of the system catalog this object appears in
3529      </para></entry>
3530     </row>
3531
3532     <row>
3533      <entry role="catalog_table_entry"><para role="column_definition">
3534       <structfield>objsubid</structfield> <type>int4</type>
3535      </para>
3536      <para>
3537       For a comment on a table column, this is the column number (the
3538       <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
3539       the table itself).  For all other object types, this column is
3540       zero.
3541      </para></entry>
3542     </row>
3543
3544     <row>
3545      <entry role="catalog_table_entry"><para role="column_definition">
3546       <structfield>description</structfield> <type>text</type>
3547      </para>
3548      <para>
3549       Arbitrary text that serves as the description of this object
3550      </para></entry>
3551     </row>
3552    </tbody>
3553   </tgroup>
3554  </table>
3555
3556 </sect1>
3557
3558
3559 <sect1 id="catalog-pg-enum">
3560  <title><structname>pg_enum</structname></title>
3561
3562  <indexterm zone="catalog-pg-enum">
3563   <primary>pg_enum</primary>
3564  </indexterm>
3565
3566  <para>
3567   The <structname>pg_enum</structname> catalog contains entries
3568   showing the values and labels for each enum type. The
3569   internal representation of a given enum value is actually the OID
3570   of its associated row in <structname>pg_enum</structname>.
3571  </para>
3572
3573  <table>
3574   <title><structname>pg_enum</structname> Columns</title>
3575   <tgroup cols="1">
3576    <thead>
3577     <row>
3578      <entry role="catalog_table_entry"><para role="column_definition">
3579       Column Type
3580      </para>
3581      <para>
3582       Description
3583      </para></entry>
3584     </row>
3585    </thead>
3586
3587    <tbody>
3588     <row>
3589      <entry role="catalog_table_entry"><para role="column_definition">
3590       <structfield>oid</structfield> <type>oid</type>
3591      </para>
3592      <para>
3593       Row identifier
3594      </para></entry>
3595     </row>
3596
3597     <row>
3598      <entry role="catalog_table_entry"><para role="column_definition">
3599       <structfield>enumtypid</structfield> <type>oid</type>
3600       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
3601      </para>
3602      <para>
3603       The OID of the <structname>pg_type</structname> entry owning this enum value
3604      </para></entry>
3605     </row>
3606
3607     <row>
3608      <entry role="catalog_table_entry"><para role="column_definition">
3609       <structfield>enumsortorder</structfield> <type>float4</type>
3610      </para>
3611      <para>
3612       The sort position of this enum value within its enum type
3613      </para></entry>
3614     </row>
3615
3616     <row>
3617      <entry role="catalog_table_entry"><para role="column_definition">
3618       <structfield>enumlabel</structfield> <type>name</type>
3619      </para>
3620      <para>
3621       The textual label for this enum value
3622      </para></entry>
3623     </row>
3624    </tbody>
3625   </tgroup>
3626  </table>
3627
3628  <para>
3629   The OIDs for <structname>pg_enum</structname> rows follow a special
3630   rule: even-numbered OIDs are guaranteed to be ordered in the same way
3631   as the sort ordering of their enum type.  That is, if two even OIDs
3632   belong to the same enum type, the smaller OID must have the smaller
3633   <structfield>enumsortorder</structfield> value.  Odd-numbered OID values
3634   need bear no relationship to the sort order.  This rule allows the
3635   enum comparison routines to avoid catalog lookups in many common cases.
3636   The routines that create and alter enum types attempt to assign even
3637   OIDs to enum values whenever possible.
3638  </para>
3639
3640  <para>
3641   When an enum type is created, its members are assigned sort-order
3642   positions 1..<replaceable>n</replaceable>.  But members added later might be given
3643   negative or fractional values of <structfield>enumsortorder</structfield>.
3644   The only requirement on these values is that they be correctly
3645   ordered and unique within each enum type.
3646  </para>
3647 </sect1>
3648
3649
3650 <sect1 id="catalog-pg-event-trigger">
3651  <title><structname>pg_event_trigger</structname></title>
3652
3653  <indexterm zone="catalog-pg-event-trigger">
3654   <primary>pg_event_trigger</primary>
3655  </indexterm>
3656
3657  <para>
3658   The catalog <structname>pg_event_trigger</structname> stores event triggers.
3659   See <xref linkend="event-triggers"/> for more information.
3660  </para>
3661
3662  <table>
3663   <title><structname>pg_event_trigger</structname> Columns</title>
3664   <tgroup cols="1">
3665    <thead>
3666     <row>
3667      <entry role="catalog_table_entry"><para role="column_definition">
3668       Column Type
3669      </para>
3670      <para>
3671       Description
3672      </para></entry>
3673     </row>
3674    </thead>
3675
3676    <tbody>
3677     <row>
3678      <entry role="catalog_table_entry"><para role="column_definition">
3679       <structfield>oid</structfield> <type>oid</type>
3680      </para>
3681      <para>
3682       Row identifier
3683      </para></entry>
3684     </row>
3685
3686     <row>
3687      <entry role="catalog_table_entry"><para role="column_definition">
3688       <structfield>evtname</structfield> <type>name</type>
3689      </para>
3690      <para>
3691       Trigger name (must be unique)
3692      </para></entry>
3693     </row>
3694
3695     <row>
3696      <entry role="catalog_table_entry"><para role="column_definition">
3697       <structfield>evtevent</structfield> <type>name</type>
3698      </para>
3699      <para>
3700       Identifies the event for which this trigger fires
3701      </para></entry>
3702     </row>
3703
3704     <row>
3705      <entry role="catalog_table_entry"><para role="column_definition">
3706       <structfield>evtowner</structfield> <type>oid</type>
3707       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3708      </para>
3709      <para>
3710       Owner of the event trigger
3711      </para></entry>
3712     </row>
3713
3714     <row>
3715      <entry role="catalog_table_entry"><para role="column_definition">
3716       <structfield>evtfoid</structfield> <type>oid</type>
3717       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
3718      </para>
3719      <para>
3720       The function to be called
3721      </para></entry>
3722     </row>
3723
3724     <row>
3725      <entry role="catalog_table_entry"><para role="column_definition">
3726       <structfield>evtenabled</structfield> <type>char</type>
3727      </para>
3728      <para>
3729       Controls in which <xref linkend="guc-session-replication-role"/> modes
3730       the event trigger fires.
3731       <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
3732       <literal>D</literal> = trigger is disabled,
3733       <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
3734       <literal>A</literal> = trigger fires always.
3735      </para></entry>
3736     </row>
3737
3738     <row>
3739      <entry role="catalog_table_entry"><para role="column_definition">
3740       <structfield>evttags</structfield> <type>text[]</type>
3741      </para>
3742      <para>
3743       Command tags for which this trigger will fire.  If NULL, the firing
3744       of this trigger is not restricted on the basis of the command tag.
3745      </para></entry>
3746     </row>
3747    </tbody>
3748   </tgroup>
3749  </table>
3750 </sect1>
3751
3752
3753 <sect1 id="catalog-pg-extension">
3754  <title><structname>pg_extension</structname></title>
3755
3756  <indexterm zone="catalog-pg-extension">
3757   <primary>pg_extension</primary>
3758  </indexterm>
3759
3760  <para>
3761   The catalog <structname>pg_extension</structname> stores information
3762   about the installed extensions.  See <xref linkend="extend-extensions"/>
3763   for details about extensions.
3764  </para>
3765
3766  <table>
3767   <title><structname>pg_extension</structname> Columns</title>
3768   <tgroup cols="1">
3769    <thead>
3770     <row>
3771      <entry role="catalog_table_entry"><para role="column_definition">
3772       Column Type
3773      </para>
3774      <para>
3775       Description
3776      </para></entry>
3777     </row>
3778    </thead>
3779
3780    <tbody>
3781     <row>
3782      <entry role="catalog_table_entry"><para role="column_definition">
3783       <structfield>oid</structfield> <type>oid</type>
3784      </para>
3785      <para>
3786       Row identifier
3787      </para></entry>
3788     </row>
3789
3790     <row>
3791      <entry role="catalog_table_entry"><para role="column_definition">
3792       <structfield>extname</structfield> <type>name</type>
3793      </para>
3794      <para>
3795       Name of the extension
3796      </para></entry>
3797     </row>
3798
3799     <row>
3800      <entry role="catalog_table_entry"><para role="column_definition">
3801       <structfield>extowner</structfield> <type>oid</type>
3802       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3803      </para>
3804      <para>
3805       Owner of the extension
3806      </para></entry>
3807     </row>
3808
3809     <row>
3810      <entry role="catalog_table_entry"><para role="column_definition">
3811       <structfield>extnamespace</structfield> <type>oid</type>
3812       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
3813      </para>
3814      <para>
3815       Schema containing the extension's exported objects
3816      </para></entry>
3817     </row>
3818
3819     <row>
3820      <entry role="catalog_table_entry"><para role="column_definition">
3821       <structfield>extrelocatable</structfield> <type>bool</type>
3822      </para>
3823      <para>
3824       True if extension can be relocated to another schema
3825      </para></entry>
3826     </row>
3827
3828     <row>
3829      <entry role="catalog_table_entry"><para role="column_definition">
3830       <structfield>extversion</structfield> <type>text</type>
3831      </para>
3832      <para>
3833       Version name for the extension
3834      </para></entry>
3835     </row>
3836
3837     <row>
3838      <entry role="catalog_table_entry"><para role="column_definition">
3839       <structfield>extconfig</structfield> <type>oid[]</type>
3840       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
3841      </para>
3842      <para>
3843       Array of <type>regclass</type> OIDs for the extension's configuration
3844       table(s), or <literal>NULL</literal> if none
3845      </para></entry>
3846     </row>
3847
3848     <row>
3849      <entry role="catalog_table_entry"><para role="column_definition">
3850       <structfield>extcondition</structfield> <type>text[]</type>
3851      </para>
3852      <para>
3853       Array of <literal>WHERE</literal>-clause filter conditions for the
3854       extension's configuration table(s), or <literal>NULL</literal> if none
3855      </para></entry>
3856     </row>
3857    </tbody>
3858   </tgroup>
3859  </table>
3860
3861  <para>
3862   Note that unlike most catalogs with a <quote>namespace</quote> column,
3863   <structfield>extnamespace</structfield> is not meant to imply
3864   that the extension belongs to that schema.  Extension names are never
3865   schema-qualified.  Rather, <structfield>extnamespace</structfield>
3866   indicates the schema that contains most or all of the extension's
3867   objects.  If <structfield>extrelocatable</structfield> is true, then
3868   this schema must in fact contain all schema-qualifiable objects
3869   belonging to the extension.
3870  </para>
3871 </sect1>
3872
3873
3874 <sect1 id="catalog-pg-foreign-data-wrapper">
3875  <title><structname>pg_foreign_data_wrapper</structname></title>
3876
3877  <indexterm zone="catalog-pg-foreign-data-wrapper">
3878   <primary>pg_foreign_data_wrapper</primary>
3879  </indexterm>
3880
3881  <para>
3882   The catalog <structname>pg_foreign_data_wrapper</structname> stores
3883   foreign-data wrapper definitions.  A foreign-data wrapper is the
3884   mechanism by which external data, residing on foreign servers, is
3885   accessed.
3886  </para>
3887
3888  <table>
3889   <title><structname>pg_foreign_data_wrapper</structname> Columns</title>
3890   <tgroup cols="1">
3891    <thead>
3892     <row>
3893      <entry role="catalog_table_entry"><para role="column_definition">
3894       Column Type
3895      </para>
3896      <para>
3897       Description
3898      </para></entry>
3899     </row>
3900    </thead>
3901
3902    <tbody>
3903     <row>
3904      <entry role="catalog_table_entry"><para role="column_definition">
3905       <structfield>oid</structfield> <type>oid</type>
3906      </para>
3907      <para>
3908       Row identifier
3909      </para></entry>
3910     </row>
3911
3912     <row>
3913      <entry role="catalog_table_entry"><para role="column_definition">
3914       <structfield>fdwname</structfield> <type>name</type>
3915      </para>
3916      <para>
3917       Name of the foreign-data wrapper
3918      </para></entry>
3919     </row>
3920
3921     <row>
3922      <entry role="catalog_table_entry"><para role="column_definition">
3923       <structfield>fdwowner</structfield> <type>oid</type>
3924       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
3925      </para>
3926      <para>
3927       Owner of the foreign-data wrapper
3928      </para></entry>
3929     </row>
3930
3931     <row>
3932      <entry role="catalog_table_entry"><para role="column_definition">
3933       <structfield>fdwhandler</structfield> <type>oid</type>
3934       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
3935      </para>
3936      <para>
3937       References a handler function that is responsible for
3938       supplying execution routines for the foreign-data wrapper.
3939       Zero if no handler is provided
3940      </para></entry>
3941     </row>
3942
3943     <row>
3944      <entry role="catalog_table_entry"><para role="column_definition">
3945       <structfield>fdwvalidator</structfield> <type>oid</type>
3946       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
3947      </para>
3948      <para>
3949       References a validator function that is responsible for
3950       checking the validity of the options given to the
3951       foreign-data wrapper, as well as options for foreign servers and user
3952       mappings using the foreign-data wrapper.  Zero if no validator
3953       is provided
3954      </para></entry>
3955     </row>
3956
3957     <row>
3958      <entry role="catalog_table_entry"><para role="column_definition">
3959       <structfield>fdwacl</structfield> <type>aclitem[]</type>
3960      </para>
3961      <para>
3962       Access privileges; see <xref linkend="ddl-priv"/> for details
3963      </para></entry>
3964     </row>
3965
3966     <row>
3967      <entry role="catalog_table_entry"><para role="column_definition">
3968       <structfield>fdwoptions</structfield> <type>text[]</type>
3969      </para>
3970      <para>
3971       Foreign-data wrapper specific options, as <quote>keyword=value</quote> strings
3972      </para></entry>
3973     </row>
3974    </tbody>
3975   </tgroup>
3976  </table>
3977 </sect1>
3978
3979
3980 <sect1 id="catalog-pg-foreign-server">
3981  <title><structname>pg_foreign_server</structname></title>
3982
3983  <indexterm zone="catalog-pg-foreign-server">
3984   <primary>pg_foreign_server</primary>
3985  </indexterm>
3986
3987  <para>
3988   The catalog <structname>pg_foreign_server</structname> stores
3989   foreign server definitions.  A foreign server describes a source
3990   of external data, such as a remote server.  Foreign
3991   servers are accessed via foreign-data wrappers.
3992  </para>
3993
3994  <table>
3995   <title><structname>pg_foreign_server</structname> Columns</title>
3996   <tgroup cols="1">
3997    <thead>
3998     <row>
3999      <entry role="catalog_table_entry"><para role="column_definition">
4000       Column Type
4001      </para>
4002      <para>
4003       Description
4004      </para></entry>
4005     </row>
4006    </thead>
4007
4008    <tbody>
4009     <row>
4010      <entry role="catalog_table_entry"><para role="column_definition">
4011       <structfield>oid</structfield> <type>oid</type>
4012      </para>
4013      <para>
4014       Row identifier
4015      </para></entry>
4016     </row>
4017
4018     <row>
4019      <entry role="catalog_table_entry"><para role="column_definition">
4020       <structfield>srvname</structfield> <type>name</type>
4021      </para>
4022      <para>
4023       Name of the foreign server
4024      </para></entry>
4025     </row>
4026
4027     <row>
4028      <entry role="catalog_table_entry"><para role="column_definition">
4029       <structfield>srvowner</structfield> <type>oid</type>
4030       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4031      </para>
4032      <para>
4033       Owner of the foreign server
4034      </para></entry>
4035     </row>
4036
4037     <row>
4038      <entry role="catalog_table_entry"><para role="column_definition">
4039       <structfield>srvfdw</structfield> <type>oid</type>
4040       (references <link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.<structfield>oid</structfield>)
4041      </para>
4042      <para>
4043       OID of the foreign-data wrapper of this foreign server
4044      </para></entry>
4045     </row>
4046
4047     <row>
4048      <entry role="catalog_table_entry"><para role="column_definition">
4049       <structfield>srvtype</structfield> <type>text</type>
4050      </para>
4051      <para>
4052       Type of the server (optional)
4053      </para></entry>
4054     </row>
4055
4056     <row>
4057      <entry role="catalog_table_entry"><para role="column_definition">
4058       <structfield>srvversion</structfield> <type>text</type>
4059      </para>
4060      <para>
4061       Version of the server (optional)
4062      </para></entry>
4063     </row>
4064
4065     <row>
4066      <entry role="catalog_table_entry"><para role="column_definition">
4067       <structfield>srvacl</structfield> <type>aclitem[]</type>
4068      </para>
4069      <para>
4070       Access privileges; see <xref linkend="ddl-priv"/> for details
4071      </para></entry>
4072     </row>
4073
4074     <row>
4075      <entry role="catalog_table_entry"><para role="column_definition">
4076       <structfield>srvoptions</structfield> <type>text[]</type>
4077      </para>
4078      <para>
4079       Foreign server specific options, as <quote>keyword=value</quote> strings
4080      </para></entry>
4081     </row>
4082    </tbody>
4083   </tgroup>
4084  </table>
4085 </sect1>
4086
4087
4088 <sect1 id="catalog-pg-foreign-table">
4089  <title><structname>pg_foreign_table</structname></title>
4090
4091  <indexterm zone="catalog-pg-foreign-table">
4092   <primary>pg_foreign_table</primary>
4093  </indexterm>
4094
4095  <para>
4096   The catalog <structname>pg_foreign_table</structname> contains
4097   auxiliary information about foreign tables.  A foreign table is
4098   primarily represented by a <structname>pg_class</structname> entry,
4099   just like a regular table.  Its <structname>pg_foreign_table</structname>
4100   entry contains the information that is pertinent only to foreign tables
4101   and not any other kind of relation.
4102  </para>
4103
4104  <table>
4105   <title><structname>pg_foreign_table</structname> Columns</title>
4106   <tgroup cols="1">
4107    <thead>
4108     <row>
4109      <entry role="catalog_table_entry"><para role="column_definition">
4110       Column Type
4111      </para>
4112      <para>
4113       Description
4114      </para></entry>
4115     </row>
4116    </thead>
4117
4118    <tbody>
4119     <row>
4120      <entry role="catalog_table_entry"><para role="column_definition">
4121       <structfield>ftrelid</structfield> <type>oid</type>
4122       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4123      </para>
4124      <para>
4125       OID of the <structname>pg_class</structname> entry for this foreign table
4126      </para></entry>
4127     </row>
4128
4129     <row>
4130      <entry role="catalog_table_entry"><para role="column_definition">
4131       <structfield>ftserver</structfield> <type>oid</type>
4132       (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
4133      </para>
4134      <para>
4135       OID of the foreign server for this foreign table
4136      </para></entry>
4137     </row>
4138
4139     <row>
4140      <entry role="catalog_table_entry"><para role="column_definition">
4141       <structfield>ftoptions</structfield> <type>text[]</type>
4142      </para>
4143      <para>
4144       Foreign table options, as <quote>keyword=value</quote> strings
4145      </para></entry>
4146     </row>
4147    </tbody>
4148   </tgroup>
4149  </table>
4150 </sect1>
4151
4152
4153 <sect1 id="catalog-pg-index">
4154  <title><structname>pg_index</structname></title>
4155
4156  <indexterm zone="catalog-pg-index">
4157   <primary>pg_index</primary>
4158  </indexterm>
4159
4160  <para>
4161   The catalog <structname>pg_index</structname> contains part of the information
4162   about indexes.  The rest is mostly in
4163   <structname>pg_class</structname>.
4164  </para>
4165
4166  <table>
4167   <title><structname>pg_index</structname> Columns</title>
4168   <tgroup cols="1">
4169    <thead>
4170     <row>
4171      <entry role="catalog_table_entry"><para role="column_definition">
4172       Column Type
4173      </para>
4174      <para>
4175       Description
4176      </para></entry>
4177     </row>
4178    </thead>
4179
4180    <tbody>
4181     <row>
4182      <entry role="catalog_table_entry"><para role="column_definition">
4183       <structfield>indexrelid</structfield> <type>oid</type>
4184       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4185      </para>
4186      <para>
4187       The OID of the <structname>pg_class</structname> entry for this index
4188      </para></entry>
4189     </row>
4190
4191     <row>
4192      <entry role="catalog_table_entry"><para role="column_definition">
4193       <structfield>indrelid</structfield> <type>oid</type>
4194       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4195      </para>
4196      <para>
4197       The OID of the <structname>pg_class</structname> entry for the table this index is for
4198      </para></entry>
4199     </row>
4200
4201     <row>
4202      <entry role="catalog_table_entry"><para role="column_definition">
4203       <structfield>indnatts</structfield> <type>int2</type>
4204      </para>
4205      <para>
4206       The total number of columns in the index (duplicates
4207       <literal>pg_class.relnatts</literal>); this number includes both key and included attributes
4208      </para></entry>
4209     </row>
4210
4211     <row>
4212      <entry role="catalog_table_entry"><para role="column_definition">
4213       <structfield>indnkeyatts</structfield> <type>int2</type>
4214      </para>
4215      <para>
4216       The number of <firstterm>key columns</firstterm> in the index,
4217       not counting any <firstterm>included columns</firstterm>, which are
4218       merely stored and do not participate in the index semantics
4219      </para></entry>
4220     </row>
4221
4222     <row>
4223      <entry role="catalog_table_entry"><para role="column_definition">
4224       <structfield>indisunique</structfield> <type>bool</type>
4225      </para>
4226      <para>
4227       If true, this is a unique index
4228      </para></entry>
4229     </row>
4230
4231     <row>
4232      <entry role="catalog_table_entry"><para role="column_definition">
4233       <structfield>indisprimary</structfield> <type>bool</type>
4234      </para>
4235      <para>
4236       If true, this index represents the primary key of the table
4237       (<structfield>indisunique</structfield> should always be true when this is true)
4238      </para></entry>
4239     </row>
4240
4241     <row>
4242      <entry role="catalog_table_entry"><para role="column_definition">
4243       <structfield>indisexclusion</structfield> <type>bool</type>
4244      </para>
4245      <para>
4246       If true, this index supports an exclusion constraint
4247      </para></entry>
4248     </row>
4249
4250     <row>
4251      <entry role="catalog_table_entry"><para role="column_definition">
4252       <structfield>indimmediate</structfield> <type>bool</type>
4253      </para>
4254      <para>
4255       If true, the uniqueness check is enforced immediately on
4256       insertion
4257       (irrelevant if <structfield>indisunique</structfield> is not true)
4258      </para></entry>
4259     </row>
4260
4261     <row>
4262      <entry role="catalog_table_entry"><para role="column_definition">
4263       <structfield>indisclustered</structfield> <type>bool</type>
4264      </para>
4265      <para>
4266       If true, the table was last clustered on this index
4267      </para></entry>
4268     </row>
4269
4270     <row>
4271      <entry role="catalog_table_entry"><para role="column_definition">
4272       <structfield>indisvalid</structfield> <type>bool</type>
4273      </para>
4274      <para>
4275       If true, the index is currently valid for queries.  False means the
4276       index is possibly incomplete: it must still be modified by
4277       <command>INSERT</command>/<command>UPDATE</command> operations, but it cannot safely
4278       be used for queries. If it is unique, the uniqueness property is not
4279       guaranteed true either.
4280      </para></entry>
4281     </row>
4282
4283     <row>
4284      <entry role="catalog_table_entry"><para role="column_definition">
4285       <structfield>indcheckxmin</structfield> <type>bool</type>
4286      </para>
4287      <para>
4288       If true, queries must not use the index until the <structfield>xmin</structfield>
4289       of this <structname>pg_index</structname> row is below their <symbol>TransactionXmin</symbol>
4290       event horizon, because the table may contain broken HOT chains with
4291       incompatible rows that they can see
4292      </para></entry>
4293     </row>
4294
4295     <row>
4296      <entry role="catalog_table_entry"><para role="column_definition">
4297       <structfield>indisready</structfield> <type>bool</type>
4298      </para>
4299      <para>
4300       If true, the index is currently ready for inserts.  False means the
4301       index must be ignored by <command>INSERT</command>/<command>UPDATE</command>
4302       operations.
4303      </para></entry>
4304     </row>
4305
4306     <row>
4307      <entry role="catalog_table_entry"><para role="column_definition">
4308       <structfield>indislive</structfield> <type>bool</type>
4309      </para>
4310      <para>
4311       If false, the index is in process of being dropped, and should be
4312       ignored for all purposes (including HOT-safety decisions)
4313      </para></entry>
4314     </row>
4315
4316     <row>
4317      <entry role="catalog_table_entry"><para role="column_definition">
4318       <structfield>indisreplident</structfield> <type>bool</type>
4319      </para>
4320      <para>
4321       If true this index has been chosen as <quote>replica identity</quote>
4322       using <command>ALTER TABLE ... REPLICA IDENTITY USING INDEX
4323       ...</command>
4324      </para></entry>
4325     </row>
4326
4327     <row>
4328      <entry role="catalog_table_entry"><para role="column_definition">
4329       <structfield>indkey</structfield> <type>int2vector</type>
4330       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
4331      </para>
4332      <para>
4333       This is an array of <structfield>indnatts</structfield> values that
4334       indicate which table columns this index indexes.  For example a value
4335       of <literal>1 3</literal> would mean that the first and the third table
4336       columns make up the index entries.  Key columns come before non-key
4337       (included) columns.  A zero in this array indicates that the
4338       corresponding index attribute is an expression over the table columns,
4339       rather than a simple column reference.
4340      </para></entry>
4341     </row>
4342
4343     <row>
4344      <entry role="catalog_table_entry"><para role="column_definition">
4345       <structfield>indcollation</structfield> <type>oidvector</type>
4346       (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
4347      </para>
4348      <para>
4349       For each column in the index key
4350       (<structfield>indnkeyatts</structfield> values), this contains the OID
4351       of the collation to use for the index, or zero if the column is not of
4352       a collatable data type.
4353      </para></entry>
4354     </row>
4355
4356     <row>
4357      <entry role="catalog_table_entry"><para role="column_definition">
4358       <structfield>indclass</structfield> <type>oidvector</type>
4359       (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
4360      </para>
4361      <para>
4362       For each column in the index key
4363       (<structfield>indnkeyatts</structfield> values), this contains the OID
4364       of the operator class to use.  See
4365       <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
4366      </para></entry>
4367     </row>
4368
4369     <row>
4370      <entry role="catalog_table_entry"><para role="column_definition">
4371       <structfield>indoption</structfield> <type>int2vector</type>
4372      </para>
4373      <para>
4374       This is an array of <structfield>indnkeyatts</structfield> values that
4375       store per-column flag bits.  The meaning of the bits is defined by
4376       the index's access method.
4377      </para></entry>
4378     </row>
4379
4380     <row>
4381      <entry role="catalog_table_entry"><para role="column_definition">
4382       <structfield>indexprs</structfield> <type>pg_node_tree</type>
4383      </para>
4384      <para>
4385       Expression trees (in <function>nodeToString()</function>
4386       representation) for index attributes that are not simple column
4387       references.  This is a list with one element for each zero
4388       entry in <structfield>indkey</structfield>.  Null if all index attributes
4389       are simple references.
4390      </para></entry>
4391     </row>
4392
4393     <row>
4394      <entry role="catalog_table_entry"><para role="column_definition">
4395       <structfield>indpred</structfield> <type>pg_node_tree</type>
4396      </para>
4397      <para>
4398       Expression tree (in <function>nodeToString()</function>
4399       representation) for partial index predicate.  Null if not a
4400       partial index.
4401      </para></entry>
4402     </row>
4403    </tbody>
4404   </tgroup>
4405  </table>
4406
4407 </sect1>
4408
4409
4410 <sect1 id="catalog-pg-inherits">
4411  <title><structname>pg_inherits</structname></title>
4412
4413  <indexterm zone="catalog-pg-inherits">
4414   <primary>pg_inherits</primary>
4415  </indexterm>
4416
4417  <para>
4418   The catalog <structname>pg_inherits</structname> records information about
4419   table and index inheritance hierarchies.  There is one entry for each direct
4420   parent-child table or index relationship in the database.  (Indirect
4421   inheritance can be determined by following chains of entries.)
4422  </para>
4423
4424  <table>
4425   <title><structname>pg_inherits</structname> Columns</title>
4426   <tgroup cols="1">
4427    <thead>
4428     <row>
4429      <entry role="catalog_table_entry"><para role="column_definition">
4430       Column Type
4431      </para>
4432      <para>
4433       Description
4434      </para></entry>
4435     </row>
4436    </thead>
4437
4438    <tbody>
4439     <row>
4440      <entry role="catalog_table_entry"><para role="column_definition">
4441       <structfield>inhrelid</structfield> <type>oid</type>
4442       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4443      </para>
4444      <para>
4445       The OID of the child table or index
4446      </para></entry>
4447     </row>
4448
4449     <row>
4450      <entry role="catalog_table_entry"><para role="column_definition">
4451       <structfield>inhparent</structfield> <type>oid</type>
4452       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4453      </para>
4454      <para>
4455       The OID of the parent table or index
4456      </para></entry>
4457     </row>
4458
4459     <row>
4460      <entry role="catalog_table_entry"><para role="column_definition">
4461       <structfield>inhseqno</structfield> <type>int4</type>
4462      </para>
4463      <para>
4464       If there is more than one direct parent for a child table (multiple
4465       inheritance), this number tells the order in which the
4466       inherited columns are to be arranged.  The count starts at 1.
4467      </para>
4468      <para>
4469       Indexes cannot have multiple inheritance, since they can only inherit
4470       when using declarative partitioning.
4471      </para></entry>
4472     </row>
4473    </tbody>
4474   </tgroup>
4475  </table>
4476
4477 </sect1>
4478
4479 <sect1 id="catalog-pg-init-privs">
4480  <title><structname>pg_init_privs</structname></title>
4481
4482  <indexterm zone="catalog-pg-init-privs">
4483   <primary>pg_init_privs</primary>
4484  </indexterm>
4485
4486  <para>
4487   The catalog <structname>pg_init_privs</structname> records information about
4488   the initial privileges of objects in the system.  There is one entry
4489   for each object in the database which has a non-default (non-NULL)
4490   initial set of privileges.
4491  </para>
4492
4493  <para>
4494   Objects can have initial privileges either by having those privileges set
4495   when the system is initialized (by <application>initdb</application>) or when the
4496   object is created during a <command>CREATE EXTENSION</command> and the
4497   extension script sets initial privileges using the <command>GRANT</command>
4498   system.  Note that the system will automatically handle recording of the
4499   privileges during the extension script and that extension authors need
4500   only use the <command>GRANT</command> and <command>REVOKE</command>
4501   statements in their script to have the privileges recorded.  The
4502   <literal>privtype</literal> column indicates if the initial privilege was
4503   set by <application>initdb</application> or during a
4504   <command>CREATE EXTENSION</command> command.
4505  </para>
4506
4507  <para>
4508   Objects which have initial privileges set by <application>initdb</application> will
4509   have entries where <literal>privtype</literal> is
4510   <literal>'i'</literal>, while objects which have initial privileges set
4511   by <command>CREATE EXTENSION</command> will have entries where
4512   <literal>privtype</literal> is <literal>'e'</literal>.
4513  </para>
4514
4515  <table>
4516   <title><structname>pg_init_privs</structname> Columns</title>
4517   <tgroup cols="1">
4518    <thead>
4519     <row>
4520      <entry role="catalog_table_entry"><para role="column_definition">
4521       Column Type
4522      </para>
4523      <para>
4524       Description
4525      </para></entry>
4526     </row>
4527    </thead>
4528
4529    <tbody>
4530     <row>
4531      <entry role="catalog_table_entry"><para role="column_definition">
4532       <structfield>objoid</structfield> <type>oid</type>
4533       (references any OID column)
4534      </para>
4535      <para>
4536       The OID of the specific object
4537      </para></entry>
4538     </row>
4539
4540     <row>
4541      <entry role="catalog_table_entry"><para role="column_definition">
4542       <structfield>classoid</structfield> <type>oid</type>
4543       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
4544      </para>
4545      <para>
4546       The OID of the system catalog the object is in
4547      </para></entry>
4548     </row>
4549
4550     <row>
4551      <entry role="catalog_table_entry"><para role="column_definition">
4552       <structfield>objsubid</structfield> <type>int4</type>
4553      </para>
4554      <para>
4555       For a table column, this is the column number (the
4556       <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to the
4557       table itself).  For all other object types, this column is
4558       zero.
4559      </para></entry>
4560     </row>
4561
4562     <row>
4563      <entry role="catalog_table_entry"><para role="column_definition">
4564       <structfield>privtype</structfield> <type>char</type>
4565      </para>
4566      <para>
4567       A code defining the type of initial privilege of this object; see text
4568      </para></entry>
4569     </row>
4570
4571     <row>
4572      <entry role="catalog_table_entry"><para role="column_definition">
4573       <structfield>initprivs</structfield> <type>aclitem[]</type>
4574      </para>
4575      <para>
4576       The initial access privileges; see
4577       <xref linkend="ddl-priv"/> for details
4578      </para></entry>
4579     </row>
4580    </tbody>
4581   </tgroup>
4582  </table>
4583
4584 </sect1>
4585
4586
4587 <sect1 id="catalog-pg-language">
4588  <title><structname>pg_language</structname></title>
4589
4590  <indexterm zone="catalog-pg-language">
4591   <primary>pg_language</primary>
4592  </indexterm>
4593
4594  <para>
4595   The catalog <structname>pg_language</structname> registers
4596   languages in which you can write functions or stored procedures.
4597   See <xref linkend="sql-createlanguage"/>
4598   and <xref linkend="xplang"/> for more information about language handlers.
4599  </para>
4600
4601  <table>
4602   <title><structname>pg_language</structname> Columns</title>
4603   <tgroup cols="1">
4604    <thead>
4605     <row>
4606      <entry role="catalog_table_entry"><para role="column_definition">
4607       Column Type
4608      </para>
4609      <para>
4610       Description
4611      </para></entry>
4612     </row>
4613    </thead>
4614
4615    <tbody>
4616     <row>
4617      <entry role="catalog_table_entry"><para role="column_definition">
4618       <structfield>oid</structfield> <type>oid</type>
4619      </para>
4620      <para>
4621       Row identifier
4622      </para></entry>
4623     </row>
4624
4625     <row>
4626      <entry role="catalog_table_entry"><para role="column_definition">
4627       <structfield>lanname</structfield> <type>name</type>
4628      </para>
4629      <para>
4630       Name of the language
4631      </para></entry>
4632     </row>
4633
4634     <row>
4635      <entry role="catalog_table_entry"><para role="column_definition">
4636       <structfield>lanowner</structfield> <type>oid</type>
4637       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4638      </para>
4639      <para>
4640       Owner of the language
4641      </para></entry>
4642     </row>
4643
4644     <row>
4645      <entry role="catalog_table_entry"><para role="column_definition">
4646       <structfield>lanispl</structfield> <type>bool</type>
4647      </para>
4648      <para>
4649       This is false for internal languages (such as
4650       <acronym>SQL</acronym>) and true for user-defined languages.
4651       Currently, <application>pg_dump</application> still uses this
4652       to determine which languages need to be dumped, but this might be
4653       replaced by a different mechanism in the future.
4654      </para></entry>
4655     </row>
4656
4657     <row>
4658      <entry role="catalog_table_entry"><para role="column_definition">
4659       <structfield>lanpltrusted</structfield> <type>bool</type>
4660      </para>
4661      <para>
4662       True if this is a trusted language, which means that it is believed
4663       not to grant access to anything outside the normal SQL execution
4664       environment.  Only superusers can create functions in untrusted
4665       languages.
4666      </para></entry>
4667     </row>
4668
4669     <row>
4670      <entry role="catalog_table_entry"><para role="column_definition">
4671       <structfield>lanplcallfoid</structfield> <type>oid</type>
4672       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4673      </para>
4674      <para>
4675       For noninternal languages this references the language
4676       handler, which is a special function that is responsible for
4677       executing all functions that are written in the particular
4678       language
4679      </para></entry>
4680     </row>
4681
4682     <row>
4683      <entry role="catalog_table_entry"><para role="column_definition">
4684       <structfield>laninline</structfield> <type>oid</type>
4685       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4686      </para>
4687      <para>
4688       This references a function that is responsible for executing
4689       <quote>inline</quote> anonymous code blocks
4690       (<xref linkend="sql-do"/> blocks).
4691       Zero if inline blocks are not supported.
4692      </para></entry>
4693     </row>
4694
4695     <row>
4696      <entry role="catalog_table_entry"><para role="column_definition">
4697       <structfield>lanvalidator</structfield> <type>oid</type>
4698       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
4699      </para>
4700      <para>
4701       This references a language validator function that is responsible
4702       for checking the syntax and validity of new functions when they
4703       are created.  Zero if no validator is provided.
4704      </para></entry>
4705     </row>
4706
4707     <row>
4708      <entry role="catalog_table_entry"><para role="column_definition">
4709       <structfield>lanacl</structfield> <type>aclitem[]</type>
4710      </para>
4711      <para>
4712       Access privileges; see <xref linkend="ddl-priv"/> for details
4713      </para></entry>
4714     </row>
4715    </tbody>
4716   </tgroup>
4717  </table>
4718
4719 </sect1>
4720
4721
4722 <sect1 id="catalog-pg-largeobject">
4723  <title><structname>pg_largeobject</structname></title>
4724
4725  <indexterm zone="catalog-pg-largeobject">
4726   <primary>pg_largeobject</primary>
4727  </indexterm>
4728
4729  <para>
4730   The catalog <structname>pg_largeobject</structname> holds the data making up
4731   <quote>large objects</quote>.  A large object is identified by an OID
4732   assigned when it is created.  Each large object is broken into
4733   segments or <quote>pages</quote> small enough to be conveniently stored as rows
4734   in <structname>pg_largeobject</structname>.
4735   The amount of data per page is defined to be <symbol>LOBLKSIZE</symbol> (which is currently
4736   <literal>BLCKSZ/4</literal>, or typically 2 kB).
4737  </para>
4738
4739  <para>
4740   Prior to <productname>PostgreSQL</productname> 9.0, there was no permission structure
4741   associated with large objects.  As a result,
4742   <structname>pg_largeobject</structname> was publicly readable and could be
4743   used to obtain the OIDs (and contents) of all large objects in the system.
4744   This is no longer the case; use
4745   <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>
4746   to obtain a list of large object OIDs.
4747  </para>
4748
4749  <table>
4750   <title><structname>pg_largeobject</structname> Columns</title>
4751   <tgroup cols="1">
4752    <thead>
4753     <row>
4754      <entry role="catalog_table_entry"><para role="column_definition">
4755       Column Type
4756      </para>
4757      <para>
4758       Description
4759      </para></entry>
4760     </row>
4761    </thead>
4762
4763    <tbody>
4764     <row>
4765      <entry role="catalog_table_entry"><para role="column_definition">
4766       <structfield>loid</structfield> <type>oid</type>
4767       (references <link linkend="catalog-pg-largeobject-metadata"><structname>pg_largeobject_metadata</structname></link>.<structfield>oid</structfield>)
4768      </para>
4769      <para>
4770       Identifier of the large object that includes this page
4771      </para></entry>
4772     </row>
4773
4774     <row>
4775      <entry role="catalog_table_entry"><para role="column_definition">
4776       <structfield>pageno</structfield> <type>int4</type>
4777      </para>
4778      <para>
4779       Page number of this page within its large object
4780       (counting from zero)
4781      </para></entry>
4782     </row>
4783
4784     <row>
4785      <entry role="catalog_table_entry"><para role="column_definition">
4786       <structfield>data</structfield> <type>bytea</type>
4787      </para>
4788      <para>
4789       Actual data stored in the large object.
4790       This will never be more than <symbol>LOBLKSIZE</symbol> bytes and might be less.
4791      </para></entry>
4792     </row>
4793    </tbody>
4794   </tgroup>
4795  </table>
4796
4797  <para>
4798   Each row of <structname>pg_largeobject</structname> holds data
4799   for one page of a large object, beginning at
4800   byte offset (<literal>pageno * LOBLKSIZE</literal>) within the object.  The implementation
4801   allows sparse storage: pages might be missing, and might be shorter than
4802   <literal>LOBLKSIZE</literal> bytes even if they are not the last page of the object.
4803   Missing regions within a large object read as zeroes.
4804  </para>
4805
4806 </sect1>
4807
4808 <sect1 id="catalog-pg-largeobject-metadata">
4809  <title><structname>pg_largeobject_metadata</structname></title>
4810
4811  <indexterm zone="catalog-pg-largeobject-metadata">
4812   <primary>pg_largeobject_metadata</primary>
4813  </indexterm>
4814
4815  <para>
4816   The catalog <structname>pg_largeobject_metadata</structname>
4817   holds metadata associated with large objects.  The actual large object
4818   data is stored in
4819   <link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link>.
4820  </para>
4821
4822  <table>
4823   <title><structname>pg_largeobject_metadata</structname> Columns</title>
4824   <tgroup cols="1">
4825    <thead>
4826     <row>
4827      <entry role="catalog_table_entry"><para role="column_definition">
4828       Column Type
4829      </para>
4830      <para>
4831       Description
4832      </para></entry>
4833     </row>
4834    </thead>
4835
4836    <tbody>
4837     <row>
4838      <entry role="catalog_table_entry"><para role="column_definition">
4839       <structfield>oid</structfield> <type>oid</type>
4840      </para>
4841      <para>
4842       Row identifier
4843      </para></entry>
4844     </row>
4845
4846     <row>
4847      <entry role="catalog_table_entry"><para role="column_definition">
4848       <structfield>lomowner</structfield> <type>oid</type>
4849       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4850      </para>
4851      <para>
4852       Owner of the large object
4853      </para></entry>
4854     </row>
4855
4856     <row>
4857      <entry role="catalog_table_entry"><para role="column_definition">
4858       <structfield>lomacl</structfield> <type>aclitem[]</type>
4859      </para>
4860      <para>
4861       Access privileges; see <xref linkend="ddl-priv"/> for details
4862      </para></entry>
4863     </row>
4864    </tbody>
4865   </tgroup>
4866  </table>
4867 </sect1>
4868
4869
4870 <sect1 id="catalog-pg-namespace">
4871  <title><structname>pg_namespace</structname></title>
4872
4873  <indexterm zone="catalog-pg-namespace">
4874   <primary>pg_namespace</primary>
4875  </indexterm>
4876
4877  <para>
4878   The catalog <structname>pg_namespace</structname> stores namespaces.
4879   A namespace is the structure underlying SQL schemas: each namespace
4880   can have a separate collection of relations, types, etc. without name
4881   conflicts.
4882  </para>
4883
4884  <table>
4885   <title><structname>pg_namespace</structname> Columns</title>
4886   <tgroup cols="1">
4887    <thead>
4888     <row>
4889      <entry role="catalog_table_entry"><para role="column_definition">
4890       Column Type
4891      </para>
4892      <para>
4893       Description
4894      </para></entry>
4895     </row>
4896    </thead>
4897
4898    <tbody>
4899     <row>
4900      <entry role="catalog_table_entry"><para role="column_definition">
4901       <structfield>oid</structfield> <type>oid</type>
4902      </para>
4903      <para>
4904       Row identifier
4905      </para></entry>
4906     </row>
4907
4908     <row>
4909      <entry role="catalog_table_entry"><para role="column_definition">
4910       <structfield>nspname</structfield> <type>name</type>
4911      </para>
4912      <para>
4913       Name of the namespace
4914      </para></entry>
4915     </row>
4916
4917     <row>
4918      <entry role="catalog_table_entry"><para role="column_definition">
4919       <structfield>nspowner</structfield> <type>oid</type>
4920       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
4921      </para>
4922      <para>
4923       Owner of the namespace
4924      </para></entry>
4925     </row>
4926
4927     <row>
4928      <entry role="catalog_table_entry"><para role="column_definition">
4929       <structfield>nspacl</structfield> <type>aclitem[]</type>
4930      </para>
4931      <para>
4932       Access privileges; see <xref linkend="ddl-priv"/> for details
4933      </para></entry>
4934     </row>
4935    </tbody>
4936   </tgroup>
4937  </table>
4938
4939 </sect1>
4940
4941
4942 <sect1 id="catalog-pg-opclass">
4943  <title><structname>pg_opclass</structname></title>
4944
4945  <indexterm zone="catalog-pg-opclass">
4946   <primary>pg_opclass</primary>
4947  </indexterm>
4948
4949  <para>
4950   The catalog <structname>pg_opclass</structname> defines
4951   index access method operator classes.  Each operator class defines
4952   semantics for index columns of a particular data type and a particular
4953   index access method.  An operator class essentially specifies that a
4954   particular operator family is applicable to a particular indexable column
4955   data type.  The set of operators from the family that are actually usable
4956   with the indexed column are whichever ones accept the column's data type
4957   as their left-hand input.
4958  </para>
4959
4960  <para>
4961   Operator classes are described at length in <xref linkend="xindex"/>.
4962  </para>
4963
4964  <table>
4965   <title><structname>pg_opclass</structname> Columns</title>
4966   <tgroup cols="1">
4967    <thead>
4968     <row>
4969      <entry role="catalog_table_entry"><para role="column_definition">
4970       Column Type
4971      </para>
4972      <para>
4973       Description
4974      </para></entry>
4975     </row>
4976    </thead>
4977
4978    <tbody>
4979     <row>
4980      <entry role="catalog_table_entry"><para role="column_definition">
4981       <structfield>oid</structfield> <type>oid</type>
4982      </para>
4983      <para>
4984       Row identifier
4985      </para></entry>
4986     </row>
4987
4988     <row>
4989      <entry role="catalog_table_entry"><para role="column_definition">
4990       <structfield>opcmethod</structfield> <type>oid</type>
4991       (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
4992      </para>
4993      <para>
4994       Index access method operator class is for
4995      </para></entry>
4996     </row>
4997
4998     <row>
4999      <entry role="catalog_table_entry"><para role="column_definition">
5000       <structfield>opcname</structfield> <type>name</type>
5001      </para>
5002      <para>
5003       Name of this operator class
5004      </para></entry>
5005     </row>
5006
5007     <row>
5008      <entry role="catalog_table_entry"><para role="column_definition">
5009       <structfield>opcnamespace</structfield> <type>oid</type>
5010       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5011      </para>
5012      <para>
5013       Namespace of this operator class
5014      </para></entry>
5015     </row>
5016
5017     <row>
5018      <entry role="catalog_table_entry"><para role="column_definition">
5019       <structfield>opcowner</structfield> <type>oid</type>
5020       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5021      </para>
5022      <para>
5023       Owner of the operator class
5024      </para></entry>
5025     </row>
5026
5027     <row>
5028      <entry role="catalog_table_entry"><para role="column_definition">
5029       <structfield>opcfamily</structfield> <type>oid</type>
5030       (references <link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.<structfield>oid</structfield>)
5031      </para>
5032      <para>
5033       Operator family containing the operator class
5034      </para></entry>
5035     </row>
5036
5037     <row>
5038      <entry role="catalog_table_entry"><para role="column_definition">
5039       <structfield>opcintype</structfield> <type>oid</type>
5040       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5041      </para>
5042      <para>
5043       Data type that the operator class indexes
5044      </para></entry>
5045     </row>
5046
5047     <row>
5048      <entry role="catalog_table_entry"><para role="column_definition">
5049       <structfield>opcdefault</structfield> <type>bool</type>
5050      </para>
5051      <para>
5052       True if this operator class is the default for <structfield>opcintype</structfield>
5053      </para></entry>
5054     </row>
5055
5056     <row>
5057      <entry role="catalog_table_entry"><para role="column_definition">
5058       <structfield>opckeytype</structfield> <type>oid</type>
5059       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5060      </para>
5061      <para>
5062       Type of data stored in index, or zero if same as <structfield>opcintype</structfield>
5063      </para></entry>
5064     </row>
5065    </tbody>
5066   </tgroup>
5067  </table>
5068
5069  <para>
5070   An operator class's <structfield>opcmethod</structfield> must match the
5071   <structname>opfmethod</structname> of its containing operator family.
5072   Also, there must be no more than one <structname>pg_opclass</structname>
5073   row having <structname>opcdefault</structname> true for any given combination of
5074   <structname>opcmethod</structname> and <structname>opcintype</structname>.
5075  </para>
5076
5077 </sect1>
5078
5079
5080 <sect1 id="catalog-pg-operator">
5081  <title><structname>pg_operator</structname></title>
5082
5083  <indexterm zone="catalog-pg-operator">
5084   <primary>pg_operator</primary>
5085  </indexterm>
5086
5087  <para>
5088   The catalog <structname>pg_operator</structname> stores information about operators.
5089   See <xref linkend="sql-createoperator"/>
5090   and <xref linkend="xoper"/> for more information.
5091  </para>
5092
5093  <table>
5094   <title><structname>pg_operator</structname> Columns</title>
5095   <tgroup cols="1">
5096    <thead>
5097     <row>
5098      <entry role="catalog_table_entry"><para role="column_definition">
5099       Column Type
5100      </para>
5101      <para>
5102       Description
5103      </para></entry>
5104     </row>
5105    </thead>
5106
5107    <tbody>
5108     <row>
5109      <entry role="catalog_table_entry"><para role="column_definition">
5110       <structfield>oid</structfield> <type>oid</type>
5111      </para>
5112      <para>
5113       Row identifier
5114      </para></entry>
5115     </row>
5116
5117     <row>
5118      <entry role="catalog_table_entry"><para role="column_definition">
5119       <structfield>oprname</structfield> <type>name</type>
5120      </para>
5121      <para>
5122       Name of the operator
5123      </para></entry>
5124     </row>
5125
5126     <row>
5127      <entry role="catalog_table_entry"><para role="column_definition">
5128       <structfield>oprnamespace</structfield> <type>oid</type>
5129       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5130      </para>
5131      <para>
5132       The OID of the namespace that contains this operator
5133      </para></entry>
5134     </row>
5135
5136     <row>
5137      <entry role="catalog_table_entry"><para role="column_definition">
5138       <structfield>oprowner</structfield> <type>oid</type>
5139       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5140      </para>
5141      <para>
5142       Owner of the operator
5143      </para></entry>
5144     </row>
5145
5146     <row>
5147      <entry role="catalog_table_entry"><para role="column_definition">
5148       <structfield>oprkind</structfield> <type>char</type>
5149      </para>
5150      <para>
5151       <literal>b</literal> = infix (<quote>both</quote>), <literal>l</literal> = prefix
5152       (<quote>left</quote>), <literal>r</literal> = postfix (<quote>right</quote>)
5153      </para></entry>
5154     </row>
5155
5156     <row>
5157      <entry role="catalog_table_entry"><para role="column_definition">
5158       <structfield>oprcanmerge</structfield> <type>bool</type>
5159      </para>
5160      <para>
5161       This operator supports merge joins
5162      </para></entry>
5163     </row>
5164
5165     <row>
5166      <entry role="catalog_table_entry"><para role="column_definition">
5167       <structfield>oprcanhash</structfield> <type>bool</type>
5168      </para>
5169      <para>
5170       This operator supports hash joins
5171      </para></entry>
5172     </row>
5173
5174     <row>
5175      <entry role="catalog_table_entry"><para role="column_definition">
5176       <structfield>oprleft</structfield> <type>oid</type>
5177       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5178      </para>
5179      <para>
5180       Type of the left operand
5181      </para></entry>
5182     </row>
5183
5184     <row>
5185      <entry role="catalog_table_entry"><para role="column_definition">
5186       <structfield>oprright</structfield> <type>oid</type>
5187       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5188      </para>
5189      <para>
5190       Type of the right operand
5191      </para></entry>
5192     </row>
5193
5194     <row>
5195      <entry role="catalog_table_entry"><para role="column_definition">
5196       <structfield>oprresult</structfield> <type>oid</type>
5197       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5198      </para>
5199      <para>
5200       Type of the result
5201      </para></entry>
5202     </row>
5203
5204     <row>
5205      <entry role="catalog_table_entry"><para role="column_definition">
5206       <structfield>oprcom</structfield> <type>oid</type>
5207       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
5208      </para>
5209      <para>
5210       Commutator of this operator, if any
5211      </para></entry>
5212     </row>
5213
5214     <row>
5215      <entry role="catalog_table_entry"><para role="column_definition">
5216       <structfield>oprnegate</structfield> <type>oid</type>
5217       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
5218      </para>
5219      <para>
5220       Negator of this operator, if any
5221      </para></entry>
5222     </row>
5223
5224     <row>
5225      <entry role="catalog_table_entry"><para role="column_definition">
5226       <structfield>oprcode</structfield> <type>regproc</type>
5227       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5228      </para>
5229      <para>
5230       Function that implements this operator
5231      </para></entry>
5232     </row>
5233
5234     <row>
5235      <entry role="catalog_table_entry"><para role="column_definition">
5236       <structfield>oprrest</structfield> <type>regproc</type>
5237       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5238      </para>
5239      <para>
5240       Restriction selectivity estimation function for this operator
5241      </para></entry>
5242     </row>
5243
5244     <row>
5245      <entry role="catalog_table_entry"><para role="column_definition">
5246       <structfield>oprjoin</structfield> <type>regproc</type>
5247       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5248      </para>
5249      <para>
5250       Join selectivity estimation function for this operator
5251      </para></entry>
5252     </row>
5253    </tbody>
5254   </tgroup>
5255  </table>
5256
5257  <para>
5258   Unused columns contain zeroes. For example, <structfield>oprleft</structfield>
5259   is zero for a prefix operator.
5260  </para>
5261
5262 </sect1>
5263
5264
5265 <sect1 id="catalog-pg-opfamily">
5266  <title><structname>pg_opfamily</structname></title>
5267
5268  <indexterm zone="catalog-pg-opfamily">
5269   <primary>pg_opfamily</primary>
5270  </indexterm>
5271
5272  <para>
5273   The catalog <structname>pg_opfamily</structname> defines operator families.
5274   Each operator family is a collection of operators and associated
5275   support routines that implement the semantics specified for a particular
5276   index access method.  Furthermore, the operators in a family are all
5277   <quote>compatible</quote>, in a way that is specified by the access method.
5278   The operator family concept allows cross-data-type operators to be used
5279   with indexes and to be reasoned about using knowledge of access method
5280   semantics.
5281  </para>
5282
5283  <para>
5284   Operator families are described at length in <xref linkend="xindex"/>.
5285  </para>
5286
5287  <table>
5288   <title><structname>pg_opfamily</structname> Columns</title>
5289   <tgroup cols="1">
5290    <thead>
5291     <row>
5292      <entry role="catalog_table_entry"><para role="column_definition">
5293       Column Type
5294      </para>
5295      <para>
5296       Description
5297      </para></entry>
5298     </row>
5299    </thead>
5300
5301    <tbody>
5302     <row>
5303      <entry role="catalog_table_entry"><para role="column_definition">
5304       <structfield>oid</structfield> <type>oid</type>
5305      </para>
5306      <para>
5307       Row identifier
5308      </para></entry>
5309     </row>
5310
5311     <row>
5312      <entry role="catalog_table_entry"><para role="column_definition">
5313       <structfield>opfmethod</structfield> <type>oid</type>
5314       (references <link linkend="catalog-pg-am"><structname>pg_am</structname></link>.<structfield>oid</structfield>)
5315      </para>
5316      <para>
5317       Index access method operator family is for
5318      </para></entry>
5319     </row>
5320
5321     <row>
5322      <entry role="catalog_table_entry"><para role="column_definition">
5323       <structfield>opfname</structfield> <type>name</type>
5324      </para>
5325      <para>
5326       Name of this operator family
5327      </para></entry>
5328     </row>
5329
5330     <row>
5331      <entry role="catalog_table_entry"><para role="column_definition">
5332       <structfield>opfnamespace</structfield> <type>oid</type>
5333       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5334      </para>
5335      <para>
5336       Namespace of this operator family
5337      </para></entry>
5338     </row>
5339
5340     <row>
5341      <entry role="catalog_table_entry"><para role="column_definition">
5342       <structfield>opfowner</structfield> <type>oid</type>
5343       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5344      </para>
5345      <para>
5346       Owner of the operator family
5347      </para></entry>
5348     </row>
5349    </tbody>
5350   </tgroup>
5351  </table>
5352
5353  <para>
5354   The majority of the information defining an operator family is not in its
5355   <structname>pg_opfamily</structname> row, but in the associated rows in
5356   <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
5357   <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
5358   and
5359   <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
5360  </para>
5361
5362 </sect1>
5363
5364
5365 <sect1 id="catalog-pg-partitioned-table">
5366  <title><structname>pg_partitioned_table</structname></title>
5367
5368  <indexterm zone="catalog-pg-partitioned-table">
5369   <primary>pg_partitioned_table</primary>
5370  </indexterm>
5371
5372  <para>
5373   The catalog <structname>pg_partitioned_table</structname> stores
5374   information about how tables are partitioned.
5375  </para>
5376
5377  <table>
5378   <title><structname>pg_partitioned_table</structname> Columns</title>
5379   <tgroup cols="1">
5380    <thead>
5381     <row>
5382      <entry role="catalog_table_entry"><para role="column_definition">
5383       Column Type
5384      </para>
5385      <para>
5386       Description
5387      </para></entry>
5388     </row>
5389    </thead>
5390
5391    <tbody>
5392     <row>
5393      <entry role="catalog_table_entry"><para role="column_definition">
5394       <structfield>partrelid</structfield> <type>oid</type>
5395       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5396      </para>
5397      <para>
5398       The OID of the <structname>pg_class</structname> entry for this partitioned table
5399      </para></entry>
5400     </row>
5401
5402     <row>
5403      <entry role="catalog_table_entry"><para role="column_definition">
5404       <structfield>partstrat</structfield> <type>char</type>
5405      </para>
5406      <para>
5407       Partitioning strategy; <literal>h</literal> = hash partitioned table,
5408       <literal>l</literal> = list partitioned table, <literal>r</literal> = range partitioned table
5409      </para></entry>
5410     </row>
5411
5412     <row>
5413      <entry role="catalog_table_entry"><para role="column_definition">
5414       <structfield>partnatts</structfield> <type>int2</type>
5415      </para>
5416      <para>
5417       The number of columns in partition key
5418      </para></entry>
5419     </row>
5420
5421     <row>
5422      <entry role="catalog_table_entry"><para role="column_definition">
5423       <structfield>partdefid</structfield> <type>oid</type>
5424       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5425      </para>
5426      <para>
5427       The OID of the <structname>pg_class</structname> entry for the default partition
5428       of this partitioned table, or zero if this partitioned table does not
5429       have a default partition.
5430      </para></entry>
5431     </row>
5432
5433     <row>
5434      <entry role="catalog_table_entry"><para role="column_definition">
5435       <structfield>partattrs</structfield> <type>int2vector</type>
5436       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
5437      </para>
5438      <para>
5439       This is an array of <structfield>partnatts</structfield> values that
5440       indicate which table columns are part of the partition key.  For
5441       example, a value of <literal>1 3</literal> would mean that the first
5442       and the third table columns make up the partition key.  A zero in this
5443       array indicates that the corresponding partition key column is an
5444       expression, rather than a simple column reference.
5445      </para></entry>
5446     </row>
5447
5448     <row>
5449      <entry role="catalog_table_entry"><para role="column_definition">
5450       <structfield>partclass</structfield> <type>oidvector</type>
5451       (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
5452      </para>
5453      <para>
5454       For each column in the partition key, this contains the OID of the
5455       operator class to use.  See
5456       <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details.
5457      </para></entry>
5458     </row>
5459
5460     <row>
5461      <entry role="catalog_table_entry"><para role="column_definition">
5462       <structfield>partcollation</structfield> <type>oidvector</type>
5463       (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
5464      </para>
5465      <para>
5466       For each column in the partition key, this contains the OID of the
5467       collation to use for partitioning, or zero if the column is not
5468       of a collatable data type.
5469      </para></entry>
5470     </row>
5471
5472     <row>
5473      <entry role="catalog_table_entry"><para role="column_definition">
5474       <structfield>partexprs</structfield> <type>pg_node_tree</type>
5475      </para>
5476      <para>
5477       Expression trees (in <function>nodeToString()</function>
5478       representation) for partition key columns that are not simple column
5479       references.  This is a list with one element for each zero
5480       entry in <structfield>partattrs</structfield>.  Null if all partition key columns
5481       are simple references.
5482      </para></entry>
5483     </row>
5484    </tbody>
5485   </tgroup>
5486  </table>
5487 </sect1>
5488
5489
5490 <sect1 id="catalog-pg-policy">
5491  <title><structname>pg_policy</structname></title>
5492
5493  <indexterm zone="catalog-pg-policy">
5494   <primary>pg_policy</primary>
5495  </indexterm>
5496
5497  <para>
5498   The catalog <structname>pg_policy</structname> stores row level
5499   security policies for tables.  A policy includes the kind of
5500   command that it applies to (possibly all commands), the roles that it
5501   applies to, the expression to be added as a security-barrier
5502   qualification to queries that include the table, and the expression
5503   to be added as a <literal>WITH CHECK</literal> option for queries that attempt to
5504   add new records to the table.
5505  </para>
5506
5507  <table>
5508   <title><structname>pg_policy</structname> Columns</title>
5509   <tgroup cols="1">
5510    <thead>
5511     <row>
5512      <entry role="catalog_table_entry"><para role="column_definition">
5513       Column Type
5514      </para>
5515      <para>
5516       Description
5517      </para></entry>
5518     </row>
5519    </thead>
5520
5521    <tbody>
5522     <row>
5523      <entry role="catalog_table_entry"><para role="column_definition">
5524       <structfield>oid</structfield> <type>oid</type>
5525      </para>
5526      <para>
5527       Row identifier
5528      </para></entry>
5529     </row>
5530
5531     <row>
5532      <entry role="catalog_table_entry"><para role="column_definition">
5533       <structfield>polname</structfield> <type>name</type>
5534      </para>
5535      <para>
5536       The name of the policy
5537      </para></entry>
5538     </row>
5539
5540     <row>
5541      <entry role="catalog_table_entry"><para role="column_definition">
5542       <structfield>polrelid</structfield> <type>oid</type>
5543       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
5544      </para>
5545      <para>
5546       The table to which the policy applies
5547      </para></entry>
5548     </row>
5549
5550     <row>
5551      <entry role="catalog_table_entry"><para role="column_definition">
5552       <structfield>polcmd</structfield> <type>char</type>
5553      </para>
5554      <para>
5555       The command type to which the policy is applied:
5556       <literal>r</literal> for <command>SELECT</command>,
5557       <literal>a</literal> for <command>INSERT</command>,
5558       <literal>w</literal> for <command>UPDATE</command>,
5559       <literal>d</literal> for <command>DELETE</command>,
5560       or <literal>*</literal> for all
5561      </para></entry>
5562     </row>
5563
5564     <row>
5565      <entry role="catalog_table_entry"><para role="column_definition">
5566       <structfield>polpermissive</structfield> <type>bool</type>
5567      </para>
5568      <para>
5569       Is the policy permissive or restrictive?
5570      </para></entry>
5571     </row>
5572
5573     <row>
5574      <entry role="catalog_table_entry"><para role="column_definition">
5575       <structfield>polroles</structfield> <type>oid[]</type>
5576       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5577      </para>
5578      <para>
5579       The roles to which the policy is applied
5580      </para></entry>
5581     </row>
5582
5583     <row>
5584      <entry role="catalog_table_entry"><para role="column_definition">
5585       <structfield>polqual</structfield> <type>pg_node_tree</type>
5586      </para>
5587      <para>
5588       The expression tree to be added to the security barrier qualifications for queries that use the table
5589      </para></entry>
5590     </row>
5591
5592     <row>
5593      <entry role="catalog_table_entry"><para role="column_definition">
5594       <structfield>polwithcheck</structfield> <type>pg_node_tree</type>
5595      </para>
5596      <para>
5597       The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table
5598      </para></entry>
5599     </row>
5600    </tbody>
5601   </tgroup>
5602  </table>
5603
5604  <note>
5605   <para>
5606    Policies stored in <structname>pg_policy</structname> are applied only when
5607    <structname>pg_class</structname>.<structfield>relrowsecurity</structfield> is set for
5608    their table.
5609   </para>
5610  </note>
5611
5612 </sect1>
5613
5614 <sect1 id="catalog-pg-proc">
5615  <title><structname>pg_proc</structname></title>
5616
5617  <indexterm zone="catalog-pg-proc">
5618   <primary>pg_proc</primary>
5619  </indexterm>
5620
5621  <para>
5622   The catalog <structname>pg_proc</structname> stores information about
5623   functions, procedures, aggregate functions, and window functions
5624   (collectively also known as routines).  See <xref
5625   linkend="sql-createfunction"/>, <xref linkend="sql-createprocedure"/>, and
5626   <xref linkend="xfunc"/> for more information.
5627  </para>
5628
5629  <para>
5630   If <structfield>prokind</structfield> indicates that the entry is for an
5631   aggregate function, there should be a matching row in
5632   <structfield>pg_aggregate</structfield>.
5633  </para>
5634
5635  <table>
5636   <title><structname>pg_proc</structname> Columns</title>
5637   <tgroup cols="1">
5638    <thead>
5639     <row>
5640      <entry role="catalog_table_entry"><para role="column_definition">
5641       Column Type
5642      </para>
5643      <para>
5644       Description
5645      </para></entry>
5646     </row>
5647    </thead>
5648
5649    <tbody>
5650     <row>
5651      <entry role="catalog_table_entry"><para role="column_definition">
5652       <structfield>oid</structfield> <type>oid</type>
5653      </para>
5654      <para>
5655       Row identifier
5656      </para></entry>
5657     </row>
5658
5659     <row>
5660      <entry role="catalog_table_entry"><para role="column_definition">
5661       <structfield>proname</structfield> <type>name</type>
5662      </para>
5663      <para>
5664       Name of the function
5665      </para></entry>
5666     </row>
5667
5668     <row>
5669      <entry role="catalog_table_entry"><para role="column_definition">
5670       <structfield>pronamespace</structfield> <type>oid</type>
5671       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
5672      </para>
5673      <para>
5674       The OID of the namespace that contains this function
5675      </para></entry>
5676     </row>
5677
5678     <row>
5679      <entry role="catalog_table_entry"><para role="column_definition">
5680       <structfield>proowner</structfield> <type>oid</type>
5681       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
5682      </para>
5683      <para>
5684       Owner of the function
5685      </para></entry>
5686     </row>
5687
5688     <row>
5689      <entry role="catalog_table_entry"><para role="column_definition">
5690       <structfield>prolang</structfield> <type>oid</type>
5691       (references <link linkend="catalog-pg-language"><structname>pg_language</structname></link>.<structfield>oid</structfield>)
5692      </para>
5693      <para>
5694       Implementation language or call interface of this function
5695      </para></entry>
5696     </row>
5697
5698     <row>
5699      <entry role="catalog_table_entry"><para role="column_definition">
5700       <structfield>procost</structfield> <type>float4</type>
5701      </para>
5702      <para>
5703       Estimated execution cost (in units of
5704       <xref linkend="guc-cpu-operator-cost"/>); if <structfield>proretset</structfield>,
5705       this is cost per row returned
5706      </para></entry>
5707     </row>
5708
5709     <row>
5710      <entry role="catalog_table_entry"><para role="column_definition">
5711       <structfield>prorows</structfield> <type>float4</type>
5712      </para>
5713      <para>
5714       Estimated number of result rows (zero if not <structfield>proretset</structfield>)
5715      </para></entry>
5716     </row>
5717
5718     <row>
5719      <entry role="catalog_table_entry"><para role="column_definition">
5720       <structfield>provariadic</structfield> <type>oid</type>
5721       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5722      </para>
5723      <para>
5724       Data type of the variadic array parameter's elements,
5725       or zero if the function does not have a variadic parameter
5726      </para></entry>
5727     </row>
5728
5729     <row>
5730      <entry role="catalog_table_entry"><para role="column_definition">
5731       <structfield>prosupport</structfield> <type>regproc</type>
5732       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
5733      </para>
5734      <para>
5735       Optional planner support function for this function
5736       (see <xref linkend="xfunc-optimization"/>)
5737      </para></entry>
5738     </row>
5739
5740     <row>
5741      <entry role="catalog_table_entry"><para role="column_definition">
5742       <structfield>prokind</structfield> <type>char</type>
5743      </para>
5744      <para>
5745       <literal>f</literal> for a normal function, <literal>p</literal>
5746       for a procedure, <literal>a</literal> for an aggregate function, or
5747       <literal>w</literal> for a window function
5748      </para></entry>
5749     </row>
5750
5751     <row>
5752      <entry role="catalog_table_entry"><para role="column_definition">
5753       <structfield>prosecdef</structfield> <type>bool</type>
5754      </para>
5755      <para>
5756       Function is a security definer (i.e., a <quote>setuid</quote>
5757       function)
5758      </para></entry>
5759     </row>
5760
5761     <row>
5762      <entry role="catalog_table_entry"><para role="column_definition">
5763       <structfield>proleakproof</structfield> <type>bool</type>
5764      </para>
5765      <para>
5766       The function has no side effects.  No information about the
5767       arguments is conveyed except via the return value.  Any function
5768       that might throw an error depending on the values of its arguments
5769       is not leak-proof.
5770      </para></entry>
5771     </row>
5772
5773     <row>
5774      <entry role="catalog_table_entry"><para role="column_definition">
5775       <structfield>proisstrict</structfield> <type>bool</type>
5776      </para>
5777      <para>
5778       Function returns null if any call argument is null.  In that
5779       case the function won't actually be called at all.  Functions
5780       that are not <quote>strict</quote> must be prepared to handle
5781       null inputs.
5782      </para></entry>
5783     </row>
5784
5785     <row>
5786      <entry role="catalog_table_entry"><para role="column_definition">
5787       <structfield>proretset</structfield> <type>bool</type>
5788      </para>
5789      <para>
5790       Function returns a set (i.e., multiple values of the specified
5791       data type)
5792      </para></entry>
5793     </row>
5794
5795     <row>
5796      <entry role="catalog_table_entry"><para role="column_definition">
5797       <structfield>provolatile</structfield> <type>char</type>
5798      </para>
5799      <para>
5800       <structfield>provolatile</structfield> tells whether the function's
5801       result depends only on its input arguments, or is affected by outside
5802       factors.
5803       It is <literal>i</literal> for <quote>immutable</quote> functions,
5804       which always deliver the same result for the same inputs.
5805       It is <literal>s</literal> for <quote>stable</quote> functions,
5806       whose results (for fixed inputs) do not change within a scan.
5807       It is <literal>v</literal> for <quote>volatile</quote> functions,
5808       whose results might change at any time.  (Use <literal>v</literal> also
5809       for functions with side-effects, so that calls to them cannot get
5810       optimized away.)
5811      </para></entry>
5812     </row>
5813
5814     <row>
5815      <entry role="catalog_table_entry"><para role="column_definition">
5816       <structfield>proparallel</structfield> <type>char</type>
5817      </para>
5818      <para>
5819       <structfield>proparallel</structfield> tells whether the function
5820       can be safely run in parallel mode.
5821       It is <literal>s</literal> for functions which are safe to run in
5822       parallel mode without restriction.
5823       It is <literal>r</literal> for functions which can be run in parallel
5824       mode, but their execution is restricted to the parallel group leader;
5825       parallel worker processes cannot invoke these functions.
5826       It is <literal>u</literal> for functions which are unsafe in parallel
5827       mode; the presence of such a function forces a serial execution plan.
5828      </para></entry>
5829     </row>
5830
5831     <row>
5832      <entry role="catalog_table_entry"><para role="column_definition">
5833       <structfield>pronargs</structfield> <type>int2</type>
5834      </para>
5835      <para>
5836       Number of input arguments
5837      </para></entry>
5838     </row>
5839
5840     <row>
5841      <entry role="catalog_table_entry"><para role="column_definition">
5842       <structfield>pronargdefaults</structfield> <type>int2</type>
5843      </para>
5844      <para>
5845       Number of arguments that have defaults
5846      </para></entry>
5847     </row>
5848
5849     <row>
5850      <entry role="catalog_table_entry"><para role="column_definition">
5851       <structfield>prorettype</structfield> <type>oid</type>
5852       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5853      </para>
5854      <para>
5855       Data type of the return value
5856      </para></entry>
5857     </row>
5858
5859     <row>
5860      <entry role="catalog_table_entry"><para role="column_definition">
5861       <structfield>proargtypes</structfield> <type>oidvector</type>
5862       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5863      </para>
5864      <para>
5865       An array of the data types of the function arguments.  This includes
5866       only input arguments (including <literal>INOUT</literal> and
5867       <literal>VARIADIC</literal> arguments), and thus represents
5868       the call signature of the function.
5869      </para></entry>
5870     </row>
5871
5872     <row>
5873      <entry role="catalog_table_entry"><para role="column_definition">
5874       <structfield>proallargtypes</structfield> <type>oid[]</type>
5875       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5876      </para>
5877      <para>
5878       An array of the data types of the function arguments.  This includes
5879       all arguments (including <literal>OUT</literal> and
5880       <literal>INOUT</literal> arguments); however, if all the
5881       arguments are <literal>IN</literal> arguments, this field will be null.
5882       Note that subscripting is 1-based, whereas for historical reasons
5883       <structfield>proargtypes</structfield> is subscripted from 0.
5884      </para></entry>
5885     </row>
5886
5887     <row>
5888      <entry role="catalog_table_entry"><para role="column_definition">
5889       <structfield>proargmodes</structfield> <type>char[]</type>
5890      </para>
5891      <para>
5892       An array of the modes of the function arguments, encoded as
5893       <literal>i</literal> for <literal>IN</literal> arguments,
5894       <literal>o</literal> for <literal>OUT</literal> arguments,
5895       <literal>b</literal> for <literal>INOUT</literal> arguments,
5896       <literal>v</literal> for <literal>VARIADIC</literal> arguments,
5897       <literal>t</literal> for <literal>TABLE</literal> arguments.
5898       If all the arguments are <literal>IN</literal> arguments,
5899       this field will be null.
5900       Note that subscripts correspond to positions of
5901       <structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
5902      </para></entry>
5903     </row>
5904
5905     <row>
5906      <entry role="catalog_table_entry"><para role="column_definition">
5907       <structfield>proargnames</structfield> <type>text[]</type>
5908      </para>
5909      <para>
5910       An array of the names of the function arguments.
5911       Arguments without a name are set to empty strings in the array.
5912       If none of the arguments have a name, this field will be null.
5913       Note that subscripts correspond to positions of
5914       <structfield>proallargtypes</structfield> not <structfield>proargtypes</structfield>.
5915      </para></entry>
5916     </row>
5917
5918     <row>
5919      <entry role="catalog_table_entry"><para role="column_definition">
5920       <structfield>proargdefaults</structfield> <type>pg_node_tree</type>
5921      </para>
5922      <para>
5923       Expression trees (in <function>nodeToString()</function> representation)
5924       for default values.  This is a list with
5925       <structfield>pronargdefaults</structfield> elements, corresponding to the last
5926       <replaceable>N</replaceable> <emphasis>input</emphasis> arguments (i.e., the last
5927       <replaceable>N</replaceable> <structfield>proargtypes</structfield> positions).
5928       If none of the arguments have defaults, this field will be null.
5929      </para></entry>
5930     </row>
5931
5932     <row>
5933      <entry role="catalog_table_entry"><para role="column_definition">
5934       <structfield>protrftypes</structfield> <type>oid[]</type>
5935       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
5936      </para>
5937      <para>
5938       An array of the argument/result data type(s) for which to apply
5939       transforms (from the function's <literal>TRANSFORM</literal>
5940       clause).  Null if none.
5941      </para></entry>
5942     </row>
5943
5944     <row>
5945      <entry role="catalog_table_entry"><para role="column_definition">
5946       <structfield>prosrc</structfield> <type>text</type>
5947      </para>
5948      <para>
5949       This tells the function handler how to invoke the function.  It
5950       might be the actual source code of the function for interpreted
5951       languages, a link symbol, a file name, or just about anything
5952       else, depending on the implementation language/call convention.
5953      </para></entry>
5954     </row>
5955
5956     <row>
5957      <entry role="catalog_table_entry"><para role="column_definition">
5958       <structfield>probin</structfield> <type>text</type>
5959      </para>
5960      <para>
5961       Additional information about how to invoke the function.
5962       Again, the interpretation is language-specific.
5963      </para></entry>
5964     </row>
5965
5966     <row>
5967      <entry role="catalog_table_entry"><para role="column_definition">
5968       <structfield>proconfig</structfield> <type>text[]</type>
5969      </para>
5970      <para>
5971       Function's local settings for run-time configuration variables
5972      </para></entry>
5973     </row>
5974
5975     <row>
5976      <entry role="catalog_table_entry"><para role="column_definition">
5977       <structfield>proacl</structfield> <type>aclitem[]</type>
5978      </para>
5979      <para>
5980       Access privileges; see <xref linkend="ddl-priv"/> for details
5981      </para></entry>
5982     </row>
5983    </tbody>
5984   </tgroup>
5985  </table>
5986
5987  <para>
5988   For compiled functions, both built-in and dynamically loaded,
5989   <structfield>prosrc</structfield> contains the function's C-language
5990   name (link symbol).  For all other currently-known language types,
5991   <structfield>prosrc</structfield> contains the function's source
5992   text.  <structfield>probin</structfield> is unused except for
5993   dynamically-loaded C functions, for which it gives the name of the
5994   shared library file containing the function.
5995  </para>
5996
5997 </sect1>
5998
5999 <sect1 id="catalog-pg-publication">
6000  <title><structname>pg_publication</structname></title>
6001
6002  <indexterm zone="catalog-pg-publication">
6003   <primary>pg_publication</primary>
6004  </indexterm>
6005
6006  <para>
6007   The catalog <structname>pg_publication</structname> contains all
6008   publications created in the database.  For more on publications see
6009   <xref linkend="logical-replication-publication"/>.
6010  </para>
6011
6012  <table>
6013   <title><structname>pg_publication</structname> Columns</title>
6014   <tgroup cols="1">
6015    <thead>
6016     <row>
6017      <entry role="catalog_table_entry"><para role="column_definition">
6018       Column Type
6019      </para>
6020      <para>
6021       Description
6022      </para></entry>
6023     </row>
6024    </thead>
6025
6026    <tbody>
6027     <row>
6028      <entry role="catalog_table_entry"><para role="column_definition">
6029       <structfield>oid</structfield> <type>oid</type>
6030      </para>
6031      <para>
6032       Row identifier
6033      </para></entry>
6034     </row>
6035
6036     <row>
6037      <entry role="catalog_table_entry"><para role="column_definition">
6038       <structfield>pubname</structfield> <type>name</type>
6039      </para>
6040      <para>
6041       Name of the publication
6042      </para></entry>
6043     </row>
6044
6045     <row>
6046      <entry role="catalog_table_entry"><para role="column_definition">
6047       <structfield>pubowner</structfield> <type>oid</type>
6048       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
6049      </para>
6050      <para>
6051       Owner of the publication
6052      </para></entry>
6053     </row>
6054
6055     <row>
6056      <entry role="catalog_table_entry"><para role="column_definition">
6057       <structfield>puballtables</structfield> <type>bool</type>
6058      </para>
6059      <para>
6060       If true, this publication automatically includes all tables
6061       in the database, including any that will be created in the future.
6062      </para></entry>
6063     </row>
6064
6065     <row>
6066      <entry role="catalog_table_entry"><para role="column_definition">
6067       <structfield>pubinsert</structfield> <type>bool</type>
6068      </para>
6069      <para>
6070       If true, <command>INSERT</command> operations are replicated for
6071       tables in the publication.
6072      </para></entry>
6073     </row>
6074
6075     <row>
6076      <entry role="catalog_table_entry"><para role="column_definition">
6077       <structfield>pubupdate</structfield> <type>bool</type>
6078      </para>
6079      <para>
6080       If true, <command>UPDATE</command> operations are replicated for
6081       tables in the publication.
6082      </para></entry>
6083     </row>
6084
6085     <row>
6086      <entry role="catalog_table_entry"><para role="column_definition">
6087       <structfield>pubdelete</structfield> <type>bool</type>
6088      </para>
6089      <para>
6090       If true, <command>DELETE</command> operations are replicated for
6091       tables in the publication.
6092      </para></entry>
6093     </row>
6094
6095     <row>
6096      <entry role="catalog_table_entry"><para role="column_definition">
6097       <structfield>pubtruncate</structfield> <type>bool</type>
6098      </para>
6099      <para>
6100       If true, <command>TRUNCATE</command> operations are replicated for
6101       tables in the publication.
6102      </para></entry>
6103     </row>
6104
6105     <row>
6106      <entry role="catalog_table_entry"><para role="column_definition">
6107       <structfield>pubviaroot</structfield> <type>bool</type>
6108      </para>
6109      <para>
6110       If true, operations on a leaf partition are replicated using the
6111       identity and schema of its topmost partitioned ancestor mentioned in the
6112       publication instead of its own.
6113      </para></entry>
6114     </row>
6115    </tbody>
6116   </tgroup>
6117  </table>
6118 </sect1>
6119
6120 <sect1 id="catalog-pg-publication-rel">
6121  <title><structname>pg_publication_rel</structname></title>
6122
6123  <indexterm zone="catalog-pg-publication-rel">
6124   <primary>pg_publication_rel</primary>
6125  </indexterm>
6126
6127  <para>
6128   The catalog <structname>pg_publication_rel</structname> contains the
6129   mapping between relations and publications in the database.  This is a
6130   many-to-many mapping.  See also <xref linkend="view-pg-publication-tables"/>
6131   for a more user-friendly view of this information.
6132  </para>
6133
6134  <table>
6135   <title><structname>pg_publication_rel</structname> Columns</title>
6136   <tgroup cols="1">
6137    <thead>
6138     <row>
6139      <entry role="catalog_table_entry"><para role="column_definition">
6140       Column Type
6141      </para>
6142      <para>
6143       Description
6144      </para></entry>
6145     </row>
6146    </thead>
6147
6148    <tbody>
6149     <row>
6150      <entry role="catalog_table_entry"><para role="column_definition">
6151       <structfield>oid</structfield> <type>oid</type>
6152      </para>
6153      <para>
6154       Row identifier
6155      </para></entry>
6156     </row>
6157
6158     <row>
6159      <entry role="catalog_table_entry"><para role="column_definition">
6160       <structfield>prpubid</structfield> <type>oid</type>
6161       (references <link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.<structfield>oid</structfield>)
6162      </para>
6163      <para>
6164       Reference to publication
6165      </para></entry>
6166     </row>
6167
6168     <row>
6169      <entry role="catalog_table_entry"><para role="column_definition">
6170       <structfield>prrelid</structfield> <type>oid</type>
6171       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6172      </para>
6173      <para>
6174       Reference to relation
6175      </para></entry>
6176     </row>
6177    </tbody>
6178   </tgroup>
6179  </table>
6180 </sect1>
6181
6182 <sect1 id="catalog-pg-range">
6183  <title><structname>pg_range</structname></title>
6184
6185  <indexterm zone="catalog-pg-range">
6186   <primary>pg_range</primary>
6187  </indexterm>
6188
6189  <para>
6190   The catalog <structname>pg_range</structname> stores information about
6191   range types.  This is in addition to the types' entries in
6192   <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.
6193  </para>
6194
6195  <table>
6196   <title><structname>pg_range</structname> Columns</title>
6197   <tgroup cols="1">
6198    <thead>
6199     <row>
6200      <entry role="catalog_table_entry"><para role="column_definition">
6201       Column Type
6202      </para>
6203      <para>
6204       Description
6205      </para></entry>
6206     </row>
6207    </thead>
6208
6209    <tbody>
6210     <row>
6211      <entry role="catalog_table_entry"><para role="column_definition">
6212       <structfield>rngtypid</structfield> <type>oid</type>
6213       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6214      </para>
6215      <para>
6216       OID of the range type
6217      </para></entry>
6218     </row>
6219
6220     <row>
6221      <entry role="catalog_table_entry"><para role="column_definition">
6222       <structfield>rngsubtype</structfield> <type>oid</type>
6223       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6224      </para>
6225      <para>
6226       OID of the element type (subtype) of this range type
6227      </para></entry>
6228     </row>
6229
6230     <row>
6231      <entry role="catalog_table_entry"><para role="column_definition">
6232       <structfield>rngcollation</structfield> <type>oid</type>
6233       (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
6234      </para>
6235      <para>
6236       OID of the collation used for range comparisons, or 0 if none
6237      </para></entry>
6238     </row>
6239
6240     <row>
6241      <entry role="catalog_table_entry"><para role="column_definition">
6242       <structfield>rngsubopc</structfield> <type>oid</type>
6243       (references <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.<structfield>oid</structfield>)
6244      </para>
6245      <para>
6246       OID of the subtype's operator class used for range comparisons
6247      </para></entry>
6248     </row>
6249
6250     <row>
6251      <entry role="catalog_table_entry"><para role="column_definition">
6252       <structfield>rngcanonical</structfield> <type>regproc</type>
6253       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
6254      </para>
6255      <para>
6256       OID of the function to convert a range value into canonical form,
6257       or 0 if none
6258      </para></entry>
6259     </row>
6260
6261     <row>
6262      <entry role="catalog_table_entry"><para role="column_definition">
6263       <structfield>rngsubdiff</structfield> <type>regproc</type>
6264       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
6265      </para>
6266      <para>
6267       OID of the function to return the difference between two element
6268       values as <type>double precision</type>, or 0 if none
6269      </para></entry>
6270     </row>
6271    </tbody>
6272   </tgroup>
6273  </table>
6274
6275  <para>
6276   <structfield>rngsubopc</structfield> (plus <structfield>rngcollation</structfield>, if the
6277   element type is collatable) determines the sort ordering used by the range
6278   type.  <structfield>rngcanonical</structfield> is used when the element type is
6279   discrete.  <structfield>rngsubdiff</structfield> is optional but should be supplied to
6280   improve performance of GiST indexes on the range type.
6281  </para>
6282
6283 </sect1>
6284
6285 <sect1 id="catalog-pg-replication-origin">
6286  <title><structname>pg_replication_origin</structname></title>
6287
6288  <indexterm zone="catalog-pg-replication-origin">
6289   <primary>pg_replication_origin</primary>
6290  </indexterm>
6291
6292  <para>
6293   The <structname>pg_replication_origin</structname> catalog contains
6294   all replication origins created.  For more on replication origins
6295   see <xref linkend="replication-origins"/>.
6296  </para>
6297
6298  <para>
6299   Unlike most system catalogs, <structname>pg_replication_origin</structname>
6300   is shared across all databases of a cluster: there is only one copy
6301   of <structname>pg_replication_origin</structname> per cluster, not one per
6302   database.
6303  </para>
6304
6305  <table>
6306   <title><structname>pg_replication_origin</structname> Columns</title>
6307   <tgroup cols="1">
6308    <thead>
6309     <row>
6310      <entry role="catalog_table_entry"><para role="column_definition">
6311       Column Type
6312      </para>
6313      <para>
6314       Description
6315      </para></entry>
6316     </row>
6317    </thead>
6318
6319    <tbody>
6320     <row>
6321      <entry role="catalog_table_entry"><para role="column_definition">
6322       <structfield>roident</structfield> <type>oid</type>
6323      </para>
6324      <para>
6325       A unique, cluster-wide identifier for the replication
6326       origin. Should never leave the system.
6327      </para></entry>
6328     </row>
6329
6330     <row>
6331      <entry role="catalog_table_entry"><para role="column_definition">
6332       <structfield>roname</structfield> <type>text</type>
6333      </para>
6334      <para>
6335       The external, user defined, name of a replication
6336       origin.
6337      </para></entry>
6338     </row>
6339    </tbody>
6340   </tgroup>
6341  </table>
6342 </sect1>
6343
6344 <sect1 id="catalog-pg-rewrite">
6345  <title><structname>pg_rewrite</structname></title>
6346
6347  <indexterm zone="catalog-pg-rewrite">
6348   <primary>pg_rewrite</primary>
6349  </indexterm>
6350
6351  <para>
6352   The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
6353  </para>
6354
6355  <table>
6356   <title><structname>pg_rewrite</structname> Columns</title>
6357   <tgroup cols="1">
6358    <thead>
6359     <row>
6360      <entry role="catalog_table_entry"><para role="column_definition">
6361       Column Type
6362      </para>
6363      <para>
6364       Description
6365      </para></entry>
6366     </row>
6367    </thead>
6368
6369    <tbody>
6370     <row>
6371      <entry role="catalog_table_entry"><para role="column_definition">
6372       <structfield>oid</structfield> <type>oid</type>
6373      </para>
6374      <para>
6375       Row identifier
6376      </para></entry>
6377     </row>
6378
6379     <row>
6380      <entry role="catalog_table_entry"><para role="column_definition">
6381       <structfield>rulename</structfield> <type>name</type>
6382      </para>
6383      <para>
6384       Rule name
6385      </para></entry>
6386     </row>
6387
6388     <row>
6389      <entry role="catalog_table_entry"><para role="column_definition">
6390       <structfield>ev_class</structfield> <type>oid</type>
6391       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6392      </para>
6393      <para>
6394       The table this rule is for
6395      </para></entry>
6396     </row>
6397
6398     <row>
6399      <entry role="catalog_table_entry"><para role="column_definition">
6400       <structfield>ev_type</structfield> <type>char</type>
6401      </para>
6402      <para>
6403       Event type that the rule is for: 1 = <command>SELECT</command>, 2 =
6404       <command>UPDATE</command>, 3 = <command>INSERT</command>, 4 =
6405       <command>DELETE</command>
6406      </para></entry>
6407     </row>
6408
6409     <row>
6410      <entry role="catalog_table_entry"><para role="column_definition">
6411       <structfield>ev_enabled</structfield> <type>char</type>
6412      </para>
6413      <para>
6414       Controls in which <xref linkend="guc-session-replication-role"/> modes
6415       the rule fires.
6416       <literal>O</literal> = rule fires in <quote>origin</quote> and <quote>local</quote> modes,
6417       <literal>D</literal> = rule is disabled,
6418       <literal>R</literal> = rule fires in <quote>replica</quote> mode,
6419       <literal>A</literal> = rule fires always.
6420      </para></entry>
6421     </row>
6422
6423     <row>
6424      <entry role="catalog_table_entry"><para role="column_definition">
6425       <structfield>is_instead</structfield> <type>bool</type>
6426      </para>
6427      <para>
6428       True if the rule is an <literal>INSTEAD</literal> rule
6429      </para></entry>
6430     </row>
6431
6432     <row>
6433      <entry role="catalog_table_entry"><para role="column_definition">
6434       <structfield>ev_qual</structfield> <type>pg_node_tree</type>
6435      </para>
6436      <para>
6437       Expression tree (in the form of a
6438       <function>nodeToString()</function> representation) for the
6439       rule's qualifying condition
6440      </para></entry>
6441     </row>
6442
6443     <row>
6444      <entry role="catalog_table_entry"><para role="column_definition">
6445       <structfield>ev_action</structfield> <type>pg_node_tree</type>
6446      </para>
6447      <para>
6448       Query tree (in the form of a
6449       <function>nodeToString()</function> representation) for the
6450       rule's action
6451      </para></entry>
6452     </row>
6453    </tbody>
6454   </tgroup>
6455  </table>
6456
6457  <note>
6458   <para>
6459    <literal>pg_class.relhasrules</literal>
6460    must be true if a table has any rules in this catalog.
6461   </para>
6462  </note>
6463
6464 </sect1>
6465
6466 <sect1 id="catalog-pg-seclabel">
6467  <title><structname>pg_seclabel</structname></title>
6468
6469  <indexterm zone="catalog-pg-seclabel">
6470   <primary>pg_seclabel</primary>
6471  </indexterm>
6472
6473  <para>
6474   The catalog <structname>pg_seclabel</structname> stores security
6475   labels on database objects.  Security labels can be manipulated
6476   with the <xref linkend="sql-security-label"/> command.  For an easier
6477   way to view security labels, see <xref linkend="view-pg-seclabels"/>.
6478  </para>
6479
6480  <para>
6481   See also <link linkend="catalog-pg-shseclabel"><structname>pg_shseclabel</structname></link>,
6482   which performs a similar function for security labels of database objects
6483   that are shared across a database cluster.
6484  </para>
6485
6486  <table>
6487   <title><structname>pg_seclabel</structname> Columns</title>
6488   <tgroup cols="1">
6489    <thead>
6490     <row>
6491      <entry role="catalog_table_entry"><para role="column_definition">
6492       Column Type
6493      </para>
6494      <para>
6495       Description
6496      </para></entry>
6497     </row>
6498    </thead>
6499
6500    <tbody>
6501     <row>
6502      <entry role="catalog_table_entry"><para role="column_definition">
6503       <structfield>objoid</structfield> <type>oid</type>
6504       (references any OID column)
6505      </para>
6506      <para>
6507       The OID of the object this security label pertains to
6508      </para></entry>
6509     </row>
6510
6511     <row>
6512      <entry role="catalog_table_entry"><para role="column_definition">
6513       <structfield>classoid</structfield> <type>oid</type>
6514       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6515      </para>
6516      <para>
6517       The OID of the system catalog this object appears in
6518      </para></entry>
6519     </row>
6520
6521     <row>
6522      <entry role="catalog_table_entry"><para role="column_definition">
6523       <structfield>objsubid</structfield> <type>int4</type>
6524      </para>
6525      <para>
6526       For a security label on a table column, this is the column number (the
6527       <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
6528       the table itself).  For all other object types, this column is
6529       zero.
6530      </para></entry>
6531     </row>
6532
6533     <row>
6534      <entry role="catalog_table_entry"><para role="column_definition">
6535       <structfield>provider</structfield> <type>text</type>
6536      </para>
6537      <para>
6538       The label provider associated with this label.
6539      </para></entry>
6540     </row>
6541
6542     <row>
6543      <entry role="catalog_table_entry"><para role="column_definition">
6544       <structfield>label</structfield> <type>text</type>
6545      </para>
6546      <para>
6547       The security label applied to this object.
6548      </para></entry>
6549     </row>
6550    </tbody>
6551   </tgroup>
6552  </table>
6553 </sect1>
6554
6555 <sect1 id="catalog-pg-sequence">
6556  <title><structname>pg_sequence</structname></title>
6557
6558  <indexterm zone="catalog-pg-sequence">
6559   <primary>pg_sequence</primary>
6560  </indexterm>
6561
6562  <para>
6563   The catalog <structname>pg_sequence</structname> contains information about
6564   sequences.  Some of the information about sequences, such as the name and
6565   the schema, is in <structname>pg_class</structname>.
6566  </para>
6567
6568  <table>
6569   <title><structname>pg_sequence</structname> Columns</title>
6570   <tgroup cols="1">
6571    <thead>
6572     <row>
6573      <entry role="catalog_table_entry"><para role="column_definition">
6574       Column Type
6575      </para>
6576      <para>
6577       Description
6578      </para></entry>
6579     </row>
6580    </thead>
6581
6582    <tbody>
6583     <row>
6584      <entry role="catalog_table_entry"><para role="column_definition">
6585       <structfield>seqrelid</structfield> <type>oid</type>
6586       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6587      </para>
6588      <para>
6589       The OID of the <structname>pg_class</structname> entry for this sequence
6590      </para></entry>
6591     </row>
6592
6593     <row>
6594      <entry role="catalog_table_entry"><para role="column_definition">
6595       <structfield>seqtypid</structfield> <type>oid</type>
6596       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
6597      </para>
6598      <para>
6599       Data type of the sequence
6600      </para></entry>
6601     </row>
6602
6603     <row>
6604      <entry role="catalog_table_entry"><para role="column_definition">
6605       <structfield>seqstart</structfield> <type>int8</type>
6606      </para>
6607      <para>
6608       Start value of the sequence
6609      </para></entry>
6610     </row>
6611
6612     <row>
6613      <entry role="catalog_table_entry"><para role="column_definition">
6614       <structfield>seqincrement</structfield> <type>int8</type>
6615      </para>
6616      <para>
6617       Increment value of the sequence
6618      </para></entry>
6619     </row>
6620
6621     <row>
6622      <entry role="catalog_table_entry"><para role="column_definition">
6623       <structfield>seqmax</structfield> <type>int8</type>
6624      </para>
6625      <para>
6626       Maximum value of the sequence
6627      </para></entry>
6628     </row>
6629
6630     <row>
6631      <entry role="catalog_table_entry"><para role="column_definition">
6632       <structfield>seqmin</structfield> <type>int8</type>
6633      </para>
6634      <para>
6635       Minimum value of the sequence
6636      </para></entry>
6637     </row>
6638
6639     <row>
6640      <entry role="catalog_table_entry"><para role="column_definition">
6641       <structfield>seqcache</structfield> <type>int8</type>
6642      </para>
6643      <para>
6644       Cache size of the sequence
6645      </para></entry>
6646     </row>
6647
6648     <row>
6649      <entry role="catalog_table_entry"><para role="column_definition">
6650       <structfield>seqcycle</structfield> <type>bool</type>
6651      </para>
6652      <para>
6653       Whether the sequence cycles
6654      </para></entry>
6655     </row>
6656    </tbody>
6657   </tgroup>
6658  </table>
6659 </sect1>
6660
6661 <sect1 id="catalog-pg-shdepend">
6662  <title><structname>pg_shdepend</structname></title>
6663
6664  <indexterm zone="catalog-pg-shdepend">
6665   <primary>pg_shdepend</primary>
6666  </indexterm>
6667
6668  <para>
6669   The catalog <structname>pg_shdepend</structname> records the
6670   dependency relationships between database objects and shared objects,
6671   such as roles.  This information allows
6672   <productname>PostgreSQL</productname> to ensure that those objects are
6673   unreferenced before attempting to delete them.
6674  </para>
6675
6676  <para>
6677   See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
6678   which performs a similar function for dependencies involving objects
6679   within a single database.
6680  </para>
6681
6682  <para>
6683   Unlike most system catalogs, <structname>pg_shdepend</structname>
6684   is shared across all databases of a cluster: there is only one
6685   copy of <structname>pg_shdepend</structname> per cluster, not
6686   one per database.
6687  </para>
6688
6689  <table>
6690   <title><structname>pg_shdepend</structname> Columns</title>
6691   <tgroup cols="1">
6692    <thead>
6693     <row>
6694      <entry role="catalog_table_entry"><para role="column_definition">
6695       Column Type
6696      </para>
6697      <para>
6698       Description
6699      </para></entry>
6700     </row>
6701    </thead>
6702
6703    <tbody>
6704     <row>
6705      <entry role="catalog_table_entry"><para role="column_definition">
6706       <structfield>dbid</structfield> <type>oid</type>
6707       (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
6708      </para>
6709      <para>
6710       The OID of the database the dependent object is in,
6711       or zero for a shared object
6712      </para></entry>
6713     </row>
6714
6715     <row>
6716      <entry role="catalog_table_entry"><para role="column_definition">
6717       <structfield>classid</structfield> <type>oid</type>
6718       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6719      </para>
6720      <para>
6721       The OID of the system catalog the dependent object is in
6722      </para></entry>
6723     </row>
6724
6725     <row>
6726      <entry role="catalog_table_entry"><para role="column_definition">
6727       <structfield>objid</structfield> <type>oid</type>
6728       (references any OID column)
6729      </para>
6730      <para>
6731       The OID of the specific dependent object
6732      </para></entry>
6733     </row>
6734
6735     <row>
6736      <entry role="catalog_table_entry"><para role="column_definition">
6737       <structfield>objsubid</structfield> <type>int4</type>
6738      </para>
6739      <para>
6740       For a table column, this is the column number (the
6741       <structfield>objid</structfield> and <structfield>classid</structfield> refer to the
6742       table itself).  For all other object types, this column is zero.
6743      </para></entry>
6744     </row>
6745
6746     <row>
6747      <entry role="catalog_table_entry"><para role="column_definition">
6748       <structfield>refclassid</structfield> <type>oid</type>
6749       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6750      </para>
6751      <para>
6752       The OID of the system catalog the referenced object is in
6753       (must be a shared catalog)
6754      </para></entry>
6755     </row>
6756
6757     <row>
6758      <entry role="catalog_table_entry"><para role="column_definition">
6759       <structfield>refobjid</structfield> <type>oid</type>
6760       (references any OID column)
6761      </para>
6762      <para>
6763       The OID of the specific referenced object
6764      </para></entry>
6765     </row>
6766
6767     <row>
6768      <entry role="catalog_table_entry"><para role="column_definition">
6769       <structfield>deptype</structfield> <type>char</type>
6770      </para>
6771      <para>
6772       A code defining the specific semantics of this dependency relationship; see text
6773      </para></entry>
6774     </row>
6775    </tbody>
6776   </tgroup>
6777  </table>
6778
6779  <para>
6780   In all cases, a <structname>pg_shdepend</structname> entry indicates that
6781   the referenced object cannot be dropped without also dropping the dependent
6782   object.  However, there are several subflavors identified by
6783   <structfield>deptype</structfield>:
6784
6785   <variablelist>
6786    <varlistentry>
6787     <term><symbol>SHARED_DEPENDENCY_OWNER</symbol> (<literal>o</literal>)</term>
6788     <listitem>
6789      <para>
6790       The referenced object (which must be a role) is the owner of the
6791       dependent object.
6792      </para>
6793     </listitem>
6794    </varlistentry>
6795
6796    <varlistentry>
6797     <term><symbol>SHARED_DEPENDENCY_ACL</symbol> (<literal>a</literal>)</term>
6798     <listitem>
6799      <para>
6800       The referenced object (which must be a role) is mentioned in the
6801       ACL (access control list, i.e., privileges list) of the
6802       dependent object.  (A <symbol>SHARED_DEPENDENCY_ACL</symbol> entry is
6803       not made for the owner of the object, since the owner will have
6804       a <symbol>SHARED_DEPENDENCY_OWNER</symbol> entry anyway.)
6805      </para>
6806     </listitem>
6807    </varlistentry>
6808
6809    <varlistentry>
6810     <term><symbol>SHARED_DEPENDENCY_POLICY</symbol> (<literal>r</literal>)</term>
6811     <listitem>
6812      <para>
6813       The referenced object (which must be a role) is mentioned as the
6814       target of a dependent policy object.
6815      </para>
6816     </listitem>
6817    </varlistentry>
6818
6819    <varlistentry>
6820     <term><symbol>SHARED_DEPENDENCY_PIN</symbol> (<literal>p</literal>)</term>
6821     <listitem>
6822      <para>
6823       There is no dependent object; this type of entry is a signal
6824       that the system itself depends on the referenced object, and so
6825       that object must never be deleted.  Entries of this type are
6826       created only by <command>initdb</command>.  The columns for the
6827       dependent object contain zeroes.
6828      </para>
6829     </listitem>
6830    </varlistentry>
6831
6832    <varlistentry>
6833     <term><symbol>SHARED_DEPENDENCY_TABLESPACE</symbol> (<literal>t</literal>)</term>
6834     <listitem>
6835      <para>
6836       The referenced object (which must be a tablespace) is mentioned as
6837       the tablespace for a relation that doesn't have storage.
6838      </para>
6839     </listitem>
6840    </varlistentry>
6841   </variablelist>
6842
6843   Other dependency flavors might be needed in future.  Note in particular
6844   that the current definition only supports roles and tablespaces as referenced
6845   objects.
6846  </para>
6847
6848 </sect1>
6849
6850 <sect1 id="catalog-pg-shdescription">
6851  <title><structname>pg_shdescription</structname></title>
6852
6853  <indexterm zone="catalog-pg-shdescription">
6854   <primary>pg_shdescription</primary>
6855  </indexterm>
6856
6857  <para>
6858   The catalog <structname>pg_shdescription</structname> stores optional
6859   descriptions (comments) for shared database objects.  Descriptions can be
6860   manipulated with the <xref linkend="sql-comment"/> command and viewed with
6861   <application>psql</application>'s <literal>\d</literal> commands.
6862  </para>
6863
6864  <para>
6865   See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
6866   which performs a similar function for descriptions involving objects
6867   within a single database.
6868  </para>
6869
6870  <para>
6871   Unlike most system catalogs, <structname>pg_shdescription</structname>
6872   is shared across all databases of a cluster: there is only one
6873   copy of <structname>pg_shdescription</structname> per cluster, not
6874   one per database.
6875  </para>
6876
6877  <table>
6878   <title><structname>pg_shdescription</structname> Columns</title>
6879   <tgroup cols="1">
6880    <thead>
6881     <row>
6882      <entry role="catalog_table_entry"><para role="column_definition">
6883       Column Type
6884      </para>
6885      <para>
6886       Description
6887      </para></entry>
6888     </row>
6889    </thead>
6890
6891    <tbody>
6892     <row>
6893      <entry role="catalog_table_entry"><para role="column_definition">
6894       <structfield>objoid</structfield> <type>oid</type>
6895       (references any OID column)
6896      </para>
6897      <para>
6898       The OID of the object this description pertains to
6899      </para></entry>
6900     </row>
6901
6902     <row>
6903      <entry role="catalog_table_entry"><para role="column_definition">
6904       <structfield>classoid</structfield> <type>oid</type>
6905       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6906      </para>
6907      <para>
6908       The OID of the system catalog this object appears in
6909      </para></entry>
6910     </row>
6911
6912     <row>
6913      <entry role="catalog_table_entry"><para role="column_definition">
6914       <structfield>description</structfield> <type>text</type>
6915      </para>
6916      <para>
6917       Arbitrary text that serves as the description of this object
6918      </para></entry>
6919     </row>
6920    </tbody>
6921   </tgroup>
6922  </table>
6923
6924 </sect1>
6925
6926 <sect1 id="catalog-pg-shseclabel">
6927  <title><structname>pg_shseclabel</structname></title>
6928
6929  <indexterm zone="catalog-pg-shseclabel">
6930   <primary>pg_shseclabel</primary>
6931  </indexterm>
6932
6933  <para>
6934   The catalog <structname>pg_shseclabel</structname> stores security
6935   labels on shared database objects.  Security labels can be manipulated
6936   with the <xref linkend="sql-security-label"/> command.  For an easier
6937   way to view security labels, see <xref linkend="view-pg-seclabels"/>.
6938  </para>
6939
6940  <para>
6941   See also <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>,
6942   which performs a similar function for security labels involving objects
6943   within a single database.
6944  </para>
6945
6946  <para>
6947   Unlike most system catalogs, <structname>pg_shseclabel</structname>
6948   is shared across all databases of a cluster: there is only one
6949   copy of <structname>pg_shseclabel</structname> per cluster, not
6950   one per database.
6951  </para>
6952
6953  <table>
6954   <title><structname>pg_shseclabel</structname> Columns</title>
6955   <tgroup cols="1">
6956    <thead>
6957     <row>
6958      <entry role="catalog_table_entry"><para role="column_definition">
6959       Column Type
6960      </para>
6961      <para>
6962       Description
6963      </para></entry>
6964     </row>
6965    </thead>
6966
6967    <tbody>
6968     <row>
6969      <entry role="catalog_table_entry"><para role="column_definition">
6970       <structfield>objoid</structfield> <type>oid</type>
6971       (references any OID column)
6972      </para>
6973      <para>
6974       The OID of the object this security label pertains to
6975      </para></entry>
6976     </row>
6977
6978     <row>
6979      <entry role="catalog_table_entry"><para role="column_definition">
6980       <structfield>classoid</structfield> <type>oid</type>
6981       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
6982      </para>
6983      <para>
6984       The OID of the system catalog this object appears in
6985      </para></entry>
6986     </row>
6987
6988     <row>
6989      <entry role="catalog_table_entry"><para role="column_definition">
6990       <structfield>provider</structfield> <type>text</type>
6991      </para>
6992      <para>
6993       The label provider associated with this label.
6994      </para></entry>
6995     </row>
6996
6997     <row>
6998      <entry role="catalog_table_entry"><para role="column_definition">
6999       <structfield>label</structfield> <type>text</type>
7000      </para>
7001      <para>
7002       The security label applied to this object.
7003      </para></entry>
7004     </row>
7005    </tbody>
7006   </tgroup>
7007  </table>
7008 </sect1>
7009
7010 <sect1 id="catalog-pg-statistic">
7011  <title><structname>pg_statistic</structname></title>
7012
7013  <indexterm zone="catalog-pg-statistic">
7014   <primary>pg_statistic</primary>
7015  </indexterm>
7016
7017  <para>
7018   The catalog <structname>pg_statistic</structname> stores
7019   statistical data about the contents of the database.  Entries are
7020   created by <xref linkend="sql-analyze"/>
7021   and subsequently used by the query planner.  Note that all the
7022   statistical data is inherently approximate, even assuming that it
7023   is up-to-date.
7024  </para>
7025
7026  <para>
7027   Normally there is one entry, with <structfield>stainherit</structfield> =
7028   <literal>false</literal>, for each table column that has been analyzed.
7029   If the table has inheritance children, a second entry with
7030   <structfield>stainherit</structfield> = <literal>true</literal> is also created.  This row
7031   represents the column's statistics over the inheritance tree, i.e.,
7032   statistics for the data you'd see with
7033   <literal>SELECT <replaceable>column</replaceable> FROM <replaceable>table</replaceable>*</literal>,
7034   whereas the <structfield>stainherit</structfield> = <literal>false</literal> row represents
7035   the results of
7036   <literal>SELECT <replaceable>column</replaceable> FROM ONLY <replaceable>table</replaceable></literal>.
7037  </para>
7038
7039  <para>
7040   <structname>pg_statistic</structname> also stores statistical data about
7041   the values of index expressions.  These are described as if they were
7042   actual data columns; in particular, <structfield>starelid</structfield>
7043   references the index.  No entry is made for an ordinary non-expression
7044   index column, however, since it would be redundant with the entry
7045   for the underlying table column.  Currently, entries for index expressions
7046   always have <structfield>stainherit</structfield> = <literal>false</literal>.
7047  </para>
7048
7049  <para>
7050   Since different kinds of statistics might be appropriate for different
7051   kinds of data, <structname>pg_statistic</structname> is designed not
7052   to assume very much about what sort of statistics it stores.  Only
7053   extremely general statistics (such as nullness) are given dedicated
7054   columns in <structname>pg_statistic</structname>.  Everything else
7055   is stored in <quote>slots</quote>, which are groups of associated columns
7056   whose content is identified by a code number in one of the slot's columns.
7057   For more information see
7058   <filename>src/include/catalog/pg_statistic.h</filename>.
7059  </para>
7060
7061  <para>
7062   <structname>pg_statistic</structname> should not be readable by the
7063   public, since even statistical information about a table's contents
7064   might be considered sensitive.  (Example: minimum and maximum values
7065   of a salary column might be quite interesting.)
7066   <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
7067   is a publicly readable view on
7068   <structname>pg_statistic</structname> that only exposes information
7069   about those tables that are readable by the current user.
7070  </para>
7071
7072  <table>
7073   <title><structname>pg_statistic</structname> Columns</title>
7074   <tgroup cols="1">
7075    <thead>
7076     <row>
7077      <entry role="catalog_table_entry"><para role="column_definition">
7078       Column Type
7079      </para>
7080      <para>
7081       Description
7082      </para></entry>
7083     </row>
7084    </thead>
7085
7086    <tbody>
7087     <row>
7088      <entry role="catalog_table_entry"><para role="column_definition">
7089       <structfield>starelid</structfield> <type>oid</type>
7090       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7091      </para>
7092      <para>
7093       The table or index that the described column belongs to
7094      </para></entry>
7095     </row>
7096
7097     <row>
7098      <entry role="catalog_table_entry"><para role="column_definition">
7099       <structfield>staattnum</structfield> <type>int2</type>
7100       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
7101      </para>
7102      <para>
7103       The number of the described column
7104      </para></entry>
7105     </row>
7106
7107     <row>
7108      <entry role="catalog_table_entry"><para role="column_definition">
7109       <structfield>stainherit</structfield> <type>bool</type>
7110      </para>
7111      <para>
7112       If true, the stats include inheritance child columns, not just the
7113       values in the specified relation
7114      </para></entry>
7115     </row>
7116
7117     <row>
7118      <entry role="catalog_table_entry"><para role="column_definition">
7119       <structfield>stanullfrac</structfield> <type>float4</type>
7120      </para>
7121      <para>
7122       The fraction of the column's entries that are null
7123      </para></entry>
7124     </row>
7125
7126     <row>
7127      <entry role="catalog_table_entry"><para role="column_definition">
7128       <structfield>stawidth</structfield> <type>int4</type>
7129      </para>
7130      <para>
7131       The average stored width, in bytes, of nonnull entries
7132      </para></entry>
7133     </row>
7134
7135     <row>
7136      <entry role="catalog_table_entry"><para role="column_definition">
7137       <structfield>stadistinct</structfield> <type>float4</type>
7138      </para>
7139      <para>
7140       The number of distinct nonnull data values in the column.
7141       A value greater than zero is the actual number of distinct values.
7142       A value less than zero is the negative of a multiplier for the number
7143       of rows in the table; for example, a column in which about 80% of the
7144       values are nonnull and each nonnull value appears about twice on
7145       average could be represented by <structfield>stadistinct</structfield> = -0.4.
7146       A zero value means the number of distinct values is unknown.
7147      </para></entry>
7148     </row>
7149
7150     <row>
7151      <entry role="catalog_table_entry"><para role="column_definition">
7152       <structfield>stakind<replaceable>N</replaceable></structfield> <type>int2</type>
7153      </para>
7154      <para>
7155       A code number indicating the kind of statistics stored in the
7156       <replaceable>N</replaceable>th <quote>slot</quote> of the
7157       <structname>pg_statistic</structname> row.
7158      </para></entry>
7159     </row>
7160
7161     <row>
7162      <entry role="catalog_table_entry"><para role="column_definition">
7163       <structfield>staop<replaceable>N</replaceable></structfield> <type>oid</type>
7164       (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>)
7165      </para>
7166      <para>
7167       An operator used to derive the statistics stored in the
7168       <replaceable>N</replaceable>th <quote>slot</quote>.  For example, a
7169       histogram slot would show the <literal>&lt;</literal> operator
7170       that defines the sort order of the data.
7171      </para></entry>
7172     </row>
7173
7174     <row>
7175      <entry role="catalog_table_entry"><para role="column_definition">
7176       <structfield>stacoll<replaceable>N</replaceable></structfield> <type>oid</type>
7177       (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
7178      </para>
7179      <para>
7180       The collation used to derive the statistics stored in the
7181       <replaceable>N</replaceable>th <quote>slot</quote>.  For example, a
7182       histogram slot for a collatable column would show the collation that
7183       defines the sort order of the data.  Zero for noncollatable data.
7184      </para></entry>
7185     </row>
7186
7187     <row>
7188      <entry role="catalog_table_entry"><para role="column_definition">
7189       <structfield>stanumbers<replaceable>N</replaceable></structfield> <type>float4[]</type>
7190      </para>
7191      <para>
7192       Numerical statistics of the appropriate kind for the
7193       <replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
7194       kind does not involve numerical values
7195      </para></entry>
7196     </row>
7197
7198     <row>
7199      <entry role="catalog_table_entry"><para role="column_definition">
7200       <structfield>stavalues<replaceable>N</replaceable></structfield> <type>anyarray</type>
7201      </para>
7202      <para>
7203       Column data values of the appropriate kind for the
7204       <replaceable>N</replaceable>th <quote>slot</quote>, or null if the slot
7205       kind does not store any data values.  Each array's element
7206       values are actually of the specific column's data type, or a related
7207       type such as an array's element type, so there is no way to define
7208       these columns' type more specifically than <type>anyarray</type>.
7209      </para></entry>
7210     </row>
7211    </tbody>
7212   </tgroup>
7213  </table>
7214
7215 </sect1>
7216
7217 <sect1 id="catalog-pg-statistic-ext">
7218  <title><structname>pg_statistic_ext</structname></title>
7219
7220  <indexterm zone="catalog-pg-statistic-ext">
7221   <primary>pg_statistic_ext</primary>
7222  </indexterm>
7223
7224  <para>
7225   The catalog <structname>pg_statistic_ext</structname>
7226   holds definitions of extended planner statistics.
7227   Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
7228   created with <xref linkend="sql-createstatistics"/>.
7229  </para>
7230
7231  <table>
7232   <title><structname>pg_statistic_ext</structname> Columns</title>
7233   <tgroup cols="1">
7234    <thead>
7235     <row>
7236      <entry role="catalog_table_entry"><para role="column_definition">
7237       Column Type
7238      </para>
7239      <para>
7240       Description
7241      </para></entry>
7242     </row>
7243    </thead>
7244
7245    <tbody>
7246     <row>
7247      <entry role="catalog_table_entry"><para role="column_definition">
7248       <structfield>oid</structfield> <type>oid</type>
7249      </para>
7250      <para>
7251       Row identifier
7252      </para></entry>
7253     </row>
7254
7255     <row>
7256      <entry role="catalog_table_entry"><para role="column_definition">
7257       <structfield>stxrelid</structfield> <type>oid</type>
7258       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7259      </para>
7260      <para>
7261       Table containing the columns described by this object
7262      </para></entry>
7263     </row>
7264
7265     <row>
7266      <entry role="catalog_table_entry"><para role="column_definition">
7267       <structfield>stxname</structfield> <type>name</type>
7268      </para>
7269      <para>
7270       Name of the statistics object
7271      </para></entry>
7272     </row>
7273
7274     <row>
7275      <entry role="catalog_table_entry"><para role="column_definition">
7276       <structfield>stxnamespace</structfield> <type>oid</type>
7277       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
7278      </para>
7279      <para>
7280       The OID of the namespace that contains this statistics object
7281      </para></entry>
7282     </row>
7283
7284     <row>
7285      <entry role="catalog_table_entry"><para role="column_definition">
7286       <structfield>stxowner</structfield> <type>oid</type>
7287       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
7288      </para>
7289      <para>
7290       Owner of the statistics object
7291      </para></entry>
7292     </row>
7293
7294     <row>
7295      <entry role="catalog_table_entry"><para role="column_definition">
7296       <structfield>stxstattarget</structfield> <type>int4</type>
7297      </para>
7298      <para>
7299       <structfield>stxstattarget</structfield> controls the level of detail
7300       of statistics accumulated for this statistics object by
7301       <xref linkend="sql-analyze"/>.
7302       A zero value indicates that no statistics should be collected.
7303       A negative value says to use the maximum of the statistics targets of
7304       the referenced columns, if set, or the system default statistics target.
7305       Positive values of <structfield>stxstattarget</structfield>
7306       determine the target number of <quote>most common values</quote>
7307       to collect.
7308      </para></entry>
7309     </row>
7310
7311     <row>
7312      <entry role="catalog_table_entry"><para role="column_definition">
7313       <structfield>stxkeys</structfield> <type>int2vector</type>
7314       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
7315      </para>
7316      <para>
7317       An array of attribute numbers, indicating which table columns are
7318       covered by this statistics object;
7319       for example a value of <literal>1 3</literal> would
7320       mean that the first and the third table columns are covered
7321      </para></entry>
7322     </row>
7323
7324     <row>
7325      <entry role="catalog_table_entry"><para role="column_definition">
7326       <structfield>stxkind</structfield> <type>char[]</type>
7327      </para>
7328      <para>
7329       An array containing codes for the enabled statistics kinds;
7330       valid values are:
7331       <literal>d</literal> for n-distinct statistics,
7332       <literal>f</literal> for functional dependency statistics, and
7333       <literal>m</literal> for most common values (MCV) list statistics
7334      </para></entry>
7335     </row>
7336    </tbody>
7337   </tgroup>
7338  </table>
7339
7340  <para>
7341   The <structname>pg_statistic_ext</structname> entry is filled in
7342   completely during <command>CREATE STATISTICS</command>, but the actual
7343   statistical values are not computed then.
7344   Subsequent <command>ANALYZE</command> commands compute the desired values
7345   and populate an entry in the
7346   <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
7347   catalog.
7348  </para>
7349 </sect1>
7350
7351 <sect1 id="catalog-pg-statistic-ext-data">
7352  <title><structname>pg_statistic_ext_data</structname></title>
7353
7354  <indexterm zone="catalog-pg-statistic-ext">
7355   <primary>pg_statistic_ext_data</primary>
7356  </indexterm>
7357
7358  <para>
7359   The catalog <structname>pg_statistic_ext_data</structname>
7360   holds data for extended planner statistics defined in <structname>pg_statistic_ext</structname>.
7361   Each row in this catalog corresponds to a <firstterm>statistics object</firstterm>
7362   created with <xref linkend="sql-createstatistics"/>.
7363  </para>
7364
7365  <para>
7366   Like <structname>pg_statistic</structname>,
7367   <structname>pg_statistic_ext_data</structname> should not be
7368   readable by the public, since the contents might be considered sensitive.
7369   (Example: most common combinations of values in columns might be quite
7370   interesting.)
7371   <link linkend="view-pg-stats-ext"><structname>pg_stats_ext</structname></link>
7372   is a publicly readable view
7373   on <structname>pg_statistic_ext_data</structname> (after joining
7374   with <structname>pg_statistic_ext</structname>) that only exposes
7375   information about those tables and columns that are readable by the
7376   current user.
7377  </para>
7378
7379  <table>
7380   <title><structname>pg_statistic_ext_data</structname> Columns</title>
7381   <tgroup cols="1">
7382    <thead>
7383     <row>
7384      <entry role="catalog_table_entry"><para role="column_definition">
7385       Column Type
7386      </para>
7387      <para>
7388       Description
7389      </para></entry>
7390     </row>
7391    </thead>
7392
7393    <tbody>
7394     <row>
7395      <entry role="catalog_table_entry"><para role="column_definition">
7396       <structfield>stxoid</structfield> <type>oid</type>
7397       (references <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.<structfield>oid</structfield>)
7398      </para>
7399      <para>
7400       Extended statistic object containing the definition for this data
7401      </para></entry>
7402     </row>
7403
7404     <row>
7405      <entry role="catalog_table_entry"><para role="column_definition">
7406       <structfield>stxdndistinct</structfield> <type>pg_ndistinct</type>
7407      </para>
7408      <para>
7409       N-distinct counts, serialized as <structname>pg_ndistinct</structname> type
7410      </para></entry>
7411     </row>
7412
7413     <row>
7414      <entry role="catalog_table_entry"><para role="column_definition">
7415       <structfield>stxddependencies</structfield> <type>pg_dependencies</type>
7416      </para>
7417      <para>
7418       Functional dependency statistics, serialized
7419       as <structname>pg_dependencies</structname> type
7420      </para></entry>
7421     </row>
7422
7423     <row>
7424      <entry role="catalog_table_entry"><para role="column_definition">
7425       <structfield>stxdmcv</structfield> <type>pg_mcv_list</type>
7426      </para>
7427      <para>
7428       MCV (most-common values) list statistics, serialized as
7429       <structname>pg_mcv_list</structname> type
7430      </para></entry>
7431     </row>
7432    </tbody>
7433   </tgroup>
7434  </table>
7435
7436 </sect1>
7437
7438 <sect1 id="catalog-pg-subscription">
7439  <title><structname>pg_subscription</structname></title>
7440
7441  <indexterm zone="catalog-pg-subscription">
7442   <primary>pg_subscription</primary>
7443  </indexterm>
7444
7445  <para>
7446   The catalog <structname>pg_subscription</structname> contains all existing
7447   logical replication subscriptions.  For more information about logical
7448   replication see <xref linkend="logical-replication"/>.
7449  </para>
7450
7451  <para>
7452   Unlike most system catalogs, <structname>pg_subscription</structname> is
7453   shared across all databases of a cluster: there is only one copy
7454   of <structname>pg_subscription</structname> per cluster, not one per
7455   database.
7456  </para>
7457
7458  <para>
7459   Access to the column <structfield>subconninfo</structfield> is revoked from
7460   normal users, because it could contain plain-text passwords.
7461  </para>
7462
7463  <table>
7464   <title><structname>pg_subscription</structname> Columns</title>
7465   <tgroup cols="1">
7466    <thead>
7467     <row>
7468      <entry role="catalog_table_entry"><para role="column_definition">
7469       Column Type
7470      </para>
7471      <para>
7472       Description
7473      </para></entry>
7474     </row>
7475    </thead>
7476
7477    <tbody>
7478     <row>
7479      <entry role="catalog_table_entry"><para role="column_definition">
7480       <structfield>oid</structfield> <type>oid</type>
7481      </para>
7482      <para>
7483       Row identifier
7484      </para></entry>
7485     </row>
7486
7487     <row>
7488      <entry role="catalog_table_entry"><para role="column_definition">
7489       <structfield>subdbid</structfield> <type>oid</type>
7490       (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
7491      </para>
7492      <para>
7493       OID of the database which the subscription resides in
7494      </para></entry>
7495     </row>
7496
7497     <row>
7498      <entry role="catalog_table_entry"><para role="column_definition">
7499       <structfield>subname</structfield> <type>name</type>
7500      </para>
7501      <para>
7502       Name of the subscription
7503      </para></entry>
7504     </row>
7505
7506     <row>
7507      <entry role="catalog_table_entry"><para role="column_definition">
7508       <structfield>subowner</structfield> <type>oid</type>
7509       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
7510      </para>
7511      <para>
7512       Owner of the subscription
7513      </para></entry>
7514     </row>
7515
7516     <row>
7517      <entry role="catalog_table_entry"><para role="column_definition">
7518       <structfield>subenabled</structfield> <type>bool</type>
7519      </para>
7520      <para>
7521       If true, the subscription is enabled and should be replicating.
7522      </para></entry>
7523     </row>
7524
7525     <row>
7526      <entry role="catalog_table_entry"><para role="column_definition">
7527       <structfield>subconninfo</structfield> <type>text</type>
7528      </para>
7529      <para>
7530       Connection string to the upstream database
7531      </para></entry>
7532     </row>
7533
7534     <row>
7535      <entry role="catalog_table_entry"><para role="column_definition">
7536       <structfield>subslotname</structfield> <type>name</type>
7537      </para>
7538      <para>
7539       Name of the replication slot in the upstream database (also used
7540       for the local replication origin name);
7541       null represents <literal>NONE</literal>
7542      </para></entry>
7543     </row>
7544
7545     <row>
7546      <entry role="catalog_table_entry"><para role="column_definition">
7547       <structfield>subsynccommit</structfield> <type>text</type>
7548      </para>
7549      <para>
7550       Contains the value of the <varname>synchronous_commit</varname>
7551       setting for the subscription workers.
7552      </para></entry>
7553     </row>
7554
7555     <row>
7556      <entry role="catalog_table_entry"><para role="column_definition">
7557       <structfield>subpublications</structfield> <type>text[]</type>
7558      </para>
7559      <para>
7560       Array of subscribed publication names. These reference the
7561       publications on the publisher server. For more on publications
7562       see <xref linkend="logical-replication-publication"/>.
7563      </para></entry>
7564     </row>
7565    </tbody>
7566   </tgroup>
7567  </table>
7568 </sect1>
7569
7570 <sect1 id="catalog-pg-subscription-rel">
7571  <title><structname>pg_subscription_rel</structname></title>
7572
7573  <indexterm zone="catalog-pg-subscription-rel">
7574   <primary>pg_subscription_rel</primary>
7575  </indexterm>
7576
7577  <para>
7578   The catalog <structname>pg_subscription_rel</structname> contains the
7579   state for each replicated relation in each subscription.  This is a
7580   many-to-many mapping.
7581  </para>
7582
7583  <para>
7584   This catalog only contains tables known to the subscription after running
7585   either <command>CREATE SUBSCRIPTION</command> or
7586   <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command>.
7587  </para>
7588
7589  <table>
7590   <title><structname>pg_subscription_rel</structname> Columns</title>
7591   <tgroup cols="1">
7592    <thead>
7593     <row>
7594      <entry role="catalog_table_entry"><para role="column_definition">
7595       Column Type
7596      </para>
7597      <para>
7598       Description
7599      </para></entry>
7600     </row>
7601    </thead>
7602
7603    <tbody>
7604     <row>
7605      <entry role="catalog_table_entry"><para role="column_definition">
7606       <structfield>srsubid</structfield> <type>oid</type>
7607       (references <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>.<structfield>oid</structfield>)
7608      </para>
7609      <para>
7610       Reference to subscription
7611      </para></entry>
7612     </row>
7613
7614     <row>
7615      <entry role="catalog_table_entry"><para role="column_definition">
7616       <structfield>srrelid</structfield> <type>oid</type>
7617       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7618      </para>
7619      <para>
7620       Reference to relation
7621      </para></entry>
7622     </row>
7623
7624     <row>
7625      <entry role="catalog_table_entry"><para role="column_definition">
7626       <structfield>srsubstate</structfield> <type>char</type>
7627      </para>
7628      <para>
7629       State code:
7630       <literal>i</literal> = initialize,
7631       <literal>d</literal> = data is being copied,
7632       <literal>s</literal> = synchronized,
7633       <literal>r</literal> = ready (normal replication)
7634      </para></entry>
7635     </row>
7636
7637     <row>
7638      <entry role="catalog_table_entry"><para role="column_definition">
7639       <structfield>srsublsn</structfield> <type>pg_lsn</type>
7640      </para>
7641      <para>
7642       Remote LSN of the state change used for synchronization coordination
7643       when in <literal>s</literal> or <literal>r</literal> states,
7644       otherwise null
7645      </para></entry>
7646     </row>
7647    </tbody>
7648   </tgroup>
7649  </table>
7650 </sect1>
7651
7652 <sect1 id="catalog-pg-tablespace">
7653  <title><structname>pg_tablespace</structname></title>
7654
7655  <indexterm zone="catalog-pg-tablespace">
7656   <primary>pg_tablespace</primary>
7657  </indexterm>
7658
7659  <para>
7660   The catalog <structname>pg_tablespace</structname> stores information
7661   about the available tablespaces.  Tables can be placed in particular
7662   tablespaces to aid administration of disk layout.
7663  </para>
7664
7665  <para>
7666   Unlike most system catalogs, <structname>pg_tablespace</structname>
7667   is shared across all databases of a cluster: there is only one
7668   copy of <structname>pg_tablespace</structname> per cluster, not
7669   one per database.
7670  </para>
7671
7672  <table>
7673   <title><structname>pg_tablespace</structname> Columns</title>
7674   <tgroup cols="1">
7675    <thead>
7676     <row>
7677      <entry role="catalog_table_entry"><para role="column_definition">
7678       Column Type
7679      </para>
7680      <para>
7681       Description
7682      </para></entry>
7683     </row>
7684    </thead>
7685
7686    <tbody>
7687     <row>
7688      <entry role="catalog_table_entry"><para role="column_definition">
7689       <structfield>oid</structfield> <type>oid</type>
7690      </para>
7691      <para>
7692       Row identifier
7693      </para></entry>
7694     </row>
7695
7696     <row>
7697      <entry role="catalog_table_entry"><para role="column_definition">
7698       <structfield>spcname</structfield> <type>name</type>
7699      </para>
7700      <para>
7701       Tablespace name
7702      </para></entry>
7703     </row>
7704
7705     <row>
7706      <entry role="catalog_table_entry"><para role="column_definition">
7707       <structfield>spcowner</structfield> <type>oid</type>
7708       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
7709      </para>
7710      <para>
7711       Owner of the tablespace, usually the user who created it
7712      </para></entry>
7713     </row>
7714
7715     <row>
7716      <entry role="catalog_table_entry"><para role="column_definition">
7717       <structfield>spcacl</structfield> <type>aclitem[]</type>
7718      </para>
7719      <para>
7720       Access privileges; see <xref linkend="ddl-priv"/> for details
7721      </para></entry>
7722     </row>
7723
7724     <row>
7725      <entry role="catalog_table_entry"><para role="column_definition">
7726       <structfield>spcoptions</structfield> <type>text[]</type>
7727      </para>
7728      <para>
7729       Tablespace-level options, as <quote>keyword=value</quote> strings
7730      </para></entry>
7731     </row>
7732    </tbody>
7733   </tgroup>
7734  </table>
7735 </sect1>
7736
7737
7738 <sect1 id="catalog-pg-transform">
7739  <title><structname>pg_transform</structname></title>
7740
7741  <indexterm zone="catalog-pg-transform">
7742   <primary>pg_transform</primary>
7743  </indexterm>
7744
7745  <para>
7746   The catalog <structname>pg_transform</structname> stores information about
7747   transforms, which are a mechanism to adapt data types to procedural
7748   languages.  See <xref linkend="sql-createtransform"/> for more information.
7749  </para>
7750
7751  <table>
7752   <title><structname>pg_transform</structname> Columns</title>
7753   <tgroup cols="1">
7754    <thead>
7755     <row>
7756      <entry role="catalog_table_entry"><para role="column_definition">
7757       Column Type
7758      </para>
7759      <para>
7760       Description
7761      </para></entry>
7762     </row>
7763    </thead>
7764
7765    <tbody>
7766     <row>
7767      <entry role="catalog_table_entry"><para role="column_definition">
7768       <structfield>oid</structfield> <type>oid</type>
7769      </para>
7770      <para>
7771       Row identifier
7772      </para></entry>
7773     </row>
7774
7775     <row>
7776      <entry role="catalog_table_entry"><para role="column_definition">
7777       <structfield>trftype</structfield> <type>oid</type>
7778       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
7779      </para>
7780      <para>
7781       OID of the data type this transform is for
7782      </para></entry>
7783     </row>
7784
7785     <row>
7786      <entry role="catalog_table_entry"><para role="column_definition">
7787       <structfield>trflang</structfield> <type>oid</type>
7788       (references <link linkend="catalog-pg-language"><structname>pg_language</structname></link>.<structfield>oid</structfield>)
7789      </para>
7790      <para>
7791       OID of the language this transform is for
7792      </para></entry>
7793     </row>
7794
7795     <row>
7796      <entry role="catalog_table_entry"><para role="column_definition">
7797       <structfield>trffromsql</structfield> <type>regproc</type>
7798       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
7799      </para>
7800      <para>
7801       The OID of the function to use when converting the data type for input
7802       to the procedural language (e.g., function parameters).  Zero is stored
7803       if this operation is not supported.
7804      </para></entry>
7805     </row>
7806
7807     <row>
7808      <entry role="catalog_table_entry"><para role="column_definition">
7809       <structfield>trftosql</structfield> <type>regproc</type>
7810       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
7811      </para>
7812      <para>
7813       The OID of the function to use when converting output from the
7814       procedural language (e.g., return values) to the data type.  Zero is
7815       stored if this operation is not supported.
7816      </para></entry>
7817     </row>
7818    </tbody>
7819   </tgroup>
7820  </table>
7821 </sect1>
7822
7823
7824 <sect1 id="catalog-pg-trigger">
7825  <title><structname>pg_trigger</structname></title>
7826
7827  <indexterm zone="catalog-pg-trigger">
7828   <primary>pg_trigger</primary>
7829  </indexterm>
7830
7831  <para>
7832   The catalog <structname>pg_trigger</structname> stores triggers on tables
7833   and views.
7834   See <xref linkend="sql-createtrigger"/>
7835   for more information.
7836  </para>
7837
7838  <table>
7839   <title><structname>pg_trigger</structname> Columns</title>
7840   <tgroup cols="1">
7841    <thead>
7842     <row>
7843      <entry role="catalog_table_entry"><para role="column_definition">
7844       Column Type
7845      </para>
7846      <para>
7847       Description
7848      </para></entry>
7849     </row>
7850    </thead>
7851
7852    <tbody>
7853     <row>
7854      <entry role="catalog_table_entry"><para role="column_definition">
7855       <structfield>oid</structfield> <type>oid</type>
7856      </para>
7857      <para>
7858       Row identifier
7859      </para></entry>
7860     </row>
7861
7862     <row>
7863      <entry role="catalog_table_entry"><para role="column_definition">
7864       <structfield>tgrelid</structfield> <type>oid</type>
7865       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7866      </para>
7867      <para>
7868       The table this trigger is on
7869      </para></entry>
7870     </row>
7871
7872     <row>
7873      <entry role="catalog_table_entry"><para role="column_definition">
7874       <structfield>tgparentid</structfield> <type>oid</type>
7875       (references <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link>.<structfield>oid</structfield>)
7876      </para>
7877      <para>
7878       Parent trigger that this trigger is cloned from, zero if not a clone;
7879       this happens when partitions are created or attached to a partitioned
7880       table.
7881      </para></entry>
7882     </row>
7883
7884     <row>
7885      <entry role="catalog_table_entry"><para role="column_definition">
7886       <structfield>tgname</structfield> <type>name</type>
7887      </para>
7888      <para>
7889       Trigger name (must be unique among triggers of same table)
7890      </para></entry>
7891     </row>
7892
7893     <row>
7894      <entry role="catalog_table_entry"><para role="column_definition">
7895       <structfield>tgfoid</structfield> <type>oid</type>
7896       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
7897      </para>
7898      <para>
7899       The function to be called
7900      </para></entry>
7901     </row>
7902
7903     <row>
7904      <entry role="catalog_table_entry"><para role="column_definition">
7905       <structfield>tgtype</structfield> <type>int2</type>
7906      </para>
7907      <para>
7908       Bit mask identifying trigger firing conditions
7909      </para></entry>
7910     </row>
7911
7912     <row>
7913      <entry role="catalog_table_entry"><para role="column_definition">
7914       <structfield>tgenabled</structfield> <type>char</type>
7915      </para>
7916      <para>
7917       Controls in which <xref linkend="guc-session-replication-role"/> modes
7918       the trigger fires.
7919       <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes,
7920       <literal>D</literal> = trigger is disabled,
7921       <literal>R</literal> = trigger fires in <quote>replica</quote> mode,
7922       <literal>A</literal> = trigger fires always.
7923      </para></entry>
7924     </row>
7925
7926     <row>
7927      <entry role="catalog_table_entry"><para role="column_definition">
7928       <structfield>tgisinternal</structfield> <type>bool</type>
7929      </para>
7930      <para>
7931       True if trigger is internally generated (usually, to enforce
7932       the constraint identified by <structfield>tgconstraint</structfield>)
7933      </para></entry>
7934     </row>
7935
7936     <row>
7937      <entry role="catalog_table_entry"><para role="column_definition">
7938       <structfield>tgconstrrelid</structfield> <type>oid</type>
7939       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7940      </para>
7941      <para>
7942       The table referenced by a referential integrity constraint
7943      </para></entry>
7944     </row>
7945
7946     <row>
7947      <entry role="catalog_table_entry"><para role="column_definition">
7948       <structfield>tgconstrindid</structfield> <type>oid</type>
7949       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
7950      </para>
7951      <para>
7952       The index supporting a unique, primary key, referential integrity,
7953       or exclusion constraint
7954      </para></entry>
7955     </row>
7956
7957     <row>
7958      <entry role="catalog_table_entry"><para role="column_definition">
7959       <structfield>tgconstraint</structfield> <type>oid</type>
7960       (references <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.<structfield>oid</structfield>)
7961      </para>
7962      <para>
7963       The <structname>pg_constraint</structname> entry associated with the trigger, if any
7964      </para></entry>
7965     </row>
7966
7967     <row>
7968      <entry role="catalog_table_entry"><para role="column_definition">
7969       <structfield>tgdeferrable</structfield> <type>bool</type>
7970      </para>
7971      <para>
7972       True if constraint trigger is deferrable
7973      </para></entry>
7974     </row>
7975
7976     <row>
7977      <entry role="catalog_table_entry"><para role="column_definition">
7978       <structfield>tginitdeferred</structfield> <type>bool</type>
7979      </para>
7980      <para>
7981       True if constraint trigger is initially deferred
7982      </para></entry>
7983     </row>
7984
7985     <row>
7986      <entry role="catalog_table_entry"><para role="column_definition">
7987       <structfield>tgnargs</structfield> <type>int2</type>
7988      </para>
7989      <para>
7990       Number of argument strings passed to trigger function
7991      </para></entry>
7992     </row>
7993
7994     <row>
7995      <entry role="catalog_table_entry"><para role="column_definition">
7996       <structfield>tgattr</structfield> <type>int2vector</type>
7997       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
7998      </para>
7999      <para>
8000       Column numbers, if trigger is column-specific; otherwise an
8001       empty array
8002      </para></entry>
8003     </row>
8004
8005     <row>
8006      <entry role="catalog_table_entry"><para role="column_definition">
8007       <structfield>tgargs</structfield> <type>bytea</type>
8008      </para>
8009      <para>
8010       Argument strings to pass to trigger, each NULL-terminated
8011      </para></entry>
8012     </row>
8013
8014     <row>
8015      <entry role="catalog_table_entry"><para role="column_definition">
8016       <structfield>tgqual</structfield> <type>pg_node_tree</type>
8017      </para>
8018      <para>
8019       Expression tree (in <function>nodeToString()</function>
8020       representation) for the trigger's <literal>WHEN</literal> condition, or null
8021       if none
8022      </para></entry>
8023     </row>
8024
8025     <row>
8026      <entry role="catalog_table_entry"><para role="column_definition">
8027       <structfield>tgoldtable</structfield> <type>name</type>
8028      </para>
8029      <para>
8030       <literal>REFERENCING</literal> clause name for <literal>OLD TABLE</literal>,
8031       or null if none
8032      </para></entry>
8033     </row>
8034
8035     <row>
8036      <entry role="catalog_table_entry"><para role="column_definition">
8037       <structfield>tgnewtable</structfield> <type>name</type>
8038      </para>
8039      <para>
8040       <literal>REFERENCING</literal> clause name for <literal>NEW TABLE</literal>,
8041       or null if none
8042      </para></entry>
8043     </row>
8044    </tbody>
8045   </tgroup>
8046  </table>
8047
8048  <para>
8049   Currently, column-specific triggering is supported only for
8050   <literal>UPDATE</literal> events, and so <structfield>tgattr</structfield> is relevant
8051   only for that event type.  <structfield>tgtype</structfield> might
8052   contain bits for other event types as well, but those are presumed
8053   to be table-wide regardless of what is in <structfield>tgattr</structfield>.
8054  </para>
8055
8056  <note>
8057   <para>
8058    When <structfield>tgconstraint</structfield> is nonzero,
8059    <structfield>tgconstrrelid</structfield>, <structfield>tgconstrindid</structfield>,
8060    <structfield>tgdeferrable</structfield>, and <structfield>tginitdeferred</structfield> are
8061    largely redundant with the referenced <structname>pg_constraint</structname> entry.
8062    However, it is possible for a non-deferrable trigger to be associated
8063    with a deferrable constraint: foreign key constraints can have some
8064    deferrable and some non-deferrable triggers.
8065   </para>
8066  </note>
8067
8068  <note>
8069   <para>
8070    <literal>pg_class.relhastriggers</literal>
8071    must be true if a relation has any triggers in this catalog.
8072   </para>
8073  </note>
8074
8075 </sect1>
8076
8077
8078 <sect1 id="catalog-pg-ts-config">
8079  <title><structname>pg_ts_config</structname></title>
8080
8081  <indexterm zone="catalog-pg-ts-config">
8082   <primary>pg_ts_config</primary>
8083  </indexterm>
8084
8085  <para>
8086   The <structname>pg_ts_config</structname> catalog contains entries
8087   representing text search configurations.  A configuration specifies
8088   a particular text search parser and a list of dictionaries to use
8089   for each of the parser's output token types.  The parser is shown
8090   in the <structname>pg_ts_config</structname> entry, but the
8091   token-to-dictionary mapping is defined by subsidiary entries in <link
8092   linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
8093  </para>
8094
8095  <para>
8096   <productname>PostgreSQL</productname>'s text search features are
8097   described at length in <xref linkend="textsearch"/>.
8098  </para>
8099
8100  <table>
8101   <title><structname>pg_ts_config</structname> Columns</title>
8102   <tgroup cols="1">
8103    <thead>
8104     <row>
8105      <entry role="catalog_table_entry"><para role="column_definition">
8106       Column Type
8107      </para>
8108      <para>
8109       Description
8110      </para></entry>
8111     </row>
8112    </thead>
8113
8114    <tbody>
8115     <row>
8116      <entry role="catalog_table_entry"><para role="column_definition">
8117       <structfield>oid</structfield> <type>oid</type>
8118      </para>
8119      <para>
8120       Row identifier
8121      </para></entry>
8122     </row>
8123
8124     <row>
8125      <entry role="catalog_table_entry"><para role="column_definition">
8126       <structfield>cfgname</structfield> <type>name</type>
8127      </para>
8128      <para>
8129       Text search configuration name
8130      </para></entry>
8131     </row>
8132
8133     <row>
8134      <entry role="catalog_table_entry"><para role="column_definition">
8135       <structfield>cfgnamespace</structfield> <type>oid</type>
8136       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8137      </para>
8138      <para>
8139       The OID of the namespace that contains this configuration
8140      </para></entry>
8141     </row>
8142
8143     <row>
8144      <entry role="catalog_table_entry"><para role="column_definition">
8145       <structfield>cfgowner</structfield> <type>oid</type>
8146       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8147      </para>
8148      <para>
8149       Owner of the configuration
8150      </para></entry>
8151     </row>
8152
8153     <row>
8154      <entry role="catalog_table_entry"><para role="column_definition">
8155       <structfield>cfgparser</structfield> <type>oid</type>
8156       (references <link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.<structfield>oid</structfield>)
8157      </para>
8158      <para>
8159       The OID of the text search parser for this configuration
8160      </para></entry>
8161     </row>
8162    </tbody>
8163   </tgroup>
8164  </table>
8165 </sect1>
8166
8167
8168 <sect1 id="catalog-pg-ts-config-map">
8169  <title><structname>pg_ts_config_map</structname></title>
8170
8171  <indexterm zone="catalog-pg-ts-config-map">
8172   <primary>pg_ts_config_map</primary>
8173  </indexterm>
8174
8175  <para>
8176   The <structname>pg_ts_config_map</structname> catalog contains entries
8177   showing which text search dictionaries should be consulted, and in
8178   what order, for each output token type of each text search configuration's
8179   parser.
8180  </para>
8181
8182  <para>
8183   <productname>PostgreSQL</productname>'s text search features are
8184   described at length in <xref linkend="textsearch"/>.
8185  </para>
8186
8187  <table>
8188   <title><structname>pg_ts_config_map</structname> Columns</title>
8189   <tgroup cols="1">
8190    <thead>
8191     <row>
8192      <entry role="catalog_table_entry"><para role="column_definition">
8193       Column Type
8194      </para>
8195      <para>
8196       Description
8197      </para></entry>
8198     </row>
8199    </thead>
8200
8201    <tbody>
8202     <row>
8203      <entry role="catalog_table_entry"><para role="column_definition">
8204       <structfield>mapcfg</structfield> <type>oid</type>
8205       (references <link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.<structfield>oid</structfield>)
8206      </para>
8207      <para>
8208       The OID of the <structname>pg_ts_config</structname> entry owning this map entry
8209      </para></entry>
8210     </row>
8211
8212     <row>
8213      <entry role="catalog_table_entry"><para role="column_definition">
8214       <structfield>maptokentype</structfield> <type>int4</type>
8215      </para>
8216      <para>
8217       A token type emitted by the configuration's parser
8218      </para></entry>
8219     </row>
8220
8221     <row>
8222      <entry role="catalog_table_entry"><para role="column_definition">
8223       <structfield>mapseqno</structfield> <type>int4</type>
8224      </para>
8225      <para>
8226       Order in which to consult this entry (lower
8227       <structfield>mapseqno</structfield>s first)
8228      </para></entry>
8229     </row>
8230
8231     <row>
8232      <entry role="catalog_table_entry"><para role="column_definition">
8233       <structfield>mapdict</structfield> <type>oid</type>
8234       (references <link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.<structfield>oid</structfield>)
8235      </para>
8236      <para>
8237       The OID of the text search dictionary to consult
8238      </para></entry>
8239     </row>
8240    </tbody>
8241   </tgroup>
8242  </table>
8243 </sect1>
8244
8245
8246 <sect1 id="catalog-pg-ts-dict">
8247  <title><structname>pg_ts_dict</structname></title>
8248
8249  <indexterm zone="catalog-pg-ts-dict">
8250   <primary>pg_ts_dict</primary>
8251  </indexterm>
8252
8253  <para>
8254   The <structname>pg_ts_dict</structname> catalog contains entries
8255   defining text search dictionaries.  A dictionary depends on a text
8256   search template, which specifies all the implementation functions
8257   needed; the dictionary itself provides values for the user-settable
8258   parameters supported by the template.  This division of labor allows
8259   dictionaries to be created by unprivileged users.  The parameters
8260   are specified by a text string <structfield>dictinitoption</structfield>,
8261   whose format and meaning vary depending on the template.
8262  </para>
8263
8264  <para>
8265   <productname>PostgreSQL</productname>'s text search features are
8266   described at length in <xref linkend="textsearch"/>.
8267  </para>
8268
8269  <table>
8270   <title><structname>pg_ts_dict</structname> Columns</title>
8271   <tgroup cols="1">
8272    <thead>
8273     <row>
8274      <entry role="catalog_table_entry"><para role="column_definition">
8275       Column Type
8276      </para>
8277      <para>
8278       Description
8279      </para></entry>
8280     </row>
8281    </thead>
8282
8283    <tbody>
8284     <row>
8285      <entry role="catalog_table_entry"><para role="column_definition">
8286       <structfield>oid</structfield> <type>oid</type>
8287      </para>
8288      <para>
8289       Row identifier
8290      </para></entry>
8291     </row>
8292
8293     <row>
8294      <entry role="catalog_table_entry"><para role="column_definition">
8295       <structfield>dictname</structfield> <type>name</type>
8296      </para>
8297      <para>
8298       Text search dictionary name
8299      </para></entry>
8300     </row>
8301
8302     <row>
8303      <entry role="catalog_table_entry"><para role="column_definition">
8304       <structfield>dictnamespace</structfield> <type>oid</type>
8305       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8306      </para>
8307      <para>
8308       The OID of the namespace that contains this dictionary
8309      </para></entry>
8310     </row>
8311
8312     <row>
8313      <entry role="catalog_table_entry"><para role="column_definition">
8314       <structfield>dictowner</structfield> <type>oid</type>
8315       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8316      </para>
8317      <para>
8318       Owner of the dictionary
8319      </para></entry>
8320     </row>
8321
8322     <row>
8323      <entry role="catalog_table_entry"><para role="column_definition">
8324       <structfield>dicttemplate</structfield> <type>oid</type>
8325       (references <link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.<structfield>oid</structfield>)
8326      </para>
8327      <para>
8328       The OID of the text search template for this dictionary
8329      </para></entry>
8330     </row>
8331
8332     <row>
8333      <entry role="catalog_table_entry"><para role="column_definition">
8334       <structfield>dictinitoption</structfield> <type>text</type>
8335      </para>
8336      <para>
8337       Initialization option string for the template
8338      </para></entry>
8339     </row>
8340    </tbody>
8341   </tgroup>
8342  </table>
8343 </sect1>
8344
8345
8346 <sect1 id="catalog-pg-ts-parser">
8347  <title><structname>pg_ts_parser</structname></title>
8348
8349  <indexterm zone="catalog-pg-ts-parser">
8350   <primary>pg_ts_parser</primary>
8351  </indexterm>
8352
8353  <para>
8354   The <structname>pg_ts_parser</structname> catalog contains entries
8355   defining text search parsers.  A parser is responsible for splitting
8356   input text into lexemes and assigning a token type to each lexeme.
8357   Since a parser must be implemented by C-language-level functions,
8358   creation of new parsers is restricted to database superusers.
8359  </para>
8360
8361  <para>
8362   <productname>PostgreSQL</productname>'s text search features are
8363   described at length in <xref linkend="textsearch"/>.
8364  </para>
8365
8366  <table>
8367   <title><structname>pg_ts_parser</structname> Columns</title>
8368   <tgroup cols="1">
8369    <thead>
8370     <row>
8371      <entry role="catalog_table_entry"><para role="column_definition">
8372       Column Type
8373      </para>
8374      <para>
8375       Description
8376      </para></entry>
8377     </row>
8378    </thead>
8379
8380    <tbody>
8381     <row>
8382      <entry role="catalog_table_entry"><para role="column_definition">
8383       <structfield>oid</structfield> <type>oid</type>
8384      </para>
8385      <para>
8386       Row identifier
8387      </para></entry>
8388     </row>
8389
8390     <row>
8391      <entry role="catalog_table_entry"><para role="column_definition">
8392       <structfield>prsname</structfield> <type>name</type>
8393      </para>
8394      <para>
8395       Text search parser name
8396      </para></entry>
8397     </row>
8398
8399     <row>
8400      <entry role="catalog_table_entry"><para role="column_definition">
8401       <structfield>prsnamespace</structfield> <type>oid</type>
8402       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8403      </para>
8404      <para>
8405       The OID of the namespace that contains this parser
8406      </para></entry>
8407     </row>
8408
8409     <row>
8410      <entry role="catalog_table_entry"><para role="column_definition">
8411       <structfield>prsstart</structfield> <type>regproc</type>
8412       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8413      </para>
8414      <para>
8415       OID of the parser's startup function
8416      </para></entry>
8417     </row>
8418
8419     <row>
8420      <entry role="catalog_table_entry"><para role="column_definition">
8421       <structfield>prstoken</structfield> <type>regproc</type>
8422       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8423      </para>
8424      <para>
8425       OID of the parser's next-token function
8426      </para></entry>
8427     </row>
8428
8429     <row>
8430      <entry role="catalog_table_entry"><para role="column_definition">
8431       <structfield>prsend</structfield> <type>regproc</type>
8432       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8433      </para>
8434      <para>
8435       OID of the parser's shutdown function
8436      </para></entry>
8437     </row>
8438
8439     <row>
8440      <entry role="catalog_table_entry"><para role="column_definition">
8441       <structfield>prsheadline</structfield> <type>regproc</type>
8442       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8443      </para>
8444      <para>
8445       OID of the parser's headline function
8446      </para></entry>
8447     </row>
8448
8449     <row>
8450      <entry role="catalog_table_entry"><para role="column_definition">
8451       <structfield>prslextype</structfield> <type>regproc</type>
8452       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8453      </para>
8454      <para>
8455       OID of the parser's lextype function
8456      </para></entry>
8457     </row>
8458    </tbody>
8459   </tgroup>
8460  </table>
8461 </sect1>
8462
8463
8464 <sect1 id="catalog-pg-ts-template">
8465  <title><structname>pg_ts_template</structname></title>
8466
8467  <indexterm zone="catalog-pg-ts-template">
8468   <primary>pg_ts_template</primary>
8469  </indexterm>
8470
8471  <para>
8472   The <structname>pg_ts_template</structname> catalog contains entries
8473   defining text search templates.  A template is the implementation
8474   skeleton for a class of text search dictionaries.
8475   Since a template must be implemented by C-language-level functions,
8476   creation of new templates is restricted to database superusers.
8477  </para>
8478
8479  <para>
8480   <productname>PostgreSQL</productname>'s text search features are
8481   described at length in <xref linkend="textsearch"/>.
8482  </para>
8483
8484  <table>
8485   <title><structname>pg_ts_template</structname> Columns</title>
8486   <tgroup cols="1">
8487    <thead>
8488     <row>
8489      <entry role="catalog_table_entry"><para role="column_definition">
8490       Column Type
8491      </para>
8492      <para>
8493       Description
8494      </para></entry>
8495     </row>
8496    </thead>
8497
8498    <tbody>
8499     <row>
8500      <entry role="catalog_table_entry"><para role="column_definition">
8501       <structfield>oid</structfield> <type>oid</type>
8502      </para>
8503      <para>
8504       Row identifier
8505      </para></entry>
8506     </row>
8507
8508     <row>
8509      <entry role="catalog_table_entry"><para role="column_definition">
8510       <structfield>tmplname</structfield> <type>name</type>
8511      </para>
8512      <para>
8513       Text search template name
8514      </para></entry>
8515     </row>
8516
8517     <row>
8518      <entry role="catalog_table_entry"><para role="column_definition">
8519       <structfield>tmplnamespace</structfield> <type>oid</type>
8520       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8521      </para>
8522      <para>
8523       The OID of the namespace that contains this template
8524      </para></entry>
8525     </row>
8526
8527     <row>
8528      <entry role="catalog_table_entry"><para role="column_definition">
8529       <structfield>tmplinit</structfield> <type>regproc</type>
8530       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8531      </para>
8532      <para>
8533       OID of the template's initialization function
8534      </para></entry>
8535     </row>
8536
8537     <row>
8538      <entry role="catalog_table_entry"><para role="column_definition">
8539       <structfield>tmpllexize</structfield> <type>regproc</type>
8540       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8541      </para>
8542      <para>
8543       OID of the template's lexize function
8544      </para></entry>
8545     </row>
8546    </tbody>
8547   </tgroup>
8548  </table>
8549 </sect1>
8550
8551
8552 <sect1 id="catalog-pg-type">
8553  <title><structname>pg_type</structname></title>
8554
8555  <indexterm zone="catalog-pg-type">
8556   <primary>pg_type</primary>
8557  </indexterm>
8558
8559  <para>
8560   The catalog <structname>pg_type</structname> stores information about data
8561   types.  Base types and enum types (scalar types) are created with
8562   <xref linkend="sql-createtype"/>, and
8563   domains with
8564   <xref linkend="sql-createdomain"/>.
8565   A composite type is automatically created for each table in the database, to
8566   represent the row structure of the table.  It is also possible to create
8567   composite types with <command>CREATE TYPE AS</command>.
8568  </para>
8569
8570  <table>
8571   <title><structname>pg_type</structname> Columns</title>
8572   <tgroup cols="1">
8573    <thead>
8574     <row>
8575      <entry role="catalog_table_entry"><para role="column_definition">
8576       Column Type
8577      </para>
8578      <para>
8579       Description
8580      </para></entry>
8581     </row>
8582    </thead>
8583
8584    <tbody>
8585     <row>
8586      <entry role="catalog_table_entry"><para role="column_definition">
8587       <structfield>oid</structfield> <type>oid</type>
8588      </para>
8589      <para>
8590       Row identifier
8591      </para></entry>
8592     </row>
8593
8594     <row>
8595      <entry role="catalog_table_entry"><para role="column_definition">
8596       <structfield>typname</structfield> <type>name</type>
8597      </para>
8598      <para>
8599       Data type name
8600      </para></entry>
8601     </row>
8602
8603     <row>
8604      <entry role="catalog_table_entry"><para role="column_definition">
8605       <structfield>typnamespace</structfield> <type>oid</type>
8606       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
8607      </para>
8608      <para>
8609       The OID of the namespace that contains this type
8610      </para></entry>
8611     </row>
8612
8613     <row>
8614      <entry role="catalog_table_entry"><para role="column_definition">
8615       <structfield>typowner</structfield> <type>oid</type>
8616       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
8617      </para>
8618      <para>
8619       Owner of the type
8620      </para></entry>
8621     </row>
8622
8623     <row>
8624      <entry role="catalog_table_entry"><para role="column_definition">
8625       <structfield>typlen</structfield> <type>int2</type>
8626      </para>
8627      <para>
8628       For a fixed-size type, <structfield>typlen</structfield> is the number
8629       of bytes in the internal representation of the type.  But for a
8630       variable-length type, <structfield>typlen</structfield> is negative.
8631       -1 indicates a <quote>varlena</quote> type (one that has a length word),
8632       -2 indicates a null-terminated C string.
8633      </para></entry>
8634     </row>
8635
8636     <row>
8637      <entry role="catalog_table_entry"><para role="column_definition">
8638       <structfield>typbyval</structfield> <type>bool</type>
8639      </para>
8640      <para>
8641       <structfield>typbyval</structfield> determines whether internal
8642       routines pass a value of this type by value or by reference.
8643       <structfield>typbyval</structfield> had better be false if
8644       <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
8645       where Datum is 8 bytes).
8646       Variable-length types are always passed by reference. Note that
8647       <structfield>typbyval</structfield> can be false even if the
8648       length would allow pass-by-value.
8649      </para></entry>
8650     </row>
8651
8652     <row>
8653      <entry role="catalog_table_entry"><para role="column_definition">
8654       <structfield>typtype</structfield> <type>char</type>
8655      </para>
8656      <para>
8657       <structfield>typtype</structfield> is
8658       <literal>b</literal> for a base type,
8659       <literal>c</literal> for a composite type (e.g., a table's row type),
8660       <literal>d</literal> for a domain,
8661       <literal>e</literal> for an enum type,
8662       <literal>p</literal> for a pseudo-type, or
8663       <literal>r</literal> for a range type.
8664       See also <structfield>typrelid</structfield> and
8665       <structfield>typbasetype</structfield>.
8666      </para></entry>
8667     </row>
8668
8669     <row>
8670      <entry role="catalog_table_entry"><para role="column_definition">
8671       <structfield>typcategory</structfield> <type>char</type>
8672      </para>
8673      <para>
8674       <structfield>typcategory</structfield> is an arbitrary classification
8675       of data types that is used by the parser to determine which implicit
8676       casts should be <quote>preferred</quote>.
8677       See <xref linkend="catalog-typcategory-table"/>.
8678      </para></entry>
8679     </row>
8680
8681     <row>
8682      <entry role="catalog_table_entry"><para role="column_definition">
8683       <structfield>typispreferred</structfield> <type>bool</type>
8684      </para>
8685      <para>
8686       True if the type is a preferred cast target within its
8687       <structfield>typcategory</structfield>
8688      </para></entry>
8689     </row>
8690
8691     <row>
8692      <entry role="catalog_table_entry"><para role="column_definition">
8693       <structfield>typisdefined</structfield> <type>bool</type>
8694      </para>
8695      <para>
8696       True if the type is defined, false if this is a placeholder
8697       entry for a not-yet-defined type.  When
8698       <structfield>typisdefined</structfield> is false, nothing
8699       except the type name, namespace, and OID can be relied on.
8700      </para></entry>
8701     </row>
8702
8703     <row>
8704      <entry role="catalog_table_entry"><para role="column_definition">
8705       <structfield>typdelim</structfield> <type>char</type>
8706      </para>
8707      <para>
8708       Character that separates two values of this type when parsing
8709       array input.  Note that the delimiter is associated with the array
8710       element data type, not the array data type.
8711      </para></entry>
8712     </row>
8713
8714     <row>
8715      <entry role="catalog_table_entry"><para role="column_definition">
8716       <structfield>typrelid</structfield> <type>oid</type>
8717       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
8718      </para>
8719      <para>
8720       If this is a composite type (see
8721       <structfield>typtype</structfield>), then this column points to
8722       the <structname>pg_class</structname> entry that defines the
8723       corresponding table.  (For a free-standing composite type, the
8724       <structname>pg_class</structname> entry doesn't really represent
8725       a table, but it is needed anyway for the type's
8726       <structname>pg_attribute</structname> entries to link to.)
8727       Zero for non-composite types.
8728      </para></entry>
8729     </row>
8730
8731     <row>
8732      <entry role="catalog_table_entry"><para role="column_definition">
8733       <structfield>typelem</structfield> <type>oid</type>
8734       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
8735      </para>
8736      <para>
8737       If <structfield>typelem</structfield> is not 0 then it
8738       identifies another row in <structname>pg_type</structname>.
8739       The current type can then be subscripted like an array yielding
8740       values of type <structfield>typelem</structfield>.  A
8741       <quote>true</quote> array type is variable length
8742       (<structfield>typlen</structfield> = -1),
8743       but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
8744       also have nonzero <structfield>typelem</structfield>, for example
8745       <type>name</type> and <type>point</type>.
8746       If a fixed-length type has a <structfield>typelem</structfield> then
8747       its internal representation must be some number of values of the
8748       <structfield>typelem</structfield> data type with no other data.
8749       Variable-length array types have a header defined by the array
8750       subroutines.
8751      </para></entry>
8752     </row>
8753
8754     <row>
8755      <entry role="catalog_table_entry"><para role="column_definition">
8756       <structfield>typarray</structfield> <type>oid</type>
8757       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
8758      </para>
8759      <para>
8760       If <structfield>typarray</structfield> is not 0 then it
8761       identifies another row in <structname>pg_type</structname>, which
8762       is the <quote>true</quote> array type having this type as element
8763      </para></entry>
8764     </row>
8765
8766     <row>
8767      <entry role="catalog_table_entry"><para role="column_definition">
8768       <structfield>typinput</structfield> <type>regproc</type>
8769       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8770      </para>
8771      <para>
8772       Input conversion function (text format)
8773      </para></entry>
8774     </row>
8775
8776     <row>
8777      <entry role="catalog_table_entry"><para role="column_definition">
8778       <structfield>typoutput</structfield> <type>regproc</type>
8779       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8780      </para>
8781      <para>
8782       Output conversion function (text format)
8783      </para></entry>
8784     </row>
8785
8786     <row>
8787      <entry role="catalog_table_entry"><para role="column_definition">
8788       <structfield>typreceive</structfield> <type>regproc</type>
8789       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8790      </para>
8791      <para>
8792       Input conversion function (binary format), or 0 if none
8793      </para></entry>
8794     </row>
8795
8796     <row>
8797      <entry role="catalog_table_entry"><para role="column_definition">
8798       <structfield>typsend</structfield> <type>regproc</type>
8799       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8800      </para>
8801      <para>
8802       Output conversion function (binary format), or 0 if none
8803      </para></entry>
8804     </row>
8805
8806     <row>
8807      <entry role="catalog_table_entry"><para role="column_definition">
8808       <structfield>typmodin</structfield> <type>regproc</type>
8809       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8810      </para>
8811      <para>
8812       Type modifier input function, or 0 if type does not support modifiers
8813      </para></entry>
8814     </row>
8815
8816     <row>
8817      <entry role="catalog_table_entry"><para role="column_definition">
8818       <structfield>typmodout</structfield> <type>regproc</type>
8819       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8820      </para>
8821      <para>
8822       Type modifier output function, or 0 to use the standard format
8823      </para></entry>
8824     </row>
8825
8826     <row>
8827      <entry role="catalog_table_entry"><para role="column_definition">
8828       <structfield>typanalyze</structfield> <type>regproc</type>
8829       (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>)
8830      </para>
8831      <para>
8832       Custom <command>ANALYZE</command> function, or 0 to use the standard function
8833      </para></entry>
8834     </row>
8835
8836     <row>
8837      <entry role="catalog_table_entry"><para role="column_definition">
8838       <structfield>typalign</structfield> <type>char</type>
8839      </para>
8840      <para>
8841       <structfield>typalign</structfield> is the alignment required
8842       when storing a value of this type.  It applies to storage on
8843       disk as well as most representations of the value inside
8844       <productname>PostgreSQL</productname>.
8845       When multiple values are stored consecutively, such
8846       as in the representation of a complete row on disk, padding is
8847       inserted before a datum of this type so that it begins on the
8848       specified boundary.  The alignment reference is the beginning
8849       of the first datum in the sequence.
8850       Possible values are:
8851       <itemizedlist>
8852        <listitem>
8853         <para><literal>c</literal> = <type>char</type> alignment, i.e., no alignment needed.</para>
8854        </listitem>
8855        <listitem>
8856         <para><literal>s</literal> = <type>short</type> alignment (2 bytes on most machines).</para>
8857        </listitem>
8858        <listitem>
8859         <para><literal>i</literal> = <type>int</type> alignment (4 bytes on most machines).</para>
8860        </listitem>
8861        <listitem>
8862         <para><literal>d</literal> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
8863        </listitem>
8864       </itemizedlist>
8865      </para></entry>
8866     </row>
8867
8868     <row>
8869      <entry role="catalog_table_entry"><para role="column_definition">
8870       <structfield>typstorage</structfield> <type>char</type>
8871      </para>
8872      <para>
8873       <structfield>typstorage</structfield> tells for varlena
8874       types (those with <structfield>typlen</structfield> = -1) if
8875       the type is prepared for toasting and what the default strategy
8876       for attributes of this type should be.
8877       Possible values are:
8878       <itemizedlist>
8879        <listitem>
8880         <para>
8881          <literal>p</literal> (plain): Values must always be stored plain
8882          (non-varlena types always use this value).
8883         </para>
8884        </listitem>
8885        <listitem>
8886         <para>
8887          <literal>e</literal> (external): Values can be stored in a
8888          secondary <quote>TOAST</quote> relation (if relation has one, see
8889          <literal>pg_class.reltoastrelid</literal>).
8890         </para>
8891        </listitem>
8892        <listitem>
8893         <para>
8894          <literal>m</literal> (main): Values can be compressed and stored
8895          inline.
8896         </para>
8897        </listitem>
8898        <listitem>
8899         <para>
8900          <literal>x</literal> (extended): Values can be compressed and/or
8901          moved to a secondary relation.
8902         </para>
8903        </listitem>
8904       </itemizedlist>
8905       <literal>x</literal> is the usual choice for toast-able types.
8906       Note that <literal>m</literal> values can also be moved out to
8907       secondary storage, but only as a last resort (<literal>e</literal>
8908       and <literal>x</literal> values are moved first).
8909      </para></entry>
8910     </row>
8911
8912     <row>
8913      <entry role="catalog_table_entry"><para role="column_definition">
8914       <structfield>typnotnull</structfield> <type>bool</type>
8915      </para>
8916      <para>
8917       <structfield>typnotnull</structfield> represents a not-null
8918       constraint on a type.  Used for domains only.
8919      </para></entry>
8920     </row>
8921
8922     <row>
8923      <entry role="catalog_table_entry"><para role="column_definition">
8924       <structfield>typbasetype</structfield> <type>oid</type>
8925       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
8926      </para>
8927      <para>
8928       If this is a domain (see <structfield>typtype</structfield>), then
8929       <structfield>typbasetype</structfield> identifies the type that this
8930       one is based on.  Zero if this type is not a domain.
8931      </para></entry>
8932     </row>
8933
8934     <row>
8935      <entry role="catalog_table_entry"><para role="column_definition">
8936       <structfield>typtypmod</structfield> <type>int4</type>
8937      </para>
8938      <para>
8939       Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</literal>
8940       to be applied to their base type (-1 if base type does not use a
8941       <literal>typmod</literal>).  -1 if this type is not a domain.
8942      </para></entry>
8943     </row>
8944
8945     <row>
8946      <entry role="catalog_table_entry"><para role="column_definition">
8947       <structfield>typndims</structfield> <type>int4</type>
8948      </para>
8949      <para>
8950       <structfield>typndims</structfield> is the number of array dimensions
8951       for a domain over an array (that is, <structfield>typbasetype</structfield> is
8952       an array type).
8953       Zero for types other than domains over array types.
8954      </para></entry>
8955     </row>
8956
8957     <row>
8958      <entry role="catalog_table_entry"><para role="column_definition">
8959       <structfield>typcollation</structfield> <type>oid</type>
8960       (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>)
8961      </para>
8962      <para>
8963       <structfield>typcollation</structfield> specifies the collation
8964       of the type.  If the type does not support collations, this will
8965       be zero.  A base type that supports collations will have a nonzero
8966       value here, typically <symbol>DEFAULT_COLLATION_OID</symbol>.
8967       A domain over a collatable type can have a collation OID different
8968       from its base type's, if one was specified for the domain.
8969      </para></entry>
8970     </row>
8971
8972     <row>
8973      <entry role="catalog_table_entry"><para role="column_definition">
8974       <structfield>typdefaultbin</structfield> <type>pg_node_tree</type>
8975      </para>
8976      <para>
8977       If <structfield>typdefaultbin</structfield> is not null, it is the
8978       <function>nodeToString()</function>
8979       representation of a default expression for the type.  This is
8980       only used for domains.
8981      </para></entry>
8982     </row>
8983
8984     <row>
8985      <entry role="catalog_table_entry"><para role="column_definition">
8986       <structfield>typdefault</structfield> <type>text</type>
8987      </para>
8988      <para>
8989       <structfield>typdefault</structfield> is null if the type has no associated
8990       default value. If <structfield>typdefaultbin</structfield> is not null,
8991       <structfield>typdefault</structfield> must contain a human-readable version of the
8992       default expression represented by <structfield>typdefaultbin</structfield>.  If
8993       <structfield>typdefaultbin</structfield> is null and <structfield>typdefault</structfield> is
8994       not, then <structfield>typdefault</structfield> is the external representation of
8995       the type's default value, which can be fed to the type's input
8996       converter to produce a constant.
8997      </para></entry>
8998     </row>
8999
9000     <row>
9001      <entry role="catalog_table_entry"><para role="column_definition">
9002       <structfield>typacl</structfield> <type>aclitem[]</type>
9003      </para>
9004      <para>
9005       Access privileges; see <xref linkend="ddl-priv"/> for details
9006      </para></entry>
9007     </row>
9008    </tbody>
9009   </tgroup>
9010  </table>
9011
9012  <note>
9013   <para>
9014    For fixed-width types used in system tables, it is critical that the size
9015    and alignment defined in <structname>pg_type</structname>
9016    agree with the way that the compiler will lay out the column in
9017    a structure representing a table row.
9018   </para>
9019  </note>
9020
9021  <para>
9022   <xref linkend="catalog-typcategory-table"/> lists the system-defined values
9023   of <structfield>typcategory</structfield>.  Any future additions to this list will
9024   also be upper-case ASCII letters.  All other ASCII characters are reserved
9025   for user-defined categories.
9026  </para>
9027
9028  <table id="catalog-typcategory-table">
9029   <title><structfield>typcategory</structfield> Codes</title>
9030
9031   <tgroup cols="2">
9032    <thead>
9033     <row>
9034      <entry>Code</entry>
9035      <entry>Category</entry>
9036     </row>
9037    </thead>
9038
9039    <tbody>
9040     <row>
9041      <entry><literal>A</literal></entry>
9042      <entry>Array types</entry>
9043     </row>
9044     <row>
9045      <entry><literal>B</literal></entry>
9046      <entry>Boolean types</entry>
9047     </row>
9048     <row>
9049      <entry><literal>C</literal></entry>
9050      <entry>Composite types</entry>
9051     </row>
9052     <row>
9053      <entry><literal>D</literal></entry>
9054      <entry>Date/time types</entry>
9055     </row>
9056     <row>
9057      <entry><literal>E</literal></entry>
9058      <entry>Enum types</entry>
9059     </row>
9060     <row>
9061      <entry><literal>G</literal></entry>
9062      <entry>Geometric types</entry>
9063     </row>
9064     <row>
9065      <entry><literal>I</literal></entry>
9066      <entry>Network address types</entry>
9067     </row>
9068     <row>
9069      <entry><literal>N</literal></entry>
9070      <entry>Numeric types</entry>
9071     </row>
9072     <row>
9073      <entry><literal>P</literal></entry>
9074      <entry>Pseudo-types</entry>
9075     </row>
9076     <row>
9077      <entry><literal>R</literal></entry>
9078      <entry>Range types</entry>
9079     </row>
9080     <row>
9081      <entry><literal>S</literal></entry>
9082      <entry>String types</entry>
9083     </row>
9084     <row>
9085      <entry><literal>T</literal></entry>
9086      <entry>Timespan types</entry>
9087     </row>
9088     <row>
9089      <entry><literal>U</literal></entry>
9090      <entry>User-defined types</entry>
9091     </row>
9092     <row>
9093      <entry><literal>V</literal></entry>
9094      <entry>Bit-string types</entry>
9095     </row>
9096     <row>
9097      <entry><literal>X</literal></entry>
9098      <entry><type>unknown</type> type</entry>
9099     </row>
9100    </tbody>
9101   </tgroup>
9102  </table>
9103
9104 </sect1>
9105
9106
9107 <sect1 id="catalog-pg-user-mapping">
9108  <title><structname>pg_user_mapping</structname></title>
9109
9110  <indexterm zone="catalog-pg-user-mapping">
9111   <primary>pg_user_mapping</primary>
9112  </indexterm>
9113
9114  <para>
9115   The catalog <structname>pg_user_mapping</structname> stores
9116   the mappings from local user to remote.  Access to this catalog is
9117   restricted from normal users, use the view
9118   <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
9119   instead.
9120  </para>
9121
9122  <table>
9123   <title><structname>pg_user_mapping</structname> Columns</title>
9124   <tgroup cols="1">
9125    <thead>
9126     <row>
9127      <entry role="catalog_table_entry"><para role="column_definition">
9128       Column Type
9129      </para>
9130      <para>
9131       Description
9132      </para></entry>
9133     </row>
9134    </thead>
9135
9136    <tbody>
9137     <row>
9138      <entry role="catalog_table_entry"><para role="column_definition">
9139       <structfield>oid</structfield> <type>oid</type>
9140      </para>
9141      <para>
9142       Row identifier
9143      </para></entry>
9144     </row>
9145
9146     <row>
9147      <entry role="catalog_table_entry"><para role="column_definition">
9148       <structfield>umuser</structfield> <type>oid</type>
9149       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
9150      </para>
9151      <para>
9152       OID of the local role being mapped, 0 if the user mapping is public
9153      </para></entry>
9154     </row>
9155
9156     <row>
9157      <entry role="catalog_table_entry"><para role="column_definition">
9158       <structfield>umserver</structfield> <type>oid</type>
9159       (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
9160      </para>
9161      <para>
9162       The OID of the foreign server that contains this mapping
9163      </para></entry>
9164     </row>
9165
9166     <row>
9167      <entry role="catalog_table_entry"><para role="column_definition">
9168       <structfield>umoptions</structfield> <type>text[]</type>
9169      </para>
9170      <para>
9171       User mapping specific options, as <quote>keyword=value</quote> strings
9172      </para></entry>
9173     </row>
9174    </tbody>
9175   </tgroup>
9176  </table>
9177 </sect1>
9178
9179
9180 <sect1 id="views-overview">
9181  <title>System Views</title>
9182
9183  <para>
9184   In addition to the system catalogs, <productname>PostgreSQL</productname>
9185   provides a number of built-in views.  Some system views provide convenient
9186   access to some commonly used queries on the system catalogs.  Other views
9187   provide access to internal server state.
9188  </para>
9189
9190  <para>
9191   The information schema (<xref linkend="information-schema"/>) provides
9192   an alternative set of views which overlap the functionality of the system
9193   views.  Since the information schema is SQL-standard whereas the views
9194   described here are <productname>PostgreSQL</productname>-specific,
9195   it's usually better to use the information schema if it provides all
9196   the information you need.
9197  </para>
9198
9199  <para>
9200   <xref linkend="view-table"/> lists the system views described here.
9201   More detailed documentation of each view follows below.
9202   There are some additional views that provide access to the results of
9203   the statistics collector; they are described in <xref
9204   linkend="monitoring-stats-views-table"/>.
9205  </para>
9206
9207  <para>
9208   Except where noted, all the views described here are read-only.
9209  </para>
9210
9211  <table id="view-table">
9212   <title>System Views</title>
9213
9214   <tgroup cols="2">
9215    <thead>
9216     <row>
9217      <entry>View Name</entry>
9218      <entry>Purpose</entry>
9219     </row>
9220    </thead>
9221
9222    <tbody>
9223     <row>
9224      <entry><link linkend="view-pg-available-extensions"><structname>pg_available_extensions</structname></link></entry>
9225      <entry>available extensions</entry>
9226     </row>
9227
9228     <row>
9229      <entry><link linkend="view-pg-available-extension-versions"><structname>pg_available_extension_versions</structname></link></entry>
9230      <entry>available versions of extensions</entry>
9231     </row>
9232
9233     <row>
9234      <entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
9235      <entry>compile-time configuration parameters</entry>
9236     </row>
9237
9238     <row>
9239      <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
9240      <entry>open cursors</entry>
9241     </row>
9242
9243     <row>
9244      <entry><link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link></entry>
9245      <entry>summary of configuration file contents</entry>
9246     </row>
9247
9248     <row>
9249      <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
9250      <entry>groups of database users</entry>
9251     </row>
9252
9253     <row>
9254      <entry><link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link></entry>
9255      <entry>summary of client authentication configuration file contents</entry>
9256     </row>
9257
9258     <row>
9259      <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
9260      <entry>indexes</entry>
9261     </row>
9262
9263     <row>
9264      <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
9265      <entry>locks currently held or awaited</entry>
9266     </row>
9267
9268     <row>
9269      <entry><link linkend="view-pg-matviews"><structname>pg_matviews</structname></link></entry>
9270      <entry>materialized views</entry>
9271     </row>
9272
9273     <row>
9274      <entry><link linkend="view-pg-policies"><structname>pg_policies</structname></link></entry>
9275      <entry>policies</entry>
9276     </row>
9277
9278     <row>
9279      <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
9280      <entry>prepared statements</entry>
9281     </row>
9282
9283     <row>
9284      <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
9285      <entry>prepared transactions</entry>
9286     </row>
9287
9288     <row>
9289      <entry><link linkend="view-pg-publication-tables"><structname>pg_publication_tables</structname></link></entry>
9290      <entry>publications and their associated tables</entry>
9291     </row>
9292
9293     <row>
9294      <entry><link linkend="view-pg-replication-origin-status"><structname>pg_replication_origin_status</structname></link></entry>
9295      <entry>information about replication origins, including replication progress</entry>
9296     </row>
9297
9298     <row>
9299      <entry><link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link></entry>
9300      <entry>replication slot information</entry>
9301     </row>
9302
9303     <row>
9304      <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
9305      <entry>database roles</entry>
9306     </row>
9307
9308     <row>
9309      <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
9310      <entry>rules</entry>
9311     </row>
9312
9313     <row>
9314      <entry><link linkend="view-pg-seclabels"><structname>pg_seclabels</structname></link></entry>
9315      <entry>security labels</entry>
9316     </row>
9317
9318     <row>
9319      <entry><link linkend="view-pg-sequences"><structname>pg_sequences</structname></link></entry>
9320      <entry>sequences</entry>
9321     </row>
9322
9323     <row>
9324      <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
9325      <entry>parameter settings</entry>
9326     </row>
9327
9328     <row>
9329      <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
9330      <entry>database users</entry>
9331     </row>
9332
9333     <row>
9334      <entry><link linkend="view-pg-shmem-allocations"><structname>pg_shmem_allocations</structname></link></entry>
9335      <entry>shared memory allocations</entry>
9336     </row>
9337
9338     <row>
9339      <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
9340      <entry>planner statistics</entry>
9341     </row>
9342
9343     <row>
9344      <entry><link linkend="view-pg-stats-ext"><structname>pg_stats_ext</structname></link></entry>
9345      <entry>extended planner statistics</entry>
9346     </row>
9347
9348     <row>
9349      <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
9350      <entry>tables</entry>
9351     </row>
9352
9353     <row>
9354      <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
9355      <entry>time zone abbreviations</entry>
9356     </row>
9357
9358     <row>
9359      <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
9360      <entry>time zone names</entry>
9361     </row>
9362
9363     <row>
9364      <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
9365      <entry>database users</entry>
9366     </row>
9367
9368     <row>
9369      <entry><link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link></entry>
9370      <entry>user mappings</entry>
9371     </row>
9372
9373     <row>
9374      <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
9375      <entry>views</entry>
9376     </row>
9377
9378    </tbody>
9379   </tgroup>
9380  </table>
9381 </sect1>
9382
9383 <sect1 id="view-pg-available-extensions">
9384  <title><structname>pg_available_extensions</structname></title>
9385
9386  <indexterm zone="view-pg-available-extensions">
9387   <primary>pg_available_extensions</primary>
9388  </indexterm>
9389
9390  <para>
9391   The <structname>pg_available_extensions</structname> view lists the
9392   extensions that are available for installation.
9393   See also the
9394   <link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
9395   catalog, which shows the extensions currently installed.
9396  </para>
9397
9398  <table>
9399   <title><structname>pg_available_extensions</structname> Columns</title>
9400   <tgroup cols="1">
9401    <thead>
9402     <row>
9403      <entry role="catalog_table_entry"><para role="column_definition">
9404       Column Type
9405      </para>
9406      <para>
9407       Description
9408      </para></entry>
9409     </row>
9410    </thead>
9411
9412    <tbody>
9413     <row>
9414      <entry role="catalog_table_entry"><para role="column_definition">
9415       <structfield>name</structfield> <type>name</type>
9416      </para>
9417      <para>
9418       Extension name
9419      </para></entry>
9420     </row>
9421
9422     <row>
9423      <entry role="catalog_table_entry"><para role="column_definition">
9424       <structfield>default_version</structfield> <type>text</type>
9425      </para>
9426      <para>
9427       Name of default version, or <literal>NULL</literal> if none is
9428       specified
9429      </para></entry>
9430     </row>
9431
9432     <row>
9433      <entry role="catalog_table_entry"><para role="column_definition">
9434       <structfield>installed_version</structfield> <type>text</type>
9435      </para>
9436      <para>
9437       Currently installed version of the extension,
9438       or <literal>NULL</literal> if not installed
9439      </para></entry>
9440     </row>
9441
9442     <row>
9443      <entry role="catalog_table_entry"><para role="column_definition">
9444       <structfield>comment</structfield> <type>text</type>
9445      </para>
9446      <para>
9447       Comment string from the extension's control file
9448      </para></entry>
9449     </row>
9450    </tbody>
9451   </tgroup>
9452  </table>
9453
9454  <para>
9455   The <structname>pg_available_extensions</structname> view is read only.
9456  </para>
9457 </sect1>
9458
9459 <sect1 id="view-pg-available-extension-versions">
9460  <title><structname>pg_available_extension_versions</structname></title>
9461
9462  <indexterm zone="view-pg-available-extension-versions">
9463   <primary>pg_available_extension_versions</primary>
9464  </indexterm>
9465
9466  <para>
9467   The <structname>pg_available_extension_versions</structname> view lists the
9468   specific extension versions that are available for installation.
9469   See also the <link
9470   linkend="catalog-pg-extension"><structname>pg_extension</structname></link>
9471   catalog, which shows the extensions currently installed.
9472  </para>
9473
9474  <table>
9475   <title><structname>pg_available_extension_versions</structname> Columns</title>
9476   <tgroup cols="1">
9477    <thead>
9478     <row>
9479      <entry role="catalog_table_entry"><para role="column_definition">
9480       Column Type
9481      </para>
9482      <para>
9483       Description
9484      </para></entry>
9485     </row>
9486    </thead>
9487
9488    <tbody>
9489     <row>
9490      <entry role="catalog_table_entry"><para role="column_definition">
9491       <structfield>name</structfield> <type>name</type>
9492      </para>
9493      <para>
9494       Extension name
9495      </para></entry>
9496     </row>
9497
9498     <row>
9499      <entry role="catalog_table_entry"><para role="column_definition">
9500       <structfield>version</structfield> <type>text</type>
9501      </para>
9502      <para>
9503       Version name
9504      </para></entry>
9505     </row>
9506
9507     <row>
9508      <entry role="catalog_table_entry"><para role="column_definition">
9509       <structfield>installed</structfield> <type>bool</type>
9510      </para>
9511      <para>
9512       True if this version of this extension is currently
9513       installed
9514      </para></entry>
9515     </row>
9516
9517     <row>
9518      <entry role="catalog_table_entry"><para role="column_definition">
9519       <structfield>superuser</structfield> <type>bool</type>
9520      </para>
9521      <para>
9522       True if only superusers are allowed to install this extension
9523       (but see <structfield>trusted</structfield>)
9524      </para></entry>
9525     </row>
9526
9527     <row>
9528      <entry role="catalog_table_entry"><para role="column_definition">
9529       <structfield>trusted</structfield> <type>bool</type>
9530      </para>
9531      <para>
9532       True if the extension can be installed by non-superusers
9533       with appropriate privileges
9534      </para></entry>
9535     </row>
9536
9537     <row>
9538      <entry role="catalog_table_entry"><para role="column_definition">
9539       <structfield>relocatable</structfield> <type>bool</type>
9540      </para>
9541      <para>
9542       True if extension can be relocated to another schema
9543      </para></entry>
9544     </row>
9545
9546     <row>
9547      <entry role="catalog_table_entry"><para role="column_definition">
9548       <structfield>schema</structfield> <type>name</type>
9549      </para>
9550      <para>
9551       Name of the schema that the extension must be installed into,
9552       or <literal>NULL</literal> if partially or fully relocatable
9553      </para></entry>
9554     </row>
9555
9556     <row>
9557      <entry role="catalog_table_entry"><para role="column_definition">
9558       <structfield>requires</structfield> <type>name[]</type>
9559      </para>
9560      <para>
9561       Names of prerequisite extensions,
9562       or <literal>NULL</literal> if none
9563      </para></entry>
9564     </row>
9565
9566     <row>
9567      <entry role="catalog_table_entry"><para role="column_definition">
9568       <structfield>comment</structfield> <type>text</type>
9569      </para>
9570      <para>
9571       Comment string from the extension's control file
9572      </para></entry>
9573     </row>
9574    </tbody>
9575   </tgroup>
9576  </table>
9577
9578  <para>
9579   The <structname>pg_available_extension_versions</structname> view is read
9580   only.
9581  </para>
9582 </sect1>
9583
9584 <sect1 id="view-pg-config">
9585  <title><structname>pg_config</structname></title>
9586
9587  <indexterm zone="view-pg-config">
9588   <primary>pg_config</primary>
9589  </indexterm>
9590
9591  <para>
9592   The view <structname>pg_config</structname> describes the
9593   compile-time configuration parameters of the currently installed
9594   version of <productname>PostgreSQL</productname>. It is intended, for example, to
9595   be used by software packages that want to interface to
9596   <productname>PostgreSQL</productname> to facilitate finding the required header
9597   files and libraries. It provides the same basic information as the
9598   <xref linkend="app-pgconfig"/> <productname>PostgreSQL</productname> client
9599   application.
9600  </para>
9601
9602  <para>
9603   By default, the <structname>pg_config</structname> view can be read
9604   only by superusers.
9605  </para>
9606
9607  <table>
9608   <title><structname>pg_config</structname> Columns</title>
9609   <tgroup cols="1">
9610    <thead>
9611     <row>
9612      <entry role="catalog_table_entry"><para role="column_definition">
9613       Column Type
9614      </para>
9615      <para>
9616       Description
9617      </para></entry>
9618     </row>
9619    </thead>
9620
9621    <tbody>
9622     <row>
9623      <entry role="catalog_table_entry"><para role="column_definition">
9624       <structfield>name</structfield> <type>text</type>
9625      </para>
9626      <para>
9627       The parameter name
9628      </para></entry>
9629     </row>
9630
9631     <row>
9632      <entry role="catalog_table_entry"><para role="column_definition">
9633       <structfield>setting</structfield> <type>text</type>
9634      </para>
9635      <para>
9636       The parameter value
9637      </para></entry>
9638     </row>
9639    </tbody>
9640   </tgroup>
9641  </table>
9642
9643 </sect1>
9644
9645 <sect1 id="view-pg-cursors">
9646  <title><structname>pg_cursors</structname></title>
9647
9648  <indexterm zone="view-pg-cursors">
9649   <primary>pg_cursors</primary>
9650  </indexterm>
9651
9652  <para>
9653   The <structname>pg_cursors</structname> view lists the cursors that
9654   are currently available. Cursors can be defined in several ways:
9655   <itemizedlist>
9656    <listitem>
9657     <para>
9658      via the <xref linkend="sql-declare"/>
9659      statement in SQL
9660     </para>
9661    </listitem>
9662
9663    <listitem>
9664     <para>
9665      via the Bind message in the frontend/backend protocol, as
9666      described in <xref linkend="protocol-flow-ext-query"/>
9667     </para>
9668    </listitem>
9669
9670    <listitem>
9671     <para>
9672      via the Server Programming Interface (SPI), as described in
9673      <xref linkend="spi-interface"/>
9674     </para>
9675    </listitem>
9676   </itemizedlist>
9677
9678   The <structname>pg_cursors</structname> view displays cursors
9679   created by any of these means. Cursors only exist for the duration
9680   of the transaction that defines them, unless they have been
9681   declared <literal>WITH HOLD</literal>. Therefore non-holdable
9682   cursors are only present in the view until the end of their
9683   creating transaction.
9684
9685   <note>
9686    <para>
9687     Cursors are used internally to implement some of the components
9688     of <productname>PostgreSQL</productname>, such as procedural languages.
9689     Therefore, the <structname>pg_cursors</structname> view might include cursors
9690     that have not been explicitly created by the user.
9691    </para>
9692   </note>
9693  </para>
9694
9695  <table>
9696   <title><structname>pg_cursors</structname> Columns</title>
9697   <tgroup cols="1">
9698    <thead>
9699     <row>
9700      <entry role="catalog_table_entry"><para role="column_definition">
9701       Column Type
9702      </para>
9703      <para>
9704       Description
9705      </para></entry>
9706     </row>
9707    </thead>
9708
9709    <tbody>
9710     <row>
9711      <entry role="catalog_table_entry"><para role="column_definition">
9712       <structfield>name</structfield> <type>text</type>
9713      </para>
9714      <para>
9715       The name of the cursor
9716      </para></entry>
9717     </row>
9718
9719     <row>
9720      <entry role="catalog_table_entry"><para role="column_definition">
9721       <structfield>statement</structfield> <type>text</type>
9722      </para>
9723      <para>
9724       The verbatim query string submitted to declare this cursor
9725      </para></entry>
9726     </row>
9727
9728     <row>
9729      <entry role="catalog_table_entry"><para role="column_definition">
9730       <structfield>is_holdable</structfield> <type>bool</type>
9731      </para>
9732      <para>
9733       <literal>true</literal> if the cursor is holdable (that is, it
9734       can be accessed after the transaction that declared the cursor
9735       has committed); <literal>false</literal> otherwise
9736      </para></entry>
9737     </row>
9738
9739     <row>
9740      <entry role="catalog_table_entry"><para role="column_definition">
9741       <structfield>is_binary</structfield> <type>bool</type>
9742      </para>
9743      <para>
9744       <literal>true</literal> if the cursor was declared
9745       <literal>BINARY</literal>; <literal>false</literal>
9746       otherwise
9747      </para></entry>
9748     </row>
9749
9750     <row>
9751      <entry role="catalog_table_entry"><para role="column_definition">
9752       <structfield>is_scrollable</structfield> <type>bool</type>
9753      </para>
9754      <para>
9755       <literal>true</literal> if the cursor is scrollable (that is, it
9756       allows rows to be retrieved in a nonsequential manner);
9757       <literal>false</literal> otherwise
9758      </para></entry>
9759     </row>
9760
9761     <row>
9762      <entry role="catalog_table_entry"><para role="column_definition">
9763       <structfield>creation_time</structfield> <type>timestamptz</type>
9764      </para>
9765      <para>
9766       The time at which the cursor was declared
9767      </para></entry>
9768     </row>
9769    </tbody>
9770   </tgroup>
9771  </table>
9772
9773  <para>
9774   The <structname>pg_cursors</structname> view is read only.
9775  </para>
9776
9777 </sect1>
9778
9779 <sect1 id="view-pg-file-settings">
9780  <title><structname>pg_file_settings</structname></title>
9781
9782  <indexterm zone="view-pg-file-settings">
9783   <primary>pg_file_settings</primary>
9784  </indexterm>
9785
9786  <para>
9787   The view <structname>pg_file_settings</structname> provides a summary of
9788   the contents of the server's configuration file(s).  A row appears in
9789   this view for each <quote>name = value</quote> entry appearing in the files,
9790   with annotations indicating whether the value could be applied
9791   successfully.  Additional row(s) may appear for problems not linked to
9792   a <quote>name = value</quote> entry, such as syntax errors in the files.
9793  </para>
9794
9795  <para>
9796   This view is helpful for checking whether planned changes in the
9797   configuration files will work, or for diagnosing a previous failure.
9798   Note that this view reports on the <emphasis>current</emphasis> contents of the
9799   files, not on what was last applied by the server.  (The
9800   <link linkend="view-pg-settings"><structname>pg_settings</structname></link>
9801   view is usually sufficient to determine that.)
9802  </para>
9803
9804  <para>
9805   By default, the <structname>pg_file_settings</structname> view can be read
9806   only by superusers.
9807  </para>
9808
9809  <table>
9810   <title><structname>pg_file_settings</structname> Columns</title>
9811   <tgroup cols="1">
9812    <thead>
9813     <row>
9814      <entry role="catalog_table_entry"><para role="column_definition">
9815       Column Type
9816      </para>
9817      <para>
9818       Description
9819      </para></entry>
9820     </row>
9821    </thead>
9822
9823    <tbody>
9824     <row>
9825      <entry role="catalog_table_entry"><para role="column_definition">
9826       <structfield>sourcefile</structfield> <type>text</type>
9827      </para>
9828      <para>
9829       Full path name of the configuration file
9830      </para></entry>
9831     </row>
9832
9833     <row>
9834      <entry role="catalog_table_entry"><para role="column_definition">
9835       <structfield>sourceline</structfield> <type>int4</type>
9836      </para>
9837      <para>
9838       Line number within the configuration file where the entry appears
9839      </para></entry>
9840     </row>
9841
9842     <row>
9843      <entry role="catalog_table_entry"><para role="column_definition">
9844       <structfield>seqno</structfield> <type>int4</type>
9845      </para>
9846      <para>
9847       Order in which the entries are processed (1..<replaceable>n</replaceable>)
9848      </para></entry>
9849     </row>
9850
9851     <row>
9852      <entry role="catalog_table_entry"><para role="column_definition">
9853       <structfield>name</structfield> <type>text</type>
9854      </para>
9855      <para>
9856       Configuration parameter name
9857      </para></entry>
9858     </row>
9859
9860     <row>
9861      <entry role="catalog_table_entry"><para role="column_definition">
9862       <structfield>setting</structfield> <type>text</type>
9863      </para>
9864      <para>
9865       Value to be assigned to the parameter
9866      </para></entry>
9867     </row>
9868
9869     <row>
9870      <entry role="catalog_table_entry"><para role="column_definition">
9871       <structfield>applied</structfield> <type>bool</type>
9872      </para>
9873      <para>
9874       True if the value can be applied successfully
9875      </para></entry>
9876     </row>
9877
9878     <row>
9879      <entry role="catalog_table_entry"><para role="column_definition">
9880       <structfield>error</structfield> <type>text</type>
9881      </para>
9882      <para>
9883       If not null, an error message indicating why this entry could
9884       not be applied
9885      </para></entry>
9886     </row>
9887    </tbody>
9888   </tgroup>
9889  </table>
9890
9891  <para>
9892   If the configuration file contains syntax errors or invalid parameter
9893   names, the server will not attempt to apply any settings from it, and
9894   therefore all the <structfield>applied</structfield> fields will read as false.
9895   In such a case there will be one or more rows with
9896   non-null <structfield>error</structfield> fields indicating the
9897   problem(s).  Otherwise, individual settings will be applied if possible.
9898   If an individual setting cannot be applied (e.g., invalid value, or the
9899   setting cannot be changed after server start) it will have an appropriate
9900   message in the <structfield>error</structfield> field.  Another way that
9901   an entry might have <structfield>applied</structfield> = false is that it is
9902   overridden by a later entry for the same parameter name; this case is not
9903   considered an error so nothing appears in
9904   the <structfield>error</structfield> field.
9905  </para>
9906
9907  <para>
9908   See <xref linkend="config-setting"/> for more information about the various
9909   ways to change run-time parameters.
9910  </para>
9911
9912</sect1>
9913
9914 <sect1 id="view-pg-group">
9915  <title><structname>pg_group</structname></title>
9916
9917  <indexterm zone="view-pg-group">
9918   <primary>pg_group</primary>
9919  </indexterm>
9920
9921  <para>
9922   The view <structname>pg_group</structname> exists for backwards
9923   compatibility: it emulates a catalog that existed in
9924   <productname>PostgreSQL</productname> before version 8.1.
9925   It shows the names and members of all roles that are marked as not
9926   <structfield>rolcanlogin</structfield>, which is an approximation to the set
9927   of roles that are being used as groups.
9928  </para>
9929
9930  <table>
9931   <title><structname>pg_group</structname> Columns</title>
9932   <tgroup cols="1">
9933    <thead>
9934     <row>
9935      <entry role="catalog_table_entry"><para role="column_definition">
9936       Column Type
9937      </para>
9938      <para>
9939       Description
9940      </para></entry>
9941     </row>
9942    </thead>
9943
9944    <tbody>
9945     <row>
9946      <entry role="catalog_table_entry"><para role="column_definition">
9947       <structfield>groname</structfield> <type>name</type>
9948       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
9949      </para>
9950      <para>
9951       Name of the group
9952      </para></entry>
9953     </row>
9954
9955     <row>
9956      <entry role="catalog_table_entry"><para role="column_definition">
9957       <structfield>grosysid</structfield> <type>oid</type>
9958       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
9959      </para>
9960      <para>
9961       ID of this group
9962      </para></entry>
9963     </row>
9964
9965     <row>
9966      <entry role="catalog_table_entry"><para role="column_definition">
9967       <structfield>grolist</structfield> <type>oid[]</type>
9968       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
9969      </para>
9970      <para>
9971       An array containing the IDs of the roles in this group
9972      </para></entry>
9973     </row>
9974    </tbody>
9975   </tgroup>
9976  </table>
9977
9978 </sect1>
9979
9980 <sect1 id="view-pg-hba-file-rules">
9981  <title><structname>pg_hba_file_rules</structname></title>
9982
9983  <indexterm zone="view-pg-hba-file-rules">
9984   <primary>pg_hba_file_rules</primary>
9985  </indexterm>
9986
9987  <para>
9988   The view <structname>pg_hba_file_rules</structname> provides a summary of
9989   the contents of the client authentication configuration
9990   file, <filename>pg_hba.conf</filename>.  A row appears in this view for each
9991   non-empty, non-comment line in the file, with annotations indicating
9992   whether the rule could be applied successfully.
9993  </para>
9994
9995  <para>
9996   This view can be helpful for checking whether planned changes in the
9997   authentication configuration file will work, or for diagnosing a previous
9998   failure.  Note that this view reports on the <emphasis>current</emphasis> contents
9999   of the file, not on what was last loaded by the server.
10000  </para>
10001
10002  <para>
10003   By default, the <structname>pg_hba_file_rules</structname> view can be read
10004   only by superusers.
10005  </para>
10006
10007  <table>
10008   <title><structname>pg_hba_file_rules</structname> Columns</title>
10009   <tgroup cols="1">
10010    <thead>
10011     <row>
10012      <entry role="catalog_table_entry"><para role="column_definition">
10013       Column Type
10014      </para>
10015      <para>
10016       Description
10017      </para></entry>
10018     </row>
10019    </thead>
10020
10021    <tbody>
10022     <row>
10023      <entry role="catalog_table_entry"><para role="column_definition">
10024       <structfield>line_number</structfield> <type>int4</type>
10025      </para>
10026      <para>
10027       Line number of this rule in <filename>pg_hba.conf</filename>
10028      </para></entry>
10029     </row>
10030
10031     <row>
10032      <entry role="catalog_table_entry"><para role="column_definition">
10033       <structfield>type</structfield> <type>text</type>
10034      </para>
10035      <para>
10036       Type of connection
10037      </para></entry>
10038     </row>
10039
10040     <row>
10041      <entry role="catalog_table_entry"><para role="column_definition">
10042       <structfield>database</structfield> <type>text[]</type>
10043      </para>
10044      <para>
10045       List of database name(s) to which this rule applies
10046      </para></entry>
10047     </row>
10048
10049     <row>
10050      <entry role="catalog_table_entry"><para role="column_definition">
10051       <structfield>user_name</structfield> <type>text[]</type>
10052      </para>
10053      <para>
10054       List of user and group name(s) to which this rule applies
10055      </para></entry>
10056     </row>
10057
10058     <row>
10059      <entry role="catalog_table_entry"><para role="column_definition">
10060       <structfield>address</structfield> <type>text</type>
10061      </para>
10062      <para>
10063       Host name or IP address, or one
10064       of <literal>all</literal>, <literal>samehost</literal>,
10065       or <literal>samenet</literal>, or null for local connections
10066      </para></entry>
10067     </row>
10068
10069     <row>
10070      <entry role="catalog_table_entry"><para role="column_definition">
10071       <structfield>netmask</structfield> <type>text</type>
10072      </para>
10073      <para>
10074       IP address mask, or null if not applicable
10075      </para></entry>
10076     </row>
10077
10078     <row>
10079      <entry role="catalog_table_entry"><para role="column_definition">
10080       <structfield>auth_method</structfield> <type>text</type>
10081      </para>
10082      <para>
10083       Authentication method
10084      </para></entry>
10085     </row>
10086
10087     <row>
10088      <entry role="catalog_table_entry"><para role="column_definition">
10089       <structfield>options</structfield> <type>text[]</type>
10090      </para>
10091      <para>
10092       Options specified for authentication method, if any
10093      </para></entry>
10094     </row>
10095
10096     <row>
10097      <entry role="catalog_table_entry"><para role="column_definition">
10098       <structfield>error</structfield> <type>text</type>
10099      </para>
10100      <para>
10101       If not null, an error message indicating why this
10102       line could not be processed
10103      </para></entry>
10104     </row>
10105    </tbody>
10106   </tgroup>
10107  </table>
10108
10109  <para>
10110   Usually, a row reflecting an incorrect entry will have values for only
10111   the <structfield>line_number</structfield> and <structfield>error</structfield> fields.
10112  </para>
10113
10114  <para>
10115   See <xref linkend="client-authentication"/> for more information about
10116   client authentication configuration.
10117  </para>
10118 </sect1>
10119
10120 <sect1 id="view-pg-indexes">
10121  <title><structname>pg_indexes</structname></title>
10122
10123  <indexterm zone="view-pg-indexes">
10124   <primary>pg_indexes</primary>
10125  </indexterm>
10126
10127  <para>
10128   The view <structname>pg_indexes</structname> provides access to
10129   useful information about each index in the database.
10130  </para>
10131
10132  <table>
10133   <title><structname>pg_indexes</structname> Columns</title>
10134   <tgroup cols="1">
10135    <thead>
10136     <row>
10137      <entry role="catalog_table_entry"><para role="column_definition">
10138       Column Type
10139      </para>
10140      <para>
10141       Description
10142      </para></entry>
10143     </row>
10144    </thead>
10145
10146    <tbody>
10147     <row>
10148      <entry role="catalog_table_entry"><para role="column_definition">
10149       <structfield>schemaname</structfield> <type>name</type>
10150       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
10151      </para>
10152      <para>
10153       Name of schema containing table and index
10154      </para></entry>
10155     </row>
10156
10157     <row>
10158      <entry role="catalog_table_entry"><para role="column_definition">
10159       <structfield>tablename</structfield> <type>name</type>
10160       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
10161      </para>
10162      <para>
10163       Name of table the index is for
10164      </para></entry>
10165     </row>
10166
10167     <row>
10168      <entry role="catalog_table_entry"><para role="column_definition">
10169       <structfield>indexname</structfield> <type>name</type>
10170       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
10171      </para>
10172      <para>
10173       Name of index
10174      </para></entry>
10175     </row>
10176
10177     <row>
10178      <entry role="catalog_table_entry"><para role="column_definition">
10179       <structfield>tablespace</structfield> <type>name</type>
10180       (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
10181      </para>
10182      <para>
10183       Name of tablespace containing index (null if default for database)
10184      </para></entry>
10185     </row>
10186
10187     <row>
10188      <entry role="catalog_table_entry"><para role="column_definition">
10189       <structfield>indexdef</structfield> <type>text</type>
10190      </para>
10191      <para>
10192       Index definition (a reconstructed <command>CREATE INDEX</command>
10193       command)
10194      </para></entry>
10195     </row>
10196    </tbody>
10197   </tgroup>
10198  </table>
10199
10200 </sect1>
10201
10202 <sect1 id="view-pg-locks">
10203  <title><structname>pg_locks</structname></title>
10204
10205  <indexterm zone="view-pg-locks">
10206   <primary>pg_locks</primary>
10207  </indexterm>
10208
10209  <para>
10210   The view <structname>pg_locks</structname> provides access to
10211   information about the locks held by active processes within the
10212   database server.  See <xref linkend="mvcc"/> for more discussion
10213   of locking.
10214  </para>
10215
10216  <para>
10217   <structname>pg_locks</structname> contains one row per active lockable
10218   object, requested lock mode, and relevant process.  Thus, the same
10219   lockable object might
10220   appear many times, if multiple processes are holding or waiting
10221   for locks on it.  However, an object that currently has no locks on it
10222   will not appear at all.
10223  </para>
10224
10225  <para>
10226   There are several distinct types of lockable objects:
10227   whole relations (e.g., tables), individual pages of relations,
10228   individual tuples of relations,
10229   transaction IDs (both virtual and permanent IDs),
10230   and general database objects (identified by class OID and object OID,
10231   in the same way as in <structname>pg_description</structname> or
10232   <structname>pg_depend</structname>).  Also, the right to extend a
10233   relation is represented as a separate lockable object, as is the right to
10234   update <structname>pg_database</structname>.<structfield>datfrozenxid</structfield>.
10235   Also, <quote>advisory</quote> locks can be taken on numbers that have
10236   user-defined meanings.
10237  </para>
10238
10239  <table>
10240   <title><structname>pg_locks</structname> Columns</title>
10241   <tgroup cols="1">
10242    <thead>
10243     <row>
10244      <entry role="catalog_table_entry"><para role="column_definition">
10245       Column Type
10246      </para>
10247      <para>
10248       Description
10249      </para></entry>
10250     </row>
10251    </thead>
10252
10253    <tbody>
10254     <row>
10255      <entry role="catalog_table_entry"><para role="column_definition">
10256       <structfield>locktype</structfield> <type>text</type>
10257      </para>
10258      <para>
10259       Type of the lockable object:
10260       <literal>relation</literal>,
10261       <literal>extend</literal>,
10262       <literal>frozenid</literal>,
10263       <literal>page</literal>,
10264       <literal>tuple</literal>,
10265       <literal>transactionid</literal>,
10266       <literal>virtualxid</literal>,
10267       <literal>spectoken</literal>,
10268       <literal>object</literal>,
10269       <literal>userlock</literal>, or
10270       <literal>advisory</literal>.
10271       (See also <xref linkend="wait-event-lock-table"/>.)
10272      </para></entry>
10273     </row>
10274
10275     <row>
10276      <entry role="catalog_table_entry"><para role="column_definition">
10277       <structfield>database</structfield> <type>oid</type>
10278       (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
10279      </para>
10280      <para>
10281       OID of the database in which the lock target exists, or
10282       zero if the target is a shared object, or
10283       null if the target is a transaction ID
10284      </para></entry>
10285     </row>
10286
10287     <row>
10288      <entry role="catalog_table_entry"><para role="column_definition">
10289       <structfield>relation</structfield> <type>oid</type>
10290       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
10291      </para>
10292      <para>
10293       OID of the relation targeted by the lock, or null if the target is not
10294       a relation or part of a relation
10295      </para></entry>
10296     </row>
10297
10298     <row>
10299      <entry role="catalog_table_entry"><para role="column_definition">
10300       <structfield>page</structfield> <type>int4</type>
10301      </para>
10302      <para>
10303       Page number targeted by the lock within the relation,
10304       or null if the target is not a relation page or tuple
10305      </para></entry>
10306     </row>
10307
10308     <row>
10309      <entry role="catalog_table_entry"><para role="column_definition">
10310       <structfield>tuple</structfield> <type>int2</type>
10311      </para>
10312      <para>
10313       Tuple number targeted by the lock within the page,
10314       or null if the target is not a tuple
10315      </para></entry>
10316     </row>
10317
10318     <row>
10319      <entry role="catalog_table_entry"><para role="column_definition">
10320       <structfield>virtualxid</structfield> <type>text</type>
10321      </para>
10322      <para>
10323       Virtual ID of the transaction targeted by the lock,
10324       or null if the target is not a virtual transaction ID
10325      </para></entry>
10326     </row>
10327
10328     <row>
10329      <entry role="catalog_table_entry"><para role="column_definition">
10330       <structfield>transactionid</structfield> <type>xid</type>
10331      </para>
10332      <para>
10333       ID of the transaction targeted by the lock,
10334       or null if the target is not a transaction ID
10335      </para></entry>
10336     </row>
10337
10338     <row>
10339      <entry role="catalog_table_entry"><para role="column_definition">
10340       <structfield>classid</structfield> <type>oid</type>
10341       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
10342      </para>
10343      <para>
10344       OID of the system catalog containing the lock target, or null if the
10345       target is not a general database object
10346      </para></entry>
10347     </row>
10348
10349     <row>
10350      <entry role="catalog_table_entry"><para role="column_definition">
10351       <structfield>objid</structfield> <type>oid</type>
10352       (references any OID column)
10353      </para>
10354      <para>
10355       OID of the lock target within its system catalog, or null if the
10356       target is not a general database object
10357      </para></entry>
10358     </row>
10359
10360     <row>
10361      <entry role="catalog_table_entry"><para role="column_definition">
10362       <structfield>objsubid</structfield> <type>int2</type>
10363      </para>
10364      <para>
10365       Column number targeted by the lock (the
10366       <structfield>classid</structfield> and <structfield>objid</structfield> refer to the
10367       table itself),
10368       or zero if the target is some other general database object,
10369       or null if the target is not a general database object
10370      </para></entry>
10371     </row>
10372
10373     <row>
10374      <entry role="catalog_table_entry"><para role="column_definition">
10375       <structfield>virtualtransaction</structfield> <type>text</type>
10376      </para>
10377      <para>
10378       Virtual ID of the transaction that is holding or awaiting this lock
10379      </para></entry>
10380     </row>
10381
10382     <row>
10383      <entry role="catalog_table_entry"><para role="column_definition">
10384       <structfield>pid</structfield> <type>int4</type>
10385      </para>
10386      <para>
10387       Process ID of the server process holding or awaiting this
10388       lock, or null if the lock is held by a prepared transaction
10389      </para></entry>
10390     </row>
10391
10392     <row>
10393      <entry role="catalog_table_entry"><para role="column_definition">
10394       <structfield>mode</structfield> <type>text</type>
10395      </para>
10396      <para>
10397       Name of the lock mode held or desired by this process (see <xref linkend="locking-tables"/> and <xref linkend="xact-serializable"/>)
10398      </para></entry>
10399     </row>
10400
10401     <row>
10402      <entry role="catalog_table_entry"><para role="column_definition">
10403       <structfield>granted</structfield> <type>bool</type>
10404      </para>
10405      <para>
10406       True if lock is held, false if lock is awaited
10407      </para></entry>
10408     </row>
10409
10410     <row>
10411      <entry role="catalog_table_entry"><para role="column_definition">
10412       <structfield>fastpath</structfield> <type>bool</type>
10413      </para>
10414      <para>
10415       True if lock was taken via fast path, false if taken via main
10416       lock table
10417      </para></entry>
10418     </row>
10419    </tbody>
10420   </tgroup>
10421  </table>
10422
10423  <para>
10424   <structfield>granted</structfield> is true in a row representing a lock
10425   held by the indicated process.  False indicates that this process is
10426   currently waiting to acquire this lock, which implies that at least one
10427   other process is holding or waiting for a conflicting lock mode on the same
10428   lockable object.  The waiting process will sleep until the other lock is
10429   released (or a deadlock situation is detected).  A single process can be
10430   waiting to acquire at most one lock at a time.
10431  </para>
10432
10433  <para>
10434   Throughout running a transaction, a server process holds an exclusive lock
10435   on the transaction's virtual transaction ID.  If a permanent ID is assigned
10436   to the transaction (which normally happens only if the transaction changes
10437   the state of the database), it also holds an exclusive lock on the
10438   transaction's permanent transaction ID until it ends.  When a process finds
10439   it necessary to wait specifically for another transaction to end, it does
10440   so by attempting to acquire share lock on the other transaction's ID
10441   (either virtual or permanent ID depending on the situation). That will
10442   succeed only when the other transaction terminates and releases its locks.
10443  </para>
10444
10445  <para>
10446   Although tuples are a lockable type of object,
10447   information about row-level locks is stored on disk, not in memory,
10448   and therefore row-level locks normally do not appear in this view.
10449   If a process is waiting for a
10450   row-level lock, it will usually appear in the view as waiting for the
10451   permanent transaction ID of the current holder of that row lock.
10452  </para>
10453
10454  <para>
10455   Advisory locks can be acquired on keys consisting of either a single
10456   <type>bigint</type> value or two integer values.
10457   A <type>bigint</type> key is displayed with its
10458   high-order half in the <structfield>classid</structfield> column, its low-order half
10459   in the <structfield>objid</structfield> column, and <structfield>objsubid</structfield> equal
10460   to 1. The original <type>bigint</type> value can be reassembled with the
10461   expression <literal>(classid::bigint &lt;&lt; 32) |
10462   objid::bigint</literal>. Integer keys are displayed with the
10463   first key in the
10464   <structfield>classid</structfield> column, the second key in the <structfield>objid</structfield>
10465   column, and <structfield>objsubid</structfield> equal to 2.  The actual meaning of
10466   the keys is up to the user.  Advisory locks are local to each database,
10467   so the <structfield>database</structfield> column is meaningful for an advisory lock.
10468  </para>
10469
10470  <para>
10471   <structname>pg_locks</structname> provides a global view of all locks
10472   in the database cluster, not only those relevant to the current database.
10473   Although its <structfield>relation</structfield> column can be joined
10474   against <structname>pg_class</structname>.<structfield>oid</structfield> to identify locked
10475   relations, this will only work correctly for relations in the current
10476   database (those for which the <structfield>database</structfield> column
10477   is either the current database's OID or zero).
10478  </para>
10479
10480  <para>
10481   The <structfield>pid</structfield> column can be joined to the
10482   <structfield>pid</structfield> column of the
10483   <link linkend="monitoring-pg-stat-activity-view">
10484   <structname>pg_stat_activity</structname></link>
10485   view to get more
10486   information on the session holding or awaiting each lock,
10487   for example
10488<programlisting>
10489SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
10490    ON pl.pid = psa.pid;
10491</programlisting>
10492   Also, if you are using prepared transactions, the
10493   <structfield>virtualtransaction</structfield> column can be joined to the
10494   <structfield>transaction</structfield> column of the <link
10495   linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
10496   view to get more information on prepared transactions that hold locks.
10497   (A prepared transaction can never be waiting for a lock,
10498   but it continues to hold the locks it acquired while running.)
10499   For example:
10500<programlisting>
10501SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
10502    ON pl.virtualtransaction = '-1/' || ppx.transaction;
10503</programlisting>
10504  </para>
10505
10506  <para>
10507   While it is possible to obtain information about which processes block
10508   which other processes by joining <structname>pg_locks</structname> against
10509   itself, this is very difficult to get right in detail.  Such a query would
10510   have to encode knowledge about which lock modes conflict with which
10511   others.  Worse, the <structname>pg_locks</structname> view does not expose
10512   information about which processes are ahead of which others in lock wait
10513   queues, nor information about which processes are parallel workers running
10514   on behalf of which other client sessions.  It is better to use
10515   the <function>pg_blocking_pids()</function> function
10516   (see <xref linkend="functions-info-session-table"/>) to identify which
10517   process(es) a waiting process is blocked behind.
10518  </para>
10519
10520  <para>
10521   The <structname>pg_locks</structname> view displays data from both the
10522   regular lock manager and the predicate lock manager, which are
10523   separate systems; in addition, the regular lock manager subdivides its
10524   locks into regular and <firstterm>fast-path</firstterm> locks.
10525   This data is not guaranteed to be entirely consistent.
10526   When the view is queried,
10527   data on fast-path locks (with <structfield>fastpath</structfield> = <literal>true</literal>)
10528   is gathered from each backend one at a time, without freezing the state of
10529   the entire lock manager, so it is possible for locks to be taken or
10530   released while information is gathered.  Note, however, that these locks are
10531   known not to conflict with any other lock currently in place.  After
10532   all backends have been queried for fast-path locks, the remainder of the
10533   regular lock manager is locked as a unit, and a consistent snapshot of all
10534   remaining locks is collected as an atomic action.  After unlocking the
10535   regular lock manager, the predicate lock manager is similarly locked and all
10536   predicate locks are collected as an atomic action.  Thus, with the exception
10537   of fast-path locks, each lock manager will deliver a consistent set of
10538   results, but as we do not lock both lock managers simultaneously, it is
10539   possible for locks to be taken or released after we interrogate the regular
10540   lock manager and before we interrogate the predicate lock manager.
10541  </para>
10542
10543  <para>
10544   Locking the regular and/or predicate lock manager could have some
10545   impact on database performance if this view is very frequently accessed.
10546   The locks are held only for the minimum amount of time necessary to
10547   obtain data from the lock managers, but this does not completely eliminate
10548   the possibility of a performance impact.
10549  </para>
10550
10551 </sect1>
10552
10553 <sect1 id="view-pg-matviews">
10554  <title><structname>pg_matviews</structname></title>
10555
10556  <indexterm zone="view-pg-matviews">
10557   <primary>pg_matviews</primary>
10558  </indexterm>
10559
10560  <indexterm zone="view-pg-matviews">
10561   <primary>materialized views</primary>
10562  </indexterm>
10563
10564  <para>
10565   The view <structname>pg_matviews</structname> provides access to
10566   useful information about each materialized view in the database.
10567  </para>
10568
10569  <table>
10570   <title><structname>pg_matviews</structname> Columns</title>
10571   <tgroup cols="1">
10572    <thead>
10573     <row>
10574      <entry role="catalog_table_entry"><para role="column_definition">
10575       Column Type
10576      </para>
10577      <para>
10578       Description
10579      </para></entry>
10580     </row>
10581    </thead>
10582
10583    <tbody>
10584     <row>
10585      <entry role="catalog_table_entry"><para role="column_definition">
10586       <structfield>schemaname</structfield> <type>name</type>
10587       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
10588      </para>
10589      <para>
10590       Name of schema containing materialized view
10591      </para></entry>
10592     </row>
10593
10594     <row>
10595      <entry role="catalog_table_entry"><para role="column_definition">
10596       <structfield>matviewname</structfield> <type>name</type>
10597       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
10598      </para>
10599      <para>
10600       Name of materialized view
10601      </para></entry>
10602     </row>
10603
10604     <row>
10605      <entry role="catalog_table_entry"><para role="column_definition">
10606       <structfield>matviewowner</structfield> <type>name</type>
10607       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
10608      </para>
10609      <para>
10610       Name of materialized view's owner
10611      </para></entry>
10612     </row>
10613
10614     <row>
10615      <entry role="catalog_table_entry"><para role="column_definition">
10616       <structfield>tablespace</structfield> <type>name</type>
10617       (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
10618      </para>
10619      <para>
10620       Name of tablespace containing materialized view (null if default for database)
10621      </para></entry>
10622     </row>
10623
10624     <row>
10625      <entry role="catalog_table_entry"><para role="column_definition">
10626       <structfield>hasindexes</structfield> <type>bool</type>
10627      </para>
10628      <para>
10629       True if materialized view has (or recently had) any indexes
10630      </para></entry>
10631     </row>
10632
10633     <row>
10634      <entry role="catalog_table_entry"><para role="column_definition">
10635       <structfield>ispopulated</structfield> <type>bool</type>
10636      </para>
10637      <para>
10638       True if materialized view is currently populated
10639      </para></entry>
10640     </row>
10641
10642     <row>
10643      <entry role="catalog_table_entry"><para role="column_definition">
10644       <structfield>definition</structfield> <type>text</type>
10645      </para>
10646      <para>
10647       Materialized view definition (a reconstructed <command>SELECT</command> query)
10648      </para></entry>
10649     </row>
10650    </tbody>
10651   </tgroup>
10652  </table>
10653
10654 </sect1>
10655
10656 <sect1 id="view-pg-policies">
10657  <title><structname>pg_policies</structname></title>
10658
10659  <indexterm zone="view-pg-policies">
10660   <primary>pg_policies</primary>
10661  </indexterm>
10662
10663  <para>
10664   The view <structname>pg_policies</structname> provides access to
10665   useful information about each row-level security policy in the database.
10666  </para>
10667
10668  <table>
10669   <title><structname>pg_policies</structname> Columns</title>
10670   <tgroup cols="1">
10671    <thead>
10672     <row>
10673      <entry role="catalog_table_entry"><para role="column_definition">
10674       Column Type
10675      </para>
10676      <para>
10677       Description
10678      </para></entry>
10679     </row>
10680    </thead>
10681
10682    <tbody>
10683     <row>
10684      <entry role="catalog_table_entry"><para role="column_definition">
10685       <structfield>schemaname</structfield> <type>name</type>
10686       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
10687      </para>
10688      <para>
10689       Name of schema containing table policy is on
10690      </para></entry>
10691     </row>
10692
10693     <row>
10694      <entry role="catalog_table_entry"><para role="column_definition">
10695       <structfield>tablename</structfield> <type>name</type>
10696       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
10697      </para>
10698      <para>
10699       Name of table policy is on
10700      </para></entry>
10701     </row>
10702
10703     <row>
10704      <entry role="catalog_table_entry"><para role="column_definition">
10705       <structfield>policyname</structfield> <type>name</type>
10706       (references <link linkend="catalog-pg-policy"><structname>pg_policy</structname></link>.<structfield>polname</structfield>)
10707      </para>
10708      <para>
10709       Name of policy
10710      </para></entry>
10711     </row>
10712
10713     <row>
10714      <entry role="catalog_table_entry"><para role="column_definition">
10715       <structfield>permissive</structfield> <type>text</type>
10716      </para>
10717      <para>
10718       Is the policy permissive or restrictive?
10719      </para></entry>
10720     </row>
10721
10722     <row>
10723      <entry role="catalog_table_entry"><para role="column_definition">
10724       <structfield>roles</structfield> <type>name[]</type>
10725      </para>
10726      <para>
10727       The roles to which this policy applies
10728      </para></entry>
10729     </row>
10730
10731     <row>
10732      <entry role="catalog_table_entry"><para role="column_definition">
10733       <structfield>cmd</structfield> <type>text</type>
10734      </para>
10735      <para>
10736       The command type to which the policy is applied
10737      </para></entry>
10738     </row>
10739
10740     <row>
10741      <entry role="catalog_table_entry"><para role="column_definition">
10742       <structfield>qual</structfield> <type>text</type>
10743      </para>
10744      <para>
10745       The expression added to the security barrier qualifications for
10746       queries that this policy applies to
10747      </para></entry>
10748     </row>
10749
10750     <row>
10751      <entry role="catalog_table_entry"><para role="column_definition">
10752       <structfield>with_check</structfield> <type>text</type>
10753      </para>
10754      <para>
10755       The expression added to the WITH CHECK qualifications for
10756       queries that attempt to add rows to this table
10757      </para></entry>
10758     </row>
10759    </tbody>
10760   </tgroup>
10761  </table>
10762
10763 </sect1>
10764
10765 <sect1 id="view-pg-prepared-statements">
10766  <title><structname>pg_prepared_statements</structname></title>
10767
10768  <indexterm zone="view-pg-prepared-statements">
10769   <primary>pg_prepared_statements</primary>
10770  </indexterm>
10771
10772  <para>
10773   The <structname>pg_prepared_statements</structname> view displays
10774   all the prepared statements that are available in the current
10775   session. See <xref linkend="sql-prepare"/> for more information about prepared
10776   statements.
10777  </para>
10778
10779  <para>
10780   <structname>pg_prepared_statements</structname> contains one row
10781   for each prepared statement. Rows are added to the view when a new
10782   prepared statement is created and removed when a prepared statement
10783   is released (for example, via the <xref linkend="sql-deallocate"/> command).
10784  </para>
10785
10786  <table>
10787   <title><structname>pg_prepared_statements</structname> Columns</title>
10788   <tgroup cols="1">
10789    <thead>
10790     <row>
10791      <entry role="catalog_table_entry"><para role="column_definition">
10792       Column Type
10793      </para>
10794      <para>
10795       Description
10796      </para></entry>
10797     </row>
10798    </thead>
10799
10800    <tbody>
10801     <row>
10802      <entry role="catalog_table_entry"><para role="column_definition">
10803       <structfield>name</structfield> <type>text</type>
10804      </para>
10805      <para>
10806       The identifier of the prepared statement
10807      </para></entry>
10808     </row>
10809
10810     <row>
10811      <entry role="catalog_table_entry"><para role="column_definition">
10812       <structfield>statement</structfield> <type>text</type>
10813      </para>
10814      <para>
10815       The query string submitted by the client to create this
10816       prepared statement. For prepared statements created via SQL,
10817       this is the <command>PREPARE</command> statement submitted by
10818       the client. For prepared statements created via the
10819       frontend/backend protocol, this is the text of the prepared
10820       statement itself.
10821      </para></entry>
10822     </row>
10823
10824     <row>
10825      <entry role="catalog_table_entry"><para role="column_definition">
10826       <structfield>prepare_time</structfield> <type>timestamptz</type>
10827      </para>
10828      <para>
10829       The time at which the prepared statement was created
10830      </para></entry>
10831     </row>
10832
10833     <row>
10834      <entry role="catalog_table_entry"><para role="column_definition">
10835       <structfield>parameter_types</structfield> <type>regtype[]</type>
10836      </para>
10837      <para>
10838       The expected parameter types for the prepared statement in the
10839       form of an array of <type>regtype</type>. The OID corresponding
10840       to an element of this array can be obtained by casting the
10841       <type>regtype</type> value to <type>oid</type>.
10842      </para></entry>
10843     </row>
10844
10845     <row>
10846      <entry role="catalog_table_entry"><para role="column_definition">
10847       <structfield>from_sql</structfield> <type>bool</type>
10848      </para>
10849      <para>
10850       <literal>true</literal> if the prepared statement was created
10851       via the <command>PREPARE</command> SQL command;
10852       <literal>false</literal> if the statement was prepared via the
10853       frontend/backend protocol
10854      </para></entry>
10855     </row>
10856    </tbody>
10857   </tgroup>
10858  </table>
10859
10860  <para>
10861   The <structname>pg_prepared_statements</structname> view is read only.
10862  </para>
10863 </sect1>
10864
10865 <sect1 id="view-pg-prepared-xacts">
10866  <title><structname>pg_prepared_xacts</structname></title>
10867
10868  <indexterm zone="view-pg-prepared-xacts">
10869   <primary>pg_prepared_xacts</primary>
10870  </indexterm>
10871
10872  <para>
10873   The view <structname>pg_prepared_xacts</structname> displays
10874   information about transactions that are currently prepared for two-phase
10875   commit (see <xref linkend="sql-prepare-transaction"/> for details).
10876  </para>
10877
10878  <para>
10879   <structname>pg_prepared_xacts</structname> contains one row per prepared
10880   transaction.  An entry is removed when the transaction is committed or
10881   rolled back.
10882  </para>
10883
10884  <table>
10885   <title><structname>pg_prepared_xacts</structname> Columns</title>
10886   <tgroup cols="1">
10887    <thead>
10888     <row>
10889      <entry role="catalog_table_entry"><para role="column_definition">
10890       Column Type
10891      </para>
10892      <para>
10893       Description
10894      </para></entry>
10895     </row>
10896    </thead>
10897
10898    <tbody>
10899     <row>
10900      <entry role="catalog_table_entry"><para role="column_definition">
10901       <structfield>transaction</structfield> <type>xid</type>
10902      </para>
10903      <para>
10904       Numeric transaction identifier of the prepared transaction
10905      </para></entry>
10906     </row>
10907
10908     <row>
10909      <entry role="catalog_table_entry"><para role="column_definition">
10910       <structfield>gid</structfield> <type>text</type>
10911      </para>
10912      <para>
10913       Global transaction identifier that was assigned to the transaction
10914      </para></entry>
10915     </row>
10916
10917     <row>
10918      <entry role="catalog_table_entry"><para role="column_definition">
10919       <structfield>prepared</structfield> <type>timestamptz</type>
10920      </para>
10921      <para>
10922       Time at which the transaction was prepared for commit
10923      </para></entry>
10924     </row>
10925
10926     <row>
10927      <entry role="catalog_table_entry"><para role="column_definition">
10928       <structfield>owner</structfield> <type>name</type>
10929       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
10930      </para>
10931      <para>
10932       Name of the user that executed the transaction
10933      </para></entry>
10934     </row>
10935
10936     <row>
10937      <entry role="catalog_table_entry"><para role="column_definition">
10938       <structfield>database</structfield> <type>name</type>
10939       (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>datname</structfield>)
10940      </para>
10941      <para>
10942       Name of the database in which the transaction was executed
10943      </para></entry>
10944     </row>
10945    </tbody>
10946   </tgroup>
10947  </table>
10948
10949  <para>
10950   When the <structname>pg_prepared_xacts</structname> view is accessed, the
10951   internal transaction manager data structures are momentarily locked, and
10952   a copy is made for the view to display.  This ensures that the
10953   view produces a consistent set of results, while not blocking
10954   normal operations longer than necessary.  Nonetheless
10955   there could be some impact on database performance if this view is
10956   frequently accessed.
10957  </para>
10958
10959 </sect1>
10960
10961 <sect1 id="view-pg-publication-tables">
10962  <title><structname>pg_publication_tables</structname></title>
10963
10964  <indexterm zone="view-pg-publication-tables">
10965   <primary>pg_publication_tables</primary>
10966  </indexterm>
10967
10968  <para>
10969   The view <structname>pg_publication_tables</structname> provides
10970   information about the mapping between publications and the tables they
10971   contain.  Unlike the underlying
10972   catalog <structname>pg_publication_rel</structname>, this view expands
10973   publications defined as <literal>FOR ALL TABLES</literal>, so for such
10974   publications there will be a row for each eligible table.
10975  </para>
10976
10977  <table>
10978   <title><structname>pg_publication_tables</structname> Columns</title>
10979   <tgroup cols="1">
10980    <thead>
10981     <row>
10982      <entry role="catalog_table_entry"><para role="column_definition">
10983       Column Type
10984      </para>
10985      <para>
10986       Description
10987      </para></entry>
10988     </row>
10989    </thead>
10990
10991    <tbody>
10992     <row>
10993      <entry role="catalog_table_entry"><para role="column_definition">
10994       <structfield>pubname</structfield> <type>name</type>
10995       (references <link linkend="catalog-pg-publication"><structname>pg_publication</structname></link>.<structfield>pubname</structfield>)
10996      </para>
10997      <para>
10998       Name of publication
10999      </para></entry>
11000     </row>
11001
11002     <row>
11003      <entry role="catalog_table_entry"><para role="column_definition">
11004       <structfield>schemaname</structfield> <type>name</type>
11005       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
11006      </para>
11007      <para>
11008       Name of schema containing table
11009      </para></entry>
11010     </row>
11011
11012     <row>
11013      <entry role="catalog_table_entry"><para role="column_definition">
11014       <structfield>tablename</structfield> <type>name</type>
11015       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
11016      </para>
11017      <para>
11018       Name of table
11019      </para></entry>
11020     </row>
11021    </tbody>
11022   </tgroup>
11023  </table>
11024 </sect1>
11025
11026  <sect1 id="view-pg-replication-origin-status">
11027  <title><structname>pg_replication_origin_status</structname></title>
11028
11029  <indexterm zone="view-pg-replication-origin-status">
11030   <primary>pg_replication_origin_status</primary>
11031  </indexterm>
11032
11033  <para>
11034   The <structname>pg_replication_origin_status</structname> view
11035   contains information about how far replay for a certain origin has
11036   progressed.  For more on replication origins
11037   see <xref linkend="replication-origins"/>.
11038  </para>
11039
11040  <table>
11041   <title><structname>pg_replication_origin_status</structname> Columns</title>
11042   <tgroup cols="1">
11043    <thead>
11044     <row>
11045      <entry role="catalog_table_entry"><para role="column_definition">
11046       Column Type
11047      </para>
11048      <para>
11049       Description
11050      </para></entry>
11051     </row>
11052    </thead>
11053
11054    <tbody>
11055     <row>
11056      <entry role="catalog_table_entry"><para role="column_definition">
11057       <structfield>local_id</structfield> <type>oid</type>
11058       (references <link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.<structfield>roident</structfield>)
11059      </para>
11060      <para>
11061       internal node identifier
11062      </para></entry>
11063     </row>
11064
11065     <row>
11066      <entry role="catalog_table_entry"><para role="column_definition">
11067       <structfield>external_id</structfield> <type>text</type>
11068       (references <link linkend="catalog-pg-replication-origin"><structname>pg_replication_origin</structname></link>.<structfield>roname</structfield>)
11069      </para>
11070      <para>
11071       external node identifier
11072      </para></entry>
11073     </row>
11074
11075     <row>
11076      <entry role="catalog_table_entry"><para role="column_definition">
11077       <structfield>remote_lsn</structfield> <type>pg_lsn</type>
11078      </para>
11079      <para>
11080       The origin node's LSN up to which data has been replicated.
11081      </para></entry>
11082     </row>
11083
11084     <row>
11085      <entry role="catalog_table_entry"><para role="column_definition">
11086       <structfield>local_lsn</structfield> <type>pg_lsn</type>
11087      </para>
11088      <para>
11089       This node's LSN at which <literal>remote_lsn</literal> has
11090       been replicated. Used to flush commit records before persisting
11091       data to disk when using asynchronous commits.
11092      </para></entry>
11093     </row>
11094    </tbody>
11095   </tgroup>
11096  </table>
11097 </sect1>
11098
11099 <sect1 id="view-pg-replication-slots">
11100  <title><structname>pg_replication_slots</structname></title>
11101
11102  <indexterm zone="view-pg-replication-slots">
11103   <primary>pg_replication_slots</primary>
11104  </indexterm>
11105
11106  <para>
11107   The <structname>pg_replication_slots</structname> view provides a listing
11108   of all replication slots that currently exist on the database cluster,
11109   along with their current state.
11110  </para>
11111
11112  <para>
11113   For more on replication slots,
11114   see <xref linkend="streaming-replication-slots"/> and <xref linkend="logicaldecoding"/>.
11115  </para>
11116
11117  <table>
11118   <title><structname>pg_replication_slots</structname> Columns</title>
11119   <tgroup cols="1">
11120    <thead>
11121     <row>
11122      <entry role="catalog_table_entry"><para role="column_definition">
11123       Column Type
11124      </para>
11125      <para>
11126       Description
11127      </para></entry>
11128     </row>
11129    </thead>
11130
11131    <tbody>
11132     <row>
11133      <entry role="catalog_table_entry"><para role="column_definition">
11134       <structfield>slot_name</structfield> <type>name</type>
11135      </para>
11136      <para>
11137       A unique, cluster-wide identifier for the replication slot
11138      </para></entry>
11139     </row>
11140
11141     <row>
11142      <entry role="catalog_table_entry"><para role="column_definition">
11143       <structfield>plugin</structfield> <type>name</type>
11144      </para>
11145      <para>
11146       The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.
11147      </para></entry>
11148     </row>
11149
11150     <row>
11151      <entry role="catalog_table_entry"><para role="column_definition">
11152       <structfield>slot_type</structfield> <type>text</type>
11153      </para>
11154      <para>
11155       The slot type: <literal>physical</literal> or <literal>logical</literal>
11156      </para></entry>
11157     </row>
11158
11159     <row>
11160      <entry role="catalog_table_entry"><para role="column_definition">
11161       <structfield>datoid</structfield> <type>oid</type>
11162       (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
11163      </para>
11164      <para>
11165       The OID of the database this slot is associated with, or
11166       null. Only logical slots have an associated database.
11167      </para></entry>
11168     </row>
11169
11170     <row>
11171      <entry role="catalog_table_entry"><para role="column_definition">
11172       <structfield>database</structfield> <type>name</type>
11173       (references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>datname</structfield>)
11174      </para>
11175      <para>
11176       The name of the database this slot is associated with, or
11177       null. Only logical slots have an associated database.
11178      </para></entry>
11179     </row>
11180
11181     <row>
11182      <entry role="catalog_table_entry"><para role="column_definition">
11183       <structfield>temporary</structfield> <type>bool</type>
11184      </para>
11185      <para>
11186       True if this is a temporary replication slot. Temporary slots are
11187       not saved to disk and are automatically dropped on error or when
11188       the session has finished.
11189      </para></entry>
11190     </row>
11191
11192     <row>
11193      <entry role="catalog_table_entry"><para role="column_definition">
11194       <structfield>active</structfield> <type>bool</type>
11195      </para>
11196      <para>
11197       True if this slot is currently actively being used
11198      </para></entry>
11199     </row>
11200
11201     <row>
11202      <entry role="catalog_table_entry"><para role="column_definition">
11203       <structfield>active_pid</structfield> <type>int4</type>
11204      </para>
11205      <para>
11206       The process ID of the session using this slot if the slot
11207       is currently actively being used. <literal>NULL</literal> if
11208       inactive.
11209      </para></entry>
11210     </row>
11211
11212     <row>
11213      <entry role="catalog_table_entry"><para role="column_definition">
11214       <structfield>xmin</structfield> <type>xid</type>
11215      </para>
11216      <para>
11217       The oldest transaction that this slot needs the database to
11218       retain.  <literal>VACUUM</literal> cannot remove tuples deleted
11219       by any later transaction.
11220      </para></entry>
11221     </row>
11222
11223     <row>
11224      <entry role="catalog_table_entry"><para role="column_definition">
11225       <structfield>catalog_xmin</structfield> <type>xid</type>
11226      </para>
11227      <para>
11228       The oldest transaction affecting the system catalogs that this
11229       slot needs the database to retain.  <literal>VACUUM</literal> cannot
11230       remove catalog tuples deleted by any later transaction.
11231      </para></entry>
11232     </row>
11233
11234     <row>
11235      <entry role="catalog_table_entry"><para role="column_definition">
11236       <structfield>restart_lsn</structfield> <type>pg_lsn</type>
11237      </para>
11238      <para>
11239       The address (<literal>LSN</literal>) of oldest WAL which still
11240       might be required by the consumer of this slot and thus won't be
11241       automatically removed during checkpoints unless this LSN
11242       gets behind more than <xref linkend="guc-max-slot-wal-keep-size"/>
11243       from the current LSN.  <literal>NULL</literal>
11244       if the <literal>LSN</literal> of this slot has never been reserved.
11245      </para></entry>
11246     </row>
11247
11248     <row>
11249      <entry role="catalog_table_entry"><para role="column_definition">
11250       <structfield>confirmed_flush_lsn</structfield> <type>pg_lsn</type>
11251      </para>
11252      <para>
11253       The address (<literal>LSN</literal>) up to which the logical
11254       slot's consumer has confirmed receiving data. Data older than this is
11255       not available anymore. <literal>NULL</literal> for physical slots.
11256      </para></entry>
11257     </row>
11258
11259     <row>
11260      <entry role="catalog_table_entry"><para role="column_definition">
11261       <structfield>wal_status</structfield> <type>text</type>
11262      </para>
11263      <para>
11264       Availability of WAL files claimed by this slot.
11265       Possible values are:
11266       <itemizedlist>
11267        <listitem>
11268         <para><literal>reserved</literal> means that the claimed files
11269          are within <varname>max_wal_size</varname>.</para>
11270        </listitem>
11271        <listitem>
11272         <para><literal>extended</literal> means
11273          that <varname>max_wal_size</varname> is exceeded but the files are
11274          still retained, either by the replication slot or
11275          by <varname>wal_keep_size</varname>.
11276         </para>
11277        </listitem>
11278        <listitem>
11279         <para>
11280          <literal>unreserved</literal> means that the slot no longer
11281          retains the required WAL files and some of them are to be removed at
11282          the next checkpoint.  This state can return
11283          to <literal>reserved</literal> or <literal>extended</literal>.
11284         </para>
11285        </listitem>
11286        <listitem>
11287         <para>
11288          <literal>lost</literal> means that some required WAL files have
11289          been removed and this slot is no longer usable.
11290         </para>
11291        </listitem>
11292       </itemizedlist>
11293       The last two states are seen only when
11294       <xref linkend="guc-max-slot-wal-keep-size"/> is
11295       non-negative. If <structfield>restart_lsn</structfield> is NULL, this
11296       field is null.
11297      </para></entry>
11298     </row>
11299
11300     <row>
11301      <entry role="catalog_table_entry"><para role="column_definition">
11302       <structfield>safe_wal_size</structfield> <type>int8</type>
11303      </para>
11304      <para>
11305       The number of bytes that can be written to WAL such that this slot
11306       is not in danger of getting in state "lost".  It is NULL for lost
11307       slots, as well as if <varname>max_slot_wal_keep_size</varname>
11308       is <literal>-1</literal>.
11309      </para></entry>
11310     </row>
11311    </tbody>
11312   </tgroup>
11313  </table>
11314 </sect1>
11315
11316 <sect1 id="view-pg-roles">
11317  <title><structname>pg_roles</structname></title>
11318
11319  <indexterm zone="view-pg-roles">
11320   <primary>pg_roles</primary>
11321  </indexterm>
11322
11323  <para>
11324   The view <structname>pg_roles</structname> provides access to
11325   information about database roles.  This is simply a publicly
11326   readable view of
11327   <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
11328   that blanks out the password field.
11329  </para>
11330
11331  <table>
11332   <title><structname>pg_roles</structname> Columns</title>
11333   <tgroup cols="1">
11334    <thead>
11335     <row>
11336      <entry role="catalog_table_entry"><para role="column_definition">
11337       Column Type
11338      </para>
11339      <para>
11340       Description
11341      </para></entry>
11342     </row>
11343    </thead>
11344
11345    <tbody>
11346     <row>
11347      <entry role="catalog_table_entry"><para role="column_definition">
11348       <structfield>rolname</structfield> <type>name</type>
11349      </para>
11350      <para>
11351       Role name
11352      </para></entry>
11353     </row>
11354
11355     <row>
11356      <entry role="catalog_table_entry"><para role="column_definition">
11357       <structfield>rolsuper</structfield> <type>bool</type>
11358      </para>
11359      <para>
11360       Role has superuser privileges
11361      </para></entry>
11362     </row>
11363
11364     <row>
11365      <entry role="catalog_table_entry"><para role="column_definition">
11366       <structfield>rolinherit</structfield> <type>bool</type>
11367      </para>
11368      <para>
11369       Role automatically inherits privileges of roles it is a
11370       member of
11371      </para></entry>
11372     </row>
11373
11374     <row>
11375      <entry role="catalog_table_entry"><para role="column_definition">
11376       <structfield>rolcreaterole</structfield> <type>bool</type>
11377      </para>
11378      <para>
11379       Role can create more roles
11380      </para></entry>
11381     </row>
11382
11383     <row>
11384      <entry role="catalog_table_entry"><para role="column_definition">
11385       <structfield>rolcreatedb</structfield> <type>bool</type>
11386      </para>
11387      <para>
11388       Role can create databases
11389      </para></entry>
11390     </row>
11391
11392     <row>
11393      <entry role="catalog_table_entry"><para role="column_definition">
11394       <structfield>rolcanlogin</structfield> <type>bool</type>
11395      </para>
11396      <para>
11397       Role can log in. That is, this role can be given as the initial
11398       session authorization identifier
11399      </para></entry>
11400     </row>
11401
11402     <row>
11403      <entry role="catalog_table_entry"><para role="column_definition">
11404       <structfield>rolreplication</structfield> <type>bool</type>
11405      </para>
11406      <para>
11407       Role is a replication role. A replication role can initiate replication
11408       connections and create and drop replication slots.
11409      </para></entry>
11410     </row>
11411
11412     <row>
11413      <entry role="catalog_table_entry"><para role="column_definition">
11414       <structfield>rolconnlimit</structfield> <type>int4</type>
11415      </para>
11416      <para>
11417       For roles that can log in, this sets maximum number of concurrent
11418       connections this role can make.  -1 means no limit.
11419      </para></entry>
11420     </row>
11421
11422     <row>
11423      <entry role="catalog_table_entry"><para role="column_definition">
11424       <structfield>rolpassword</structfield> <type>text</type>
11425      </para>
11426      <para>
11427       Not the password (always reads as <literal>********</literal>)
11428      </para></entry>
11429     </row>
11430
11431     <row>
11432      <entry role="catalog_table_entry"><para role="column_definition">
11433       <structfield>rolvaliduntil</structfield> <type>timestamptz</type>
11434      </para>
11435      <para>
11436       Password expiry time (only used for password authentication);
11437       null if no expiration
11438      </para></entry>
11439     </row>
11440
11441     <row>
11442      <entry role="catalog_table_entry"><para role="column_definition">
11443       <structfield>rolbypassrls</structfield> <type>bool</type>
11444      </para>
11445      <para>
11446       Role bypasses every row level security policy, see
11447       <xref linkend="ddl-rowsecurity"/> for more information.
11448      </para></entry>
11449     </row>
11450
11451     <row>
11452      <entry role="catalog_table_entry"><para role="column_definition">
11453       <structfield>rolconfig</structfield> <type>text[]</type>
11454      </para>
11455      <para>
11456       Role-specific defaults for run-time configuration variables
11457      </para></entry>
11458     </row>
11459
11460     <row>
11461      <entry role="catalog_table_entry"><para role="column_definition">
11462       <structfield>oid</structfield> <type>oid</type>
11463       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
11464      </para>
11465      <para>
11466       ID of role
11467      </para></entry>
11468     </row>
11469    </tbody>
11470   </tgroup>
11471  </table>
11472
11473 </sect1>
11474
11475 <sect1 id="view-pg-rules">
11476  <title><structname>pg_rules</structname></title>
11477
11478  <indexterm zone="view-pg-rules">
11479   <primary>pg_rules</primary>
11480  </indexterm>
11481
11482  <para>
11483   The view <structname>pg_rules</structname> provides access to
11484   useful information about query rewrite rules.
11485  </para>
11486
11487  <table>
11488   <title><structname>pg_rules</structname> Columns</title>
11489   <tgroup cols="1">
11490    <thead>
11491     <row>
11492      <entry role="catalog_table_entry"><para role="column_definition">
11493       Column Type
11494      </para>
11495      <para>
11496       Description
11497      </para></entry>
11498     </row>
11499    </thead>
11500
11501    <tbody>
11502     <row>
11503      <entry role="catalog_table_entry"><para role="column_definition">
11504       <structfield>schemaname</structfield> <type>name</type>
11505       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
11506      </para>
11507      <para>
11508       Name of schema containing table
11509      </para></entry>
11510     </row>
11511
11512     <row>
11513      <entry role="catalog_table_entry"><para role="column_definition">
11514       <structfield>tablename</structfield> <type>name</type>
11515       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
11516      </para>
11517      <para>
11518       Name of table the rule is for
11519      </para></entry>
11520     </row>
11521
11522     <row>
11523      <entry role="catalog_table_entry"><para role="column_definition">
11524       <structfield>rulename</structfield> <type>name</type>
11525       (references <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.<structfield>rulename</structfield>)
11526      </para>
11527      <para>
11528       Name of rule
11529      </para></entry>
11530     </row>
11531
11532     <row>
11533      <entry role="catalog_table_entry"><para role="column_definition">
11534       <structfield>definition</structfield> <type>text</type>
11535      </para>
11536      <para>
11537       Rule definition (a reconstructed creation command)
11538      </para></entry>
11539     </row>
11540    </tbody>
11541   </tgroup>
11542  </table>
11543
11544  <para>
11545   The <structname>pg_rules</structname> view excludes the <literal>ON SELECT</literal> rules
11546   of views and materialized views; those can be seen in
11547   <structname>pg_views</structname> and <structname>pg_matviews</structname>.
11548  </para>
11549
11550 </sect1>
11551
11552 <sect1 id="view-pg-seclabels">
11553  <title><structname>pg_seclabels</structname></title>
11554
11555  <indexterm zone="view-pg-seclabels">
11556   <primary>pg_seclabels</primary>
11557  </indexterm>
11558
11559  <para>
11560   The view <structname>pg_seclabels</structname> provides information about
11561   security labels.  It as an easier-to-query version of the
11562   <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link> catalog.
11563  </para>
11564
11565  <table>
11566   <title><structname>pg_seclabels</structname> Columns</title>
11567   <tgroup cols="1">
11568    <thead>
11569     <row>
11570      <entry role="catalog_table_entry"><para role="column_definition">
11571       Column Type
11572      </para>
11573      <para>
11574       Description
11575      </para></entry>
11576     </row>
11577    </thead>
11578
11579    <tbody>
11580     <row>
11581      <entry role="catalog_table_entry"><para role="column_definition">
11582       <structfield>objoid</structfield> <type>oid</type>
11583       (references any OID column)
11584      </para>
11585      <para>
11586       The OID of the object this security label pertains to
11587      </para></entry>
11588     </row>
11589
11590     <row>
11591      <entry role="catalog_table_entry"><para role="column_definition">
11592       <structfield>classoid</structfield> <type>oid</type>
11593       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
11594      </para>
11595      <para>
11596       The OID of the system catalog this object appears in
11597      </para></entry>
11598     </row>
11599
11600     <row>
11601      <entry role="catalog_table_entry"><para role="column_definition">
11602       <structfield>objsubid</structfield> <type>int4</type>
11603      </para>
11604      <para>
11605       For a security label on a table column, this is the column number (the
11606       <structfield>objoid</structfield> and <structfield>classoid</structfield> refer to
11607       the table itself).  For all other object types, this column is
11608       zero.
11609      </para></entry>
11610     </row>
11611
11612     <row>
11613      <entry role="catalog_table_entry"><para role="column_definition">
11614       <structfield>objtype</structfield> <type>text</type>
11615      </para>
11616      <para>
11617       The type of object to which this label applies, as text.
11618      </para></entry>
11619     </row>
11620
11621     <row>
11622      <entry role="catalog_table_entry"><para role="column_definition">
11623       <structfield>objnamespace</structfield> <type>oid</type>
11624       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
11625      </para>
11626      <para>
11627       The OID of the namespace for this object, if applicable;
11628       otherwise NULL.
11629      </para></entry>
11630     </row>
11631
11632     <row>
11633      <entry role="catalog_table_entry"><para role="column_definition">
11634       <structfield>objname</structfield> <type>text</type>
11635      </para>
11636      <para>
11637       The name of the object to which this label applies, as text.
11638      </para></entry>
11639     </row>
11640
11641     <row>
11642      <entry role="catalog_table_entry"><para role="column_definition">
11643       <structfield>provider</structfield> <type>text</type>
11644       (references <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.<structfield>provider</structfield>)
11645      </para>
11646      <para>
11647       The label provider associated with this label.
11648      </para></entry>
11649     </row>
11650
11651     <row>
11652      <entry role="catalog_table_entry"><para role="column_definition">
11653       <structfield>label</structfield> <type>text</type>
11654       (references <link linkend="catalog-pg-seclabel"><structname>pg_seclabel</structname></link>.<structfield>label</structfield>)
11655      </para>
11656      <para>
11657       The security label applied to this object.
11658      </para></entry>
11659     </row>
11660    </tbody>
11661   </tgroup>
11662  </table>
11663 </sect1>
11664
11665 <sect1 id="view-pg-sequences">
11666  <title><structname>pg_sequences</structname></title>
11667
11668  <indexterm zone="view-pg-sequences">
11669   <primary>pg_sequences</primary>
11670  </indexterm>
11671
11672  <para>
11673   The view <structname>pg_sequences</structname> provides access to
11674   useful information about each sequence in the database.
11675  </para>
11676
11677  <table>
11678   <title><structname>pg_sequences</structname> Columns</title>
11679   <tgroup cols="1">
11680    <thead>
11681     <row>
11682      <entry role="catalog_table_entry"><para role="column_definition">
11683       Column Type
11684      </para>
11685      <para>
11686       Description
11687      </para></entry>
11688     </row>
11689    </thead>
11690
11691    <tbody>
11692     <row>
11693      <entry role="catalog_table_entry"><para role="column_definition">
11694       <structfield>schemaname</structfield> <type>name</type>
11695       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
11696      </para>
11697      <para>
11698       Name of schema containing sequence
11699      </para></entry>
11700     </row>
11701
11702     <row>
11703      <entry role="catalog_table_entry"><para role="column_definition">
11704       <structfield>sequencename</structfield> <type>name</type>
11705       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
11706      </para>
11707      <para>
11708       Name of sequence
11709      </para></entry>
11710     </row>
11711
11712     <row>
11713      <entry role="catalog_table_entry"><para role="column_definition">
11714       <structfield>sequenceowner</structfield> <type>name</type>
11715       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
11716      </para>
11717      <para>
11718       Name of sequence's owner
11719      </para></entry>
11720     </row>
11721
11722     <row>
11723      <entry role="catalog_table_entry"><para role="column_definition">
11724       <structfield>data_type</structfield> <type>regtype</type>
11725       (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>)
11726      </para>
11727      <para>
11728       Data type of the sequence
11729      </para></entry>
11730     </row>
11731
11732     <row>
11733      <entry role="catalog_table_entry"><para role="column_definition">
11734       <structfield>start_value</structfield> <type>int8</type>
11735      </para>
11736      <para>
11737       Start value of the sequence
11738      </para></entry>
11739     </row>
11740
11741     <row>
11742      <entry role="catalog_table_entry"><para role="column_definition">
11743       <structfield>min_value</structfield> <type>int8</type>
11744      </para>
11745      <para>
11746       Minimum value of the sequence
11747      </para></entry>
11748     </row>
11749
11750     <row>
11751      <entry role="catalog_table_entry"><para role="column_definition">
11752       <structfield>max_value</structfield> <type>int8</type>
11753      </para>
11754      <para>
11755       Maximum value of the sequence
11756      </para></entry>
11757     </row>
11758
11759     <row>
11760      <entry role="catalog_table_entry"><para role="column_definition">
11761       <structfield>increment_by</structfield> <type>int8</type>
11762      </para>
11763      <para>
11764       Increment value of the sequence
11765      </para></entry>
11766     </row>
11767
11768     <row>
11769      <entry role="catalog_table_entry"><para role="column_definition">
11770       <structfield>cycle</structfield> <type>bool</type>
11771      </para>
11772      <para>
11773       Whether the sequence cycles
11774      </para></entry>
11775     </row>
11776
11777     <row>
11778      <entry role="catalog_table_entry"><para role="column_definition">
11779       <structfield>cache_size</structfield> <type>int8</type>
11780      </para>
11781      <para>
11782       Cache size of the sequence
11783      </para></entry>
11784     </row>
11785
11786     <row>
11787      <entry role="catalog_table_entry"><para role="column_definition">
11788       <structfield>last_value</structfield> <type>int8</type>
11789      </para>
11790      <para>
11791       The last sequence value written to disk.  If caching is used,
11792       this value can be greater than the last value handed out from the
11793       sequence.  Null if the sequence has not been read from yet.  Also, if
11794       the current user does not have <literal>USAGE</literal>
11795       or <literal>SELECT</literal> privilege on the sequence, the value is
11796       null.
11797      </para></entry>
11798     </row>
11799    </tbody>
11800   </tgroup>
11801  </table>
11802 </sect1>
11803
11804 <sect1 id="view-pg-settings">
11805  <title><structname>pg_settings</structname></title>
11806
11807  <indexterm zone="view-pg-settings">
11808   <primary>pg_settings</primary>
11809  </indexterm>
11810
11811  <para>
11812   The view <structname>pg_settings</structname> provides access to
11813   run-time parameters of the server.  It is essentially an alternative
11814   interface to the <xref linkend="sql-show"/>
11815   and <xref linkend="sql-set"/> commands.
11816   It also provides access to some facts about each parameter that are
11817   not directly available from <command>SHOW</command>, such as minimum and
11818   maximum values.
11819  </para>
11820
11821  <table>
11822   <title><structname>pg_settings</structname> Columns</title>
11823   <tgroup cols="1">
11824    <thead>
11825     <row>
11826      <entry role="catalog_table_entry"><para role="column_definition">
11827       Column Type
11828      </para>
11829      <para>
11830       Description
11831      </para></entry>
11832     </row>
11833    </thead>
11834
11835    <tbody>
11836     <row>
11837      <entry role="catalog_table_entry"><para role="column_definition">
11838       <structfield>name</structfield> <type>text</type>
11839      </para>
11840      <para>
11841       Run-time configuration parameter name
11842      </para></entry>
11843     </row>
11844
11845     <row>
11846      <entry role="catalog_table_entry"><para role="column_definition">
11847       <structfield>setting</structfield> <type>text</type>
11848      </para>
11849      <para>
11850       Current value of the parameter
11851      </para></entry>
11852     </row>
11853
11854     <row>
11855      <entry role="catalog_table_entry"><para role="column_definition">
11856       <structfield>unit</structfield> <type>text</type>
11857      </para>
11858      <para>
11859       Implicit unit of the parameter
11860      </para></entry>
11861     </row>
11862
11863     <row>
11864      <entry role="catalog_table_entry"><para role="column_definition">
11865       <structfield>category</structfield> <type>text</type>
11866      </para>
11867      <para>
11868       Logical group of the parameter
11869      </para></entry>
11870     </row>
11871
11872     <row>
11873      <entry role="catalog_table_entry"><para role="column_definition">
11874       <structfield>short_desc</structfield> <type>text</type>
11875      </para>
11876      <para>
11877       A brief description of the parameter
11878      </para></entry>
11879     </row>
11880
11881     <row>
11882      <entry role="catalog_table_entry"><para role="column_definition">
11883       <structfield>extra_desc</structfield> <type>text</type>
11884      </para>
11885      <para>
11886       Additional, more detailed, description of the parameter
11887      </para></entry>
11888     </row>
11889
11890     <row>
11891      <entry role="catalog_table_entry"><para role="column_definition">
11892       <structfield>context</structfield> <type>text</type>
11893      </para>
11894      <para>
11895       Context required to set the parameter's value (see below)
11896      </para></entry>
11897     </row>
11898
11899     <row>
11900      <entry role="catalog_table_entry"><para role="column_definition">
11901       <structfield>vartype</structfield> <type>text</type>
11902      </para>
11903      <para>
11904       Parameter type (<literal>bool</literal>, <literal>enum</literal>,
11905       <literal>integer</literal>, <literal>real</literal>, or <literal>string</literal>)
11906      </para></entry>
11907     </row>
11908
11909     <row>
11910      <entry role="catalog_table_entry"><para role="column_definition">
11911       <structfield>source</structfield> <type>text</type>
11912      </para>
11913      <para>
11914       Source of the current parameter value
11915      </para></entry>
11916     </row>
11917
11918     <row>
11919      <entry role="catalog_table_entry"><para role="column_definition">
11920       <structfield>min_val</structfield> <type>text</type>
11921      </para>
11922      <para>
11923       Minimum allowed value of the parameter (null for non-numeric
11924       values)
11925      </para></entry>
11926     </row>
11927
11928     <row>
11929      <entry role="catalog_table_entry"><para role="column_definition">
11930       <structfield>max_val</structfield> <type>text</type>
11931      </para>
11932      <para>
11933       Maximum allowed value of the parameter (null for non-numeric
11934       values)
11935      </para></entry>
11936     </row>
11937
11938     <row>
11939      <entry role="catalog_table_entry"><para role="column_definition">
11940       <structfield>enumvals</structfield> <type>text[]</type>
11941      </para>
11942      <para>
11943       Allowed values of an enum parameter (null for non-enum
11944       values)
11945      </para></entry>
11946     </row>
11947
11948     <row>
11949      <entry role="catalog_table_entry"><para role="column_definition">
11950       <structfield>boot_val</structfield> <type>text</type>
11951      </para>
11952      <para>
11953       Parameter value assumed at server startup if the parameter is
11954       not otherwise set
11955      </para></entry>
11956     </row>
11957
11958     <row>
11959      <entry role="catalog_table_entry"><para role="column_definition">
11960       <structfield>reset_val</structfield> <type>text</type>
11961      </para>
11962      <para>
11963       Value that <command>RESET</command> would reset the parameter to
11964       in the current session
11965      </para></entry>
11966     </row>
11967
11968     <row>
11969      <entry role="catalog_table_entry"><para role="column_definition">
11970       <structfield>sourcefile</structfield> <type>text</type>
11971      </para>
11972      <para>
11973       Configuration file the current value was set in (null for
11974       values set from sources other than configuration files, or when
11975       examined by a user who is neither a superuser or a member of
11976       <literal>pg_read_all_settings</literal>); helpful when using
11977       <literal>include</literal> directives in configuration files
11978      </para></entry>
11979     </row>
11980
11981     <row>
11982      <entry role="catalog_table_entry"><para role="column_definition">
11983       <structfield>sourceline</structfield> <type>int4</type>
11984      </para>
11985      <para>
11986       Line number within the configuration file the current value was
11987       set at (null for values set from sources other than configuration files,
11988       or when examined by a user who is neither a superuser or a member of
11989       <literal>pg_read_all_settings</literal>).
11990      </para></entry>
11991     </row>
11992
11993     <row>
11994      <entry role="catalog_table_entry"><para role="column_definition">
11995       <structfield>pending_restart</structfield> <type>bool</type>
11996      </para>
11997      <para>
11998       <literal>true</literal> if the value has been changed in the
11999       configuration file but needs a restart; or <literal>false</literal>
12000       otherwise.
12001      </para></entry>
12002     </row>
12003    </tbody>
12004   </tgroup>
12005  </table>
12006
12007  <para>
12008   There are several possible values of <structfield>context</structfield>.
12009   In order of decreasing difficulty of changing the setting, they are:
12010  </para>
12011
12012  <variablelist>
12013   <varlistentry>
12014    <!-- PGC_INTERNAL -->
12015    <term><literal>internal</literal></term>
12016    <listitem>
12017     <para>
12018      These settings cannot be changed directly; they reflect internally
12019      determined values.  Some of them may be adjustable by rebuilding the
12020      server with different configuration options, or by changing options
12021      supplied to <command>initdb</command>.
12022     </para>
12023    </listitem>
12024   </varlistentry>
12025   <varlistentry>
12026    <!-- PGC_POSTMASTER -->
12027    <term><literal>postmaster</literal></term>
12028    <listitem>
12029     <para>
12030      These settings can only be applied when the server starts, so any change
12031      requires restarting the server.  Values for these settings are typically
12032      stored in the <filename>postgresql.conf</filename> file, or passed on
12033      the command line when starting the server.  Of course, settings with any
12034      of the lower <structfield>context</structfield> types can also be
12035      set at server start time.
12036     </para>
12037    </listitem>
12038   </varlistentry>
12039   <varlistentry>
12040    <!-- PGC_SIGHUP -->
12041    <term><literal>sighup</literal></term>
12042    <listitem>
12043     <para>
12044      Changes to these settings can be made in
12045      <filename>postgresql.conf</filename> without restarting the server.
12046      Send a <systemitem>SIGHUP</systemitem> signal to the postmaster to
12047      cause it to re-read <filename>postgresql.conf</filename> and apply
12048      the changes.  The postmaster will also forward the
12049      <systemitem>SIGHUP</systemitem> signal to its child processes so that
12050      they all pick up the new value.
12051     </para>
12052    </listitem>
12053   </varlistentry>
12054   <varlistentry>
12055    <!-- PGC_SU_BACKEND -->
12056    <term><literal>superuser-backend</literal></term>
12057    <listitem>
12058     <para>
12059      Changes to these settings can be made in
12060      <filename>postgresql.conf</filename> without restarting the server.
12061      They can also be set for a particular session in the connection request
12062      packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
12063      environment variable), but only if the connecting user is a superuser.
12064      However, these settings never change in a session after it is started.
12065      If you change them in <filename>postgresql.conf</filename>, send a
12066      <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
12067      re-read <filename>postgresql.conf</filename>.  The new values will only
12068      affect subsequently-launched sessions.
12069     </para>
12070    </listitem>
12071   </varlistentry>
12072   <varlistentry>
12073    <!-- PGC_BACKEND -->
12074    <term><literal>backend</literal></term>
12075    <listitem>
12076     <para>
12077      Changes to these settings can be made in
12078      <filename>postgresql.conf</filename> without restarting the server.
12079      They can also be set for a particular session in the connection request
12080      packet (for example, via <application>libpq</application>'s <literal>PGOPTIONS</literal>
12081      environment variable); any user can make such a change for their session.
12082      However, these settings never change in a session after it is started.
12083      If you change them in <filename>postgresql.conf</filename>, send a
12084      <systemitem>SIGHUP</systemitem> signal to the postmaster to cause it to
12085      re-read <filename>postgresql.conf</filename>.  The new values will only
12086      affect subsequently-launched sessions.
12087     </para>
12088    </listitem>
12089   </varlistentry>
12090   <varlistentry>
12091    <!-- PGC_SUSET -->
12092    <term><literal>superuser</literal></term>
12093    <listitem>
12094     <para>
12095      These settings can be set from <filename>postgresql.conf</filename>,
12096      or within a session via the <command>SET</command> command; but only superusers
12097      can change them via <command>SET</command>.  Changes in
12098      <filename>postgresql.conf</filename> will affect existing sessions
12099      only if no session-local value has been established with <command>SET</command>.
12100     </para>
12101    </listitem>
12102   </varlistentry>
12103   <varlistentry>
12104    <!-- PGC_USERSET -->
12105    <term><literal>user</literal></term>
12106    <listitem>
12107     <para>
12108      These settings can be set from <filename>postgresql.conf</filename>,
12109      or within a session via the <command>SET</command> command.  Any user is
12110      allowed to change their session-local value.  Changes in
12111      <filename>postgresql.conf</filename> will affect existing sessions
12112      only if no session-local value has been established with <command>SET</command>.
12113     </para>
12114    </listitem>
12115   </varlistentry>
12116  </variablelist>
12117
12118  <para>
12119   See <xref linkend="config-setting"/> for more information about the various
12120   ways to change these parameters.
12121  </para>
12122
12123  <para>
12124   The <structname>pg_settings</structname> view cannot be inserted into or
12125   deleted from, but it can be updated.  An <command>UPDATE</command> applied
12126   to a row of <structname>pg_settings</structname> is equivalent to executing
12127   the <xref linkend="sql-set"/> command on that named
12128   parameter. The change only affects the value used by the current
12129   session. If an <command>UPDATE</command> is issued within a transaction
12130   that is later aborted, the effects of the <command>UPDATE</command> command
12131   disappear when the transaction is rolled back. Once the surrounding
12132   transaction is committed, the effects will persist until the end of the
12133   session, unless overridden by another <command>UPDATE</command> or
12134   <command>SET</command>.
12135  </para>
12136
12137 </sect1>
12138
12139 <sect1 id="view-pg-shadow">
12140  <title><structname>pg_shadow</structname></title>
12141
12142  <indexterm zone="view-pg-shadow">
12143   <primary>pg_shadow</primary>
12144  </indexterm>
12145
12146  <para>
12147   The view <structname>pg_shadow</structname> exists for backwards
12148   compatibility: it emulates a catalog that existed in
12149   <productname>PostgreSQL</productname> before version 8.1.
12150   It shows properties of all roles that are marked as
12151   <structfield>rolcanlogin</structfield> in
12152   <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.
12153  </para>
12154
12155  <para>
12156   The name stems from the fact that this table
12157   should not be readable by the public since it contains passwords.
12158   <link linkend="view-pg-user"><structname>pg_user</structname></link>
12159   is a publicly readable view on
12160   <structname>pg_shadow</structname> that blanks out the password field.
12161  </para>
12162
12163  <table>
12164   <title><structname>pg_shadow</structname> Columns</title>
12165   <tgroup cols="1">
12166    <thead>
12167     <row>
12168      <entry role="catalog_table_entry"><para role="column_definition">
12169       Column Type
12170      </para>
12171      <para>
12172       Description
12173      </para></entry>
12174     </row>
12175    </thead>
12176
12177    <tbody>
12178     <row>
12179      <entry role="catalog_table_entry"><para role="column_definition">
12180       <structfield>usename</structfield> <type>name</type>
12181       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
12182      </para>
12183      <para>
12184       User name
12185      </para></entry>
12186     </row>
12187
12188     <row>
12189      <entry role="catalog_table_entry"><para role="column_definition">
12190       <structfield>usesysid</structfield> <type>oid</type>
12191       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
12192      </para>
12193      <para>
12194       ID of this user
12195      </para></entry>
12196     </row>
12197
12198     <row>
12199      <entry role="catalog_table_entry"><para role="column_definition">
12200       <structfield>usecreatedb</structfield> <type>bool</type>
12201      </para>
12202      <para>
12203       User can create databases
12204      </para></entry>
12205     </row>
12206
12207     <row>
12208      <entry role="catalog_table_entry"><para role="column_definition">
12209       <structfield>usesuper</structfield> <type>bool</type>
12210      </para>
12211      <para>
12212       User is a superuser
12213      </para></entry>
12214     </row>
12215
12216     <row>
12217      <entry role="catalog_table_entry"><para role="column_definition">
12218       <structfield>userepl</structfield> <type>bool</type>
12219      </para>
12220      <para>
12221       User can initiate streaming replication and put the system in and
12222       out of backup mode.
12223      </para></entry>
12224     </row>
12225
12226     <row>
12227      <entry role="catalog_table_entry"><para role="column_definition">
12228       <structfield>usebypassrls</structfield> <type>bool</type>
12229      </para>
12230      <para>
12231       User bypasses every row level security policy, see
12232       <xref linkend="ddl-rowsecurity"/> for more information.
12233      </para></entry>
12234     </row>
12235
12236     <row>
12237      <entry role="catalog_table_entry"><para role="column_definition">
12238       <structfield>passwd</structfield> <type>text</type>
12239      </para>
12240      <para>
12241       Password (possibly encrypted); null if none.  See
12242       <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
12243       for details of how encrypted passwords are stored.
12244      </para></entry>
12245     </row>
12246
12247     <row>
12248      <entry role="catalog_table_entry"><para role="column_definition">
12249       <structfield>valuntil</structfield> <type>timestamptz</type>
12250      </para>
12251      <para>
12252       Password expiry time (only used for password authentication)
12253      </para></entry>
12254     </row>
12255
12256     <row>
12257      <entry role="catalog_table_entry"><para role="column_definition">
12258       <structfield>useconfig</structfield> <type>text[]</type>
12259      </para>
12260      <para>
12261       Session defaults for run-time configuration variables
12262      </para></entry>
12263     </row>
12264    </tbody>
12265   </tgroup>
12266  </table>
12267
12268 </sect1>
12269
12270 <sect1 id="view-pg-shmem-allocations">
12271  <title><structname>pg_shmem_allocations</structname></title>
12272
12273  <indexterm zone="view-pg-shmem-allocations">
12274   <primary>pg_shmem_allocations</primary>
12275  </indexterm>
12276
12277  <para>
12278   The <structname>pg_shmem_allocations</structname> view shows allocations
12279   made from the server's main shared memory segment.  This includes both
12280   memory allocated by <productname>postgres</productname> itself and memory
12281   allocated by extensions using the mechanisms detailed in
12282   <xref linkend="xfunc-shared-addin" />.
12283  </para>
12284
12285  <para>
12286   Note that this view does not include memory allocated using the dynamic
12287   shared memory infrastructure.
12288  </para>
12289
12290  <table>
12291   <title><structname>pg_shmem_allocations</structname> Columns</title>
12292   <tgroup cols="1">
12293    <thead>
12294     <row>
12295      <entry role="catalog_table_entry"><para role="column_definition">
12296       Column Type
12297      </para>
12298      <para>
12299       Description
12300      </para></entry>
12301     </row>
12302    </thead>
12303
12304    <tbody>
12305     <row>
12306      <entry role="catalog_table_entry"><para role="column_definition">
12307       <structfield>name</structfield> <type>text</type>
12308      </para>
12309      <para>
12310       The name of the shared memory allocation. NULL for unused memory
12311       and <literal>&lt;anonymous&gt;</literal> for anonymous
12312       allocations.
12313      </para></entry>
12314     </row>
12315
12316     <row>
12317      <entry role="catalog_table_entry"><para role="column_definition">
12318       <structfield>off</structfield> <type>int8</type>
12319      </para>
12320      <para>
12321       The offset at which the allocation starts. NULL for anonymous
12322       allocations, since details related to them are not known.
12323      </para></entry>
12324     </row>
12325
12326     <row>
12327      <entry role="catalog_table_entry"><para role="column_definition">
12328       <structfield>size</structfield> <type>int8</type>
12329      </para>
12330      <para>
12331       Size of the allocation
12332      </para></entry>
12333     </row>
12334
12335     <row>
12336      <entry role="catalog_table_entry"><para role="column_definition">
12337       <structfield>allocated_size</structfield> <type>int8</type>
12338      </para>
12339      <para>
12340       Size of the allocation including padding. For anonymous
12341       allocations, no information about padding is available, so the
12342       <literal>size</literal> and <literal>allocated_size</literal> columns
12343       will always be equal. Padding is not meaningful for free memory, so
12344       the columns will be equal in that case also.
12345      </para></entry>
12346     </row>
12347    </tbody>
12348   </tgroup>
12349  </table>
12350
12351  <para>
12352   Anonymous allocations are allocations that have been made
12353   with <literal>ShmemAlloc()</literal> directly, rather than via
12354   <literal>ShmemInitStruct()</literal> or
12355   <literal>ShmemInitHash()</literal>.
12356  </para>
12357
12358  <para>
12359   By default, the <structname>pg_shmem_allocations</structname> view can be
12360   read only by superusers.
12361  </para>
12362 </sect1>
12363
12364 <sect1 id="view-pg-stats">
12365  <title><structname>pg_stats</structname></title>
12366
12367  <indexterm zone="view-pg-stats">
12368   <primary>pg_stats</primary>
12369  </indexterm>
12370
12371  <para>
12372   The view <structname>pg_stats</structname> provides access to
12373   the information stored in the <link
12374   linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
12375   catalog.  This view allows access only to rows of
12376   <structname>pg_statistic</structname> that correspond to tables the
12377   user has permission to read, and therefore it is safe to allow public
12378   read access to this view.
12379  </para>
12380
12381  <para>
12382   <structname>pg_stats</structname> is also designed to present the
12383   information in a more readable format than the underlying catalog
12384   &mdash; at the cost that its schema must be extended whenever new slot types
12385   are defined for <structname>pg_statistic</structname>.
12386  </para>
12387
12388  <table>
12389   <title><structname>pg_stats</structname> Columns</title>
12390   <tgroup cols="1">
12391    <thead>
12392     <row>
12393      <entry role="catalog_table_entry"><para role="column_definition">
12394       Column Type
12395      </para>
12396      <para>
12397       Description
12398      </para></entry>
12399     </row>
12400    </thead>
12401
12402    <tbody>
12403     <row>
12404      <entry role="catalog_table_entry"><para role="column_definition">
12405       <structfield>schemaname</structfield> <type>name</type>
12406       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
12407      </para>
12408      <para>
12409       Name of schema containing table
12410      </para></entry>
12411     </row>
12412
12413     <row>
12414      <entry role="catalog_table_entry"><para role="column_definition">
12415       <structfield>tablename</structfield> <type>name</type>
12416       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
12417      </para>
12418      <para>
12419       Name of table
12420      </para></entry>
12421     </row>
12422
12423     <row>
12424      <entry role="catalog_table_entry"><para role="column_definition">
12425       <structfield>attname</structfield> <type>name</type>
12426       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>)
12427      </para>
12428      <para>
12429       Name of the column described by this row
12430      </para></entry>
12431     </row>
12432
12433     <row>
12434      <entry role="catalog_table_entry"><para role="column_definition">
12435       <structfield>inherited</structfield> <type>bool</type>
12436      </para>
12437      <para>
12438       If true, this row includes inheritance child columns, not just the
12439       values in the specified table
12440      </para></entry>
12441     </row>
12442
12443     <row>
12444      <entry role="catalog_table_entry"><para role="column_definition">
12445       <structfield>null_frac</structfield> <type>float4</type>
12446      </para>
12447      <para>
12448       Fraction of column entries that are null
12449      </para></entry>
12450     </row>
12451
12452     <row>
12453      <entry role="catalog_table_entry"><para role="column_definition">
12454       <structfield>avg_width</structfield> <type>int4</type>
12455      </para>
12456      <para>
12457       Average width in bytes of column's entries
12458      </para></entry>
12459     </row>
12460
12461     <row>
12462      <entry role="catalog_table_entry"><para role="column_definition">
12463       <structfield>n_distinct</structfield> <type>float4</type>
12464      </para>
12465      <para>
12466       If greater than zero, the estimated number of distinct values in the
12467       column.  If less than zero, the negative of the number of distinct
12468       values divided by the number of rows.  (The negated form is used when
12469       <command>ANALYZE</command> believes that the number of distinct values is
12470       likely to increase as the table grows; the positive form is used when
12471       the column seems to have a fixed number of possible values.)  For
12472       example, -1 indicates a unique column in which the number of distinct
12473       values is the same as the number of rows.
12474      </para></entry>
12475     </row>
12476
12477     <row>
12478      <entry role="catalog_table_entry"><para role="column_definition">
12479       <structfield>most_common_vals</structfield> <type>anyarray</type>
12480      </para>
12481      <para>
12482       A list of the most common values in the column. (Null if
12483       no values seem to be more common than any others.)
12484      </para></entry>
12485     </row>
12486
12487     <row>
12488      <entry role="catalog_table_entry"><para role="column_definition">
12489       <structfield>most_common_freqs</structfield> <type>float4[]</type>
12490      </para>
12491      <para>
12492       A list of the frequencies of the most common values,
12493       i.e., number of occurrences of each divided by total number of rows.
12494       (Null when <structfield>most_common_vals</structfield> is.)
12495      </para></entry>
12496     </row>
12497
12498     <row>
12499      <entry role="catalog_table_entry"><para role="column_definition">
12500       <structfield>histogram_bounds</structfield> <type>anyarray</type>
12501      </para>
12502      <para>
12503       A list of values that divide the column's values into groups of
12504       approximately equal population.  The values in
12505       <structfield>most_common_vals</structfield>, if present, are omitted from this
12506       histogram calculation.  (This column is null if the column data type
12507       does not have a <literal>&lt;</literal> operator or if the
12508       <structfield>most_common_vals</structfield> list accounts for the entire
12509       population.)
12510      </para></entry>
12511     </row>
12512
12513     <row>
12514      <entry role="catalog_table_entry"><para role="column_definition">
12515       <structfield>correlation</structfield> <type>float4</type>
12516      </para>
12517      <para>
12518       Statistical correlation between physical row ordering and
12519       logical ordering of the column values.  This ranges from -1 to +1.
12520       When the value is near -1 or +1, an index scan on the column will
12521       be estimated to be cheaper than when it is near zero, due to reduction
12522       of random access to the disk.  (This column is null if the column data
12523       type does not have a <literal>&lt;</literal> operator.)
12524      </para></entry>
12525     </row>
12526
12527     <row>
12528      <entry role="catalog_table_entry"><para role="column_definition">
12529       <structfield>most_common_elems</structfield> <type>anyarray</type>
12530      </para>
12531      <para>
12532       A list of non-null element values most often appearing within values of
12533       the column. (Null for scalar types.)
12534      </para></entry>
12535     </row>
12536
12537     <row>
12538      <entry role="catalog_table_entry"><para role="column_definition">
12539       <structfield>most_common_elem_freqs</structfield> <type>float4[]</type>
12540      </para>
12541      <para>
12542       A list of the frequencies of the most common element values, i.e., the
12543       fraction of rows containing at least one instance of the given value.
12544       Two or three additional values follow the per-element frequencies;
12545       these are the minimum and maximum of the preceding per-element
12546       frequencies, and optionally the frequency of null elements.
12547       (Null when <structfield>most_common_elems</structfield> is.)
12548      </para></entry>
12549     </row>
12550
12551     <row>
12552      <entry role="catalog_table_entry"><para role="column_definition">
12553       <structfield>elem_count_histogram</structfield> <type>float4[]</type>
12554      </para>
12555      <para>
12556       A histogram of the counts of distinct non-null element values within the
12557       values of the column, followed by the average number of distinct
12558       non-null elements.  (Null for scalar types.)
12559      </para></entry>
12560     </row>
12561    </tbody>
12562   </tgroup>
12563  </table>
12564
12565  <para>
12566   The maximum number of entries in the array fields can be controlled on a
12567   column-by-column basis using the <command>ALTER TABLE SET STATISTICS</command>
12568   command, or globally by setting the
12569   <xref linkend="guc-default-statistics-target"/> run-time parameter.
12570  </para>
12571
12572 </sect1>
12573
12574 <sect1 id="view-pg-stats-ext">
12575  <title><structname>pg_stats_ext</structname></title>
12576
12577  <indexterm zone="view-pg-stats-ext">
12578   <primary>pg_stats_ext</primary>
12579  </indexterm>
12580
12581  <para>
12582   The view <structname>pg_stats_ext</structname> provides access to
12583   the information stored in the <link
12584   linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>
12585   and <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
12586   catalogs.  This view allows access only to rows of
12587   <structname>pg_statistic_ext</structname> and <structname>pg_statistic_ext_data</structname>
12588   that correspond to tables the user has permission to read, and therefore
12589   it is safe to allow public read access to this view.
12590  </para>
12591
12592  <para>
12593   <structname>pg_stats_ext</structname> is also designed to present the
12594   information in a more readable format than the underlying catalogs
12595   &mdash; at the cost that its schema must be extended whenever new types
12596   of extended statistics are added to <structname>pg_statistic_ext</structname>.
12597  </para>
12598
12599  <table>
12600   <title><structname>pg_stats_ext</structname> Columns</title>
12601   <tgroup cols="1">
12602    <thead>
12603     <row>
12604      <entry role="catalog_table_entry"><para role="column_definition">
12605       Column Type
12606      </para>
12607      <para>
12608       Description
12609      </para></entry>
12610     </row>
12611    </thead>
12612
12613    <tbody>
12614     <row>
12615      <entry role="catalog_table_entry"><para role="column_definition">
12616       <structfield>schemaname</structfield> <type>name</type>
12617       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
12618      </para>
12619      <para>
12620       Name of schema containing table
12621      </para></entry>
12622     </row>
12623
12624     <row>
12625      <entry role="catalog_table_entry"><para role="column_definition">
12626       <structfield>tablename</structfield> <type>name</type>
12627       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
12628      </para>
12629      <para>
12630       Name of table
12631      </para></entry>
12632     </row>
12633
12634     <row>
12635      <entry role="catalog_table_entry"><para role="column_definition">
12636       <structfield>statistics_schemaname</structfield> <type>name</type>
12637       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
12638      </para>
12639      <para>
12640       Name of schema containing extended statistic
12641      </para></entry>
12642     </row>
12643
12644     <row>
12645      <entry role="catalog_table_entry"><para role="column_definition">
12646       <structfield>statistics_name</structfield> <type>name</type>
12647       (references <link linkend="catalog-pg-statistic-ext"><structname>pg_statistic_ext</structname></link>.<structfield>stxname</structfield>)
12648      </para>
12649      <para>
12650       Name of extended statistics
12651      </para></entry>
12652     </row>
12653
12654     <row>
12655      <entry role="catalog_table_entry"><para role="column_definition">
12656       <structfield>statistics_owner</structfield> <type>name</type>
12657       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
12658      </para>
12659      <para>
12660       Owner of the extended statistics
12661      </para></entry>
12662     </row>
12663
12664     <row>
12665      <entry role="catalog_table_entry"><para role="column_definition">
12666       <structfield>attnames</structfield> <type>name[]</type>
12667       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>)
12668      </para>
12669      <para>
12670       Names of the columns the extended statistics is defined on
12671      </para></entry>
12672     </row>
12673
12674     <row>
12675      <entry role="catalog_table_entry"><para role="column_definition">
12676       <structfield>kinds</structfield> <type>char[]</type>
12677      </para>
12678      <para>
12679       Types of extended statistics enabled for this record
12680      </para></entry>
12681     </row>
12682
12683     <row>
12684      <entry role="catalog_table_entry"><para role="column_definition">
12685       <structfield>n_distinct</structfield> <type>pg_ndistinct</type>
12686      </para>
12687      <para>
12688       N-distinct counts for combinations of column values. If greater
12689       than zero, the estimated number of distinct values in the combination.
12690       If less than zero, the negative of the number of distinct values divided
12691       by the number of rows.
12692       (The negated form is used when <command>ANALYZE</command> believes that
12693       the number of distinct values is likely to increase as the table grows;
12694       the positive form is used when the column seems to have a fixed number
12695       of possible values.)  For example, -1 indicates a unique combination of
12696       columns in which the number of distinct combinations is the same as the
12697       number of rows.
12698      </para></entry>
12699     </row>
12700
12701     <row>
12702      <entry role="catalog_table_entry"><para role="column_definition">
12703       <structfield>dependencies</structfield> <type>pg_dependencies</type>
12704      </para>
12705      <para>
12706       Functional dependency statistics
12707      </para></entry>
12708     </row>
12709
12710     <row>
12711      <entry role="catalog_table_entry"><para role="column_definition">
12712       <structfield>most_common_vals</structfield> <type>text[]</type>
12713      </para>
12714      <para>
12715       A list of the most common combinations of values in the columns.
12716       (Null if no combinations seem to be more common than any others.)
12717      </para></entry>
12718     </row>
12719
12720     <row>
12721      <entry role="catalog_table_entry"><para role="column_definition">
12722       <structfield>most_common_val_nulls</structfield> <type>bool[]</type>
12723      </para>
12724      <para>
12725       A list of NULL flags for the most common combinations of values.
12726       (Null when <structfield>most_common_vals</structfield> is.)
12727      </para></entry>
12728     </row>
12729
12730     <row>
12731      <entry role="catalog_table_entry"><para role="column_definition">
12732       <structfield>most_common_freqs</structfield> <type>float8[]</type>
12733      </para>
12734      <para>
12735       A list of the frequencies of the most common combinations,
12736       i.e., number of occurrences of each divided by total number of rows.
12737       (Null when <structfield>most_common_vals</structfield> is.)
12738      </para></entry>
12739     </row>
12740
12741     <row>
12742      <entry role="catalog_table_entry"><para role="column_definition">
12743       <structfield>most_common_base_freqs</structfield> <type>float8[]</type>
12744      </para>
12745      <para>
12746       A list of the base frequencies of the most common combinations,
12747       i.e., product of per-value frequencies.
12748       (Null when <structfield>most_common_vals</structfield> is.)
12749      </para></entry>
12750     </row>
12751    </tbody>
12752   </tgroup>
12753  </table>
12754
12755  <para>
12756   The maximum number of entries in the array fields can be controlled on a
12757   column-by-column basis using the <command>ALTER TABLE SET STATISTICS</command>
12758   command, or globally by setting the
12759   <xref linkend="guc-default-statistics-target"/> run-time parameter.
12760  </para>
12761
12762 </sect1>
12763
12764 <sect1 id="view-pg-tables">
12765  <title><structname>pg_tables</structname></title>
12766
12767  <indexterm zone="view-pg-tables">
12768   <primary>pg_tables</primary>
12769  </indexterm>
12770
12771  <para>
12772   The view <structname>pg_tables</structname> provides access to
12773   useful information about each table in the database.
12774  </para>
12775
12776  <table>
12777   <title><structname>pg_tables</structname> Columns</title>
12778   <tgroup cols="1">
12779    <thead>
12780     <row>
12781      <entry role="catalog_table_entry"><para role="column_definition">
12782       Column Type
12783      </para>
12784      <para>
12785       Description
12786      </para></entry>
12787     </row>
12788    </thead>
12789
12790    <tbody>
12791     <row>
12792      <entry role="catalog_table_entry"><para role="column_definition">
12793       <structfield>schemaname</structfield> <type>name</type>
12794       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
12795      </para>
12796      <para>
12797       Name of schema containing table
12798      </para></entry>
12799     </row>
12800
12801     <row>
12802      <entry role="catalog_table_entry"><para role="column_definition">
12803       <structfield>tablename</structfield> <type>name</type>
12804       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
12805      </para>
12806      <para>
12807       Name of table
12808      </para></entry>
12809     </row>
12810
12811     <row>
12812      <entry role="catalog_table_entry"><para role="column_definition">
12813       <structfield>tableowner</structfield> <type>name</type>
12814       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
12815      </para>
12816      <para>
12817       Name of table's owner
12818      </para></entry>
12819     </row>
12820
12821     <row>
12822      <entry role="catalog_table_entry"><para role="column_definition">
12823       <structfield>tablespace</structfield> <type>name</type>
12824       (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
12825      </para>
12826      <para>
12827       Name of tablespace containing table (null if default for database)
12828      </para></entry>
12829     </row>
12830
12831     <row>
12832      <entry role="catalog_table_entry"><para role="column_definition">
12833       <structfield>hasindexes</structfield> <type>bool</type>
12834       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhasindex</structfield>)
12835      </para>
12836      <para>
12837       True if table has (or recently had) any indexes
12838      </para></entry>
12839     </row>
12840
12841     <row>
12842      <entry role="catalog_table_entry"><para role="column_definition">
12843       <structfield>hasrules</structfield> <type>bool</type>
12844       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhasrules</structfield>)
12845      </para>
12846      <para>
12847       True if table has (or once had) rules
12848      </para></entry>
12849     </row>
12850
12851     <row>
12852      <entry role="catalog_table_entry"><para role="column_definition">
12853       <structfield>hastriggers</structfield> <type>bool</type>
12854       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relhastriggers</structfield>)
12855      </para>
12856      <para>
12857       True if table has (or once had) triggers
12858      </para></entry>
12859     </row>
12860
12861     <row>
12862      <entry role="catalog_table_entry"><para role="column_definition">
12863       <structfield>rowsecurity</structfield> <type>bool</type>
12864       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relrowsecurity</structfield>)
12865      </para>
12866      <para>
12867       True if row security is enabled on the table
12868      </para></entry>
12869     </row>
12870    </tbody>
12871   </tgroup>
12872  </table>
12873
12874 </sect1>
12875
12876 <sect1 id="view-pg-timezone-abbrevs">
12877  <title><structname>pg_timezone_abbrevs</structname></title>
12878
12879  <indexterm zone="view-pg-timezone-abbrevs">
12880   <primary>pg_timezone_abbrevs</primary>
12881  </indexterm>
12882
12883  <para>
12884   The view <structname>pg_timezone_abbrevs</structname> provides a list
12885   of time zone abbreviations that are currently recognized by the datetime
12886   input routines.  The contents of this view change when the
12887   <xref linkend="guc-timezone-abbreviations"/> run-time parameter is modified.
12888  </para>
12889
12890  <table>
12891   <title><structname>pg_timezone_abbrevs</structname> Columns</title>
12892   <tgroup cols="1">
12893    <thead>
12894     <row>
12895      <entry role="catalog_table_entry"><para role="column_definition">
12896       Column Type
12897      </para>
12898      <para>
12899       Description
12900      </para></entry>
12901     </row>
12902    </thead>
12903
12904    <tbody>
12905     <row>
12906      <entry role="catalog_table_entry"><para role="column_definition">
12907       <structfield>abbrev</structfield> <type>text</type>
12908      </para>
12909      <para>
12910       Time zone abbreviation
12911      </para></entry>
12912     </row>
12913
12914     <row>
12915      <entry role="catalog_table_entry"><para role="column_definition">
12916       <structfield>utc_offset</structfield> <type>interval</type>
12917      </para>
12918      <para>
12919       Offset from UTC (positive means east of Greenwich)
12920      </para></entry>
12921     </row>
12922
12923     <row>
12924      <entry role="catalog_table_entry"><para role="column_definition">
12925       <structfield>is_dst</structfield> <type>bool</type>
12926      </para>
12927      <para>
12928       True if this is a daylight-savings abbreviation
12929      </para></entry>
12930     </row>
12931    </tbody>
12932   </tgroup>
12933  </table>
12934
12935  <para>
12936   While most timezone abbreviations represent fixed offsets from UTC,
12937   there are some that have historically varied in value
12938   (see <xref linkend="datetime-config-files"/> for more information).
12939   In such cases this view presents their current meaning.
12940  </para>
12941
12942 </sect1>
12943
12944 <sect1 id="view-pg-timezone-names">
12945  <title><structname>pg_timezone_names</structname></title>
12946
12947  <indexterm zone="view-pg-timezone-names">
12948   <primary>pg_timezone_names</primary>
12949  </indexterm>
12950
12951  <para>
12952   The view <structname>pg_timezone_names</structname> provides a list
12953   of time zone names that are recognized by <command>SET TIMEZONE</command>,
12954   along with their associated abbreviations, UTC offsets,
12955   and daylight-savings status.  (Technically,
12956   <productname>PostgreSQL</productname> does not use UTC because leap
12957   seconds are not handled.)
12958   Unlike the abbreviations shown in <link
12959   linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
12960   date rules.  Therefore, the associated information changes across local DST
12961   boundaries.  The displayed information is computed based on the current
12962   value of <function>CURRENT_TIMESTAMP</function>.
12963  </para>
12964
12965  <table>
12966   <title><structname>pg_timezone_names</structname> Columns</title>
12967   <tgroup cols="1">
12968    <thead>
12969     <row>
12970      <entry role="catalog_table_entry"><para role="column_definition">
12971       Column Type
12972      </para>
12973      <para>
12974       Description
12975      </para></entry>
12976     </row>
12977    </thead>
12978
12979    <tbody>
12980     <row>
12981      <entry role="catalog_table_entry"><para role="column_definition">
12982       <structfield>name</structfield> <type>text</type>
12983      </para>
12984      <para>
12985       Time zone name
12986      </para></entry>
12987     </row>
12988
12989     <row>
12990      <entry role="catalog_table_entry"><para role="column_definition">
12991       <structfield>abbrev</structfield> <type>text</type>
12992      </para>
12993      <para>
12994       Time zone abbreviation
12995      </para></entry>
12996     </row>
12997
12998     <row>
12999      <entry role="catalog_table_entry"><para role="column_definition">
13000       <structfield>utc_offset</structfield> <type>interval</type>
13001      </para>
13002      <para>
13003       Offset from UTC (positive means east of Greenwich)
13004      </para></entry>
13005     </row>
13006
13007     <row>
13008      <entry role="catalog_table_entry"><para role="column_definition">
13009       <structfield>is_dst</structfield> <type>bool</type>
13010      </para>
13011      <para>
13012       True if currently observing daylight savings
13013      </para></entry>
13014     </row>
13015    </tbody>
13016   </tgroup>
13017  </table>
13018
13019 </sect1>
13020
13021 <sect1 id="view-pg-user">
13022  <title><structname>pg_user</structname></title>
13023
13024  <indexterm zone="view-pg-user">
13025   <primary>pg_user</primary>
13026  </indexterm>
13027
13028  <para>
13029   The view <structname>pg_user</structname> provides access to
13030   information about database users.  This is simply a publicly
13031   readable view of
13032   <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
13033   that blanks out the password field.
13034  </para>
13035
13036  <table>
13037   <title><structname>pg_user</structname> Columns</title>
13038   <tgroup cols="1">
13039    <thead>
13040     <row>
13041      <entry role="catalog_table_entry"><para role="column_definition">
13042       Column Type
13043      </para>
13044      <para>
13045       Description
13046      </para></entry>
13047     </row>
13048    </thead>
13049
13050    <tbody>
13051     <row>
13052      <entry role="catalog_table_entry"><para role="column_definition">
13053       <structfield>usename</structfield> <type>name</type>
13054      </para>
13055      <para>
13056       User name
13057      </para></entry>
13058     </row>
13059
13060     <row>
13061      <entry role="catalog_table_entry"><para role="column_definition">
13062       <structfield>usesysid</structfield> <type>oid</type>
13063      </para>
13064      <para>
13065       ID of this user
13066      </para></entry>
13067     </row>
13068
13069     <row>
13070      <entry role="catalog_table_entry"><para role="column_definition">
13071       <structfield>usecreatedb</structfield> <type>bool</type>
13072      </para>
13073      <para>
13074       User can create databases
13075      </para></entry>
13076     </row>
13077
13078     <row>
13079      <entry role="catalog_table_entry"><para role="column_definition">
13080       <structfield>usesuper</structfield> <type>bool</type>
13081      </para>
13082      <para>
13083       User is a superuser
13084      </para></entry>
13085     </row>
13086
13087     <row>
13088      <entry role="catalog_table_entry"><para role="column_definition">
13089       <structfield>userepl</structfield> <type>bool</type>
13090      </para>
13091      <para>
13092       User can initiate streaming replication and put the system in and
13093       out of backup mode.
13094      </para></entry>
13095     </row>
13096
13097     <row>
13098      <entry role="catalog_table_entry"><para role="column_definition">
13099       <structfield>usebypassrls</structfield> <type>bool</type>
13100      </para>
13101      <para>
13102       User bypasses every row level security policy, see
13103       <xref linkend="ddl-rowsecurity"/> for more information.
13104      </para></entry>
13105     </row>
13106
13107     <row>
13108      <entry role="catalog_table_entry"><para role="column_definition">
13109       <structfield>passwd</structfield> <type>text</type>
13110      </para>
13111      <para>
13112       Not the password (always reads as <literal>********</literal>)
13113      </para></entry>
13114     </row>
13115
13116     <row>
13117      <entry role="catalog_table_entry"><para role="column_definition">
13118       <structfield>valuntil</structfield> <type>timestamptz</type>
13119      </para>
13120      <para>
13121       Password expiry time (only used for password authentication)
13122      </para></entry>
13123     </row>
13124
13125     <row>
13126      <entry role="catalog_table_entry"><para role="column_definition">
13127       <structfield>useconfig</structfield> <type>text[]</type>
13128      </para>
13129      <para>
13130       Session defaults for run-time configuration variables
13131      </para></entry>
13132     </row>
13133    </tbody>
13134   </tgroup>
13135  </table>
13136
13137 </sect1>
13138
13139 <sect1 id="view-pg-user-mappings">
13140  <title><structname>pg_user_mappings</structname></title>
13141
13142  <indexterm zone="view-pg-user-mappings">
13143   <primary>pg_user_mappings</primary>
13144  </indexterm>
13145
13146  <para>
13147   The view <structname>pg_user_mappings</structname> provides access
13148   to information about user mappings.  This is essentially a publicly
13149   readable view of
13150   <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
13151   that leaves out the options field if the user has no rights to use
13152   it.
13153  </para>
13154
13155  <table>
13156   <title><structname>pg_user_mappings</structname> Columns</title>
13157   <tgroup cols="1">
13158    <thead>
13159     <row>
13160      <entry role="catalog_table_entry"><para role="column_definition">
13161       Column Type
13162      </para>
13163      <para>
13164       Description
13165      </para></entry>
13166     </row>
13167    </thead>
13168
13169    <tbody>
13170     <row>
13171      <entry role="catalog_table_entry"><para role="column_definition">
13172       <structfield>umid</structfield> <type>oid</type>
13173       (references <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.<structfield>oid</structfield>)
13174      </para>
13175      <para>
13176       OID of the user mapping
13177      </para></entry>
13178     </row>
13179
13180     <row>
13181      <entry role="catalog_table_entry"><para role="column_definition">
13182       <structfield>srvid</structfield> <type>oid</type>
13183       (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>oid</structfield>)
13184      </para>
13185      <para>
13186       The OID of the foreign server that contains this mapping
13187      </para></entry>
13188     </row>
13189
13190     <row>
13191      <entry role="catalog_table_entry"><para role="column_definition">
13192       <structfield>srvname</structfield> <type>name</type>
13193       (references <link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.<structfield>srvname</structfield>)
13194      </para>
13195      <para>
13196       Name of the foreign server
13197      </para></entry>
13198     </row>
13199
13200     <row>
13201      <entry role="catalog_table_entry"><para role="column_definition">
13202       <structfield>umuser</structfield> <type>oid</type>
13203       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
13204      </para>
13205      <para>
13206       OID of the local role being mapped, 0 if the user mapping is public
13207      </para></entry>
13208     </row>
13209
13210     <row>
13211      <entry role="catalog_table_entry"><para role="column_definition">
13212       <structfield>usename</structfield> <type>name</type>
13213      </para>
13214      <para>
13215       Name of the local user to be mapped
13216      </para></entry>
13217     </row>
13218
13219     <row>
13220      <entry role="catalog_table_entry"><para role="column_definition">
13221       <structfield>umoptions</structfield> <type>text[]</type>
13222      </para>
13223      <para>
13224       User mapping specific options, as <quote>keyword=value</quote> strings
13225      </para></entry>
13226     </row>
13227    </tbody>
13228   </tgroup>
13229  </table>
13230
13231  <para>
13232   To protect password information stored as a user mapping option,
13233   the <structfield>umoptions</structfield> column will read as null
13234   unless one of the following applies:
13235   <itemizedlist>
13236    <listitem>
13237     <para>
13238      current user is the user being mapped, and owns the server or
13239      holds <literal>USAGE</literal> privilege on it
13240     </para>
13241    </listitem>
13242    <listitem>
13243     <para>
13244      current user is the server owner and mapping is for <literal>PUBLIC</literal>
13245     </para>
13246    </listitem>
13247    <listitem>
13248     <para>
13249      current user is a superuser
13250     </para>
13251    </listitem>
13252   </itemizedlist>
13253  </para>
13254
13255 </sect1>
13256
13257
13258 <sect1 id="view-pg-views">
13259  <title><structname>pg_views</structname></title>
13260
13261  <indexterm zone="view-pg-views">
13262   <primary>pg_views</primary>
13263  </indexterm>
13264
13265  <para>
13266   The view <structname>pg_views</structname> provides access to
13267   useful information about each view in the database.
13268  </para>
13269
13270  <table>
13271   <title><structname>pg_views</structname> Columns</title>
13272   <tgroup cols="1">
13273    <thead>
13274     <row>
13275      <entry role="catalog_table_entry"><para role="column_definition">
13276       Column Type
13277      </para>
13278      <para>
13279       Description
13280      </para></entry>
13281     </row>
13282    </thead>
13283
13284    <tbody>
13285     <row>
13286      <entry role="catalog_table_entry"><para role="column_definition">
13287       <structfield>schemaname</structfield> <type>name</type>
13288       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
13289      </para>
13290      <para>
13291       Name of schema containing view
13292      </para></entry>
13293     </row>
13294
13295     <row>
13296      <entry role="catalog_table_entry"><para role="column_definition">
13297       <structfield>viewname</structfield> <type>name</type>
13298       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
13299      </para>
13300      <para>
13301       Name of view
13302      </para></entry>
13303     </row>
13304
13305     <row>
13306      <entry role="catalog_table_entry"><para role="column_definition">
13307       <structfield>viewowner</structfield> <type>name</type>
13308       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>rolname</structfield>)
13309      </para>
13310      <para>
13311       Name of view's owner
13312      </para></entry>
13313     </row>
13314
13315     <row>
13316      <entry role="catalog_table_entry"><para role="column_definition">
13317       <structfield>definition</structfield> <type>text</type>
13318      </para>
13319      <para>
13320       View definition (a reconstructed <command>SELECT</command> query)
13321      </para></entry>
13322     </row>
13323    </tbody>
13324   </tgroup>
13325  </table>
13326
13327 </sect1>
13328
13329</chapter>
13330