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