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