]> granicus.if.org Git - postgresql/blob - doc/src/sgml/catalogs.sgml
Fix some SGML-compiler warnings on -wxml mode.
[postgresql] / doc / src / sgml / catalogs.sgml
1 <!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.194 2009/02/04 21:30:41 alvherre Exp $ -->
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-autovacuum"><structname>pg_autovacuum</structname></link></entry>
93       <entry>per-relation autovacuum configuration parameters</entry>
94      </row>
95
96      <row>
97       <entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
98       <entry>casts (data type conversions)</entry>
99      </row>
100
101      <row>
102       <entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
103       <entry>tables, indexes, sequences, views (<quote>relations</quote>)</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-depend"><structname>pg_depend</structname></link></entry>
123       <entry>dependencies between database objects</entry>
124      </row>
125
126      <row>
127       <entry><link linkend="catalog-pg-description"><structname>pg_description</structname></link></entry>
128       <entry>descriptions or comments on database objects</entry>
129      </row>
130
131      <row>
132       <entry><link linkend="catalog-pg-enum"><structname>pg_enum</structname></link></entry>
133       <entry>enum label and value definitions</entry>
134      </row>
135
136      <row>
137       <entry><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link></entry>
138       <entry>foreign-data wrapper definitions</entry>
139      </row>
140
141      <row>
142       <entry><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link></entry>
143       <entry>foreign server definitions</entry>
144      </row>
145
146      <row>
147       <entry><link linkend="catalog-pg-index"><structname>pg_index</structname></link></entry>
148       <entry>additional index information</entry>
149      </row>
150
151      <row>
152       <entry><link linkend="catalog-pg-inherits"><structname>pg_inherits</structname></link></entry>
153       <entry>table inheritance hierarchy</entry>
154      </row>
155
156      <row>
157       <entry><link linkend="catalog-pg-language"><structname>pg_language</structname></link></entry>
158       <entry>languages for writing functions</entry>
159      </row>
160
161      <row>
162       <entry><link linkend="catalog-pg-largeobject"><structname>pg_largeobject</structname></link></entry>
163       <entry>large objects</entry>
164      </row>
165
166      <row>
167       <entry><link linkend="catalog-pg-listener"><structname>pg_listener</structname></link></entry>
168       <entry>asynchronous notification support</entry>
169      </row>
170
171      <row>
172       <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry>
173       <entry>schemas</entry>
174      </row>
175
176      <row>
177       <entry><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link></entry>
178       <entry>access method operator classes</entry>
179      </row>
180
181      <row>
182       <entry><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link></entry>
183       <entry>operators</entry>
184      </row>
185
186      <row>
187       <entry><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link></entry>
188       <entry>access method operator families</entry>
189      </row>
190
191      <row>
192       <entry><link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link></entry>
193       <entry>template data for procedural languages</entry>
194      </row>
195
196      <row>
197       <entry><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link></entry>
198       <entry>functions and procedures</entry>
199      </row>
200
201      <row>
202       <entry><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link></entry>
203       <entry>query rewrite rules</entry>
204      </row>
205
206      <row>
207       <entry><link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link></entry>
208       <entry>dependencies on shared objects</entry>
209      </row>
210
211      <row>
212       <entry><link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link></entry>
213       <entry>comments on shared objects</entry>
214      </row>
215
216      <row>
217       <entry><link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link></entry>
218       <entry>planner statistics</entry>
219      </row>
220
221      <row>
222       <entry><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link></entry>
223       <entry>tablespaces within this database cluster</entry>
224      </row>
225
226      <row>
227       <entry><link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link></entry>
228       <entry>triggers</entry>
229      </row>
230
231      <row>
232       <entry><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link></entry>
233       <entry>text search configurations</entry>
234      </row>
235
236      <row>
237       <entry><link linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link></entry>
238       <entry>text search configurations' token mappings</entry>
239      </row>
240
241      <row>
242       <entry><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link></entry>
243       <entry>text search dictionaries</entry>
244      </row>
245
246      <row>
247       <entry><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link></entry>
248       <entry>text search parsers</entry>
249      </row>
250
251      <row>
252       <entry><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link></entry>
253       <entry>text search templates</entry>
254      </row>
255
256      <row>
257       <entry><link linkend="catalog-pg-type"><structname>pg_type</structname></link></entry>
258       <entry>data types</entry>
259      </row>
260
261      <row>
262       <entry><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link></entry>
263       <entry>mappings of users to foreign servers</entry>
264      </row>
265     </tbody>
266    </tgroup>
267   </table>
268  </sect1>
269
270
271  <sect1 id="catalog-pg-aggregate">
272   <title><structname>pg_aggregate</structname></title>
273
274   <indexterm zone="catalog-pg-aggregate">
275    <primary>pg_aggregate</primary>
276   </indexterm>
277
278   <para>
279    The catalog <structname>pg_aggregate</structname> stores information about
280    aggregate functions.  An aggregate function is a function that
281    operates on a set of values (typically one column from each row
282    that matches a query condition) and returns a single value computed
283    from all these values.  Typical aggregate functions are
284    <function>sum</function>, <function>count</function>, and
285    <function>max</function>.  Each entry in
286    <structname>pg_aggregate</structname> is an extension of an entry
287    in <structname>pg_proc</structname>.  The <structname>pg_proc</structname>
288    entry carries the aggregate's name, input and output data types, and
289    other information that is similar to ordinary functions.
290   </para>
291
292   <table>
293    <title><structname>pg_aggregate</> Columns</title>
294
295    <tgroup cols="4">
296     <thead>
297      <row>
298       <entry>Name</entry>
299       <entry>Type</entry>
300       <entry>References</entry>
301       <entry>Description</entry>
302      </row>
303     </thead>
304     <tbody>
305      <row>
306       <entry><structfield>aggfnoid</structfield></entry>
307       <entry><type>regproc</type></entry>
308       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
309       <entry><structname>pg_proc</structname> OID of the aggregate function</entry>
310      </row>
311      <row>
312       <entry><structfield>aggtransfn</structfield></entry>
313       <entry><type>regproc</type></entry>
314       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
315       <entry>Transition function</entry>
316      </row>
317      <row>
318       <entry><structfield>aggfinalfn</structfield></entry>
319       <entry><type>regproc</type></entry>
320       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
321       <entry>Final function (zero if none)</entry>
322      </row>
323      <row>
324       <entry><structfield>aggsortop</structfield></entry>
325       <entry><type>oid</type></entry>
326       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
327       <entry>Associated sort operator (zero if none)</entry>
328      </row>
329      <row>
330       <entry><structfield>aggtranstype</structfield></entry>
331       <entry><type>oid</type></entry>
332       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
333       <entry>Data type of the aggregate function's internal transition (state) data</entry>
334      </row>
335      <row>
336       <entry><structfield>agginitval</structfield></entry>
337       <entry><type>text</type></entry>
338       <entry></entry>
339       <entry>
340        The initial value of the transition state.  This is a text
341        field containing the initial value in its external string
342        representation.  If this field is NULL, the transition state
343        value starts out NULL
344       </entry>
345      </row>
346     </tbody>
347    </tgroup>
348   </table>
349
350   <para>
351    New aggregate functions are registered with the <xref
352    linkend="sql-createaggregate" endterm="sql-createaggregate-title">
353    command.  See <xref linkend="xaggr"> for more information about
354    writing aggregate functions and the meaning of the transition
355    functions, etc.
356   </para>
357
358  </sect1>
359
360
361  <sect1 id="catalog-pg-am">
362   <title><structname>pg_am</structname></title>
363
364   <indexterm zone="catalog-pg-am">
365    <primary>pg_am</primary>
366   </indexterm>
367
368   <para>
369    The catalog <structname>pg_am</structname> stores information about index
370    access methods.  There is one row for each index access method supported by
371    the system.  The contents of this catalog are discussed in detail in
372    <xref linkend="indexam">.
373   </para>
374
375   <table>
376    <title><structname>pg_am</> Columns</title>
377
378    <tgroup cols="4">
379     <thead>
380      <row>
381       <entry>Name</entry>
382       <entry>Type</entry>
383       <entry>References</entry>
384       <entry>Description</entry>
385      </row>
386     </thead>
387     <tbody>
388
389      <row>
390       <entry><structfield>amname</structfield></entry>
391       <entry><type>name</type></entry>
392       <entry></entry>
393       <entry>Name of the access method</entry>
394      </row>
395
396      <row>
397       <entry><structfield>amstrategies</structfield></entry>
398       <entry><type>int2</type></entry>
399       <entry></entry>
400       <entry>Number of operator strategies for this access method,
401        or zero if access method does not have a fixed set of operator
402        strategies</entry>
403      </row>
404
405      <row>
406       <entry><structfield>amsupport</structfield></entry>
407       <entry><type>int2</type></entry>
408       <entry></entry>
409       <entry>Number of support routines for this access method</entry>
410      </row>
411
412      <row>
413       <entry><structfield>amcanorder</structfield></entry>
414       <entry><type>bool</type></entry>
415       <entry></entry>
416       <entry>Does the access method support ordered scans?</entry>
417      </row>
418
419      <row>
420       <entry><structfield>amcanbackward</structfield></entry>
421       <entry><type>bool</type></entry>
422       <entry></entry>
423       <entry>Does the access method support backward scanning?</entry>
424      </row>
425
426      <row>
427       <entry><structfield>amcanunique</structfield></entry>
428       <entry><type>bool</type></entry>
429       <entry></entry>
430       <entry>Does the access method support unique indexes?</entry>
431      </row>
432
433      <row>
434       <entry><structfield>amcanmulticol</structfield></entry>
435       <entry><type>bool</type></entry>
436       <entry></entry>
437       <entry>Does the access method support multicolumn indexes?</entry>
438      </row>
439
440      <row>
441       <entry><structfield>amoptionalkey</structfield></entry>
442       <entry><type>bool</type></entry>
443       <entry></entry>
444       <entry>Does the access method support a scan without any constraint
445        for the first index column?</entry>
446      </row>
447
448      <row>
449       <entry><structfield>amindexnulls</structfield></entry>
450       <entry><type>bool</type></entry>
451       <entry></entry>
452       <entry>Does the access method support null index entries?</entry>
453      </row>
454
455      <row>
456       <entry><structfield>amsearchnulls</structfield></entry>
457       <entry><type>bool</type></entry>
458       <entry></entry>
459       <entry>Does the access method support IS NULL searches?</entry>
460      </row>
461
462      <row>
463       <entry><structfield>amstorage</structfield></entry>
464       <entry><type>bool</type></entry>
465       <entry></entry>
466       <entry>Can index storage data type differ from column data type?</entry>
467      </row>
468
469      <row>
470       <entry><structfield>amclusterable</structfield></entry>
471       <entry><type>bool</type></entry>
472       <entry></entry>
473       <entry>Can an index of this type be clustered on?</entry>
474      </row>
475
476      <row>
477       <entry><structfield>amkeytype</structfield></entry>
478       <entry><type>oid</type></entry>
479       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
480       <entry>Type of data stored in index, or zero if not a fixed type</entry>
481      </row>
482
483      <row>
484       <entry><structfield>aminsert</structfield></entry>
485       <entry><type>regproc</type></entry>
486       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
487       <entry><quote>Insert this tuple</quote> function</entry>
488      </row>
489
490      <row>
491       <entry><structfield>ambeginscan</structfield></entry>
492       <entry><type>regproc</type></entry>
493       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
494       <entry><quote>Start new scan</quote> function</entry>
495      </row>
496
497      <row>
498       <entry><structfield>amgettuple</structfield></entry>
499       <entry><type>regproc</type></entry>
500       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
501       <entry><quote>Next valid tuple</quote> function</entry>
502      </row>
503
504      <row>
505       <entry><structfield>amgetbitmap</structfield></entry>
506       <entry><type>regproc</type></entry>
507       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
508       <entry><quote>Fetch all valid tuples</quote> function</entry>
509      </row>
510
511      <row>
512       <entry><structfield>amrescan</structfield></entry>
513       <entry><type>regproc</type></entry>
514       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
515       <entry><quote>Restart this scan</quote> function</entry>
516      </row>
517
518      <row>
519       <entry><structfield>amendscan</structfield></entry>
520       <entry><type>regproc</type></entry>
521       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
522       <entry><quote>End this scan</quote> function</entry>
523      </row>
524
525      <row>
526       <entry><structfield>ammarkpos</structfield></entry>
527       <entry><type>regproc</type></entry>
528       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
529       <entry><quote>Mark current scan position</quote> function</entry>
530      </row>
531
532      <row>
533       <entry><structfield>amrestrpos</structfield></entry>
534       <entry><type>regproc</type></entry>
535       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
536       <entry><quote>Restore marked scan position</quote> function</entry>
537      </row>
538
539      <row>
540       <entry><structfield>ambuild</structfield></entry>
541       <entry><type>regproc</type></entry>
542       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
543       <entry><quote>Build new index</quote> function</entry>
544      </row>
545
546      <row>
547       <entry><structfield>ambulkdelete</structfield></entry>
548       <entry><type>regproc</type></entry>
549       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
550       <entry>Bulk-delete function</entry>
551      </row>
552
553      <row>
554       <entry><structfield>amvacuumcleanup</structfield></entry>
555       <entry><type>regproc</type></entry>
556       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
557       <entry>Post-<command>VACUUM</command> cleanup function</entry>
558      </row>
559
560      <row>
561       <entry><structfield>amcostestimate</structfield></entry>
562       <entry><type>regproc</type></entry>
563       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
564       <entry>Function to estimate cost of an index scan</entry>
565      </row>
566
567      <row>
568       <entry><structfield>amoptions</structfield></entry>
569       <entry><type>regproc</type></entry>
570       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
571       <entry>Function to parse and validate <structfield>reloptions</> for an index</entry>
572      </row>
573
574     </tbody>
575    </tgroup>
576   </table>
577
578  </sect1>
579
580
581  <sect1 id="catalog-pg-amop">
582   <title><structname>pg_amop</structname></title>
583
584   <indexterm zone="catalog-pg-amop">
585    <primary>pg_amop</primary>
586   </indexterm>
587
588   <para>
589    The catalog <structname>pg_amop</structname> stores information about
590    operators associated with access method operator families.  There is one
591    row for each operator that is a member of an operator family.  An operator
592    can appear in more than one family, but cannot appear in more than one
593    position within a family.
594   </para>
595
596   <table>
597    <title><structname>pg_amop</> Columns</title>
598
599    <tgroup cols="4">
600     <thead>
601      <row>
602       <entry>Name</entry>
603       <entry>Type</entry>
604       <entry>References</entry>
605       <entry>Description</entry>
606      </row>
607     </thead>
608     <tbody>
609
610      <row>
611       <entry><structfield>amopfamily</structfield></entry>
612       <entry><type>oid</type></entry>
613       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
614       <entry>The operator family this entry is for</entry>
615      </row>
616
617      <row>
618       <entry><structfield>amoplefttype</structfield></entry>
619       <entry><type>oid</type></entry>
620       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
621       <entry>Left-hand input data type of operator</entry>
622      </row>
623
624      <row>
625       <entry><structfield>amoprighttype</structfield></entry>
626       <entry><type>oid</type></entry>
627       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
628       <entry>Right-hand input data type of operator</entry>
629      </row>
630
631      <row>
632       <entry><structfield>amopstrategy</structfield></entry>
633       <entry><type>int2</type></entry>
634       <entry></entry>
635       <entry>Operator strategy number</entry>
636      </row>
637
638      <row>
639       <entry><structfield>amopopr</structfield></entry>
640       <entry><type>oid</type></entry>
641       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
642       <entry>OID of the operator</entry>
643      </row>
644
645      <row>
646       <entry><structfield>amopmethod</structfield></entry>
647       <entry><type>oid</type></entry>
648       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
649       <entry>Index access method operator family is for</entry>
650      </row>
651
652     </tbody>
653    </tgroup>
654   </table>
655
656   <para>
657    An entry's <structfield>amopmethod</> must match the
658    <structname>opfmethod</> of its containing operator family (including
659    <structfield>amopmethod</> here is an intentional denormalization of the
660    catalog structure for performance reasons).  Also,
661    <structfield>amoplefttype</> and <structfield>amoprighttype</> must match
662    the <structfield>oprleft</> and <structfield>oprright</> fields of the
663    referenced <structname>pg_operator</> entry.
664   </para>
665
666  </sect1>
667
668
669  <sect1 id="catalog-pg-amproc">
670   <title><structname>pg_amproc</structname></title>
671
672   <indexterm zone="catalog-pg-amproc">
673    <primary>pg_amproc</primary>
674   </indexterm>
675
676   <para>
677    The catalog <structname>pg_amproc</structname> stores information about
678    support procedures associated with access method operator families.  There
679    is one row for each support procedure belonging to an operator family.
680   </para>
681
682   <table>
683    <title><structname>pg_amproc</structname> Columns</title>
684
685    <tgroup cols="4">
686     <thead>
687      <row>
688       <entry>Name</entry>
689       <entry>Type</entry>
690       <entry>References</entry>
691       <entry>Description</entry>
692      </row>
693     </thead>
694     <tbody>
695
696      <row>
697       <entry><structfield>amprocfamily</structfield></entry>
698       <entry><type>oid</type></entry>
699       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
700       <entry>The operator family this entry is for</entry>
701      </row>
702
703      <row>
704       <entry><structfield>amproclefttype</structfield></entry>
705       <entry><type>oid</type></entry>
706       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
707       <entry>Left-hand input data type of associated operator</entry>
708      </row>
709
710      <row>
711       <entry><structfield>amprocrighttype</structfield></entry>
712       <entry><type>oid</type></entry>
713       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
714       <entry>Right-hand input data type of associated operator</entry>
715      </row>
716
717      <row>
718       <entry><structfield>amprocnum</structfield></entry>
719       <entry><type>int2</type></entry>
720       <entry></entry>
721       <entry>Support procedure number</entry>
722      </row>
723
724      <row>
725       <entry><structfield>amproc</structfield></entry>
726       <entry><type>regproc</type></entry>
727       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
728       <entry>OID of the procedure</entry>
729      </row>
730
731     </tbody>
732    </tgroup>
733   </table>
734
735   <para>
736    The usual interpretation of the
737    <structfield>amproclefttype</> and <structfield>amprocrighttype</> fields
738    is that they identify the left and right input types of the operator(s)
739    that a particular support procedure supports.  For some access methods
740    these match the input data type(s) of the support procedure itself, for
741    others not.  There is a notion of <quote>default</> support procedures for
742    an index, which are those with <structfield>amproclefttype</> and
743    <structfield>amprocrighttype</> both equal to the index opclass's
744    <structfield>opcintype</>.
745   </para>
746
747  </sect1>
748
749
750  <sect1 id="catalog-pg-attrdef">
751   <title><structname>pg_attrdef</structname></title>
752
753   <indexterm zone="catalog-pg-attrdef">
754    <primary>pg_attrdef</primary>
755   </indexterm>
756
757   <para>
758    The catalog <structname>pg_attrdef</structname> stores column default values.  The main information
759    about columns is stored in <structname>pg_attribute</structname>
760    (see below).  Only columns that explicitly specify a default value
761    (when the table is created or the column is added) will have an
762    entry here.
763   </para>
764
765   <table>
766    <title><structname>pg_attrdef</> Columns</title>
767
768    <tgroup cols="4">
769     <thead>
770      <row>
771       <entry>Name</entry>
772       <entry>Type</entry>
773       <entry>References</entry>
774       <entry>Description</entry>
775      </row>
776     </thead>
777
778     <tbody>
779      <row>
780       <entry><structfield>adrelid</structfield></entry>
781       <entry><type>oid</type></entry>
782       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
783       <entry>The table this column belongs to</entry>
784      </row>
785
786      <row>
787       <entry><structfield>adnum</structfield></entry>
788       <entry><type>int2</type></entry>
789       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
790       <entry>The number of the column</entry>
791      </row>
792
793      <row>
794       <entry><structfield>adbin</structfield></entry>
795       <entry><type>text</type></entry>
796       <entry></entry>
797       <entry>The internal representation of the column default value</entry>
798      </row>
799
800      <row>
801       <entry><structfield>adsrc</structfield></entry>
802       <entry><type>text</type></entry>
803       <entry></entry>
804       <entry>A human-readable representation of the default value</entry>
805      </row>
806     </tbody>
807    </tgroup>
808   </table>
809
810    <para>
811     The <structfield>adsrc</structfield> field is historical, and is best
812     not used, because it does not track outside changes that might affect
813     the representation of the default value.  Reverse-compiling the
814     <structfield>adbin</structfield> field (with <function>pg_get_expr</> for
815     example) is a better way to display the default value.
816    </para>
817
818  </sect1>
819
820
821  <sect1 id="catalog-pg-attribute">
822   <title><structname>pg_attribute</structname></title>
823
824   <indexterm zone="catalog-pg-attribute">
825    <primary>pg_attribute</primary>
826   </indexterm>
827
828   <para>
829    The catalog <structname>pg_attribute</structname> stores information about
830    table columns.  There will be exactly one
831    <structname>pg_attribute</structname> row for every column in every
832    table in the database.  (There will also be attribute entries for
833    indexes, and indeed all objects that have <structname>pg_class</structname>
834    entries.)
835   </para>
836
837   <para>
838    The term attribute is equivalent to column and is used for
839    historical reasons.
840   </para>
841
842   <table>
843    <title><structname>pg_attribute</> Columns</title>
844
845    <tgroup cols="4">
846     <thead>
847      <row>
848       <entry>Name</entry>
849       <entry>Type</entry>
850       <entry>References</entry>
851       <entry>Description</entry>
852      </row>
853     </thead>
854
855     <tbody>
856      <row>
857       <entry><structfield>attrelid</structfield></entry>
858       <entry><type>oid</type></entry>
859       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
860       <entry>The table this column belongs to</entry>
861      </row>
862
863      <row>
864       <entry><structfield>attname</structfield></entry>
865       <entry><type>name</type></entry>
866       <entry></entry>
867       <entry>The column name</entry>
868      </row>
869
870      <row>
871       <entry><structfield>atttypid</structfield></entry>
872       <entry><type>oid</type></entry>
873       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
874       <entry>The data type of this column</entry>
875      </row>
876
877      <row>
878       <entry><structfield>attstattarget</structfield></entry>
879       <entry><type>int4</type></entry>
880       <entry></entry>
881       <entry>
882        <structfield>attstattarget</structfield> controls the level of detail
883        of statistics accumulated for this column by
884        <xref linkend="sql-analyze" endterm="sql-analyze-title">.
885        A zero value indicates that no statistics should be collected.
886        A negative value says to use the system default statistics target.
887        The exact meaning of positive values is data type-dependent.
888        For scalar data types, <structfield>attstattarget</structfield>
889        is both the target number of <quote>most common values</quote>
890        to collect, and the target number of histogram bins to create
891       </entry>
892      </row>
893
894      <row>
895       <entry><structfield>attlen</structfield></entry>
896       <entry><type>int2</type></entry>
897       <entry></entry>
898       <entry>
899        A copy of <literal>pg_type.typlen</literal> of this column's
900        type
901       </entry>
902      </row>
903
904      <row>
905       <entry><structfield>attnum</structfield></entry>
906       <entry><type>int2</type></entry>
907       <entry></entry>
908       <entry>
909        The number of the column.  Ordinary columns are numbered from 1
910        up.  System columns, such as <structfield>oid</structfield>,
911        have (arbitrary) negative numbers
912       </entry>
913      </row>
914
915      <row>
916       <entry><structfield>attndims</structfield></entry>
917       <entry><type>int4</type></entry>
918       <entry></entry>
919       <entry>
920        Number of dimensions, if the column is an array type; otherwise 0.
921        (Presently, the number of dimensions of an array is not enforced,
922        so any nonzero value effectively means <quote>it's an array</>)
923       </entry>
924      </row>
925
926      <row>
927       <entry><structfield>attcacheoff</structfield></entry>
928       <entry><type>int4</type></entry>
929       <entry></entry>
930       <entry>
931        Always -1 in storage, but when loaded into a row descriptor
932        in memory this might be updated to cache the offset of the attribute
933        within the row
934       </entry>
935      </row>
936
937      <row>
938       <entry><structfield>atttypmod</structfield></entry>
939       <entry><type>int4</type></entry>
940       <entry></entry>
941       <entry>
942        <structfield>atttypmod</structfield> records type-specific data
943        supplied at table creation time (for example, the maximum
944        length of a <type>varchar</type> column).  It is passed to
945        type-specific input functions and length coercion functions.
946        The value will generally be -1 for types that do not need <structfield>atttypmod</>
947       </entry>
948      </row>
949
950      <row>
951       <entry><structfield>attbyval</structfield></entry>
952       <entry><type>bool</type></entry>
953       <entry></entry>
954       <entry>
955        A copy of <literal>pg_type.typbyval</> of this column's type
956       </entry>
957      </row>
958
959      <row>
960       <entry><structfield>attstorage</structfield></entry>
961       <entry><type>char</type></entry>
962       <entry></entry>
963       <entry>
964        Normally a copy of <literal>pg_type.typstorage</> of this
965        column's type.  For TOAST-able data types, this can be altered
966        after column creation to control storage policy
967       </entry>
968      </row>
969
970      <row>
971       <entry><structfield>attalign</structfield></entry>
972       <entry><type>char</type></entry>
973       <entry></entry>
974       <entry>
975        A copy of <literal>pg_type.typalign</> of this column's type
976       </entry>
977      </row>
978
979      <row>
980       <entry><structfield>attnotnull</structfield></entry>
981       <entry><type>bool</type></entry>
982       <entry></entry>
983       <entry>
984        This represents a not-null constraint.  It is possible to
985        change this column to enable or disable the constraint
986       </entry>
987      </row>
988
989      <row>
990       <entry><structfield>atthasdef</structfield></entry>
991       <entry><type>bool</type></entry>
992       <entry></entry>
993       <entry>
994        This column has a default value, in which case there will be a
995        corresponding entry in the <structname>pg_attrdef</structname>
996        catalog that actually defines the value
997       </entry>
998      </row>
999
1000      <row>
1001       <entry><structfield>attisdropped</structfield></entry>
1002       <entry><type>bool</type></entry>
1003       <entry></entry>
1004       <entry>
1005        This column has been dropped and is no longer valid.  A dropped
1006        column is still physically present in the table, but is
1007        ignored by the parser and so cannot be accessed via SQL
1008       </entry>
1009      </row>
1010
1011      <row>
1012       <entry><structfield>attislocal</structfield></entry>
1013       <entry><type>bool</type></entry>
1014       <entry></entry>
1015       <entry>
1016        This column is defined locally in the relation.  Note that a column can
1017        be locally defined and inherited simultaneously
1018       </entry>
1019      </row>
1020
1021      <row>
1022       <entry><structfield>attinhcount</structfield></entry>
1023       <entry><type>int4</type></entry>
1024       <entry></entry>
1025       <entry>
1026        The number of direct ancestors this column has.  A column with a
1027        nonzero number of ancestors cannot be dropped nor renamed
1028       </entry>
1029      </row>
1030
1031      <row>
1032       <entry><structfield>attacl</structfield></entry>
1033       <entry><type>aclitem[]</type></entry>
1034       <entry></entry>
1035       <entry>
1036        Column-level access privileges, if any have been granted specifically
1037        on this column
1038       </entry>
1039      </row>
1040
1041     </tbody>
1042    </tgroup>
1043   </table>
1044
1045   <para>
1046    In a dropped column's <structname>pg_attribute</structname> entry,
1047    <structfield>atttypid</structfield> is reset to zero, but
1048    <structfield>attlen</structfield> and the other fields copied from
1049    <structname>pg_type</> are still valid.  This arrangement is needed
1050    to cope with the situation where the dropped column's data type was
1051    later dropped, and so there is no <structname>pg_type</> row anymore.
1052    <structfield>attlen</structfield> and the other fields can be used
1053    to interpret the contents of a row of the table.
1054   </para>
1055  </sect1>
1056
1057
1058  <sect1 id="catalog-pg-authid">
1059   <title><structname>pg_authid</structname></title>
1060
1061   <indexterm zone="catalog-pg-authid">
1062    <primary>pg_authid</primary>
1063   </indexterm>
1064
1065   <para>
1066    The catalog <structname>pg_authid</structname> contains information about
1067    database authorization identifiers (roles).  A role subsumes the concepts
1068    of <quote>users</> and <quote>groups</>.  A user is essentially just a
1069    role with the <structfield>rolcanlogin</> flag set.  Any role (with or
1070    without <structfield>rolcanlogin</>) can have other roles as members; see
1071    <link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link>.
1072   </para>
1073
1074   <para>
1075    Since this catalog contains passwords, it must not be publicly readable.
1076    <link linkend="view-pg-roles"><structname>pg_roles</structname></link>
1077    is a publicly readable view on
1078    <structname>pg_authid</structname> that blanks out the password field.
1079   </para>
1080
1081   <para>
1082    <xref linkend="user-manag"> contains detailed information about user and
1083    privilege management.
1084   </para>
1085
1086   <para>
1087    Because user identities are cluster-wide,
1088    <structname>pg_authid</structname>
1089    is shared across all databases of a cluster: there is only one
1090    copy of <structname>pg_authid</structname> per cluster, not
1091    one per database.
1092   </para>
1093
1094   <table>
1095    <title><structname>pg_authid</> Columns</title>
1096
1097    <tgroup cols="3">
1098     <thead>
1099      <row>
1100       <entry>Name</entry>
1101       <entry>Type</entry>
1102       <entry>Description</entry>
1103      </row>
1104     </thead>
1105
1106     <tbody>
1107      <row>
1108       <entry><structfield>rolname</structfield></entry>
1109       <entry><type>name</type></entry>
1110       <entry>Role name</entry>
1111      </row>
1112
1113      <row>
1114       <entry><structfield>rolsuper</structfield></entry>
1115       <entry><type>bool</type></entry>
1116       <entry>Role has superuser privileges</entry>
1117      </row>
1118
1119      <row>
1120       <entry><structfield>rolinherit</structfield></entry>
1121       <entry><type>bool</type></entry>
1122       <entry>Role automatically inherits privileges of roles it is a
1123        member of</entry>
1124      </row>
1125
1126      <row>
1127       <entry><structfield>rolcreaterole</structfield></entry>
1128       <entry><type>bool</type></entry>
1129       <entry>Role can create more roles</entry>
1130      </row>
1131
1132      <row>
1133       <entry><structfield>rolcreatedb</structfield></entry>
1134       <entry><type>bool</type></entry>
1135       <entry>Role can create databases</entry>
1136      </row>
1137
1138      <row>
1139       <entry><structfield>rolcatupdate</structfield></entry>
1140       <entry><type>bool</type></entry>
1141       <entry>
1142        Role can update system catalogs directly.  (Even a superuser cannot do
1143        this unless this column is true)
1144       </entry>
1145      </row>
1146
1147      <row>
1148       <entry><structfield>rolcanlogin</structfield></entry>
1149       <entry><type>bool</type></entry>
1150       <entry>
1151        Role can log in. That is, this role can be given as the initial
1152        session authorization identifier
1153       </entry>
1154      </row>
1155
1156      <row>
1157       <entry><structfield>rolconnlimit</structfield></entry>
1158       <entry><type>int4</type></entry>
1159       <entry>
1160        For roles that can log in, this sets maximum number of concurrent
1161        connections this role can make.  -1 means no limit
1162       </entry>
1163      </row>
1164
1165      <row>
1166       <entry><structfield>rolpassword</structfield></entry>
1167       <entry><type>text</type></entry>
1168       <entry>Password (possibly encrypted); NULL if none</entry>
1169      </row>
1170
1171      <row>
1172       <entry><structfield>rolvaliduntil</structfield></entry>
1173       <entry><type>timestamptz</type></entry>
1174       <entry>Password expiry time (only used for password authentication);
1175        NULL if no expiration</entry>
1176      </row>
1177
1178      <row>
1179       <entry><structfield>rolconfig</structfield></entry>
1180       <entry><type>text[]</type></entry>
1181       <entry>Session defaults for run-time configuration variables</entry>
1182      </row>
1183     </tbody>
1184    </tgroup>
1185   </table>
1186
1187  </sect1>
1188
1189
1190  <sect1 id="catalog-pg-auth-members">
1191   <title><structname>pg_auth_members</structname></title>
1192
1193   <indexterm zone="catalog-pg-auth-members">
1194    <primary>pg_auth_members</primary>
1195   </indexterm>
1196
1197   <para>
1198    The catalog <structname>pg_auth_members</structname> shows the membership
1199    relations between roles.  Any non-circular set of relationships is allowed.
1200   </para>
1201
1202   <para>
1203    Because user identities are cluster-wide,
1204    <structname>pg_auth_members</structname>
1205    is shared across all databases of a cluster: there is only one
1206    copy of <structname>pg_auth_members</structname> per cluster, not
1207    one per database.
1208   </para>
1209
1210   <table>
1211    <title><structname>pg_auth_members</> Columns</title>
1212
1213    <tgroup cols="4">
1214     <thead>
1215      <row>
1216       <entry>Name</entry>
1217       <entry>Type</entry>
1218       <entry>References</entry>
1219       <entry>Description</entry>
1220      </row>
1221     </thead>
1222
1223     <tbody>
1224      <row>
1225       <entry><structfield>roleid</structfield></entry>
1226       <entry><type>oid</type></entry>
1227       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1228       <entry>ID of a role that has a member</entry>
1229      </row>
1230
1231      <row>
1232       <entry><structfield>member</structfield></entry>
1233       <entry><type>oid</type></entry>
1234       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1235       <entry>ID of a role that is a member of <structfield>roleid</></entry>
1236      </row>
1237
1238      <row>
1239       <entry><structfield>grantor</structfield></entry>
1240       <entry><type>oid</type></entry>
1241       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1242       <entry>ID of the role that granted this membership</entry>
1243      </row>
1244
1245      <row>
1246       <entry><structfield>admin_option</structfield></entry>
1247       <entry><type>bool</type></entry>
1248       <entry></entry>
1249       <entry>True if <structfield>member</> can grant membership in
1250        <structfield>roleid</> to others</entry>
1251      </row>
1252     </tbody>
1253    </tgroup>
1254   </table>
1255
1256  </sect1>
1257
1258
1259  <sect1 id="catalog-pg-autovacuum">
1260   <title><structname>pg_autovacuum</structname></title>
1261
1262   <indexterm zone="catalog-pg-autovacuum">
1263    <primary>pg_autovacuum</primary>
1264   </indexterm>
1265
1266   <indexterm zone="catalog-pg-autovacuum">
1267    <primary>autovacuum</primary>
1268    <secondary>table-specific configuration</secondary>
1269   </indexterm>
1270
1271   <para>
1272    The catalog <structname>pg_autovacuum</structname> stores optional
1273    per-relation configuration parameters for the autovacuum daemon.
1274    If there is an entry here for a particular relation, the given
1275    parameters will be used for autovacuuming that table.  If no entry
1276    is present, the system-wide defaults will be used. For more information
1277    about the autovacuum daemon, see <xref linkend="autovacuum">.
1278   </para>
1279
1280   <note>
1281    <para>
1282     It is likely that <structname>pg_autovacuum</structname> will disappear
1283     in a future release, with the information instead being kept in
1284     <structname>pg_class</>.<structfield>reloptions</> entries.
1285    </para>
1286   </note>
1287
1288   <table>
1289    <title><structname>pg_autovacuum</> Columns</title>
1290
1291    <tgroup cols="4">
1292     <thead>
1293      <row>
1294       <entry>Name</entry>
1295       <entry>Type</entry>
1296       <entry>References</entry>
1297       <entry>Description</entry>
1298      </row>
1299     </thead>
1300
1301     <tbody>
1302      <row>
1303       <entry><structfield>vacrelid</structfield></entry>
1304       <entry><type>oid</type></entry>
1305       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1306       <entry>The table this entry is for</entry>
1307      </row>
1308
1309      <row>
1310       <entry><structfield>enabled</structfield></entry>
1311       <entry><type>bool</type></entry>
1312       <entry></entry>
1313       <entry>If false, this table will not be autovacuumed, except
1314        to prevent transaction ID wraparound</entry>
1315      </row>
1316
1317      <row>
1318       <entry><structfield>vac_base_thresh</structfield></entry>
1319       <entry><type>integer</type></entry>
1320       <entry></entry>
1321       <entry>Minimum number of modified tuples before vacuum</entry>
1322      </row>
1323
1324      <row>
1325       <entry><structfield>vac_scale_factor</structfield></entry>
1326       <entry><type>float4</type></entry>
1327       <entry></entry>
1328       <entry>Multiplier for <structfield>reltuples</> to add to
1329        <structfield>vac_base_thresh</></entry>
1330      </row>
1331
1332      <row>
1333       <entry><structfield>anl_base_thresh</structfield></entry>
1334       <entry><type>integer</type></entry>
1335       <entry></entry>
1336       <entry>Minimum number of modified tuples before analyze</entry>
1337      </row>
1338
1339      <row>
1340       <entry><structfield>anl_scale_factor</structfield></entry>
1341       <entry><type>float4</type></entry>
1342       <entry></entry>
1343       <entry>Multiplier for <structfield>reltuples</> to add to
1344        <structfield>anl_base_thresh</></entry>
1345      </row>
1346
1347      <row>
1348       <entry><structfield>vac_cost_delay</structfield></entry>
1349       <entry><type>integer</type></entry>
1350       <entry></entry>
1351       <entry>Custom <varname>vacuum_cost_delay</> parameter</entry>
1352      </row>
1353
1354      <row>
1355       <entry><structfield>vac_cost_limit</structfield></entry>
1356       <entry><type>integer</type></entry>
1357       <entry></entry>
1358       <entry>Custom <varname>vacuum_cost_limit</> parameter</entry>
1359      </row>
1360
1361      <row>
1362       <entry><structfield>freeze_min_age</structfield></entry>
1363       <entry><type>integer</type></entry>
1364       <entry></entry>
1365       <entry>Custom <varname>vacuum_freeze_min_age</> parameter</entry>
1366      </row>
1367
1368      <row>
1369       <entry><structfield>freeze_max_age</structfield></entry>
1370       <entry><type>integer</type></entry>
1371       <entry></entry>
1372       <entry>Custom <varname>autovacuum_freeze_max_age</> parameter</entry>
1373      </row>
1374
1375      <row>
1376       <entry><structfield>freeze_table_age</structfield></entry>
1377       <entry><type>integer</type></entry>
1378       <entry></entry>
1379       <entry>Custom <varname>vacuum_freeze_table_age</> parameter</entry>
1380      </row>
1381     </tbody>
1382    </tgroup>
1383   </table>
1384
1385   <para>
1386    The autovacuum daemon will initiate a <command>VACUUM</> operation
1387    on a particular table when the number of updated or deleted tuples
1388    exceeds <structfield>vac_base_thresh</structfield> plus
1389    <structfield>vac_scale_factor</structfield> times the number of
1390    live tuples currently estimated to be in the relation.
1391    Similarly, it will initiate an <command>ANALYZE</> operation
1392    when the number of inserted, updated or deleted tuples
1393    exceeds <structfield>anl_base_thresh</structfield> plus
1394    <structfield>anl_scale_factor</structfield> times the number of
1395    live tuples currently estimated to be in the relation.
1396   </para>
1397
1398   <para>
1399    Also, the autovacuum daemon will perform a <command>VACUUM</> operation
1400    to prevent transaction ID wraparound if the table's
1401    <structname>pg_class</>.<structfield>relfrozenxid</> field attains an age
1402    of more than <structfield>freeze_max_age</> transactions, whether the table
1403    has been changed or not, even if
1404    <structname>pg_autovacuum</>.<structfield>enabled</> is set to
1405    <literal>false</> for it.  The system will launch autovacuum to perform
1406    such <command>VACUUM</>s even if autovacuum is otherwise disabled.
1407    See <xref linkend="vacuum-for-wraparound"> for more about wraparound
1408    prevention.
1409   </para>
1410
1411   <para>
1412    Any of the numerical fields can contain <literal>-1</> (or indeed
1413    any negative value) to indicate that the system-wide default should
1414    be used for this particular value.  Observe that the
1415    <structfield>vac_cost_delay</> variable inherits its default value from the
1416    <xref linkend="guc-autovacuum-vacuum-cost-delay"> configuration parameter,
1417    or from <xref linkend="guc-vacuum-cost-delay"> if the former is set to a
1418    negative value.  The same applies to <structfield>vac_cost_limit</>.
1419    Also, autovacuum will ignore attempts to set a per-table
1420    <structfield>freeze_max_age</> larger than the system-wide setting (it can
1421    only be set smaller), and the <structfield>freeze_min_age</> value will be
1422    limited to half the system-wide <xref
1423    linkend="guc-autovacuum-freeze-max-age"> setting.  Note that while you
1424    can set <structfield>freeze_max_age</> very small, or even zero, this
1425    is usually unwise since it will force frequent vacuuming.
1426   </para>
1427
1428  </sect1>
1429
1430
1431  <sect1 id="catalog-pg-cast">
1432   <title><structname>pg_cast</structname></title>
1433
1434   <indexterm zone="catalog-pg-cast">
1435    <primary>pg_cast</primary>
1436   </indexterm>
1437
1438   <para>
1439    The catalog <structname>pg_cast</structname> stores data type conversion
1440    paths, both built-in paths and those defined with
1441    <xref linkend="sql-createcast" endterm="sql-createcast-title">.
1442   </para>
1443
1444   <para>
1445    It should be noted that <structname>pg_cast</structname> does not represent
1446    every type conversion that the system knows how to perform; only those that
1447    cannot be deduced from some generic rule.  For example, casting between a
1448    domain and its base type is not explicitly represented in
1449    <structname>pg_cast</structname>.  Another important exception is that
1450    <quote>automatic I/O conversion casts</>, those performed using a data
1451    type's own I/O functions to convert to or from <type>text</> or other
1452    string types, are not explicitly represented in
1453    <structname>pg_cast</structname>.
1454   </para>
1455
1456   <table>
1457    <title><structname>pg_cast</> Columns</title>
1458
1459    <tgroup cols="4">
1460     <thead>
1461      <row>
1462       <entry>Name</entry>
1463       <entry>Type</entry>
1464       <entry>References</entry>
1465       <entry>Description</entry>
1466      </row>
1467     </thead>
1468
1469     <tbody>
1470      <row>
1471       <entry><structfield>castsource</structfield></entry>
1472       <entry><type>oid</type></entry>
1473       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1474       <entry>OID of the source data type</entry>
1475      </row>
1476
1477      <row>
1478       <entry><structfield>casttarget</structfield></entry>
1479       <entry><type>oid</type></entry>
1480       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1481       <entry>OID of the target data type</entry>
1482      </row>
1483
1484      <row>
1485       <entry><structfield>castfunc</structfield></entry>
1486       <entry><type>oid</type></entry>
1487       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
1488       <entry>
1489        The OID of the function to use to perform this cast.  Zero is
1490        stored if the cast method doesn't require a function.
1491       </entry>
1492      </row>
1493
1494      <row>
1495       <entry><structfield>castcontext</structfield></entry>
1496       <entry><type>char</type></entry>
1497       <entry></entry>
1498       <entry>
1499        Indicates what contexts the cast can be invoked in.
1500        <literal>e</> means only as an explicit cast (using
1501        <literal>CAST</> or <literal>::</> syntax).
1502        <literal>a</> means implicitly in assignment
1503        to a target column, as well as explicitly.
1504        <literal>i</> means implicitly in expressions, as well as the
1505        other cases
1506       </entry>
1507      </row>
1508      <row>
1509       <entry><structfield>castmethod</structfield></entry>
1510       <entry><type>char</type></entry>
1511       <entry></entry>
1512       <entry>
1513        Indicates how the cast is performed.
1514        <literal>f</> means that the function specified in the <structfield>castfunc</> field is used.
1515        <literal>i</> means that the input/output functions are used.
1516        <literal>b</> means that the types are binary-coercible, thus no conversion is required
1517       </entry>
1518      </row>
1519     </tbody>
1520    </tgroup>
1521   </table>
1522
1523   <para>
1524    The cast functions listed in <structname>pg_cast</structname> must
1525    always take the cast source type as their first argument type, and
1526    return the cast destination type as their result type.  A cast
1527    function can have up to three arguments.  The second argument,
1528    if present, must be type <type>integer</>; it receives the type
1529    modifier associated with the destination type, or <literal>-1</>
1530    if there is none.  The third argument,
1531    if present, must be type <type>boolean</>; it receives <literal>true</>
1532    if the cast is an explicit cast, <literal>false</> otherwise.
1533   </para>
1534
1535   <para>
1536    It is legitimate to create a <structname>pg_cast</structname> entry
1537    in which the source and target types are the same, if the associated
1538    function takes more than one argument.  Such entries represent
1539    <quote>length coercion functions</> that coerce values of the type
1540    to be legal for a particular type modifier value.
1541   </para>
1542
1543   <para>
1544    When a <structname>pg_cast</structname> entry has different source and
1545    target types and a function that takes more than one argument, it
1546    represents converting from one type to another and applying a length
1547    coercion in a single step.  When no such entry is available, coercion
1548    to a type that uses a type modifier involves two steps, one to
1549    convert between data types and a second to apply the modifier.
1550   </para>
1551  </sect1>
1552
1553  <sect1 id="catalog-pg-class">
1554   <title><structname>pg_class</structname></title>
1555
1556   <indexterm zone="catalog-pg-class">
1557    <primary>pg_class</primary>
1558   </indexterm>
1559
1560   <para>
1561    The catalog <structname>pg_class</structname> catalogs tables and most
1562    everything else that has columns or is otherwise similar to a
1563    table.  This includes indexes (but see also
1564    <structname>pg_index</structname>), sequences, views, composite types,
1565    and TOAST tables; see <structfield>relkind</>.
1566    Below, when we mean all of these
1567    kinds of objects we speak of <quote>relations</quote>.  Not all
1568    columns are meaningful for all relation types.
1569   </para>
1570
1571   <table>
1572    <title><structname>pg_class</> Columns</title>
1573
1574    <tgroup cols="4">
1575     <thead>
1576      <row>
1577       <entry>Name</entry>
1578       <entry>Type</entry>
1579       <entry>References</entry>
1580       <entry>Description</entry>
1581      </row>
1582     </thead>
1583
1584     <tbody>
1585      <row>
1586       <entry><structfield>relname</structfield></entry>
1587       <entry><type>name</type></entry>
1588       <entry></entry>
1589       <entry>Name of the table, index, view, etc.</entry>
1590      </row>
1591
1592      <row>
1593       <entry><structfield>relnamespace</structfield></entry>
1594       <entry><type>oid</type></entry>
1595       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1596       <entry>
1597        The OID of the namespace that contains this relation
1598       </entry>
1599      </row>
1600
1601      <row>
1602       <entry><structfield>reltype</structfield></entry>
1603       <entry><type>oid</type></entry>
1604       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1605       <entry>
1606        The OID of the data type that corresponds to this table's row type,
1607        if any (zero for indexes, which have no <structname>pg_type</> entry)
1608       </entry>
1609      </row>
1610
1611      <row>
1612       <entry><structfield>relowner</structfield></entry>
1613       <entry><type>oid</type></entry>
1614       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
1615       <entry>Owner of the relation</entry>
1616      </row>
1617
1618      <row>
1619       <entry><structfield>relam</structfield></entry>
1620       <entry><type>oid</type></entry>
1621       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
1622       <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1623      </row>
1624
1625      <row>
1626       <entry><structfield>relfilenode</structfield></entry>
1627       <entry><type>oid</type></entry>
1628       <entry></entry>
1629       <entry>Name of the on-disk file of this relation; 0 if none</entry>
1630      </row>
1631
1632      <row>
1633       <entry><structfield>reltablespace</structfield></entry>
1634       <entry><type>oid</type></entry>
1635       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
1636       <entry>
1637        The tablespace in which this relation is stored.  If zero,
1638        the database's default tablespace is implied.  (Not meaningful
1639        if the relation has no on-disk file.)
1640       </entry>
1641      </row>
1642
1643      <row>
1644       <entry><structfield>relpages</structfield></entry>
1645       <entry><type>int4</type></entry>
1646       <entry></entry>
1647       <entry>
1648        Size of the on-disk representation of this table in pages (of size
1649        <symbol>BLCKSZ</symbol>).  This is only an estimate used by the
1650        planner.  It is updated by <command>VACUUM</command>,
1651        <command>ANALYZE</command>, and a few DDL commands such as
1652        <command>CREATE INDEX</command>
1653       </entry>
1654      </row>
1655
1656      <row>
1657       <entry><structfield>reltuples</structfield></entry>
1658       <entry><type>float4</type></entry>
1659       <entry></entry>
1660       <entry>
1661        Number of rows in the table.  This is only an estimate used by the
1662        planner.  It is updated by <command>VACUUM</command>,
1663        <command>ANALYZE</command>, and a few DDL commands such as
1664        <command>CREATE INDEX</command>
1665       </entry>
1666      </row>
1667
1668      <row>
1669       <entry><structfield>reltoastrelid</structfield></entry>
1670       <entry><type>oid</type></entry>
1671       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1672       <entry>
1673        OID of the TOAST table associated with this table, 0 if none.  The
1674        TOAST table stores large attributes <quote>out of line</quote> in a
1675        secondary table
1676       </entry>
1677      </row>
1678
1679      <row>
1680       <entry><structfield>reltoastidxid</structfield></entry>
1681       <entry><type>oid</type></entry>
1682       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1683       <entry>
1684        For a TOAST table, the OID of its index.  0 if not a TOAST table
1685       </entry>
1686      </row>
1687
1688      <row>
1689       <entry><structfield>relhasindex</structfield></entry>
1690       <entry><type>bool</type></entry>
1691       <entry></entry>
1692       <entry>
1693        True if this is a table and it has (or recently had) any
1694        indexes. This is set by <command>CREATE INDEX</command>, but
1695        not cleared immediately by <command>DROP INDEX</command>.
1696        <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the
1697        table has no indexes
1698       </entry>
1699      </row>
1700
1701      <row>
1702       <entry><structfield>relisshared</structfield></entry>
1703       <entry><type>bool</type></entry>
1704       <entry></entry>
1705       <entry>
1706        True if this table is shared across all databases in the cluster.  Only
1707        certain system catalogs (such as <structname>pg_database</structname>)
1708        are shared
1709       </entry>
1710      </row>
1711
1712      <row>
1713       <entry><structfield>relkind</structfield></entry>
1714       <entry><type>char</type></entry>
1715       <entry></entry>
1716       <entry>
1717        <literal>r</> = ordinary table, <literal>i</> = index,
1718        <literal>S</> = sequence, <literal>v</> = view, <literal>c</> =
1719        composite type, <literal>t</> = TOAST
1720        table
1721       </entry>
1722      </row>
1723
1724      <row>
1725       <entry><structfield>relnatts</structfield></entry>
1726       <entry><type>int2</type></entry>
1727       <entry></entry>
1728       <entry>
1729        Number of user columns in the relation (system columns not
1730        counted).  There must be this many corresponding entries in
1731        <structname>pg_attribute</structname>.  See also
1732        <literal>pg_attribute.attnum</literal>
1733       </entry>
1734      </row>
1735
1736      <row>
1737       <entry><structfield>relchecks</structfield></entry>
1738       <entry><type>int2</type></entry>
1739       <entry></entry>
1740       <entry>
1741        Number of check constraints on the table; see
1742        <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> catalog
1743       </entry>
1744      </row>
1745
1746      <row>
1747       <entry><structfield>relhasoids</structfield></entry>
1748       <entry><type>bool</type></entry>
1749       <entry></entry>
1750       <entry>
1751        True if we generate an OID for each row of the relation
1752       </entry>
1753      </row>
1754
1755      <row>
1756       <entry><structfield>relhaspkey</structfield></entry>
1757       <entry><type>bool</type></entry>
1758       <entry></entry>
1759       <entry>
1760        True if the table has (or once had) a primary key
1761       </entry>
1762      </row>
1763
1764      <row>
1765       <entry><structfield>relhasrules</structfield></entry>
1766       <entry><type>bool</type></entry>
1767       <entry></entry>
1768       <entry>
1769        True if table has (or once had) rules; see
1770        <link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link> catalog
1771       </entry>
1772      </row>
1773
1774      <row>
1775       <entry><structfield>relhastriggers</structfield></entry>
1776       <entry><type>bool</type></entry>
1777       <entry></entry>
1778       <entry>
1779        True if table has (or once had) triggers; see
1780        <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link> catalog
1781       </entry>
1782      </row>
1783
1784      <row>
1785       <entry><structfield>relhassubclass</structfield></entry>
1786       <entry><type>bool</type></entry>
1787       <entry></entry>
1788       <entry>True if table has (or once had) any inheritance children</entry>
1789      </row>
1790
1791      <row>
1792       <entry><structfield>relfrozenxid</structfield></entry>
1793       <entry><type>xid</type></entry>
1794       <entry></entry>
1795       <entry>
1796        All transaction IDs before this one have been replaced with a permanent
1797        (<quote>frozen</>) transaction ID in this table.  This is used to track
1798        whether the table needs to be vacuumed in order to prevent transaction
1799        ID wraparound or to allow <literal>pg_clog</> to be shrunk.  Zero
1800        (<symbol>InvalidTransactionId</symbol>) if the relation is not a table
1801       </entry>
1802      </row>
1803
1804      <row>
1805       <entry><structfield>relacl</structfield></entry>
1806       <entry><type>aclitem[]</type></entry>
1807       <entry></entry>
1808       <entry>
1809        Access privileges; see
1810        <xref linkend="sql-grant" endterm="sql-grant-title"> and
1811        <xref linkend="sql-revoke" endterm="sql-revoke-title">
1812        for details
1813       </entry>
1814      </row>
1815
1816      <row>
1817       <entry><structfield>reloptions</structfield></entry>
1818       <entry><type>text[]</type></entry>
1819       <entry></entry>
1820       <entry>
1821        Access-method-specific options, as <quote>keyword=value</> strings
1822       </entry>
1823      </row>
1824     </tbody>
1825    </tgroup>
1826   </table>
1827  </sect1>
1828
1829  <sect1 id="catalog-pg-constraint">
1830   <title><structname>pg_constraint</structname></title>
1831
1832   <indexterm zone="catalog-pg-constraint">
1833    <primary>pg_constraint</primary>
1834   </indexterm>
1835
1836   <para>
1837    The catalog <structname>pg_constraint</structname> stores check, primary key, unique, and foreign
1838    key constraints on tables.  (Column constraints are not treated
1839    specially.  Every column constraint is equivalent to some table
1840    constraint.)  Not-null constraints are represented in the
1841    <structname>pg_attribute</> catalog.
1842   </para>
1843
1844   <para>
1845    Check constraints on domains are stored here, too.
1846   </para>
1847
1848   <table>
1849    <title><structname>pg_constraint</> Columns</title>
1850
1851    <tgroup cols="4">
1852     <thead>
1853      <row>
1854       <entry>Name</entry>
1855       <entry>Type</entry>
1856       <entry>References</entry>
1857       <entry>Description</entry>
1858      </row>
1859     </thead>
1860
1861     <tbody>
1862      <row>
1863       <entry><structfield>conname</structfield></entry>
1864       <entry><type>name</type></entry>
1865       <entry></entry>
1866       <entry>Constraint name (not necessarily unique!)</entry>
1867      </row>
1868
1869      <row>
1870       <entry><structfield>connamespace</structfield></entry>
1871       <entry><type>oid</type></entry>
1872       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
1873       <entry>
1874        The OID of the namespace that contains this constraint
1875       </entry>
1876      </row>
1877
1878      <row>
1879       <entry><structfield>contype</structfield></entry>
1880       <entry><type>char</type></entry>
1881       <entry></entry>
1882       <entry>
1883         <literal>c</> = check constraint,
1884         <literal>f</> = foreign key constraint,
1885         <literal>p</> = primary key constraint,
1886         <literal>u</> = unique constraint
1887       </entry>
1888      </row>
1889
1890      <row>
1891       <entry><structfield>condeferrable</structfield></entry>
1892       <entry><type>bool</type></entry>
1893       <entry></entry>
1894       <entry>Is the constraint deferrable?</entry>
1895      </row>
1896
1897      <row>
1898       <entry><structfield>condeferred</structfield></entry>
1899       <entry><type>bool</type></entry>
1900       <entry></entry>
1901       <entry>Is the constraint deferred by default?</entry>
1902      </row>
1903
1904      <row>
1905       <entry><structfield>conrelid</structfield></entry>
1906       <entry><type>oid</type></entry>
1907       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1908       <entry>The table this constraint is on; 0 if not a table constraint</entry>
1909      </row>
1910
1911      <row>
1912       <entry><structfield>contypid</structfield></entry>
1913       <entry><type>oid</type></entry>
1914       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
1915       <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1916      </row>
1917
1918      <row>
1919       <entry><structfield>confrelid</structfield></entry>
1920       <entry><type>oid</type></entry>
1921       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
1922       <entry>If a foreign key, the referenced table; else 0</entry>
1923      </row>
1924
1925      <row>
1926       <entry><structfield>confupdtype</structfield></entry>
1927       <entry><type>char</type></entry>
1928       <entry></entry>
1929       <entry>Foreign key update action code:
1930             <literal>a</> = no action,
1931             <literal>r</> = restrict,
1932             <literal>c</> = cascade,
1933             <literal>n</> = set null,
1934             <literal>d</> = set default
1935           </entry>
1936      </row>
1937
1938      <row>
1939       <entry><structfield>confdeltype</structfield></entry>
1940       <entry><type>char</type></entry>
1941       <entry></entry>
1942       <entry>Foreign key deletion action code:
1943             <literal>a</> = no action,
1944             <literal>r</> = restrict,
1945             <literal>c</> = cascade,
1946             <literal>n</> = set null,
1947             <literal>d</> = set default
1948           </entry>
1949      </row>
1950
1951      <row>
1952       <entry><structfield>confmatchtype</structfield></entry>
1953       <entry><type>char</type></entry>
1954       <entry></entry>
1955       <entry>Foreign key match type:
1956             <literal>f</> = full,
1957             <literal>p</> = partial,
1958             <literal>u</> = simple (unspecified)
1959           </entry>
1960      </row>
1961
1962      <row>
1963       <entry><structfield>conislocal</structfield></entry>
1964       <entry><type>bool</type></entry>
1965       <entry></entry>
1966       <entry>
1967        This constraint is defined locally in the relation.  Note that a
1968        constraint can be locally defined and inherited simultaneously
1969       </entry>
1970      </row>
1971
1972      <row>
1973       <entry><structfield>coninhcount</structfield></entry>
1974       <entry><type>int4</type></entry>
1975       <entry></entry>
1976       <entry>
1977        The number of direct ancestors this constraint has.  A constraint with
1978        a nonzero number of ancestors cannot be dropped nor renamed
1979       </entry>
1980      </row>
1981
1982      <row>
1983       <entry><structfield>conkey</structfield></entry>
1984       <entry><type>int2[]</type></entry>
1985       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1986       <entry>If a table constraint, list of columns which the constraint constrains</entry>
1987      </row>
1988
1989      <row>
1990       <entry><structfield>confkey</structfield></entry>
1991       <entry><type>int2[]</type></entry>
1992       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry>
1993       <entry>If a foreign key, list of the referenced columns</entry>
1994      </row>
1995
1996      <row>
1997       <entry><structfield>conpfeqop</structfield></entry>
1998       <entry><type>oid[]</type></entry>
1999       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2000       <entry>If a foreign key, list of the equality operators for PK = FK comparisons</entry>
2001      </row>
2002
2003      <row>
2004       <entry><structfield>conppeqop</structfield></entry>
2005       <entry><type>oid[]</type></entry>
2006       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2007       <entry>If a foreign key, list of the equality operators for PK = PK comparisons</entry>
2008      </row>
2009
2010      <row>
2011       <entry><structfield>conffeqop</structfield></entry>
2012       <entry><type>oid[]</type></entry>
2013       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</></entry>
2014       <entry>If a foreign key, list of the equality operators for FK = FK comparisons</entry>
2015      </row>
2016
2017      <row>
2018       <entry><structfield>conbin</structfield></entry>
2019       <entry><type>text</type></entry>
2020       <entry></entry>
2021       <entry>If a check constraint, an internal representation of the expression</entry>
2022      </row>
2023
2024      <row>
2025       <entry><structfield>consrc</structfield></entry>
2026       <entry><type>text</type></entry>
2027       <entry></entry>
2028       <entry>If a check constraint, a human-readable representation of the expression</entry>
2029      </row>
2030     </tbody>
2031    </tgroup>
2032   </table>
2033
2034   <note>
2035    <para>
2036     <structfield>consrc</structfield> is not updated when referenced objects
2037     change; for example, it won't track renaming of columns.  Rather than
2038     relying on this field, it's best to use <function>pg_get_constraintdef()</>
2039     to extract the definition of a check constraint.
2040    </para>
2041   </note>
2042
2043   <note>
2044    <para>
2045     <literal>pg_class.relchecks</literal> needs to agree with the
2046     number of check-constraint entries found in this table for each
2047     relation.
2048    </para>
2049   </note>
2050
2051  </sect1>
2052
2053  <sect1 id="catalog-pg-conversion">
2054   <title><structname>pg_conversion</structname></title>
2055
2056   <indexterm zone="catalog-pg-conversion">
2057    <primary>pg_conversion</primary>
2058   </indexterm>
2059
2060   <para>
2061    The catalog <structname>pg_conversion</structname> describes the
2062    available encoding conversion procedures.  See
2063    <xref linkend="sql-createconversion" endterm="sql-createconversion-title">
2064    for more information.
2065   </para>
2066
2067   <table>
2068    <title><structname>pg_conversion</> Columns</title>
2069
2070    <tgroup cols="4">
2071     <thead>
2072      <row>
2073       <entry>Name</entry>
2074       <entry>Type</entry>
2075       <entry>References</entry>
2076       <entry>Description</entry>
2077      </row>
2078     </thead>
2079
2080     <tbody>
2081      <row>
2082       <entry><structfield>conname</structfield></entry>
2083       <entry><type>name</type></entry>
2084       <entry></entry>
2085       <entry>Conversion name (unique within a namespace)</entry>
2086      </row>
2087
2088      <row>
2089       <entry><structfield>connamespace</structfield></entry>
2090       <entry><type>oid</type></entry>
2091       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
2092       <entry>
2093        The OID of the namespace that contains this conversion
2094       </entry>
2095      </row>
2096
2097      <row>
2098       <entry><structfield>conowner</structfield></entry>
2099       <entry><type>oid</type></entry>
2100       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2101       <entry>Owner of the conversion</entry>
2102      </row>
2103
2104      <row>
2105       <entry><structfield>conforencoding</structfield></entry>
2106       <entry><type>int4</type></entry>
2107       <entry></entry>
2108       <entry>Source encoding ID</entry>
2109      </row>
2110
2111      <row>
2112       <entry><structfield>contoencoding</structfield></entry>
2113       <entry><type>int4</type></entry>
2114       <entry></entry>
2115       <entry>Destination encoding ID</entry>
2116      </row>
2117
2118      <row>
2119       <entry><structfield>conproc</structfield></entry>
2120       <entry><type>regproc</type></entry>
2121       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
2122       <entry>Conversion procedure</entry>
2123      </row>
2124
2125      <row>
2126       <entry><structfield>condefault</structfield></entry>
2127       <entry><type>bool</type></entry>
2128       <entry></entry>
2129       <entry>True if this is the default conversion</entry>
2130      </row>
2131
2132     </tbody>
2133    </tgroup>
2134   </table>
2135
2136  </sect1>
2137
2138  <sect1 id="catalog-pg-database">
2139   <title><structname>pg_database</structname></title>
2140
2141   <indexterm zone="catalog-pg-database">
2142    <primary>pg_database</primary>
2143   </indexterm>
2144
2145   <para>
2146    The catalog <structname>pg_database</structname> stores information about
2147    the available databases.  Databases are created with the <xref
2148    linkend="sql-createdatabase" endterm="sql-createdatabase-title"> command.
2149    Consult <xref linkend="managing-databases"> for details about the meaning
2150    of some of the parameters.
2151   </para>
2152
2153   <para>
2154    Unlike most system catalogs, <structname>pg_database</structname>
2155    is shared across all databases of a cluster: there is only one
2156    copy of <structname>pg_database</structname> per cluster, not
2157    one per database.
2158   </para>
2159
2160   <table>
2161    <title><structname>pg_database</> Columns</title>
2162
2163    <tgroup cols="4">
2164     <thead>
2165      <row>
2166       <entry>Name</entry>
2167       <entry>Type</entry>
2168       <entry>References</entry>
2169       <entry>Description</entry>
2170      </row>
2171     </thead>
2172
2173     <tbody>
2174      <row>
2175       <entry><structfield>datname</structfield></entry>
2176       <entry><type>name</type></entry>
2177       <entry></entry>
2178       <entry>Database name</entry>
2179      </row>
2180
2181      <row>
2182       <entry><structfield>datdba</structfield></entry>
2183       <entry><type>oid</type></entry>
2184       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2185       <entry>Owner of the database, usually the user who created it</entry>
2186      </row>
2187
2188      <row>
2189       <entry><structfield>encoding</structfield></entry>
2190       <entry><type>int4</type></entry>
2191       <entry></entry>
2192       <entry>Character encoding for this database
2193           (<function>pg_encoding_to_char()</function> can translate
2194            this number to the encoding name)</entry>
2195      </row>
2196
2197      <row>
2198       <entry><structfield>datcollate</structfield></entry>
2199       <entry><type>name</type></entry>
2200       <entry></entry>
2201       <entry>LC_COLLATE for this database</entry>
2202      </row>
2203
2204      <row>
2205       <entry><structfield>datctype</structfield></entry>
2206       <entry><type>name</type></entry>
2207       <entry></entry>
2208       <entry>LC_CTYPE for this database</entry>
2209      </row>
2210
2211      <row>
2212       <entry><structfield>datistemplate</structfield></entry>
2213       <entry><type>bool</type></entry>
2214       <entry></entry>
2215       <entry>
2216        If true then this database can be used in the
2217        <literal>TEMPLATE</literal> clause of <command>CREATE
2218        DATABASE</command> to create a new database as a clone of
2219        this one
2220       </entry>
2221      </row>
2222
2223      <row>
2224       <entry><structfield>datallowconn</structfield></entry>
2225       <entry><type>bool</type></entry>
2226       <entry></entry>
2227       <entry>
2228        If false then no one can connect to this database.  This is
2229        used to protect the <literal>template0</> database from being altered
2230       </entry>
2231      </row>
2232
2233      <row>
2234       <entry><structfield>datconnlimit</structfield></entry>
2235       <entry><type>int4</type></entry>
2236       <entry></entry>
2237       <entry>
2238        Sets maximum number of concurrent connections that can be made
2239        to this database.  -1 means no limit
2240       </entry>
2241      </row>
2242
2243      <row>
2244       <entry><structfield>datlastsysoid</structfield></entry>
2245       <entry><type>oid</type></entry>
2246       <entry></entry>
2247       <entry>
2248        Last system OID in the database; useful
2249        particularly to <application>pg_dump</application>
2250       </entry>
2251      </row>
2252
2253      <row>
2254       <entry><structfield>datfrozenxid</structfield></entry>
2255       <entry><type>xid</type></entry>
2256       <entry></entry>
2257       <entry>
2258        All transaction IDs before this one have been replaced with a permanent
2259        (<quote>frozen</>) transaction ID in this database.  This is used to
2260        track whether the database needs to be vacuumed in order to prevent
2261        transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
2262        It is the minimum of the per-table
2263        <structname>pg_class</>.<structfield>relfrozenxid</> values
2264       </entry>
2265      </row>
2266
2267      <row>
2268       <entry><structfield>dattablespace</structfield></entry>
2269       <entry><type>oid</type></entry>
2270       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry>
2271       <entry>
2272        The default tablespace for the database.
2273        Within this database, all tables for which
2274        <structname>pg_class</>.<structfield>reltablespace</> is zero
2275        will be stored in this tablespace; in particular, all the non-shared
2276        system catalogs will be there
2277       </entry>
2278      </row>
2279
2280      <row>
2281       <entry><structfield>datconfig</structfield></entry>
2282       <entry><type>text[]</type></entry>
2283       <entry></entry>
2284       <entry>Session defaults for run-time configuration variables</entry>
2285      </row>
2286
2287      <row>
2288       <entry><structfield>datacl</structfield></entry>
2289       <entry><type>aclitem[]</type></entry>
2290       <entry></entry>
2291       <entry>
2292        Access privileges; see
2293        <xref linkend="sql-grant" endterm="sql-grant-title"> and
2294        <xref linkend="sql-revoke" endterm="sql-revoke-title">
2295        for details
2296       </entry>
2297      </row>
2298     </tbody>
2299    </tgroup>
2300   </table>
2301  </sect1>
2302
2303
2304  <sect1 id="catalog-pg-depend">
2305   <title><structname>pg_depend</structname></title>
2306
2307   <indexterm zone="catalog-pg-depend">
2308    <primary>pg_depend</primary>
2309   </indexterm>
2310
2311   <para>
2312    The catalog <structname>pg_depend</structname> records the dependency
2313    relationships between database objects.  This information allows
2314    <command>DROP</> commands to find which other objects must be dropped
2315    by <command>DROP CASCADE</> or prevent dropping in the <command>DROP
2316    RESTRICT</> case.
2317   </para>
2318
2319   <para>
2320    See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
2321    which performs a similar function for dependencies involving objects
2322    that are shared across a database cluster.
2323   </para>
2324
2325   <table>
2326    <title><structname>pg_depend</> Columns</title>
2327
2328    <tgroup cols="4">
2329     <thead>
2330      <row>
2331       <entry>Name</entry>
2332       <entry>Type</entry>
2333       <entry>References</entry>
2334       <entry>Description</entry>
2335      </row>
2336     </thead>
2337
2338     <tbody>
2339      <row>
2340       <entry><structfield>classid</structfield></entry>
2341       <entry><type>oid</type></entry>
2342       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2343       <entry>The OID of the system catalog the dependent object is in</entry>
2344      </row>
2345
2346      <row>
2347       <entry><structfield>objid</structfield></entry>
2348       <entry><type>oid</type></entry>
2349       <entry>any OID column</entry>
2350       <entry>The OID of the specific dependent object</entry>
2351      </row>
2352
2353      <row>
2354       <entry><structfield>objsubid</structfield></entry>
2355       <entry><type>int4</type></entry>
2356       <entry></entry>
2357       <entry>
2358        For a table column, this is the column number (the
2359        <structfield>objid</> and <structfield>classid</> refer to the
2360        table itself).  For all other object types, this column is
2361        zero
2362       </entry>
2363      </row>
2364
2365      <row>
2366       <entry><structfield>refclassid</structfield></entry>
2367       <entry><type>oid</type></entry>
2368       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2369       <entry>The OID of the system catalog the referenced object is in</entry>
2370      </row>
2371
2372      <row>
2373       <entry><structfield>refobjid</structfield></entry>
2374       <entry><type>oid</type></entry>
2375       <entry>any OID column</entry>
2376       <entry>The OID of the specific referenced object</entry>
2377      </row>
2378
2379      <row>
2380       <entry><structfield>refobjsubid</structfield></entry>
2381       <entry><type>int4</type></entry>
2382       <entry></entry>
2383       <entry>
2384        For a table column, this is the column number (the
2385        <structfield>refobjid</> and <structfield>refclassid</> refer
2386        to the table itself).  For all other object types, this column
2387        is zero
2388       </entry>
2389      </row>
2390
2391      <row>
2392       <entry><structfield>deptype</structfield></entry>
2393       <entry><type>char</type></entry>
2394       <entry></entry>
2395       <entry>
2396        A code defining the specific semantics of this dependency relationship; see text
2397       </entry>
2398      </row>
2399
2400     </tbody>
2401    </tgroup>
2402   </table>
2403
2404   <para>
2405    In all cases, a <structname>pg_depend</structname> entry indicates that the
2406    referenced object cannot be dropped without also dropping the dependent
2407    object.  However, there are several subflavors identified by
2408    <structfield>deptype</>:
2409
2410    <variablelist>
2411     <varlistentry>
2412      <term><symbol>DEPENDENCY_NORMAL</> (<literal>n</>)</term>
2413      <listitem>
2414       <para>
2415        A normal relationship between separately-created objects.  The
2416        dependent object can be dropped without affecting the
2417        referenced object.  The referenced object can only be dropped
2418        by specifying <literal>CASCADE</>, in which case the dependent
2419        object is dropped, too.  Example: a table column has a normal
2420        dependency on its data type.
2421       </para>
2422      </listitem>
2423     </varlistentry>
2424
2425     <varlistentry>
2426      <term><symbol>DEPENDENCY_AUTO</> (<literal>a</>)</term>
2427      <listitem>
2428       <para>
2429        The dependent object can be dropped separately from the
2430        referenced object, and should be automatically dropped
2431        (regardless of <literal>RESTRICT</> or <literal>CASCADE</>
2432        mode) if the referenced object is dropped.  Example: a named
2433        constraint on a table is made autodependent on the table, so
2434        that it will go away if the table is dropped.
2435       </para>
2436      </listitem>
2437     </varlistentry>
2438
2439     <varlistentry>
2440      <term><symbol>DEPENDENCY_INTERNAL</> (<literal>i</>)</term>
2441      <listitem>
2442       <para>
2443        The dependent object was created as part of creation of the
2444        referenced object, and is really just a part of its internal
2445        implementation.  A <command>DROP</> of the dependent object
2446        will be disallowed outright (we'll tell the user to issue a
2447        <command>DROP</> against the referenced object, instead).  A
2448        <command>DROP</> of the referenced object will be propagated
2449        through to drop the dependent object whether
2450        <command>CASCADE</> is specified or not.  Example: a trigger
2451        that's created to enforce a foreign-key constraint is made
2452        internally dependent on the constraint's
2453        <structname>pg_constraint</> entry.
2454       </para>
2455      </listitem>
2456     </varlistentry>
2457
2458     <varlistentry>
2459      <term><symbol>DEPENDENCY_PIN</> (<literal>p</>)</term>
2460      <listitem>
2461       <para>
2462        There is no dependent object; this type of entry is a signal
2463        that the system itself depends on the referenced object, and so
2464        that object must never be deleted.  Entries of this type are
2465        created only by <command>initdb</command>.  The columns for the
2466        dependent object contain zeroes.
2467       </para>
2468      </listitem>
2469     </varlistentry>
2470    </variablelist>
2471
2472    Other dependency flavors might be needed in future.
2473   </para>
2474
2475  </sect1>
2476
2477
2478  <sect1 id="catalog-pg-description">
2479   <title><structname>pg_description</structname></title>
2480
2481   <indexterm zone="catalog-pg-description">
2482    <primary>pg_description</primary>
2483   </indexterm>
2484
2485   <para>
2486    The catalog <structname>pg_description</> stores optional descriptions
2487    (comments) for each database object.  Descriptions can be manipulated
2488    with the <xref linkend="sql-comment" endterm="sql-comment-title"> command and viewed with
2489    <application>psql</application>'s <literal>\d</literal> commands.
2490    Descriptions of many built-in system objects are provided in the initial
2491    contents of <structname>pg_description</structname>.
2492   </para>
2493
2494   <para>
2495    See also <link linkend="catalog-pg-shdescription"><structname>pg_shdescription</structname></link>,
2496    which performs a similar function for descriptions involving objects that
2497    are shared across a database cluster.
2498   </para>
2499
2500   <table>
2501    <title><structname>pg_description</> Columns</title>
2502
2503    <tgroup cols="4">
2504     <thead>
2505      <row>
2506       <entry>Name</entry>
2507       <entry>Type</entry>
2508       <entry>References</entry>
2509       <entry>Description</entry>
2510      </row>
2511     </thead>
2512
2513     <tbody>
2514      <row>
2515       <entry><structfield>objoid</structfield></entry>
2516       <entry><type>oid</type></entry>
2517       <entry>any OID column</entry>
2518       <entry>The OID of the object this description pertains to</entry>
2519      </row>
2520
2521      <row>
2522       <entry><structfield>classoid</structfield></entry>
2523       <entry><type>oid</type></entry>
2524       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2525       <entry>The OID of the system catalog this object appears in</entry>
2526      </row>
2527
2528      <row>
2529       <entry><structfield>objsubid</structfield></entry>
2530       <entry><type>int4</type></entry>
2531       <entry></entry>
2532       <entry>
2533        For a comment on a table column, this is the column number (the
2534        <structfield>objoid</> and <structfield>classoid</> refer to
2535        the table itself).  For all other object types, this column is
2536        zero
2537       </entry>
2538      </row>
2539
2540      <row>
2541       <entry><structfield>description</structfield></entry>
2542       <entry><type>text</type></entry>
2543       <entry></entry>
2544       <entry>Arbitrary text that serves as the description of this object</entry>
2545      </row>
2546     </tbody>
2547    </tgroup>
2548   </table>
2549
2550  </sect1>
2551
2552
2553  <sect1 id="catalog-pg-enum">
2554   <title><structname>pg_enum</structname></title>
2555
2556   <indexterm zone="catalog-pg-enum">
2557    <primary>pg_enum</primary>
2558   </indexterm>
2559
2560   <para>
2561    The <structname>pg_enum</structname> catalog contains entries
2562    matching enum types to their associated values and labels. The
2563    internal representation of a given enum value is actually the OID
2564    of its associated row in <structname>pg_enum</structname>.  The
2565    OIDs for a particular enum type are guaranteed to be ordered in
2566    the way the type should sort, but there is no guarantee about the
2567    ordering of OIDs of unrelated enum types.
2568   </para>
2569
2570   <table>
2571    <title><structname>pg_enum</> Columns</title>
2572
2573    <tgroup cols="4">
2574     <thead>
2575      <row>
2576       <entry>Name</entry>
2577       <entry>Type</entry>
2578       <entry>References</entry>
2579       <entry>Description</entry>
2580      </row>
2581     </thead>
2582
2583     <tbody>
2584      <row>
2585       <entry><structfield>enumtypid</structfield></entry>
2586       <entry><type>oid</type></entry>
2587       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
2588       <entry>The OID of the <structname>pg_type</> entry owning this enum value</entry>
2589      </row>
2590
2591      <row>
2592       <entry><structfield>enumlabel</structfield></entry>
2593       <entry><type>name</type></entry>
2594       <entry></entry>
2595       <entry>The textual label for this enum value</entry>
2596      </row>
2597     </tbody>
2598    </tgroup>
2599   </table>
2600  </sect1>
2601
2602
2603  <sect1 id="catalog-pg-foreign-data-wrapper">
2604   <title><structname>pg_foreign_data_wrapper</structname></title>
2605
2606   <indexterm zone="catalog-pg-foreign-data-wrapper">
2607    <primary>pg_foreign_data_wrapper</primary>
2608   </indexterm>
2609
2610   <para>
2611    The catalog <structname>pg_foreign_data_wrapper</structname> stores
2612    foreign-data wrapper definitions.  A foreign-data wrapper is the
2613    mechanism by which external data, residing on foreign servers, is
2614    accessed.
2615   </para>
2616
2617   <table>
2618    <title><structname>pg_foreign_data_wrapper</> Columns</title>
2619
2620    <tgroup cols="4">
2621     <thead>
2622      <row>
2623       <entry>Name</entry>
2624       <entry>Type</entry>
2625       <entry>References</entry>
2626       <entry>Description</entry>
2627      </row>
2628     </thead>
2629
2630     <tbody>
2631      <row>
2632       <entry><structfield>fdwname</structfield></entry>
2633       <entry><type>name</type></entry>
2634       <entry></entry>
2635       <entry>Name of the foreign-data wrapper</entry>
2636      </row>
2637
2638      <row>
2639       <entry><structfield>fdwowner</structfield></entry>
2640       <entry><type>oid</type></entry>
2641       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2642       <entry>Owner of the foreign-data wrapper</entry>
2643      </row>
2644
2645      <row>
2646       <entry><structfield>fdwlibrary</structfield></entry>
2647       <entry><type>text</type></entry>
2648       <entry></entry>
2649       <entry>File name of the library implementing this foreign-data wrapper</entry>
2650      </row>
2651
2652      <row>
2653       <entry><structfield>fdwacl</structfield></entry>
2654       <entry><type>aclitem[]</type></entry>
2655       <entry></entry>
2656       <entry>
2657        Access privileges; see
2658        <xref linkend="sql-grant" endterm="sql-grant-title"> and
2659        <xref linkend="sql-revoke" endterm="sql-revoke-title">
2660        for details
2661       </entry>
2662      </row>
2663
2664      <row>
2665       <entry><structfield>fdwoptions</structfield></entry>
2666       <entry><type>text[]</type></entry>
2667       <entry></entry>
2668       <entry>
2669        Foreign-data wrapper specific options, as <quote>keyword=value</> strings
2670       </entry>
2671      </row>
2672     </tbody>
2673    </tgroup>
2674   </table>
2675  </sect1>
2676
2677
2678  <sect1 id="catalog-pg-foreign-server">
2679   <title><structname>pg_foreign_server</structname></title>
2680
2681   <indexterm zone="catalog-pg-foreign-server">
2682    <primary>pg_foreign_server</primary>
2683   </indexterm>
2684
2685   <para>
2686    The catalog <structname>pg_foreign_server</structname> stores
2687    foreign server definitions.  A foreign server describes the
2688    connection to a remote server, managing external data.  Foreign
2689    servers are accessed via foreign-data wrappers.
2690   </para>
2691
2692   <table>
2693    <title><structname>pg_foreign_server</> Columns</title>
2694
2695    <tgroup cols="4">
2696     <thead>
2697      <row>
2698       <entry>Name</entry>
2699       <entry>Type</entry>
2700       <entry>References</entry>
2701       <entry>Description</entry>
2702      </row>
2703     </thead>
2704
2705     <tbody>
2706      <row>
2707       <entry><structfield>srvname</structfield></entry>
2708       <entry><type>name</type></entry>
2709       <entry></entry>
2710       <entry>Name of the foreign server</entry>
2711      </row>
2712
2713      <row>
2714       <entry><structfield>srvowner</structfield></entry>
2715       <entry><type>oid</type></entry>
2716       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
2717       <entry>Owner of the foreign server</entry>
2718      </row>
2719
2720      <row>
2721       <entry><structfield>srvfdw</structfield></entry>
2722       <entry><type>oid</type></entry>
2723       <entry><literal><link linkend="catalog-pg-foreign-data-wrapper"><structname>pg_foreign_data_wrapper</structname></link>.oid</literal></entry>
2724       <entry>The OID of the foreign-data wrapper of this foreign server</entry>
2725      </row>
2726
2727      <row>
2728       <entry><structfield>srvtype</structfield></entry>
2729       <entry><type>text</type></entry>
2730       <entry></entry>
2731       <entry>Type of the server (optional)</entry>
2732      </row>
2733
2734      <row>
2735       <entry><structfield>srvversion</structfield></entry>
2736       <entry><type>text</type></entry>
2737       <entry></entry>
2738       <entry>Version of the server (optional)</entry>
2739      </row>
2740
2741      <row>
2742       <entry><structfield>srvacl</structfield></entry>
2743       <entry><type>aclitem[]</type></entry>
2744       <entry></entry>
2745       <entry>
2746        Access privileges; see
2747        <xref linkend="sql-grant" endterm="sql-grant-title"> and
2748        <xref linkend="sql-revoke" endterm="sql-revoke-title">
2749        for details
2750       </entry>
2751      </row>
2752
2753      <row>
2754       <entry><structfield>srvoptions</structfield></entry>
2755       <entry><type>text[]</type></entry>
2756       <entry></entry>
2757       <entry>
2758        Foreign server specific options, as <quote>keyword=value</> strings.
2759       </entry>
2760      </row>
2761     </tbody>
2762    </tgroup>
2763   </table>
2764  </sect1>
2765
2766
2767  <sect1 id="catalog-pg-index">
2768   <title><structname>pg_index</structname></title>
2769
2770   <indexterm zone="catalog-pg-index">
2771    <primary>pg_index</primary>
2772   </indexterm>
2773
2774   <para>
2775    The catalog <structname>pg_index</structname> contains part of the information
2776    about indexes.  The rest is mostly in
2777    <structname>pg_class</structname>.
2778   </para>
2779
2780   <table>
2781    <title><structname>pg_index</> Columns</title>
2782
2783    <tgroup cols="4">
2784     <thead>
2785      <row>
2786       <entry>Name</entry>
2787       <entry>Type</entry>
2788       <entry>References</entry>
2789       <entry>Description</entry>
2790      </row>
2791     </thead>
2792
2793     <tbody>
2794      <row>
2795       <entry><structfield>indexrelid</structfield></entry>
2796       <entry><type>oid</type></entry>
2797       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2798       <entry>The OID of the <structname>pg_class</> entry for this index</entry>
2799      </row>
2800
2801      <row>
2802       <entry><structfield>indrelid</structfield></entry>
2803       <entry><type>oid</type></entry>
2804       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2805       <entry>The OID of the <structname>pg_class</> entry for the table this index is for</entry>
2806      </row>
2807
2808      <row>
2809       <entry><structfield>indnatts</structfield></entry>
2810       <entry><type>int2</type></entry>
2811       <entry></entry>
2812       <entry>The number of columns in the index (duplicates
2813       <literal>pg_class.relnatts</literal>)</entry>
2814      </row>
2815
2816      <row>
2817       <entry><structfield>indisunique</structfield></entry>
2818       <entry><type>bool</type></entry>
2819       <entry></entry>
2820       <entry>If true, this is a unique index</entry>
2821      </row>
2822
2823      <row>
2824       <entry><structfield>indisprimary</structfield></entry>
2825       <entry><type>bool</type></entry>
2826       <entry></entry>
2827       <entry>If true, this index represents the primary key of the table
2828       (<structfield>indisunique</> should always be true when this is true)</entry>
2829      </row>
2830
2831      <row>
2832       <entry><structfield>indisclustered</structfield></entry>
2833       <entry><type>bool</type></entry>
2834       <entry></entry>
2835       <entry>If true, the table was last clustered on this index</entry>
2836      </row>
2837
2838      <row>
2839       <entry><structfield>indisvalid</structfield></entry>
2840       <entry><type>bool</type></entry>
2841       <entry></entry>
2842       <entry>
2843        If true, the index is currently valid for queries.  False means the
2844        index is possibly incomplete: it must still be modified by
2845        <command>INSERT</>/<command>UPDATE</> operations, but it cannot safely
2846        be used for queries. If it is unique, the uniqueness property is not
2847        true either
2848       </entry>
2849      </row>
2850
2851      <row>
2852       <entry><structfield>indcheckxmin</structfield></entry>
2853       <entry><type>bool</type></entry>
2854       <entry></entry>
2855       <entry>
2856        If true, queries must not use the index until the <structfield>xmin</>
2857        of this <structname>pg_index</> row is below their TransactionXmin
2858        event horizon, because the table may contain broken HOT chains with
2859        incompatible rows that they can see
2860       </entry>
2861      </row>
2862
2863      <row>
2864       <entry><structfield>indisready</structfield></entry>
2865       <entry><type>bool</type></entry>
2866       <entry></entry>
2867       <entry>
2868        If true, the index is currently ready for inserts.  False means the
2869        index must be ignored by <command>INSERT</>/<command>UPDATE</>
2870        operations
2871       </entry>
2872      </row>
2873
2874      <row>
2875       <entry><structfield>indkey</structfield></entry>
2876       <entry><type>int2vector</type></entry>
2877       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
2878       <entry>
2879        This is an array of <structfield>indnatts</structfield> values that
2880        indicate which table columns this index indexes.  For example a value
2881        of <literal>1 3</literal> would mean that the first and the third table
2882        columns make up the index key.  A zero in this array indicates that the
2883        corresponding index attribute is an expression over the table columns,
2884        rather than a simple column reference
2885       </entry>
2886      </row>
2887
2888      <row>
2889       <entry><structfield>indclass</structfield></entry>
2890       <entry><type>oidvector</type></entry>
2891       <entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
2892       <entry>
2893        For each column in the index key, this contains the OID of
2894        the operator class to use.  See
2895        <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link> for details
2896       </entry>
2897      </row>
2898
2899      <row>
2900       <entry><structfield>indoption</structfield></entry>
2901       <entry><type>int2vector</type></entry>
2902       <entry></entry>
2903       <entry>
2904        This is an array of <structfield>indnatts</structfield> values that
2905        store per-column flag bits.  The meaning of the bits is defined by
2906        the index's access method
2907       </entry>
2908      </row>
2909
2910      <row>
2911       <entry><structfield>indexprs</structfield></entry>
2912       <entry><type>text</type></entry>
2913       <entry></entry>
2914       <entry>Expression trees (in <function>nodeToString()</function> representation)
2915       for index attributes that are not simple column references.  This is a
2916       list with one element for each zero entry in <structfield>indkey</>.
2917       NULL if all index attributes are simple references</entry>
2918      </row>
2919
2920      <row>
2921       <entry><structfield>indpred</structfield></entry>
2922       <entry><type>text</type></entry>
2923       <entry></entry>
2924       <entry>Expression tree (in <function>nodeToString()</function> representation)
2925       for partial index predicate.  NULL if not a partial index</entry>
2926      </row>
2927     </tbody>
2928    </tgroup>
2929   </table>
2930
2931  </sect1>
2932
2933
2934  <sect1 id="catalog-pg-inherits">
2935   <title><structname>pg_inherits</structname></title>
2936
2937   <indexterm zone="catalog-pg-inherits">
2938    <primary>pg_inherits</primary>
2939   </indexterm>
2940
2941   <para>
2942    The catalog <structname>pg_inherits</> records information about
2943    table inheritance hierarchies.  There is one entry for each direct
2944    child table in the database.  (Indirect inheritance can be determined
2945    by following chains of entries.)
2946   </para>
2947
2948   <table>
2949    <title><structname>pg_inherits</> Columns</title>
2950
2951    <tgroup cols="4">
2952     <thead>
2953      <row>
2954       <entry>Name</entry>
2955       <entry>Type</entry>
2956       <entry>References</entry>
2957       <entry>Description</entry>
2958      </row>
2959     </thead>
2960
2961     <tbody>
2962      <row>
2963       <entry><structfield>inhrelid</structfield></entry>
2964       <entry><type>oid</type></entry>
2965       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2966       <entry>
2967        The OID of the child table
2968       </entry>
2969      </row>
2970
2971      <row>
2972       <entry><structfield>inhparent</structfield></entry>
2973       <entry><type>oid</type></entry>
2974       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
2975       <entry>
2976        The OID of the parent table
2977       </entry>
2978      </row>
2979
2980      <row>
2981       <entry><structfield>inhseqno</structfield></entry>
2982       <entry><type>int4</type></entry>
2983       <entry></entry>
2984       <entry>
2985        If there is more than one direct parent for a child table (multiple
2986        inheritance), this number tells the order in which the
2987        inherited columns are to be arranged.  The count starts at 1
2988       </entry>
2989      </row>
2990     </tbody>
2991    </tgroup>
2992   </table>
2993
2994  </sect1>
2995
2996
2997  <sect1 id="catalog-pg-language">
2998   <title><structname>pg_language</structname></title>
2999
3000   <indexterm zone="catalog-pg-language">
3001    <primary>pg_language</primary>
3002   </indexterm>
3003
3004   <para>
3005    The catalog <structname>pg_language</structname> registers
3006    languages in which you can write functions or stored procedures.
3007    See <xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
3008    and <xref linkend="xplang"> for more information about language handlers.
3009   </para>
3010
3011   <table>
3012    <title><structname>pg_language</> Columns</title>
3013
3014    <tgroup cols="4">
3015     <thead>
3016      <row>
3017       <entry>Name</entry>
3018       <entry>Type</entry>
3019       <entry>References</entry>
3020       <entry>Description</entry>
3021      </row>
3022     </thead>
3023
3024     <tbody>
3025      <row>
3026       <entry><structfield>lanname</structfield></entry>
3027       <entry><type>name</type></entry>
3028       <entry></entry>
3029       <entry>Name of the language</entry>
3030      </row>
3031
3032      <row>
3033       <entry><structfield>lanowner</structfield></entry>
3034       <entry><type>oid</type></entry>
3035       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3036       <entry>Owner of the language</entry>
3037      </row>
3038
3039      <row>
3040       <entry><structfield>lanispl</structfield></entry>
3041       <entry><type>bool</type></entry>
3042       <entry></entry>
3043       <entry>
3044        This is false for internal languages (such as
3045        <acronym>SQL</acronym>) and true for user-defined languages.
3046        Currently, <application>pg_dump</application> still uses this
3047        to determine which languages need to be dumped, but this might be
3048        replaced by a different mechanism in the future
3049       </entry>
3050      </row>
3051
3052      <row>
3053       <entry><structfield>lanpltrusted</structfield></entry>
3054       <entry><type>bool</type></entry>
3055       <entry></entry>
3056       <entry>
3057        True if this is a trusted language, which means that it is believed
3058        not to grant access to anything outside the normal SQL execution
3059        environment.  Only superusers can create functions in untrusted
3060        languages
3061       </entry>
3062      </row>
3063
3064      <row>
3065       <entry><structfield>lanplcallfoid</structfield></entry>
3066       <entry><type>oid</type></entry>
3067       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3068       <entry>
3069        For noninternal languages this references the language
3070        handler, which is a special function that is responsible for
3071        executing all functions that are written in the particular
3072        language
3073       </entry>
3074      </row>
3075
3076      <row>
3077       <entry><structfield>lanvalidator</structfield></entry>
3078       <entry><type>oid</type></entry>
3079       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3080       <entry>
3081        This references a language validator function that is responsible
3082        for checking the syntax and validity of new functions when they
3083        are created.  Zero if no validator is provided
3084       </entry>
3085      </row>
3086
3087      <row>
3088       <entry><structfield>lanacl</structfield></entry>
3089       <entry><type>aclitem[]</type></entry>
3090       <entry></entry>
3091       <entry>
3092        Access privileges; see
3093        <xref linkend="sql-grant" endterm="sql-grant-title"> and
3094        <xref linkend="sql-revoke" endterm="sql-revoke-title">
3095        for details
3096       </entry>
3097      </row>
3098     </tbody>
3099    </tgroup>
3100   </table>
3101
3102  </sect1>
3103
3104
3105  <sect1 id="catalog-pg-largeobject">
3106   <title><structname>pg_largeobject</structname></title>
3107
3108   <indexterm zone="catalog-pg-largeobject">
3109    <primary>pg_largeobject</primary>
3110   </indexterm>
3111
3112   <para>
3113    The catalog <structname>pg_largeobject</structname> holds the data making up
3114    <quote>large objects</quote>.  A large object is identified by an
3115    OID assigned when it is created.  Each large object is broken into
3116    segments or <quote>pages</> small enough to be conveniently stored as rows
3117    in <structname>pg_largeobject</structname>.
3118    The amount of data per page is defined to be <symbol>LOBLKSIZE</> (which is currently
3119    <literal>BLCKSZ/4</>, or typically 2 kB).
3120   </para>
3121
3122   <table>
3123    <title><structname>pg_largeobject</> Columns</title>
3124
3125    <tgroup cols="3">
3126     <thead>
3127      <row>
3128       <entry>Name</entry>
3129       <entry>Type</entry>
3130       <entry>Description</entry>
3131      </row>
3132     </thead>
3133
3134     <tbody>
3135      <row>
3136       <entry><structfield>loid</structfield></entry>
3137       <entry><type>oid</type></entry>
3138       <entry>Identifier of the large object that includes this page</entry>
3139      </row>
3140
3141      <row>
3142       <entry><structfield>pageno</structfield></entry>
3143       <entry><type>int4</type></entry>
3144       <entry>Page number of this page within its large object
3145       (counting from zero)</entry>
3146      </row>
3147
3148      <row>
3149       <entry><structfield>data</structfield></entry>
3150       <entry><type>bytea</type></entry>
3151       <entry>
3152        Actual data stored in the large object.
3153        This will never be more than <symbol>LOBLKSIZE</> bytes and might be less
3154       </entry>
3155      </row>
3156     </tbody>
3157    </tgroup>
3158   </table>
3159
3160   <para>
3161    Each row of <structname>pg_largeobject</structname> holds data
3162    for one page of a large object, beginning at
3163    byte offset (<literal>pageno * LOBLKSIZE</>) within the object.  The implementation
3164    allows sparse storage: pages might be missing, and might be shorter than
3165    <literal>LOBLKSIZE</> bytes even if they are not the last page of the object.
3166    Missing regions within a large object read as zeroes.
3167   </para>
3168
3169  </sect1>
3170
3171
3172  <sect1 id="catalog-pg-listener">
3173   <title><structname>pg_listener</structname></title>
3174
3175   <indexterm zone="catalog-pg-listener">
3176    <primary>pg_listener</primary>
3177   </indexterm>
3178
3179   <para>
3180    The catalog <structname>pg_listener</structname> supports the
3181    <xref linkend="sql-listen" endterm="sql-listen-title"> and
3182    <xref linkend="sql-notify" endterm="sql-notify-title">
3183    commands.  A listener creates an entry in
3184    <structname>pg_listener</structname> for each notification name
3185    it is listening for.  A notifier scans <structname>pg_listener</structname>
3186    and updates each matching entry to show that a notification has occurred.
3187    The notifier also sends a signal (using the PID recorded in the table)
3188    to awaken the listener from sleep.
3189   </para>
3190
3191   <table>
3192    <title><structname>pg_listener</> 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>relname</structfield></entry>
3207       <entry><type>name</type></entry>
3208       <entry>
3209        Notify condition name.  (The name need not match any actual
3210        relation in the database; the name <structfield>relname</> is historical.)
3211       </entry>
3212      </row>
3213
3214      <row>
3215       <entry><structfield>listenerpid</structfield></entry>
3216       <entry><type>int4</type></entry>
3217       <entry>PID of the server process that created this entry</entry>
3218      </row>
3219
3220      <row>
3221       <entry><structfield>notification</structfield></entry>
3222       <entry><type>int4</type></entry>
3223       <entry>
3224        Zero if no event is pending for this listener.  If an event is
3225        pending, the PID of the server process that sent the notification
3226       </entry>
3227      </row>
3228     </tbody>
3229    </tgroup>
3230   </table>
3231
3232  </sect1>
3233
3234
3235  <sect1 id="catalog-pg-namespace">
3236   <title><structname>pg_namespace</structname></title>
3237
3238   <indexterm zone="catalog-pg-namespace">
3239    <primary>pg_namespace</primary>
3240   </indexterm>
3241
3242   <para>
3243    The catalog <structname>pg_namespace</> stores namespaces.
3244    A namespace is the structure underlying SQL schemas: each namespace
3245    can have a separate collection of relations, types, etc. without name
3246    conflicts.
3247   </para>
3248
3249   <table>
3250    <title><structname>pg_namespace</> Columns</title>
3251
3252    <tgroup cols="4">
3253     <thead>
3254      <row>
3255       <entry>Name</entry>
3256       <entry>Type</entry>
3257       <entry>References</entry>
3258       <entry>Description</entry>
3259      </row>
3260     </thead>
3261
3262     <tbody>
3263      <row>
3264       <entry><structfield>nspname</structfield></entry>
3265       <entry><type>name</type></entry>
3266       <entry></entry>
3267       <entry>Name of the namespace</entry>
3268      </row>
3269
3270      <row>
3271       <entry><structfield>nspowner</structfield></entry>
3272       <entry><type>oid</type></entry>
3273       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3274       <entry>Owner of the namespace</entry>
3275      </row>
3276
3277      <row>
3278       <entry><structfield>nspacl</structfield></entry>
3279       <entry><type>aclitem[]</type></entry>
3280       <entry></entry>
3281       <entry>
3282        Access privileges; see
3283        <xref linkend="sql-grant" endterm="sql-grant-title"> and
3284        <xref linkend="sql-revoke" endterm="sql-revoke-title">
3285        for details
3286       </entry>
3287      </row>
3288     </tbody>
3289    </tgroup>
3290   </table>
3291
3292  </sect1>
3293
3294
3295  <sect1 id="catalog-pg-opclass">
3296   <title><structname>pg_opclass</structname></title>
3297
3298   <indexterm zone="catalog-pg-opclass">
3299    <primary>pg_opclass</primary>
3300   </indexterm>
3301
3302   <para>
3303    The catalog <structname>pg_opclass</structname> defines
3304    index access method operator classes.  Each operator class defines
3305    semantics for index columns of a particular data type and a particular
3306    index access method.  An operator class essentially specifies that a
3307    particular operator family is applicable to a particular indexable column
3308    data type.  The set of operators from the family that are actually usable
3309    with the indexed column are whichever ones accept the column's data type
3310    as their lefthand input.
3311   </para>
3312
3313   <para>
3314    Operator classes are described at length in <xref linkend="xindex">.
3315   </para>
3316
3317   <table>
3318    <title><structname>pg_opclass</> Columns</title>
3319
3320    <tgroup cols="4">
3321     <thead>
3322      <row>
3323       <entry>Name</entry>
3324       <entry>Type</entry>
3325       <entry>References</entry>
3326       <entry>Description</entry>
3327      </row>
3328     </thead>
3329     <tbody>
3330
3331      <row>
3332       <entry><structfield>opcmethod</structfield></entry>
3333       <entry><type>oid</type></entry>
3334       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3335       <entry>Index access method operator class is for</entry>
3336      </row>
3337
3338      <row>
3339       <entry><structfield>opcname</structfield></entry>
3340       <entry><type>name</type></entry>
3341       <entry></entry>
3342       <entry>Name of this operator class</entry>
3343      </row>
3344
3345      <row>
3346       <entry><structfield>opcnamespace</structfield></entry>
3347       <entry><type>oid</type></entry>
3348       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3349       <entry>Namespace of this operator class</entry>
3350      </row>
3351
3352      <row>
3353       <entry><structfield>opcowner</structfield></entry>
3354       <entry><type>oid</type></entry>
3355       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3356       <entry>Owner of the operator class</entry>
3357      </row>
3358
3359      <row>
3360       <entry><structfield>opcfamily</structfield></entry>
3361       <entry><type>oid</type></entry>
3362       <entry><literal><link linkend="catalog-pg-opfamily"><structname>pg_opfamily</structname></link>.oid</literal></entry>
3363       <entry>Operator family containing the operator class</entry>
3364      </row>
3365
3366      <row>
3367       <entry><structfield>opcintype</structfield></entry>
3368       <entry><type>oid</type></entry>
3369       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3370       <entry>Data type that the operator class indexes</entry>
3371      </row>
3372
3373      <row>
3374       <entry><structfield>opcdefault</structfield></entry>
3375       <entry><type>bool</type></entry>
3376       <entry></entry>
3377       <entry>True if this operator class is the default for <structfield>opcintype</></entry>
3378      </row>
3379
3380      <row>
3381       <entry><structfield>opckeytype</structfield></entry>
3382       <entry><type>oid</type></entry>
3383       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3384       <entry>Type of data stored in index, or zero if same as <structfield>opcintype</></entry>
3385      </row>
3386
3387     </tbody>
3388    </tgroup>
3389   </table>
3390
3391   <para>
3392    An operator class's <structfield>opcmethod</> must match the
3393    <structname>opfmethod</> of its containing operator family.
3394    Also, there must be no more than one <structname>pg_opclass</structname>
3395    row having <structname>opcdefault</> true for any given combination of
3396    <structname>opcmethod</> and <structname>opcintype</>.
3397   </para>
3398
3399  </sect1>
3400
3401
3402  <sect1 id="catalog-pg-operator">
3403   <title><structname>pg_operator</structname></title>
3404
3405   <indexterm zone="catalog-pg-operator">
3406    <primary>pg_operator</primary>
3407   </indexterm>
3408
3409   <para>
3410    The catalog <structname>pg_operator</> stores information about operators.
3411    See <xref linkend="sql-createoperator" endterm="sql-createoperator-title">
3412    and <xref linkend="xoper"> for more information.
3413   </para>
3414
3415   <table>
3416    <title><structname>pg_operator</> Columns</title>
3417
3418    <tgroup cols="4">
3419     <thead>
3420      <row>
3421       <entry>Name</entry>
3422       <entry>Type</entry>
3423       <entry>References</entry>
3424       <entry>Description</entry>
3425      </row>
3426     </thead>
3427
3428     <tbody>
3429      <row>
3430       <entry><structfield>oprname</structfield></entry>
3431       <entry><type>name</type></entry>
3432       <entry></entry>
3433       <entry>Name of the operator</entry>
3434      </row>
3435
3436      <row>
3437       <entry><structfield>oprnamespace</structfield></entry>
3438       <entry><type>oid</type></entry>
3439       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3440       <entry>
3441        The OID of the namespace that contains this operator
3442       </entry>
3443      </row>
3444
3445      <row>
3446       <entry><structfield>oprowner</structfield></entry>
3447       <entry><type>oid</type></entry>
3448       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3449       <entry>Owner of the operator</entry>
3450      </row>
3451
3452      <row>
3453       <entry><structfield>oprkind</structfield></entry>
3454       <entry><type>char</type></entry>
3455       <entry></entry>
3456       <entry>
3457        <literal>b</> = infix (<quote>both</quote>), <literal>l</> = prefix
3458        (<quote>left</quote>), <literal>r</> = postfix (<quote>right</quote>)
3459       </entry>
3460      </row>
3461
3462      <row>
3463       <entry><structfield>oprcanmerge</structfield></entry>
3464       <entry><type>bool</type></entry>
3465       <entry></entry>
3466       <entry>This operator supports merge joins</entry>
3467      </row>
3468
3469      <row>
3470       <entry><structfield>oprcanhash</structfield></entry>
3471       <entry><type>bool</type></entry>
3472       <entry></entry>
3473       <entry>This operator supports hash joins</entry>
3474      </row>
3475
3476      <row>
3477       <entry><structfield>oprleft</structfield></entry>
3478       <entry><type>oid</type></entry>
3479       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3480       <entry>Type of the left operand</entry>
3481      </row>
3482
3483      <row>
3484       <entry><structfield>oprright</structfield></entry>
3485       <entry><type>oid</type></entry>
3486       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3487       <entry>Type of the right operand</entry>
3488      </row>
3489
3490      <row>
3491       <entry><structfield>oprresult</structfield></entry>
3492       <entry><type>oid</type></entry>
3493       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3494       <entry>Type of the result</entry>
3495      </row>
3496
3497      <row>
3498       <entry><structfield>oprcom</structfield></entry>
3499       <entry><type>oid</type></entry>
3500       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3501       <entry>Commutator of this operator, if any</entry>
3502      </row>
3503
3504      <row>
3505       <entry><structfield>oprnegate</structfield></entry>
3506       <entry><type>oid</type></entry>
3507       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
3508       <entry>Negator of this operator, if any</entry>
3509      </row>
3510
3511      <row>
3512       <entry><structfield>oprcode</structfield></entry>
3513       <entry><type>regproc</type></entry>
3514       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3515       <entry>Function that implements this operator</entry>
3516      </row>
3517
3518      <row>
3519       <entry><structfield>oprrest</structfield></entry>
3520       <entry><type>regproc</type></entry>
3521       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3522       <entry>Restriction selectivity estimation function for this operator</entry>
3523      </row>
3524
3525      <row>
3526       <entry><structfield>oprjoin</structfield></entry>
3527       <entry><type>regproc</type></entry>
3528       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
3529       <entry>Join selectivity estimation function for this operator</entry>
3530      </row>
3531     </tbody>
3532    </tgroup>
3533   </table>
3534
3535   <para>
3536    Unused column contain zeroes. For example, <structfield>oprleft</structfield>
3537    is zero for a prefix operator.
3538   </para>
3539
3540  </sect1>
3541
3542
3543  <sect1 id="catalog-pg-opfamily">
3544   <title><structname>pg_opfamily</structname></title>
3545
3546   <indexterm zone="catalog-pg-opfamily">
3547    <primary>pg_opfamily</primary>
3548   </indexterm>
3549
3550   <para>
3551    The catalog <structname>pg_opfamily</structname> defines operator families.
3552    Each operator family is a collection of operators and associated
3553    support routines that implement the semantics specified for a particular
3554    index access method.  Furthermore, the operators in a family are all
3555    <quote>compatible</>, in a way that is specified by the access method.
3556    The operator family concept allows cross-data-type operators to be used
3557    with indexes and to be reasoned about using knowledge of access method
3558    semantics.
3559   </para>
3560
3561   <para>
3562    Operator families are described at length in <xref linkend="xindex">.
3563   </para>
3564
3565   <table>
3566    <title><structname>pg_opfamily</> Columns</title>
3567
3568    <tgroup cols="4">
3569     <thead>
3570      <row>
3571       <entry>Name</entry>
3572       <entry>Type</entry>
3573       <entry>References</entry>
3574       <entry>Description</entry>
3575      </row>
3576     </thead>
3577     <tbody>
3578
3579      <row>
3580       <entry><structfield>opfmethod</structfield></entry>
3581       <entry><type>oid</type></entry>
3582       <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry>
3583       <entry>Index access method operator family is for</entry>
3584      </row>
3585
3586      <row>
3587       <entry><structfield>opfname</structfield></entry>
3588       <entry><type>name</type></entry>
3589       <entry></entry>
3590       <entry>Name of this operator family</entry>
3591      </row>
3592
3593      <row>
3594       <entry><structfield>opfnamespace</structfield></entry>
3595       <entry><type>oid</type></entry>
3596       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3597       <entry>Namespace of this operator family</entry>
3598      </row>
3599
3600      <row>
3601       <entry><structfield>opfowner</structfield></entry>
3602       <entry><type>oid</type></entry>
3603       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3604       <entry>Owner of the operator family</entry>
3605      </row>
3606
3607     </tbody>
3608    </tgroup>
3609   </table>
3610
3611   <para>
3612    The majority of the information defining an operator family is not in its
3613    <structname>pg_opfamily</structname> row, but in the associated rows in
3614    <link linkend="catalog-pg-amop"><structname>pg_amop</structname></link>,
3615    <link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link>,
3616    and
3617    <link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.
3618   </para>
3619
3620  </sect1>
3621
3622
3623  <sect1 id="catalog-pg-pltemplate">
3624   <title><structname>pg_pltemplate</structname></title>
3625
3626   <indexterm zone="catalog-pg-pltemplate">
3627    <primary>pg_pltemplate</primary>
3628   </indexterm>
3629
3630   <para>
3631    The catalog <structname>pg_pltemplate</structname> stores
3632    <quote>template</> information for procedural languages.
3633    A template for a language allows the language to be created in a
3634    particular database by a simple <command>CREATE LANGUAGE</> command,
3635    with no need to specify implementation details.
3636   </para>
3637
3638   <para>
3639    Unlike most system catalogs, <structname>pg_pltemplate</structname>
3640    is shared across all databases of a cluster: there is only one
3641    copy of <structname>pg_pltemplate</structname> per cluster, not
3642    one per database.  This allows the information to be accessible in
3643    each database as it is needed.
3644   </para>
3645
3646   <table>
3647    <title><structname>pg_pltemplate</> Columns</title>
3648
3649    <tgroup cols="3">
3650     <thead>
3651      <row>
3652       <entry>Name</entry>
3653       <entry>Type</entry>
3654       <entry>Description</entry>
3655      </row>
3656     </thead>
3657
3658     <tbody>
3659      <row>
3660       <entry><structfield>tmplname</structfield></entry>
3661       <entry><type>name</type></entry>
3662       <entry>Name of the language this template is for</entry>
3663      </row>
3664
3665      <row>
3666       <entry><structfield>tmpltrusted</structfield></entry>
3667       <entry><type>boolean</type></entry>
3668       <entry>True if language is considered trusted</entry>
3669      </row>
3670
3671      <row>
3672       <entry><structfield>tmpldbacreate</structfield></entry>
3673       <entry><type>boolean</type></entry>
3674       <entry>True if language may be created by a database owner</entry>
3675      </row>
3676
3677      <row>
3678       <entry><structfield>tmplhandler</structfield></entry>
3679       <entry><type>text</type></entry>
3680       <entry>Name of call handler function</entry>
3681      </row>
3682
3683      <row>
3684       <entry><structfield>tmplvalidator</structfield></entry>
3685       <entry><type>text</type></entry>
3686       <entry>Name of validator function, or NULL if none</entry>
3687      </row>
3688
3689      <row>
3690       <entry><structfield>tmpllibrary</structfield></entry>
3691       <entry><type>text</type></entry>
3692       <entry>Path of shared library that implements language</entry>
3693      </row>
3694
3695      <row>
3696       <entry><structfield>tmplacl</structfield></entry>
3697       <entry><type>aclitem[]</type></entry>
3698       <entry>Access privileges for template (not yet used)</entry>
3699      </row>
3700
3701     </tbody>
3702    </tgroup>
3703   </table>
3704
3705   <para>
3706    There are not currently any commands that manipulate procedural language
3707    templates; to change the built-in information, a superuser must modify
3708    the table using ordinary <command>INSERT</command>, <command>DELETE</command>,
3709    or <command>UPDATE</command> commands.  It is likely that a future
3710    release of <productname>PostgreSQL</productname> will offer
3711    commands to change the entries in a cleaner fashion.
3712   </para>
3713
3714   <para>
3715    When implemented, the <structfield>tmplacl</structfield> field will provide
3716    access control for the template itself (i.e., the right to create a
3717    language using it), not for the languages created from the template.
3718   </para>
3719
3720  </sect1>
3721
3722
3723  <sect1 id="catalog-pg-proc">
3724   <title><structname>pg_proc</structname></title>
3725
3726   <indexterm zone="catalog-pg-proc">
3727    <primary>pg_proc</primary>
3728   </indexterm>
3729
3730   <para>
3731    The catalog <structname>pg_proc</> stores information about functions (or procedures).
3732    See <xref linkend="sql-createfunction" endterm="sql-createfunction-title">
3733    and <xref linkend="xfunc"> for more information.
3734   </para>
3735
3736   <para>
3737    The table contains data for aggregate functions as well as plain functions.
3738    If <structfield>proisagg</structfield> is true, there should be a matching
3739    row in <structfield>pg_aggregate</structfield>.
3740   </para>
3741
3742   <table>
3743    <title><structname>pg_proc</> Columns</title>
3744
3745    <tgroup cols="4">
3746     <thead>
3747      <row>
3748       <entry>Name</entry>
3749       <entry>Type</entry>
3750       <entry>References</entry>
3751       <entry>Description</entry>
3752      </row>
3753     </thead>
3754
3755     <tbody>
3756      <row>
3757       <entry><structfield>proname</structfield></entry>
3758       <entry><type>name</type></entry>
3759       <entry></entry>
3760       <entry>Name of the function</entry>
3761      </row>
3762
3763      <row>
3764       <entry><structfield>pronamespace</structfield></entry>
3765       <entry><type>oid</type></entry>
3766       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
3767       <entry>
3768        The OID of the namespace that contains this function
3769       </entry>
3770      </row>
3771
3772      <row>
3773       <entry><structfield>proowner</structfield></entry>
3774       <entry><type>oid</type></entry>
3775       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
3776       <entry>Owner of the function</entry>
3777      </row>
3778
3779      <row>
3780       <entry><structfield>prolang</structfield></entry>
3781       <entry><type>oid</type></entry>
3782       <entry><literal><link linkend="catalog-pg-language"><structname>pg_language</structname></link>.oid</literal></entry>
3783       <entry>Implementation language or call interface of this function</entry>
3784      </row>
3785
3786      <row>
3787       <entry><structfield>procost</structfield></entry>
3788       <entry><type>float4</type></entry>
3789       <entry></entry>
3790       <entry>Estimated execution cost (in units of
3791        <xref linkend="guc-cpu-operator-cost">); if <structfield>proretset</>,
3792        this is cost per row returned</entry>
3793      </row>
3794
3795      <row>
3796       <entry><structfield>prorows</structfield></entry>
3797       <entry><type>float4</type></entry>
3798       <entry></entry>
3799       <entry>Estimated number of result rows (zero if not <structfield>proretset</>)</entry>
3800      </row>
3801
3802      <row>
3803       <entry><structfield>provariadic</structfield></entry>
3804       <entry><type>oid</type></entry>
3805       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3806       <entry>Data type of the variadic array parameter's elements,
3807        or zero if the function does not have a variadic parameter</entry>
3808      </row>
3809
3810      <row>
3811       <entry><structfield>proisagg</structfield></entry>
3812       <entry><type>bool</type></entry>
3813       <entry></entry>
3814       <entry>Function is an aggregate function</entry>
3815      </row>
3816
3817      <row>
3818       <entry><structfield>proiswindow</structfield></entry>
3819       <entry><type>bool</type></entry>
3820       <entry></entry>
3821       <entry>Function is a window function</entry>
3822      </row>
3823
3824      <row>
3825       <entry><structfield>prosecdef</structfield></entry>
3826       <entry><type>bool</type></entry>
3827       <entry></entry>
3828       <entry>Function is a security definer (i.e., a <quote>setuid</>
3829       function)</entry>
3830      </row>
3831
3832      <row>
3833       <entry><structfield>proisstrict</structfield></entry>
3834       <entry><type>bool</type></entry>
3835       <entry></entry>
3836       <entry>
3837        Function returns null if any call argument is null.  In that
3838        case the function won't actually be called at all.  Functions
3839        that are not <quote>strict</quote> must be prepared to handle
3840        null inputs
3841       </entry>
3842      </row>
3843
3844      <row>
3845       <entry><structfield>proretset</structfield></entry>
3846       <entry><type>bool</type></entry>
3847       <entry></entry>
3848       <entry>Function returns a set (i.e., multiple values of the specified
3849       data type)</entry>
3850      </row>
3851
3852      <row>
3853       <entry><structfield>provolatile</structfield></entry>
3854       <entry><type>char</type></entry>
3855       <entry></entry>
3856       <entry>
3857        <structfield>provolatile</structfield> tells whether the function's
3858        result depends only on its input arguments, or is affected by outside
3859        factors.
3860        It is <literal>i</literal> for <quote>immutable</> functions,
3861        which always deliver the same result for the same inputs.
3862        It is <literal>s</literal> for <quote>stable</> functions,
3863        whose results (for fixed inputs) do not change within a scan.
3864        It is <literal>v</literal> for <quote>volatile</> functions,
3865        whose results might change at any time.  (Use <literal>v</literal> also
3866        for functions with side-effects, so that calls to them cannot get
3867        optimized away.)
3868       </entry>
3869      </row>
3870
3871      <row>
3872       <entry><structfield>pronargs</structfield></entry>
3873       <entry><type>int2</type></entry>
3874       <entry></entry>
3875       <entry>Number of input arguments</entry>
3876      </row>
3877
3878      <row>
3879       <entry><structfield>pronargdefaults</structfield></entry>
3880       <entry><type>int2</type></entry>
3881       <entry></entry>
3882       <entry>Number of arguments that have defaults</entry>
3883      </row>
3884
3885      <row>
3886       <entry><structfield>prorettype</structfield></entry>
3887       <entry><type>oid</type></entry>
3888       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3889       <entry>Data type of the return value</entry>
3890      </row>
3891
3892      <row>
3893       <entry><structfield>proargtypes</structfield></entry>
3894       <entry><type>oidvector</type></entry>
3895       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3896       <entry>
3897        An array with the data types of the function arguments.  This includes
3898        only input arguments (including <literal>INOUT</literal> and
3899        <literal>VARIADIC</> arguments), and thus represents
3900        the call signature of the function
3901       </entry>
3902      </row>
3903
3904      <row>
3905       <entry><structfield>proallargtypes</structfield></entry>
3906       <entry><type>oid[]</type></entry>
3907       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
3908       <entry>
3909        An array with the data types of the function arguments.  This includes
3910        all arguments (including <literal>OUT</literal> and
3911        <literal>INOUT</literal> arguments); however, if all the
3912        arguments are <literal>IN</literal> arguments, this field will be null.
3913        Note that subscripting is 1-based, whereas for historical reasons
3914        <structfield>proargtypes</> is subscripted from 0
3915       </entry>
3916      </row>
3917
3918      <row>
3919       <entry><structfield>proargmodes</structfield></entry>
3920       <entry><type>char[]</type></entry>
3921       <entry></entry>
3922       <entry>
3923         An array with the modes of the function arguments, encoded as
3924         <literal>i</literal> for <literal>IN</> arguments,
3925         <literal>o</literal> for <literal>OUT</> arguments,
3926         <literal>b</literal> for <literal>INOUT</> arguments,
3927         <literal>v</literal> for <literal>VARIADIC</> arguments,
3928         <literal>t</literal> for <literal>TABLE</> arguments.
3929         If all the arguments are <literal>IN</literal> arguments,
3930         this field will be null.
3931         Note that subscripts correspond to positions of
3932         <structfield>proallargtypes</> not <structfield>proargtypes</>
3933       </entry>
3934      </row>
3935
3936      <row>
3937       <entry><structfield>proargnames</structfield></entry>
3938       <entry><type>text[]</type></entry>
3939       <entry></entry>
3940       <entry>
3941         An array with the names of the function arguments.
3942         Arguments without a name are set to empty strings in the array.
3943         If none of the arguments have a name, this field will be null.
3944         Note that subscripts correspond to positions of
3945         <structfield>proallargtypes</> not <structfield>proargtypes</>
3946       </entry>
3947      </row>
3948
3949      <row>
3950       <entry><structfield>proargdefaults</structfield></entry>
3951       <entry><type>text</type></entry>
3952       <entry></entry>
3953       <entry>
3954        Expression trees (in <function>nodeToString()</function> representation)
3955        for default values.  This is a list with
3956        <structfield>pronargdefaults</> elements, corresponding to the last
3957        <replaceable>N</> <emphasis>input</> arguments (i.e., the last
3958        <replaceable>N</> <structfield>proargtypes</> positions).
3959        If none of the arguments have defaults, this field will be null
3960       </entry>
3961      </row>
3962
3963      <row>
3964       <entry><structfield>prosrc</structfield></entry>
3965       <entry><type>text</type></entry>
3966       <entry></entry>
3967       <entry>
3968        This tells the function handler how to invoke the function.  It
3969        might be the actual source code of the function for interpreted
3970        languages, a link symbol, a file name, or just about anything
3971        else, depending on the implementation language/call convention
3972       </entry>
3973      </row>
3974
3975      <row>
3976       <entry><structfield>probin</structfield></entry>
3977       <entry><type>bytea</type></entry>
3978       <entry></entry>
3979       <entry>
3980        Additional information about how to invoke the function.
3981        Again, the interpretation is language-specific
3982       </entry>
3983      </row>
3984
3985      <row>
3986       <entry><structfield>proconfig</structfield></entry>
3987       <entry><type>text[]</type></entry>
3988       <entry></entry>
3989       <entry>Function's local settings for run-time configuration variables</entry>
3990      </row>
3991
3992      <row>
3993       <entry><structfield>proacl</structfield></entry>
3994       <entry><type>aclitem[]</type></entry>
3995       <entry></entry>
3996       <entry>
3997        Access privileges; see
3998        <xref linkend="sql-grant" endterm="sql-grant-title"> and
3999        <xref linkend="sql-revoke" endterm="sql-revoke-title">
4000        for details
4001       </entry>
4002      </row>
4003     </tbody>
4004    </tgroup>
4005   </table>
4006
4007   <para>
4008    For compiled functions, both built-in and dynamically loaded,
4009    <structfield>prosrc</structfield> contains the function's C-language
4010    name (link symbol).  For all other currently-known language types,
4011    <structfield>prosrc</structfield> contains the function's source
4012    text.  <structfield>probin</structfield> is unused except for
4013    dynamically-loaded C functions, for which it gives the name of the
4014    shared library file containing the function.
4015   </para>
4016
4017  </sect1>
4018
4019  <sect1 id="catalog-pg-rewrite">
4020   <title><structname>pg_rewrite</structname></title>
4021
4022   <indexterm zone="catalog-pg-rewrite">
4023    <primary>pg_rewrite</primary>
4024   </indexterm>
4025
4026   <para>
4027    The catalog <structname>pg_rewrite</structname> stores rewrite rules for tables and views.
4028   </para>
4029
4030   <table>
4031    <title><structname>pg_rewrite</> Columns</title>
4032
4033    <tgroup cols="4">
4034     <thead>
4035      <row>
4036       <entry>Name</entry>
4037       <entry>Type</entry>
4038       <entry>References</entry>
4039       <entry>Description</entry>
4040      </row>
4041     </thead>
4042
4043     <tbody>
4044      <row>
4045       <entry><structfield>rulename</structfield></entry>
4046       <entry><type>name</type></entry>
4047       <entry></entry>
4048       <entry>Rule name</entry>
4049      </row>
4050
4051      <row>
4052       <entry><structfield>ev_class</structfield></entry>
4053       <entry><type>oid</type></entry>
4054       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4055       <entry>The table this rule is for</entry>
4056      </row>
4057
4058      <row>
4059       <entry><structfield>ev_attr</structfield></entry>
4060       <entry><type>int2</type></entry>
4061       <entry></entry>
4062       <entry>The column this rule is for (currently, always zero to
4063       indicate the whole table)</entry>
4064      </row>
4065
4066      <row>
4067       <entry><structfield>ev_type</structfield></entry>
4068       <entry><type>char</type></entry>
4069       <entry></entry>
4070       <entry>
4071        Event type that the rule is for: 1 = <command>SELECT</>, 2 =
4072        <command>UPDATE</>, 3 = <command>INSERT</>, 4 =
4073        <command>DELETE</>
4074       </entry>
4075      </row>
4076
4077      <row>
4078       <entry><structfield>ev_enabled</structfield></entry>
4079       <entry><type>char</type></entry>
4080       <entry></entry>
4081       <entry>
4082        Controls in which <xref linkend="guc-session-replication-role"> modes
4083        the rule fires.
4084        <literal>O</> = rule fires in <quote>origin</> and <quote>local</> modes,
4085        <literal>D</> = rule is disabled,
4086        <literal>R</> = rule fires in <quote>replica</> mode,
4087        <literal>A</> = rule fires always.
4088       </entry>
4089      </row>
4090
4091      <row>
4092       <entry><structfield>is_instead</structfield></entry>
4093       <entry><type>bool</type></entry>
4094       <entry></entry>
4095       <entry>True if the rule is an <literal>INSTEAD</literal> rule</entry>
4096      </row>
4097
4098      <row>
4099       <entry><structfield>ev_qual</structfield></entry>
4100       <entry><type>text</type></entry>
4101       <entry></entry>
4102       <entry>
4103        Expression tree (in the form of a
4104        <function>nodeToString()</function> representation) for the
4105        rule's qualifying condition
4106       </entry>
4107      </row>
4108
4109      <row>
4110       <entry><structfield>ev_action</structfield></entry>
4111       <entry><type>text</type></entry>
4112       <entry></entry>
4113       <entry>
4114        Query tree (in the form of a
4115        <function>nodeToString()</function> representation) for the
4116        rule's action
4117       </entry>
4118      </row>
4119     </tbody>
4120    </tgroup>
4121   </table>
4122
4123   <note>
4124    <para>
4125     <literal>pg_class.relhasrules</literal>
4126     must be true if a table has any rules in this catalog.
4127    </para>
4128   </note>
4129
4130  </sect1>
4131
4132
4133  <sect1 id="catalog-pg-shdepend">
4134   <title><structname>pg_shdepend</structname></title>
4135
4136   <indexterm zone="catalog-pg-shdepend">
4137    <primary>pg_shdepend</primary>
4138   </indexterm>
4139
4140   <para>
4141    The catalog <structname>pg_shdepend</structname> records the
4142    dependency relationships between database objects and shared objects,
4143    such as roles.  This information allows
4144    <productname>PostgreSQL</productname> to ensure that those objects are
4145    unreferenced before attempting to delete them.
4146   </para>
4147
4148   <para>
4149    See also <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>,
4150    which performs a similar function for dependencies involving objects
4151    within a single database.
4152   </para>
4153
4154   <para>
4155    Unlike most system catalogs, <structname>pg_shdepend</structname>
4156    is shared across all databases of a cluster: there is only one
4157    copy of <structname>pg_shdepend</structname> per cluster, not
4158    one per database.
4159   </para>
4160
4161   <table>
4162    <title><structname>pg_shdepend</> Columns</title>
4163
4164    <tgroup cols="4">
4165     <thead>
4166      <row>
4167       <entry>Name</entry>
4168       <entry>Type</entry>
4169       <entry>References</entry>
4170       <entry>Description</entry>
4171      </row>
4172     </thead>
4173
4174     <tbody>
4175      <row>
4176       <entry><structfield>dbid</structfield></entry>
4177       <entry><type>oid</type></entry>
4178       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
4179       <entry>The OID of the database the dependent object is in,
4180        or zero for a shared object</entry>
4181      </row>
4182
4183      <row>
4184       <entry><structfield>classid</structfield></entry>
4185       <entry><type>oid</type></entry>
4186       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4187       <entry>The OID of the system catalog the dependent object is in</entry>
4188      </row>
4189
4190      <row>
4191       <entry><structfield>objid</structfield></entry>
4192       <entry><type>oid</type></entry>
4193       <entry>any OID column</entry>
4194       <entry>The OID of the specific dependent object</entry>
4195      </row>
4196
4197      <row>
4198       <entry><structfield>objsubid</structfield></entry>
4199       <entry><type>int4</type></entry>
4200       <entry></entry>
4201       <entry>
4202        For a table column, this is the column number (the
4203        <structfield>objid</> and <structfield>classid</> refer to the
4204        table itself).  For all other object types, this column is zero
4205       </entry>
4206      </row>
4207
4208      <row>
4209       <entry><structfield>refclassid</structfield></entry>
4210       <entry><type>oid</type></entry>
4211       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4212       <entry>The OID of the system catalog the referenced object is in
4213        (must be a shared catalog)</entry>
4214      </row>
4215
4216      <row>
4217       <entry><structfield>refobjid</structfield></entry>
4218       <entry><type>oid</type></entry>
4219       <entry>any OID column</entry>
4220       <entry>The OID of the specific referenced object</entry>
4221      </row>
4222
4223      <row>
4224       <entry><structfield>deptype</structfield></entry>
4225       <entry><type>char</type></entry>
4226       <entry></entry>
4227       <entry>
4228        A code defining the specific semantics of this dependency relationship; see text
4229       </entry>
4230      </row>
4231
4232     </tbody>
4233    </tgroup>
4234   </table>
4235
4236   <para>
4237    In all cases, a <structname>pg_shdepend</structname> entry indicates that
4238    the referenced object cannot be dropped without also dropping the dependent
4239    object.  However, there are several subflavors identified by
4240    <structfield>deptype</>:
4241
4242    <variablelist>
4243     <varlistentry>
4244      <term><symbol>SHARED_DEPENDENCY_OWNER</> (<literal>o</>)</term>
4245      <listitem>
4246       <para>
4247        The referenced object (which must be a role) is the owner of the
4248        dependent object.
4249       </para>
4250      </listitem>
4251     </varlistentry>
4252
4253     <varlistentry>
4254      <term><symbol>SHARED_DEPENDENCY_ACL</> (<literal>a</>)</term>
4255      <listitem>
4256       <para>
4257        The referenced object (which must be a role) is mentioned in the
4258        ACL (access control list, i.e., privileges list) of the
4259        dependent object.  (A <symbol>SHARED_DEPENDENCY_ACL</> entry is
4260        not made for the owner of the object, since the owner will have
4261        a <symbol>SHARED_DEPENDENCY_OWNER</> entry anyway.)
4262       </para>
4263      </listitem>
4264     </varlistentry>
4265
4266     <varlistentry>
4267      <term><symbol>SHARED_DEPENDENCY_PIN</> (<literal>p</>)</term>
4268      <listitem>
4269       <para>
4270        There is no dependent object; this type of entry is a signal
4271        that the system itself depends on the referenced object, and so
4272        that object must never be deleted.  Entries of this type are
4273        created only by <command>initdb</command>.  The columns for the
4274        dependent object contain zeroes.
4275       </para>
4276      </listitem>
4277     </varlistentry>
4278    </variablelist>
4279
4280    Other dependency flavors might be needed in future.  Note in particular
4281    that the current definition only supports roles as referenced objects.
4282   </para>
4283
4284  </sect1>
4285
4286  <sect1 id="catalog-pg-shdescription">
4287   <title><structname>pg_shdescription</structname></title>
4288
4289   <indexterm zone="catalog-pg-shdescription">
4290    <primary>pg_shdescription</primary>
4291   </indexterm>
4292
4293   <para>
4294    The catalog <structname>pg_shdescription</structname> stores optional
4295    descriptions (comments) for shared database objects.  Descriptions can be
4296    manipulated with the <xref linkend="sql-comment"
4297    endterm="sql-comment-title"> command and viewed with
4298    <application>psql</application>'s <literal>\d</literal> commands.
4299   </para>
4300
4301   <para>
4302    See also <link linkend="catalog-pg-description"><structname>pg_description</structname></link>,
4303    which performs a similar function for descriptions involving objects
4304    within a single database.
4305   </para>
4306
4307   <para>
4308    Unlike most system catalogs, <structname>pg_shdescription</structname>
4309    is shared across all databases of a cluster: there is only one
4310    copy of <structname>pg_shdescription</structname> per cluster, not
4311    one per database.
4312   </para>
4313
4314   <table>
4315    <title><structname>pg_shdescription</> Columns</title>
4316
4317    <tgroup cols="4">
4318     <thead>
4319      <row>
4320       <entry>Name</entry>
4321       <entry>Type</entry>
4322       <entry>References</entry>
4323       <entry>Description</entry>
4324      </row>
4325     </thead>
4326
4327     <tbody>
4328      <row>
4329       <entry><structfield>objoid</structfield></entry>
4330       <entry><type>oid</type></entry>
4331       <entry>any OID column</entry>
4332       <entry>The OID of the object this description pertains to</entry>
4333      </row>
4334
4335      <row>
4336       <entry><structfield>classoid</structfield></entry>
4337       <entry><type>oid</type></entry>
4338       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4339       <entry>The OID of the system catalog this object appears in</entry>
4340      </row>
4341
4342      <row>
4343       <entry><structfield>description</structfield></entry>
4344       <entry><type>text</type></entry>
4345       <entry></entry>
4346       <entry>Arbitrary text that serves as the description of this object</entry>
4347      </row>
4348     </tbody>
4349    </tgroup>
4350   </table>
4351
4352  </sect1>
4353
4354
4355  <sect1 id="catalog-pg-statistic">
4356   <title><structname>pg_statistic</structname></title>
4357
4358   <indexterm zone="catalog-pg-statistic">
4359    <primary>pg_statistic</primary>
4360   </indexterm>
4361
4362   <para>
4363    The catalog <structname>pg_statistic</structname> stores
4364    statistical data about the contents of the database.  Entries are
4365    created by <xref linkend="sql-analyze" endterm="sql-analyze-title">
4366    and subsequently used by the query planner.  There is one entry for
4367    each table column that has been analyzed.  Note that all the
4368    statistical data is inherently approximate, even assuming that it
4369    is up-to-date.
4370   </para>
4371
4372   <para>
4373    <structname>pg_statistic</structname> also stores statistical data about
4374    the values of index expressions.  These are described as if they were
4375    actual data columns; in particular, <structfield>starelid</structfield>
4376    references the index.  No entry is made for an ordinary non-expression
4377    index column, however, since it would be redundant with the entry
4378    for the underlying table column.
4379   </para>
4380
4381   <para>
4382    Since different kinds of statistics might be appropriate for different
4383    kinds of data, <structname>pg_statistic</structname> is designed not
4384    to assume very much about what sort of statistics it stores.  Only
4385    extremely general statistics (such as nullness) are given dedicated
4386    columns in <structname>pg_statistic</structname>.  Everything else
4387    is stored in <quote>slots</quote>, which are groups of associated columns
4388    whose content is identified by a code number in one of the slot's columns.
4389    For more information see
4390    <filename>src/include/catalog/pg_statistic.h</filename>.
4391   </para>
4392
4393   <para>
4394    <structname>pg_statistic</structname> should not be readable by the
4395    public, since even statistical information about a table's contents
4396    might be considered sensitive.  (Example: minimum and maximum values
4397    of a salary column might be quite interesting.)
4398    <link linkend="view-pg-stats"><structname>pg_stats</structname></link>
4399    is a publicly readable view on
4400    <structname>pg_statistic</structname> that only exposes information
4401    about those tables that are readable by the current user.
4402   </para>
4403
4404   <table>
4405    <title><structname>pg_statistic</> Columns</title>
4406
4407    <tgroup cols="4">
4408     <thead>
4409      <row>
4410       <entry>Name</entry>
4411       <entry>Type</entry>
4412       <entry>References</entry>
4413       <entry>Description</entry>
4414      </row>
4415     </thead>
4416
4417     <tbody>
4418      <row>
4419       <entry><structfield>starelid</structfield></entry>
4420       <entry><type>oid</type></entry>
4421       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4422       <entry>The table or index that the described column belongs to</entry>
4423      </row>
4424
4425      <row>
4426       <entry><structfield>staattnum</structfield></entry>
4427       <entry><type>int2</type></entry>
4428       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
4429       <entry>The number of the described column</entry>
4430      </row>
4431
4432      <row>
4433       <entry><structfield>stanullfrac</structfield></entry>
4434       <entry><type>float4</type></entry>
4435       <entry></entry>
4436       <entry>The fraction of the column's entries that are null</entry>
4437      </row>
4438
4439      <row>
4440       <entry><structfield>stawidth</structfield></entry>
4441       <entry><type>int4</type></entry>
4442       <entry></entry>
4443       <entry>The average stored width, in bytes, of nonnull entries</entry>
4444      </row>
4445
4446      <row>
4447       <entry><structfield>stadistinct</structfield></entry>
4448       <entry><type>float4</type></entry>
4449       <entry></entry>
4450       <entry>The number of distinct nonnull data values in the column.
4451       A value greater than zero is the actual number of distinct values.
4452       A value less than zero is the negative of a fraction of the number
4453       of rows in the table (for example, a column in which values appear about
4454       twice on the average could be represented by <structfield>stadistinct</> = -0.5).
4455       A zero value means the number of distinct values is unknown
4456       </entry>
4457      </row>
4458
4459      <row>
4460       <entry><structfield>stakind<replaceable>N</></structfield></entry>
4461       <entry><type>int2</type></entry>
4462       <entry></entry>
4463       <entry>
4464        A code number indicating the kind of statistics stored in the
4465        <replaceable>N</>th <quote>slot</quote> of the
4466        <structname>pg_statistic</structname> row
4467       </entry>
4468      </row>
4469
4470      <row>
4471       <entry><structfield>staop<replaceable>N</></structfield></entry>
4472       <entry><type>oid</type></entry>
4473       <entry><literal><link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.oid</literal></entry>
4474       <entry>
4475        An operator used to derive the statistics stored in the
4476        <replaceable>N</>th <quote>slot</quote>.  For example, a
4477        histogram slot would show the <literal>&lt;</literal> operator
4478        that defines the sort order of the data
4479       </entry>
4480      </row>
4481
4482      <row>
4483       <entry><structfield>stanumbers<replaceable>N</></structfield></entry>
4484       <entry><type>float4[]</type></entry>
4485       <entry></entry>
4486       <entry>
4487        Numerical statistics of the appropriate kind for the
4488        <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4489        kind does not involve numerical values
4490       </entry>
4491      </row>
4492
4493      <row>
4494       <entry><structfield>stavalues<replaceable>N</></structfield></entry>
4495       <entry><type>anyarray</type></entry>
4496       <entry></entry>
4497       <entry>
4498        Column data values of the appropriate kind for the
4499        <replaceable>N</>th <quote>slot</quote>, or NULL if the slot
4500        kind does not store any data values.  Each array's element
4501        values are actually of the specific column's data type, so there
4502        is no way to define these columns' type more specifically than
4503        <type>anyarray</>
4504       </entry>
4505      </row>
4506     </tbody>
4507    </tgroup>
4508   </table>
4509
4510  </sect1>
4511
4512
4513  <sect1 id="catalog-pg-tablespace">
4514   <title><structname>pg_tablespace</structname></title>
4515
4516   <indexterm zone="catalog-pg-tablespace">
4517    <primary>pg_tablespace</primary>
4518   </indexterm>
4519
4520   <para>
4521    The catalog <structname>pg_tablespace</structname> stores information
4522    about the available tablespaces.  Tables can be placed in particular
4523    tablespaces to aid administration of disk layout.
4524   </para>
4525
4526   <para>
4527    Unlike most system catalogs, <structname>pg_tablespace</structname>
4528    is shared across all databases of a cluster: there is only one
4529    copy of <structname>pg_tablespace</structname> per cluster, not
4530    one per database.
4531   </para>
4532
4533   <table>
4534    <title><structname>pg_tablespace</> Columns</title>
4535
4536    <tgroup cols="4">
4537     <thead>
4538      <row>
4539       <entry>Name</entry>
4540       <entry>Type</entry>
4541       <entry>References</entry>
4542       <entry>Description</entry>
4543      </row>
4544     </thead>
4545
4546     <tbody>
4547      <row>
4548       <entry><structfield>spcname</structfield></entry>
4549       <entry><type>name</type></entry>
4550       <entry></entry>
4551       <entry>Tablespace name</entry>
4552      </row>
4553
4554      <row>
4555       <entry><structfield>spcowner</structfield></entry>
4556       <entry><type>oid</type></entry>
4557       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4558       <entry>Owner of the tablespace, usually the user who created it</entry>
4559      </row>
4560
4561      <row>
4562       <entry><structfield>spclocation</structfield></entry>
4563       <entry><type>text</type></entry>
4564       <entry></entry>
4565       <entry>Location (directory path) of the tablespace</entry>
4566      </row>
4567
4568      <row>
4569       <entry><structfield>spcacl</structfield></entry>
4570       <entry><type>aclitem[]</type></entry>
4571       <entry></entry>
4572       <entry>
4573        Access privileges; see
4574        <xref linkend="sql-grant" endterm="sql-grant-title"> and
4575        <xref linkend="sql-revoke" endterm="sql-revoke-title">
4576        for details
4577       </entry>
4578      </row>
4579     </tbody>
4580    </tgroup>
4581   </table>
4582  </sect1>
4583
4584
4585  <sect1 id="catalog-pg-trigger">
4586   <title><structname>pg_trigger</structname></title>
4587
4588   <indexterm zone="catalog-pg-trigger">
4589    <primary>pg_trigger</primary>
4590   </indexterm>
4591
4592   <para>
4593    The catalog <structname>pg_trigger</structname> stores triggers on tables.
4594    See <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title">
4595    for more information.
4596   </para>
4597
4598   <table>
4599    <title><structname>pg_trigger</> Columns</title>
4600
4601    <tgroup cols="4">
4602     <thead>
4603      <row>
4604       <entry>Name</entry>
4605       <entry>Type</entry>
4606       <entry>References</entry>
4607       <entry>Description</entry>
4608      </row>
4609     </thead>
4610
4611     <tbody>
4612      <row>
4613       <entry><structfield>tgrelid</structfield></entry>
4614       <entry><type>oid</type></entry>
4615       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4616       <entry>The table this trigger is on</entry>
4617      </row>
4618
4619      <row>
4620       <entry><structfield>tgname</structfield></entry>
4621       <entry><type>name</type></entry>
4622       <entry></entry>
4623       <entry>Trigger name (must be unique among triggers of same table)</entry>
4624      </row>
4625
4626      <row>
4627       <entry><structfield>tgfoid</structfield></entry>
4628       <entry><type>oid</type></entry>
4629       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
4630       <entry>The function to be called</entry>
4631      </row>
4632
4633      <row>
4634       <entry><structfield>tgtype</structfield></entry>
4635       <entry><type>int2</type></entry>
4636       <entry></entry>
4637       <entry>Bit mask identifying trigger conditions</entry>
4638      </row>
4639
4640      <row>
4641       <entry><structfield>tgenabled</structfield></entry>
4642       <entry><type>char</type></entry>
4643       <entry></entry>
4644       <entry>
4645        Controls in which <xref linkend="guc-session-replication-role"> modes
4646        the trigger fires.
4647        <literal>O</> = trigger fires in <quote>origin</> and <quote>local</> modes,
4648        <literal>D</> = trigger is disabled,
4649        <literal>R</> = trigger fires in <quote>replica</> mode,
4650        <literal>A</> = trigger fires always.
4651       </entry>
4652      </row>
4653
4654      <row>
4655       <entry><structfield>tgisconstraint</structfield></entry>
4656       <entry><type>bool</type></entry>
4657       <entry></entry>
4658       <entry>True if trigger is a <quote>constraint trigger</></entry>
4659      </row>
4660
4661      <row>
4662       <entry><structfield>tgconstrname</structfield></entry>
4663       <entry><type>name</type></entry>
4664       <entry></entry>
4665       <entry>Constraint name, if a constraint trigger</entry>
4666      </row>
4667
4668      <row>
4669       <entry><structfield>tgconstrrelid</structfield></entry>
4670       <entry><type>oid</type></entry>
4671       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
4672       <entry>The table referenced by a referential integrity constraint</entry>
4673      </row>
4674
4675      <row>
4676       <entry><structfield>tgconstraint</structfield></entry>
4677       <entry><type>oid</type></entry>
4678       <entry><literal><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.oid</literal></entry>
4679       <entry>The <structname>pg_constraint</> entry owning the trigger, if any</entry>
4680      </row>
4681
4682      <row>
4683       <entry><structfield>tgdeferrable</structfield></entry>
4684       <entry><type>bool</type></entry>
4685       <entry></entry>
4686       <entry>True if constraint trigger is deferrable</entry>
4687      </row>
4688
4689      <row>
4690       <entry><structfield>tginitdeferred</structfield></entry>
4691       <entry><type>bool</type></entry>
4692       <entry></entry>
4693       <entry>True if constraint trigger is initially deferred</entry>
4694      </row>
4695
4696      <row>
4697       <entry><structfield>tgnargs</structfield></entry>
4698       <entry><type>int2</type></entry>
4699       <entry></entry>
4700       <entry>Number of argument strings passed to trigger function</entry>
4701      </row>
4702
4703      <row>
4704       <entry><structfield>tgattr</structfield></entry>
4705       <entry><type>int2vector</type></entry>
4706       <entry></entry>
4707       <entry>Currently unused</entry>
4708      </row>
4709
4710      <row>
4711       <entry><structfield>tgargs</structfield></entry>
4712       <entry><type>bytea</type></entry>
4713       <entry></entry>
4714       <entry>Argument strings to pass to trigger, each NULL-terminated</entry>
4715      </row>
4716     </tbody>
4717    </tgroup>
4718   </table>
4719
4720   <note>
4721    <para>
4722     When <structfield>tgconstraint</> is nonzero,
4723     <structfield>tgisconstraint</> must be true, and
4724     <structfield>tgconstrname</>, <structfield>tgconstrrelid</>,
4725     <structfield>tgdeferrable</>, <structfield>tginitdeferred</> are redundant
4726     with the referenced <structname>pg_constraint</> entry.  The reason we
4727     keep these fields is that we support <quote>stand-alone</> constraint
4728     triggers with no corresponding <structname>pg_constraint</> entry.
4729    </para>
4730   </note>
4731
4732   <note>
4733    <para>
4734     <literal>pg_class.relhastriggers</literal>
4735     must be true if a table has any triggers in this catalog.
4736    </para>
4737   </note>
4738
4739  </sect1>
4740
4741
4742  <sect1 id="catalog-pg-ts-config">
4743   <title><structname>pg_ts_config</structname></title>
4744
4745   <indexterm zone="catalog-pg-ts-config">
4746    <primary>pg_ts_config</primary>
4747   </indexterm>
4748
4749   <para>
4750    The <structname>pg_ts_config</structname> catalog contains entries
4751    representing text search configurations.  A configuration specifies
4752    a particular text search parser and a list of dictionaries to use
4753    for each of the parser's output token types.  The parser is shown
4754    in the <structname>pg_ts_config</structname> entry, but the
4755    token-to-dictionary mapping is defined by subsidiary entries in <link
4756    linkend="catalog-pg-ts-config-map"><structname>pg_ts_config_map</structname></link>.
4757   </para>
4758
4759   <para>
4760    <productname>PostgreSQL</productname>'s text search features are
4761    described at length in <xref linkend="textsearch">.
4762   </para>
4763
4764   <table>
4765    <title><structname>pg_ts_config</> Columns</title>
4766
4767    <tgroup cols="4">
4768     <thead>
4769      <row>
4770       <entry>Name</entry>
4771       <entry>Type</entry>
4772       <entry>References</entry>
4773       <entry>Description</entry>
4774      </row>
4775     </thead>
4776
4777     <tbody>
4778      <row>
4779       <entry><structfield>cfgname</structfield></entry>
4780       <entry><type>name</type></entry>
4781       <entry></entry>
4782       <entry>Text search configuration name</entry>
4783      </row>
4784
4785      <row>
4786       <entry><structfield>cfgnamespace</structfield></entry>
4787       <entry><type>oid</type></entry>
4788       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4789       <entry>
4790        The OID of the namespace that contains this configuration
4791       </entry>
4792      </row>
4793
4794      <row>
4795       <entry><structfield>cfgowner</structfield></entry>
4796       <entry><type>oid</type></entry>
4797       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4798       <entry>Owner of the configuration</entry>
4799      </row>
4800
4801      <row>
4802       <entry><structfield>cfgparser</structfield></entry>
4803       <entry><type>oid</type></entry>
4804       <entry><literal><link linkend="catalog-pg-ts-parser"><structname>pg_ts_parser</structname></link>.oid</literal></entry>
4805       <entry>The OID of the text search parser for this configuration</entry>
4806      </row>
4807     </tbody>
4808    </tgroup>
4809   </table>
4810  </sect1>
4811
4812
4813  <sect1 id="catalog-pg-ts-config-map">
4814   <title><structname>pg_ts_config_map</structname></title>
4815
4816   <indexterm zone="catalog-pg-ts-config-map">
4817    <primary>pg_ts_config_map</primary>
4818   </indexterm>
4819
4820   <para>
4821    The <structname>pg_ts_config_map</structname> catalog contains entries
4822    showing which text search dictionaries should be consulted, and in
4823    what order, for each output token type of each text search configuration's
4824    parser.
4825   </para>
4826
4827   <para>
4828    <productname>PostgreSQL</productname>'s text search features are
4829    described at length in <xref linkend="textsearch">.
4830   </para>
4831
4832   <table>
4833    <title><structname>pg_ts_config_map</> Columns</title>
4834
4835    <tgroup cols="4">
4836     <thead>
4837      <row>
4838       <entry>Name</entry>
4839       <entry>Type</entry>
4840       <entry>References</entry>
4841       <entry>Description</entry>
4842      </row>
4843     </thead>
4844
4845     <tbody>
4846      <row>
4847       <entry><structfield>mapcfg</structfield></entry>
4848       <entry><type>oid</type></entry>
4849       <entry><literal><link linkend="catalog-pg-ts-config"><structname>pg_ts_config</structname></link>.oid</literal></entry>
4850       <entry>The OID of the <structname>pg_ts_config</> entry owning this map entry</entry>
4851      </row>
4852
4853      <row>
4854       <entry><structfield>maptokentype</structfield></entry>
4855       <entry><type>integer</type></entry>
4856       <entry></entry>
4857       <entry>A token type emitted by the configuration's parser</entry>
4858      </row>
4859
4860      <row>
4861       <entry><structfield>mapseqno</structfield></entry>
4862       <entry><type>integer</type></entry>
4863       <entry></entry>
4864       <entry>Order in which to consult this entry (lower
4865        <structfield>mapseqno</>s first)</entry>
4866      </row>
4867
4868      <row>
4869       <entry><structfield>mapdict</structfield></entry>
4870       <entry><type>oid</type></entry>
4871       <entry><literal><link linkend="catalog-pg-ts-dict"><structname>pg_ts_dict</structname></link>.oid</literal></entry>
4872       <entry>The OID of the text search dictionary to consult</entry>
4873      </row>
4874     </tbody>
4875    </tgroup>
4876   </table>
4877  </sect1>
4878
4879
4880  <sect1 id="catalog-pg-ts-dict">
4881   <title><structname>pg_ts_dict</structname></title>
4882
4883   <indexterm zone="catalog-pg-ts-dict">
4884    <primary>pg_ts_dict</primary>
4885   </indexterm>
4886
4887   <para>
4888    The <structname>pg_ts_dict</structname> catalog contains entries
4889    defining text search dictionaries.  A dictionary depends on a text
4890    search template, which specifies all the implementation functions
4891    needed; the dictionary itself provides values for the user-settable
4892    parameters supported by the template.  This division of labor allows
4893    dictionaries to be created by unprivileged users.  The parameters
4894    are specified by a text string <structfield>dictinitoption</>,
4895    whose format and meaning vary depending on the template.
4896   </para>
4897
4898   <para>
4899    <productname>PostgreSQL</productname>'s text search features are
4900    described at length in <xref linkend="textsearch">.
4901   </para>
4902
4903   <table>
4904    <title><structname>pg_ts_dict</> Columns</title>
4905
4906    <tgroup cols="4">
4907     <thead>
4908      <row>
4909       <entry>Name</entry>
4910       <entry>Type</entry>
4911       <entry>References</entry>
4912       <entry>Description</entry>
4913      </row>
4914     </thead>
4915
4916     <tbody>
4917      <row>
4918       <entry><structfield>dictname</structfield></entry>
4919       <entry><type>name</type></entry>
4920       <entry></entry>
4921       <entry>Text search dictionary name</entry>
4922      </row>
4923
4924      <row>
4925       <entry><structfield>dictnamespace</structfield></entry>
4926       <entry><type>oid</type></entry>
4927       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
4928       <entry>
4929        The OID of the namespace that contains this dictionary
4930       </entry>
4931      </row>
4932
4933      <row>
4934       <entry><structfield>dictowner</structfield></entry>
4935       <entry><type>oid</type></entry>
4936       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
4937       <entry>Owner of the dictionary</entry>
4938      </row>
4939
4940      <row>
4941       <entry><structfield>dicttemplate</structfield></entry>
4942       <entry><type>oid</type></entry>
4943       <entry><literal><link linkend="catalog-pg-ts-template"><structname>pg_ts_template</structname></link>.oid</literal></entry>
4944       <entry>The OID of the text search template for this dictionary</entry>
4945      </row>
4946
4947      <row>
4948       <entry><structfield>dictinitoption</structfield></entry>
4949       <entry><type>text</type></entry>
4950       <entry></entry>
4951       <entry>Initialization option string for the template</entry>
4952      </row>
4953     </tbody>
4954    </tgroup>
4955   </table>
4956  </sect1>
4957
4958
4959  <sect1 id="catalog-pg-ts-parser">
4960   <title><structname>pg_ts_parser</structname></title>
4961
4962   <indexterm zone="catalog-pg-ts-parser">
4963    <primary>pg_ts_parser</primary>
4964   </indexterm>
4965
4966   <para>
4967    The <structname>pg_ts_parser</structname> catalog contains entries
4968    defining text search parsers.  A parser is responsible for splitting
4969    input text into lexemes and assigning a token type to each lexeme.
4970    Since a parser must be implemented by C-language-level functions,
4971    creation of new parsers is restricted to database superusers.
4972   </para>
4973
4974   <para>
4975    <productname>PostgreSQL</productname>'s text search features are
4976    described at length in <xref linkend="textsearch">.
4977   </para>
4978
4979   <table>
4980    <title><structname>pg_ts_parser</> Columns</title>
4981
4982    <tgroup cols="4">
4983     <thead>
4984      <row>
4985       <entry>Name</entry>
4986       <entry>Type</entry>
4987       <entry>References</entry>
4988       <entry>Description</entry>
4989      </row>
4990     </thead>
4991
4992     <tbody>
4993      <row>
4994       <entry><structfield>prsname</structfield></entry>
4995       <entry><type>name</type></entry>
4996       <entry></entry>
4997       <entry>Text search parser name</entry>
4998      </row>
4999
5000      <row>
5001       <entry><structfield>prsnamespace</structfield></entry>
5002       <entry><type>oid</type></entry>
5003       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5004       <entry>
5005        The OID of the namespace that contains this parser
5006       </entry>
5007      </row>
5008
5009      <row>
5010       <entry><structfield>prsstart</structfield></entry>
5011       <entry><type>regproc</type></entry>
5012       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5013       <entry>OID of the parser's startup function</entry>
5014      </row>
5015
5016      <row>
5017       <entry><structfield>prstoken</structfield></entry>
5018       <entry><type>regproc</type></entry>
5019       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5020       <entry>OID of the parser's next-token function</entry>
5021      </row>
5022
5023      <row>
5024       <entry><structfield>prsend</structfield></entry>
5025       <entry><type>regproc</type></entry>
5026       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5027       <entry>OID of the parser's shutdown function</entry>
5028      </row>
5029
5030      <row>
5031       <entry><structfield>prsheadline</structfield></entry>
5032       <entry><type>regproc</type></entry>
5033       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5034       <entry>OID of the parser's headline function</entry>
5035      </row>
5036
5037      <row>
5038       <entry><structfield>prslextype</structfield></entry>
5039       <entry><type>regproc</type></entry>
5040       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5041       <entry>OID of the parser's lextype function</entry>
5042      </row>
5043     </tbody>
5044    </tgroup>
5045   </table>
5046  </sect1>
5047
5048
5049  <sect1 id="catalog-pg-ts-template">
5050   <title><structname>pg_ts_template</structname></title>
5051
5052   <indexterm zone="catalog-pg-ts-template">
5053    <primary>pg_ts_template</primary>
5054   </indexterm>
5055
5056   <para>
5057    The <structname>pg_ts_template</structname> catalog contains entries
5058    defining text search templates.  A template is the implementation
5059    skeleton for a class of text search dictionaries.
5060    Since a template must be implemented by C-language-level functions,
5061    creation of new templates is restricted to database superusers.
5062   </para>
5063
5064   <para>
5065    <productname>PostgreSQL</productname>'s text search features are
5066    described at length in <xref linkend="textsearch">.
5067   </para>
5068
5069   <table>
5070    <title><structname>pg_ts_template</> Columns</title>
5071
5072    <tgroup cols="4">
5073     <thead>
5074      <row>
5075       <entry>Name</entry>
5076       <entry>Type</entry>
5077       <entry>References</entry>
5078       <entry>Description</entry>
5079      </row>
5080     </thead>
5081
5082     <tbody>
5083      <row>
5084       <entry><structfield>tmplname</structfield></entry>
5085       <entry><type>name</type></entry>
5086       <entry></entry>
5087       <entry>Text search template name</entry>
5088      </row>
5089
5090      <row>
5091       <entry><structfield>tmplnamespace</structfield></entry>
5092       <entry><type>oid</type></entry>
5093       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5094       <entry>
5095        The OID of the namespace that contains this template
5096       </entry>
5097      </row>
5098
5099      <row>
5100       <entry><structfield>tmplinit</structfield></entry>
5101       <entry><type>regproc</type></entry>
5102       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5103       <entry>OID of the template's initialization function</entry>
5104      </row>
5105
5106      <row>
5107       <entry><structfield>tmpllexize</structfield></entry>
5108       <entry><type>regproc</type></entry>
5109       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5110       <entry>OID of the template's lexize function</entry>
5111      </row>
5112     </tbody>
5113    </tgroup>
5114   </table>
5115  </sect1>
5116
5117
5118  <sect1 id="catalog-pg-type">
5119   <title><structname>pg_type</structname></title>
5120
5121   <indexterm zone="catalog-pg-type">
5122    <primary>pg_type</primary>
5123   </indexterm>
5124
5125   <para>
5126    The catalog <structname>pg_type</structname> stores information about data
5127    types.  Base types and enum types (scalar types) are created with
5128    <xref linkend="sql-createtype" endterm="sql-createtype-title">, and
5129    domains with
5130    <xref linkend="sql-createdomain" endterm="sql-createdomain-title">.
5131    A composite type is automatically created for each table in the database, to
5132    represent the row structure of the table.  It is also possible to create
5133    composite types with <command>CREATE TYPE AS</command>.
5134   </para>
5135
5136   <table>
5137    <title><structname>pg_type</> Columns</title>
5138
5139    <tgroup cols="4">
5140     <thead>
5141      <row>
5142       <entry>Name</entry>
5143       <entry>Type</entry>
5144       <entry>References</entry>
5145       <entry>Description</entry>
5146      </row>
5147     </thead>
5148
5149     <tbody>
5150      <row>
5151       <entry><structfield>typname</structfield></entry>
5152       <entry><type>name</type></entry>
5153       <entry></entry>
5154       <entry>Data type name</entry>
5155      </row>
5156
5157      <row>
5158       <entry><structfield>typnamespace</structfield></entry>
5159       <entry><type>oid</type></entry>
5160       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
5161       <entry>
5162        The OID of the namespace that contains this type
5163       </entry>
5164      </row>
5165
5166      <row>
5167       <entry><structfield>typowner</structfield></entry>
5168       <entry><type>oid</type></entry>
5169       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5170       <entry>Owner of the type</entry>
5171      </row>
5172
5173      <row>
5174       <entry><structfield>typlen</structfield></entry>
5175       <entry><type>int2</type></entry>
5176       <entry></entry>
5177       <entry>
5178        For a fixed-size type, <structfield>typlen</structfield> is the number
5179        of bytes in the internal representation of the type.  But for a
5180        variable-length type, <structfield>typlen</structfield> is negative.
5181        -1 indicates a <quote>varlena</> type (one that has a length word),
5182        -2 indicates a null-terminated C string.
5183       </entry>
5184      </row>
5185
5186      <row>
5187       <entry><structfield>typbyval</structfield></entry>
5188       <entry><type>bool</type></entry>
5189       <entry></entry>
5190       <entry>
5191        <structfield>typbyval</structfield> determines whether internal
5192        routines pass a value of this type by value or by reference.
5193        <structfield>typbyval</structfield> had better be false if
5194        <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
5195        where Datum is 8 bytes).
5196        Variable-length types are always passed by reference. Note that
5197        <structfield>typbyval</structfield> can be false even if the
5198        length would allow pass-by-value
5199       </entry>
5200      </row>
5201
5202      <row>
5203       <entry><structfield>typtype</structfield></entry>
5204       <entry><type>char</type></entry>
5205       <entry></entry>
5206       <entry>
5207        <structfield>typtype</structfield> is
5208        <literal>b</literal> for a base type,
5209        <literal>c</literal> for a composite type (e.g., a table's row type),
5210        <literal>d</literal> for a domain,
5211        <literal>e</literal> for an enum type,
5212        or <literal>p</literal> for a pseudo-type.
5213        See also <structfield>typrelid</structfield> and
5214        <structfield>typbasetype</structfield>
5215       </entry>
5216      </row>
5217
5218      <row>
5219       <entry><structfield>typcategory</structfield></entry>
5220       <entry><type>char</type></entry>
5221       <entry></entry>
5222       <entry>
5223        <structfield>typcategory</structfield> is an arbitrary classification
5224        of data types that is used by the parser to determine which implicit
5225        casts should be <quote>preferred</>.
5226        See <xref linkend="catalog-typcategory-table">
5227       </entry>
5228      </row>
5229
5230      <row>
5231       <entry><structfield>typispreferred</structfield></entry>
5232       <entry><type>bool</type></entry>
5233       <entry></entry>
5234       <entry>
5235        True if the type is a preferred cast target within its
5236        <structfield>typcategory</structfield>
5237       </entry>
5238      </row>
5239
5240      <row>
5241       <entry><structfield>typisdefined</structfield></entry>
5242       <entry><type>bool</type></entry>
5243       <entry></entry>
5244       <entry>
5245        True if the type is defined, false if this is a placeholder
5246        entry for a not-yet-defined type.  When
5247        <structfield>typisdefined</structfield> is false, nothing
5248        except the type name, namespace, and OID can be relied on
5249       </entry>
5250      </row>
5251
5252      <row>
5253       <entry><structfield>typdelim</structfield></entry>
5254       <entry><type>char</type></entry>
5255       <entry></entry>
5256       <entry>
5257        Character that separates two values of this type when parsing
5258        array input.  Note that the delimiter is associated with the array
5259        element data type, not the array data type
5260       </entry>
5261      </row>
5262
5263      <row>
5264       <entry><structfield>typrelid</structfield></entry>
5265       <entry><type>oid</type></entry>
5266       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
5267       <entry>
5268        If this is a composite type (see
5269        <structfield>typtype</structfield>), then this column points to
5270        the <structname>pg_class</structname> entry that defines the
5271        corresponding table.  (For a free-standing composite type, the
5272        <structname>pg_class</structname> entry doesn't really represent
5273        a table, but it is needed anyway for the type's
5274        <structname>pg_attribute</structname> entries to link to.)
5275        Zero for non-composite types
5276       </entry>
5277      </row>
5278
5279      <row>
5280       <entry><structfield>typelem</structfield></entry>
5281       <entry><type>oid</type></entry>
5282       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5283       <entry>
5284        If <structfield>typelem</structfield> is not 0 then it
5285        identifies another row in <structname>pg_type</structname>.
5286        The current type can then be subscripted like an array yielding
5287        values of type <structfield>typelem</structfield>.  A
5288        <quote>true</quote> array type is variable length
5289        (<structfield>typlen</structfield> = -1),
5290        but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
5291        also have nonzero <structfield>typelem</structfield>, for example
5292        <type>name</type> and <type>point</type>.
5293        If a fixed-length type has a <structfield>typelem</structfield> then
5294        its internal representation must be some number of values of the
5295        <structfield>typelem</structfield> data type with no other data.
5296        Variable-length array types have a header defined by the array
5297        subroutines
5298       </entry>
5299      </row>
5300
5301      <row>
5302       <entry><structfield>typarray</structfield></entry>
5303       <entry><type>oid</type></entry>
5304       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5305       <entry>
5306        If <structfield>typarray</structfield> is not 0 then it
5307        identifies another row in <structname>pg_type</structname>, which
5308        is the <quote>true</quote> array type having this type as element
5309       </entry>
5310      </row>
5311
5312      <row>
5313       <entry><structfield>typinput</structfield></entry>
5314       <entry><type>regproc</type></entry>
5315       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5316       <entry>Input conversion function (text format)</entry>
5317      </row>
5318
5319      <row>
5320       <entry><structfield>typoutput</structfield></entry>
5321       <entry><type>regproc</type></entry>
5322       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5323       <entry>Output conversion function (text format)</entry>
5324      </row>
5325
5326      <row>
5327       <entry><structfield>typreceive</structfield></entry>
5328       <entry><type>regproc</type></entry>
5329       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5330       <entry>Input conversion function (binary format), or 0 if none</entry>
5331      </row>
5332
5333      <row>
5334       <entry><structfield>typsend</structfield></entry>
5335       <entry><type>regproc</type></entry>
5336       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5337       <entry>Output conversion function (binary format), or 0 if none</entry>
5338      </row>
5339
5340      <row>
5341       <entry><structfield>typmodin</structfield></entry>
5342       <entry><type>regproc</type></entry>
5343       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5344       <entry>Type modifier input function, or 0 if type does not support modifiers</entry>
5345      </row>
5346
5347      <row>
5348       <entry><structfield>typmodout</structfield></entry>
5349       <entry><type>regproc</type></entry>
5350       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5351       <entry>Type modifier output function, or 0 to use the standard format</entry>
5352      </row>
5353
5354      <row>
5355       <entry><structfield>typanalyze</structfield></entry>
5356       <entry><type>regproc</type></entry>
5357       <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
5358       <entry>Custom ANALYZE function, or 0 to use the standard function</entry>
5359      </row>
5360
5361      <row>
5362       <entry><structfield>typalign</structfield></entry>
5363       <entry><type>char</type></entry>
5364       <entry></entry>
5365       <entry><para>
5366
5367        <structfield>typalign</structfield> is the alignment required
5368        when storing a value of this type.  It applies to storage on
5369        disk as well as most representations of the value inside
5370        <productname>PostgreSQL</>.
5371        When multiple values are stored consecutively, such
5372        as in the representation of a complete row on disk, padding is
5373        inserted before a datum of this type so that it begins on the
5374        specified boundary.  The alignment reference is the beginning
5375        of the first datum in the sequence.
5376       </para><para>
5377        Possible values are:
5378        <itemizedlist>
5379         <listitem>
5380          <para><literal>c</> = <type>char</type> alignment, i.e., no alignment needed.</para>
5381         </listitem>
5382         <listitem>
5383          <para><literal>s</> = <type>short</type> alignment (2 bytes on most machines).</para>
5384         </listitem>
5385         <listitem>
5386          <para><literal>i</> = <type>int</type> alignment (4 bytes on most machines).</para>
5387         </listitem>
5388         <listitem>
5389          <para><literal>d</> = <type>double</type> alignment (8 bytes on many machines, but by no means all).</para>
5390         </listitem>
5391        </itemizedlist>
5392       </para><note>
5393        <para>
5394         For types used in system tables, it is critical that the size
5395         and alignment defined in <structname>pg_type</structname>
5396         agree with the way that the compiler will lay out the column in
5397         a structure representing a table row.
5398        </para>
5399       </note></entry>
5400      </row>
5401
5402      <row>
5403       <entry><structfield>typstorage</structfield></entry>
5404       <entry><type>char</type></entry>
5405       <entry></entry>
5406       <entry><para>
5407        <structfield>typstorage</structfield> tells for varlena
5408        types (those with <structfield>typlen</structfield> = -1) if
5409        the type is prepared for toasting and what the default strategy
5410        for attributes of this type should be.
5411        Possible values are
5412        <itemizedlist>
5413         <listitem>
5414          <para><literal>p</>: Value must always be stored plain.</para>
5415         </listitem>
5416         <listitem>
5417          <para>
5418           <literal>e</>: Value can be stored in a <quote>secondary</quote>
5419           relation (if relation has one, see
5420           <literal>pg_class.reltoastrelid</literal>).
5421          </para>
5422         </listitem>
5423         <listitem>
5424          <para><literal>m</>: Value can be stored compressed inline.</para>
5425         </listitem>
5426         <listitem>
5427          <para><literal>x</>: Value can be stored compressed inline or stored in <quote>secondary</quote> storage.</para>
5428         </listitem>
5429        </itemizedlist>
5430        Note that <literal>m</> columns can also be moved out to secondary
5431        storage, but only as a last resort (<literal>e</> and <literal>x</> columns are
5432        moved first).
5433       </para></entry>
5434      </row>
5435
5436      <row>
5437       <entry><structfield>typnotnull</structfield></entry>
5438       <entry><type>bool</type></entry>
5439       <entry></entry>
5440       <entry><para>
5441        <structfield>typnotnull</structfield> represents a not-null
5442        constraint on a type.  Used for domains only
5443       </para></entry>
5444      </row>
5445
5446      <row>
5447       <entry><structfield>typbasetype</structfield></entry>
5448       <entry><type>oid</type></entry>
5449       <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry>
5450       <entry><para>
5451        If this is a domain (see <structfield>typtype</structfield>), then
5452        <structfield>typbasetype</structfield> identifies the type that this
5453        one is based on.  Zero if this type is not a domain
5454       </para></entry>
5455      </row>
5456
5457      <row>
5458       <entry><structfield>typtypmod</structfield></entry>
5459       <entry><type>int4</type></entry>
5460       <entry></entry>
5461       <entry><para>
5462        Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</>
5463        to be applied to their base type (-1 if base type does not use a
5464        <literal>typmod</>).  -1 if this type is not a domain
5465       </para></entry>
5466      </row>
5467
5468      <row>
5469       <entry><structfield>typndims</structfield></entry>
5470       <entry><type>int4</type></entry>
5471       <entry></entry>
5472       <entry><para>
5473        <structfield>typndims</structfield> is the number of array dimensions
5474        for a domain that is an array (that is, <structfield>typbasetype</> is
5475        an array type; the domain's <structfield>typelem</> will match the base
5476        type's <structfield>typelem</structfield>).
5477        Zero for types other than domains over array types
5478        </para></entry>
5479      </row>
5480
5481      <row>
5482       <entry><structfield>typdefaultbin</structfield></entry>
5483       <entry><type>text</type></entry>
5484       <entry></entry>
5485       <entry><para>
5486        If <structfield>typdefaultbin</> is not null, it is the <function>nodeToString()</function>
5487        representation of a default expression for the type.  This is
5488        only used for domains
5489       </para></entry>
5490      </row>
5491
5492      <row>
5493       <entry><structfield>typdefault</structfield></entry>
5494       <entry><type>text</type></entry>
5495       <entry></entry>
5496       <entry><para>
5497        <structfield>typdefault</> is null if the type has no associated
5498        default value. If <structfield>typdefaultbin</> is not null,
5499        <structfield>typdefault</> must contain a human-readable version of the
5500        default expression represented by <structfield>typdefaultbin</>.  If
5501        <structfield>typdefaultbin</> is null and <structfield>typdefault</> is
5502        not, then <structfield>typdefault</> is the external representation of
5503        the type's default value, which might be fed to the type's input
5504        converter to produce a constant
5505       </para></entry>
5506      </row>
5507     </tbody>
5508    </tgroup>
5509   </table>
5510
5511   <para>
5512    <xref linkend="catalog-typcategory-table"> lists the system-defined values
5513    of <structfield>typcategory</>.  Any future additions to this list will
5514    also be upper-case ASCII letters.  All other ASCII characters are reserved
5515    for user-defined categories.
5516   </para>
5517
5518   <table id="catalog-typcategory-table">
5519    <title><structfield>typcategory</> Codes</title>
5520
5521    <tgroup cols="2">
5522     <thead>
5523      <row>
5524       <entry>Code</entry>
5525       <entry>Category</entry>
5526      </row>
5527     </thead>
5528
5529     <tbody>
5530      <row>
5531       <entry><literal>A</literal></entry>
5532       <entry>Array types</entry>
5533      </row>
5534      <row>
5535       <entry><literal>B</literal></entry>
5536       <entry>Boolean types</entry>
5537      </row>
5538      <row>
5539       <entry><literal>C</literal></entry>
5540       <entry>Composite types</entry>
5541      </row>
5542      <row>
5543       <entry><literal>D</literal></entry>
5544       <entry>Date/time types</entry>
5545      </row>
5546      <row>
5547       <entry><literal>E</literal></entry>
5548       <entry>Enum types</entry>
5549      </row>
5550      <row>
5551       <entry><literal>G</literal></entry>
5552       <entry>Geometric types</entry>
5553      </row>
5554      <row>
5555       <entry><literal>I</literal></entry>
5556       <entry>Network address types</entry>
5557      </row>
5558      <row>
5559       <entry><literal>N</literal></entry>
5560       <entry>Numeric types</entry>
5561      </row>
5562      <row>
5563       <entry><literal>P</literal></entry>
5564       <entry>Pseudo-types</entry>
5565      </row>
5566      <row>
5567       <entry><literal>S</literal></entry>
5568       <entry>String types</entry>
5569      </row>
5570      <row>
5571       <entry><literal>T</literal></entry>
5572       <entry>Timespan types</entry>
5573      </row>
5574      <row>
5575       <entry><literal>U</literal></entry>
5576       <entry>User-defined types</entry>
5577      </row>
5578      <row>
5579       <entry><literal>V</literal></entry>
5580       <entry>Bit-string types</entry>
5581      </row>
5582      <row>
5583       <entry><literal>X</literal></entry>
5584       <entry><type>unknown</> type</entry>
5585      </row>
5586     </tbody>
5587    </tgroup>
5588   </table>
5589
5590  </sect1>
5591
5592
5593  <sect1 id="catalog-pg-user-mapping">
5594   <title><structname>pg_user_mapping</structname></title>
5595
5596   <indexterm zone="catalog-pg-user-mapping">
5597    <primary>pg_user_mapping</primary>
5598   </indexterm>
5599
5600   <para>
5601    The catalog <structname>pg_user_mapping</structname> stores
5602    the mappings from local user to remote.  Access to this catalog is
5603    restricted from normal users, use the view
5604    <link linkend="view-pg-user-mappings"><structname>pg_user_mappings</structname></link>
5605    instead.
5606   </para>
5607
5608   <table>
5609    <title><structname>pg_user_mapping</> Columns</title>
5610
5611    <tgroup cols="4">
5612     <thead>
5613      <row>
5614       <entry>Name</entry>
5615       <entry>Type</entry>
5616       <entry>References</entry>
5617       <entry>Description</entry>
5618      </row>
5619     </thead>
5620
5621     <tbody>
5622      <row>
5623       <entry><structfield>umuser</structfield></entry>
5624       <entry><type>oid</type></entry>
5625       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5626       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
5627      </row>
5628
5629      <row>
5630       <entry><structfield>umserver</structfield></entry>
5631       <entry><type>oid</type></entry>
5632       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
5633       <entry>
5634        The OID of the foreign server that contains this mapping
5635       </entry>
5636      </row>
5637
5638      <row>
5639       <entry><structfield>umoptions</structfield></entry>
5640       <entry><type>text[]</type></entry>
5641       <entry></entry>
5642       <entry>
5643        User mapping specific options, as <quote>keyword=value</> strings.
5644       </entry>
5645      </row>
5646     </tbody>
5647    </tgroup>
5648   </table>
5649  </sect1>
5650
5651
5652  <sect1 id="views-overview">
5653   <title>System Views</title>
5654
5655   <para>
5656    In addition to the system catalogs, <productname>PostgreSQL</productname>
5657    provides a number of built-in views.  Some system views provide convenient
5658    access to some commonly used queries on the system catalogs.  Other views
5659    provide access to internal server state.
5660   </para>
5661
5662   <para>
5663    The information schema (<xref linkend="information-schema">) provides
5664    an alternative set of views which overlap the functionality of the system
5665    views.  Since the information schema is SQL-standard whereas the views
5666    described here are <productname>PostgreSQL</productname>-specific,
5667    it's usually better to use the information schema if it provides all
5668    the information you need.
5669   </para>
5670
5671   <para>
5672    <xref linkend="view-table"> lists the system views described here.
5673    More detailed documentation of each view follows below.
5674    There are some additional views that provide access to the results of
5675    the statistics collector; they are described in <xref
5676    linkend="monitoring-stats-views-table">.
5677   </para>
5678
5679   <para>
5680    Except where noted, all the views described here are read-only.
5681   </para>
5682
5683   <table id="view-table">
5684    <title>System Views</title>
5685
5686    <tgroup cols="2">
5687     <thead>
5688      <row>
5689       <entry>View Name</entry>
5690       <entry>Purpose</entry>
5691      </row>
5692     </thead>
5693
5694     <tbody>
5695      <row>
5696       <entry><link linkend="view-pg-cursors"><structname>pg_cursors</structname></link></entry>
5697       <entry>open cursors</entry>
5698      </row>
5699
5700      <row>
5701       <entry><link linkend="view-pg-group"><structname>pg_group</structname></link></entry>
5702       <entry>groups of database users</entry>
5703      </row>
5704
5705      <row>
5706       <entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
5707       <entry>indexes</entry>
5708      </row>
5709
5710      <row>
5711       <entry><link linkend="view-pg-locks"><structname>pg_locks</structname></link></entry>
5712       <entry>currently held locks</entry>
5713      </row>
5714
5715      <row>
5716       <entry><link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link></entry>
5717       <entry>prepared statements</entry>
5718      </row>
5719
5720      <row>
5721       <entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
5722       <entry>prepared transactions</entry>
5723      </row>
5724
5725      <row>
5726       <entry><link linkend="view-pg-roles"><structname>pg_roles</structname></link></entry>
5727       <entry>database roles</entry>
5728      </row>
5729
5730      <row>
5731       <entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
5732       <entry>rules</entry>
5733      </row>
5734
5735      <row>
5736       <entry><link linkend="view-pg-settings"><structname>pg_settings</structname></link></entry>
5737       <entry>parameter settings</entry>
5738      </row>
5739
5740      <row>
5741       <entry><link linkend="view-pg-shadow"><structname>pg_shadow</structname></link></entry>
5742       <entry>database users</entry>
5743      </row>
5744
5745      <row>
5746       <entry><link linkend="view-pg-stats"><structname>pg_stats</structname></link></entry>
5747       <entry>planner statistics</entry>
5748      </row>
5749
5750      <row>
5751       <entry><link linkend="view-pg-tables"><structname>pg_tables</structname></link></entry>
5752       <entry>tables</entry>
5753      </row>
5754
5755      <row>
5756       <entry><link linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link></entry>
5757       <entry>time zone abbreviations</entry>
5758      </row>
5759
5760      <row>
5761       <entry><link linkend="view-pg-timezone-names"><structname>pg_timezone_names</structname></link></entry>
5762       <entry>time zone names</entry>
5763      </row>
5764
5765      <row>
5766       <entry><link linkend="view-pg-user"><structname>pg_user</structname></link></entry>
5767       <entry>database users</entry>
5768      </row>
5769
5770      <row>
5771       <entry><link linkend="view-pg-views"><structname>pg_views</structname></link></entry>
5772       <entry>views</entry>
5773      </row>
5774
5775     </tbody>
5776    </tgroup>
5777   </table>
5778  </sect1>
5779
5780  <sect1 id="view-pg-cursors">
5781   <title><structname>pg_cursors</structname></title>
5782
5783   <indexterm zone="view-pg-cursors">
5784    <primary>pg_cursors</primary>
5785   </indexterm>
5786
5787   <para>
5788    The <structname>pg_cursors</structname> view lists the cursors that
5789    are currently available. Cursors can be defined in several ways:
5790    <itemizedlist>
5791     <listitem>
5792      <para>
5793       via the <xref linkend="sql-declare" endterm="sql-declare-title">
5794       statement in SQL
5795      </para>
5796     </listitem>
5797
5798     <listitem>
5799      <para>
5800       via the Bind message in the frontend/backend protocol, as
5801       described in <xref linkend="protocol-flow-ext-query">
5802      </para>
5803     </listitem>
5804
5805     <listitem>
5806      <para>
5807       via the Server Programming Interface (SPI), as described in
5808       <xref linkend="spi-interface">
5809      </para>
5810     </listitem>
5811    </itemizedlist>
5812
5813    The <structname>pg_cursors</structname> view displays cursors
5814    created by any of these means. Cursors only exist for the duration
5815    of the transaction that defines them, unless they have been
5816    declared <literal>WITH HOLD</literal>. Therefore non-holdable
5817    cursors are only present in the view until the end of their
5818    creating transaction.
5819
5820    <note>
5821     <para>
5822      Cursors are used internally to implement some of the components
5823      of <productname>PostgreSQL</>, such as procedural languages.
5824      Therefore, the <structname>pg_cursors</> view might include cursors
5825      that have not been explicitly created by the user.
5826     </para>
5827    </note>
5828   </para>
5829
5830   <table>
5831    <title><structname>pg_cursors</> Columns</title>
5832
5833    <tgroup cols="3">
5834     <thead>
5835      <row>
5836       <entry>Name</entry>
5837       <entry>Type</entry>
5838       <entry>Description</entry>
5839      </row>
5840     </thead>
5841
5842     <tbody>
5843      <row>
5844       <entry><structfield>name</structfield></entry>
5845       <entry><type>text</type></entry>
5846       <entry>The name of the cursor</entry>
5847      </row>
5848
5849      <row>
5850       <entry><structfield>statement</structfield></entry>
5851       <entry><type>text</type></entry>
5852       <entry>The verbatim query string submitted to declare this cursor</entry>
5853      </row>
5854
5855      <row>
5856       <entry><structfield>is_holdable</structfield></entry>
5857       <entry><type>boolean</type></entry>
5858       <entry>
5859        <literal>true</literal> if the cursor is holdable (that is, it
5860        can be accessed after the transaction that declared the cursor
5861        has committed); <literal>false</literal> otherwise
5862        </entry>
5863      </row>
5864
5865      <row>
5866       <entry><structfield>is_binary</structfield></entry>
5867       <entry><type>boolean</type></entry>
5868       <entry>
5869        <literal>true</literal> if the cursor was declared
5870        <literal>BINARY</literal>; <literal>false</literal>
5871        otherwise
5872        </entry>
5873      </row>
5874
5875      <row>
5876       <entry><structfield>is_scrollable</structfield></entry>
5877       <entry><type>boolean</type></entry>
5878       <entry>
5879        <literal>true</> if the cursor is scrollable (that is, it
5880        allows rows to be retrieved in a nonsequential manner);
5881        <literal>false</literal> otherwise
5882        </entry>
5883      </row>
5884
5885      <row>
5886       <entry><structfield>creation_time</structfield></entry>
5887       <entry><type>timestamptz</type></entry>
5888       <entry>The time at which the cursor was declared</entry>
5889      </row>
5890     </tbody>
5891    </tgroup>
5892   </table>
5893
5894   <para>
5895    The <structname>pg_cursors</structname> view is read only.
5896   </para>
5897
5898  </sect1>
5899
5900  <sect1 id="view-pg-group">
5901   <title><structname>pg_group</structname></title>
5902
5903   <indexterm zone="view-pg-group">
5904    <primary>pg_group</primary>
5905   </indexterm>
5906
5907   <para>
5908    The view <structname>pg_group</structname> exists for backwards
5909    compatibility: it emulates a catalog that existed in
5910    <productname>PostgreSQL</productname> before version 8.1.
5911    It shows the names and members of all roles that are marked as not
5912    <structfield>rolcanlogin</>, which is an approximation to the set
5913    of roles that are being used as groups.
5914   </para>
5915
5916   <table>
5917    <title><structname>pg_group</> Columns</title>
5918
5919    <tgroup cols="4">
5920     <thead>
5921      <row>
5922       <entry>Name</entry>
5923       <entry>Type</entry>
5924       <entry>References</entry>
5925       <entry>Description</entry>
5926      </row>
5927     </thead>
5928
5929     <tbody>
5930      <row>
5931       <entry><structfield>groname</structfield></entry>
5932       <entry><type>name</type></entry>
5933       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
5934       <entry>Name of the group</entry>
5935      </row>
5936
5937      <row>
5938       <entry><structfield>grosysid</structfield></entry>
5939       <entry><type>oid</type></entry>
5940       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5941       <entry>ID of this group</entry>
5942      </row>
5943
5944      <row>
5945       <entry><structfield>grolist</structfield></entry>
5946       <entry><type>oid[]</type></entry>
5947       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
5948       <entry>An array containing the IDs of the roles in this group</entry>
5949      </row>
5950     </tbody>
5951    </tgroup>
5952   </table>
5953
5954  </sect1>
5955
5956  <sect1 id="view-pg-indexes">
5957   <title><structname>pg_indexes</structname></title>
5958
5959   <indexterm zone="view-pg-indexes">
5960    <primary>pg_indexes</primary>
5961   </indexterm>
5962
5963   <para>
5964    The view <structname>pg_indexes</structname> provides access to
5965    useful information about each index in the database.
5966   </para>
5967
5968   <table>
5969    <title><structname>pg_indexes</> Columns</title>
5970
5971    <tgroup cols="4">
5972     <thead>
5973      <row>
5974       <entry>Name</entry>
5975       <entry>Type</entry>
5976       <entry>References</entry>
5977       <entry>Description</entry>
5978      </row>
5979     </thead>
5980     <tbody>
5981      <row>
5982       <entry><structfield>schemaname</structfield></entry>
5983       <entry><type>name</type></entry>
5984       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
5985       <entry>Name of schema containing table and index</entry>
5986      </row>
5987      <row>
5988       <entry><structfield>tablename</structfield></entry>
5989       <entry><type>name</type></entry>
5990       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5991       <entry>Name of table the index is for</entry>
5992      </row>
5993      <row>
5994       <entry><structfield>indexname</structfield></entry>
5995       <entry><type>name</type></entry>
5996       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
5997       <entry>Name of index</entry>
5998      </row>
5999      <row>
6000       <entry><structfield>tablespace</structfield></entry>
6001       <entry><type>name</type></entry>
6002       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
6003       <entry>Name of tablespace containing index (NULL if default for database)</entry>
6004      </row>
6005      <row>
6006       <entry><structfield>indexdef</structfield></entry>
6007       <entry><type>text</type></entry>
6008       <entry></entry>
6009       <entry>Index definition (a reconstructed <command>CREATE INDEX</command>
6010       command)</entry>
6011      </row>
6012     </tbody>
6013    </tgroup>
6014   </table>
6015
6016  </sect1>
6017
6018  <sect1 id="view-pg-locks">
6019   <title><structname>pg_locks</structname></title>
6020
6021   <indexterm zone="view-pg-locks">
6022    <primary>pg_locks</primary>
6023   </indexterm>
6024
6025   <para>
6026    The view <structname>pg_locks</structname> provides access to
6027    information about the locks held by open transactions within the
6028    database server.  See <xref linkend="mvcc"> for more discussion
6029    of locking.
6030   </para>
6031
6032   <para>
6033    <structname>pg_locks</structname> contains one row per active lockable
6034    object, requested lock mode, and relevant transaction.  Thus, the same
6035    lockable object might
6036    appear many times, if multiple transactions are holding or waiting
6037    for locks on it.  However, an object that currently has no locks on it
6038    will not appear at all.
6039   </para>
6040
6041   <para>
6042    There are several distinct types of lockable objects:
6043    whole relations (e.g., tables), individual pages of relations,
6044    individual tuples of relations,
6045    transaction IDs (both virtual and permanent IDs),
6046    and general database objects (identified by class OID and object OID,
6047    in the same way as in <structname>pg_description</structname> or
6048    <structname>pg_depend</structname>).  Also, the right to extend a
6049    relation is represented as a separate lockable object.
6050   </para>
6051
6052   <table>
6053    <title><structname>pg_locks</> Columns</title>
6054
6055    <tgroup cols="4">
6056     <thead>
6057      <row>
6058       <entry>Name</entry>
6059       <entry>Type</entry>
6060       <entry>References</entry>
6061       <entry>Description</entry>
6062      </row>
6063     </thead>
6064     <tbody>
6065      <row>
6066       <entry><structfield>locktype</structfield></entry>
6067       <entry><type>text</type></entry>
6068       <entry></entry>
6069       <entry>
6070        type of the lockable object:
6071        <literal>relation</>,
6072        <literal>extend</>,
6073        <literal>page</>,
6074        <literal>tuple</>,
6075        <literal>transactionid</>,
6076        <literal>virtualxid</>,
6077        <literal>object</>,
6078        <literal>userlock</>, or
6079        <literal>advisory</>
6080       </entry>
6081      </row>
6082      <row>
6083       <entry><structfield>database</structfield></entry>
6084       <entry><type>oid</type></entry>
6085       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
6086       <entry>
6087        OID of the database in which the object exists, or
6088        zero if the object is a shared object, or
6089        NULL if the object is a transaction ID
6090       </entry>
6091      </row>
6092      <row>
6093       <entry><structfield>relation</structfield></entry>
6094       <entry><type>oid</type></entry>
6095       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6096       <entry>
6097        OID of the relation, or NULL if the object is not
6098        a relation or part of a relation
6099       </entry>
6100      </row>
6101      <row>
6102       <entry><structfield>page</structfield></entry>
6103       <entry><type>integer</type></entry>
6104       <entry></entry>
6105       <entry>
6106        Page number within the relation, or NULL if the object
6107        is not a tuple or relation page
6108       </entry>
6109      </row>
6110      <row>
6111       <entry><structfield>tuple</structfield></entry>
6112       <entry><type>smallint</type></entry>
6113       <entry></entry>
6114       <entry>
6115        Tuple number within the page, or NULL if the object is not a tuple
6116       </entry>
6117      </row>
6118      <row>
6119       <entry><structfield>virtualxid</structfield></entry>
6120       <entry><type>text</type></entry>
6121       <entry></entry>
6122       <entry>
6123        Virtual ID of a transaction, or NULL if the object is not a
6124        virtual transaction ID
6125       </entry>
6126      </row>
6127      <row>
6128       <entry><structfield>transactionid</structfield></entry>
6129       <entry><type>xid</type></entry>
6130       <entry></entry>
6131       <entry>
6132        ID of a transaction, or NULL if the object is not a transaction ID
6133       </entry>
6134      </row>
6135      <row>
6136       <entry><structfield>classid</structfield></entry>
6137       <entry><type>oid</type></entry>
6138       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
6139       <entry>
6140        OID of the system catalog containing the object, or NULL if the
6141        object is not a general database object
6142       </entry>
6143      </row>
6144      <row>
6145       <entry><structfield>objid</structfield></entry>
6146       <entry><type>oid</type></entry>
6147       <entry>any OID column</entry>
6148       <entry>
6149        OID of the object within its system catalog, or NULL if the
6150        object is not a general database object.
6151        For advisory locks it is used to distinguish the two key
6152        spaces (<literal>1</> for an int8 key, <literal>2</> for two
6153        int4 keys).
6154       </entry>
6155      </row>
6156      <row>
6157       <entry><structfield>objsubid</structfield></entry>
6158       <entry><type>smallint</type></entry>
6159       <entry></entry>
6160       <entry>
6161        For a table column, this is the column number (the
6162        <structfield>classid</> and <structfield>objid</> refer to the
6163        table itself).  For all other object types, this column is
6164        zero.  NULL if the object is not a general database object
6165       </entry>
6166      </row>
6167      <row>
6168       <entry><structfield>virtualtransaction</structfield></entry>
6169       <entry><type>text</type></entry>
6170       <entry></entry>
6171       <entry>
6172        Virtual ID of the transaction that is holding or awaiting this lock
6173       </entry>
6174      </row>
6175      <row>
6176       <entry><structfield>pid</structfield></entry>
6177       <entry><type>integer</type></entry>
6178       <entry></entry>
6179       <entry>
6180        Process ID of the server process holding or awaiting this
6181        lock.  NULL if the lock is held by a prepared transaction
6182       </entry>
6183      </row>
6184      <row>
6185       <entry><structfield>mode</structfield></entry>
6186       <entry><type>text</type></entry>
6187       <entry></entry>
6188       <entry>Name of the lock mode held or desired by this process (see <xref
6189       linkend="locking-tables">)</entry>
6190      </row>
6191      <row>
6192       <entry><structfield>granted</structfield></entry>
6193       <entry><type>boolean</type></entry>
6194       <entry></entry>
6195       <entry>True if lock is held, false if lock is awaited</entry>
6196      </row>
6197     </tbody>
6198    </tgroup>
6199   </table>
6200
6201   <para>
6202    <structfield>granted</structfield> is true in a row representing a lock
6203    held by the indicated transaction.  False indicates that this transaction is
6204    currently waiting to acquire this lock, which implies that some other
6205    transaction is holding a conflicting lock mode on the same lockable object.
6206    The waiting transaction will sleep until the other lock is released (or a
6207    deadlock situation is detected). A single transaction can be waiting to
6208    acquire at most one lock at a time.
6209   </para>
6210
6211   <para>
6212    Every transaction holds an exclusive lock on its virtual transaction ID for
6213    its entire duration.  If a permanent ID is assigned to the transaction
6214    (which normally happens only if the transaction changes the state of the
6215    database), it also holds an exclusive lock on its permanent transaction ID
6216    until it ends.  When one transaction finds it necessary to wait specifically
6217    for another transaction, it does so by attempting to acquire share lock on
6218    the other transaction ID (either virtual or permanent ID depending on the
6219    situation). That will succeed only when the other transaction
6220    terminates and releases its locks.
6221   </para>
6222
6223   <para>
6224    Although tuples are a lockable type of object,
6225    information about row-level locks is stored on disk, not in memory,
6226    and therefore row-level locks normally do not appear in this view.
6227    If a transaction is waiting for a
6228    row-level lock, it will usually appear in the view as waiting for the
6229    permanent transaction ID of the current holder of that row lock.
6230   </para>
6231
6232   <para>
6233    Advisory locks can be acquired on keys consisting of either a single
6234    <type>bigint</type> value or two integer values.  A <type>bigint</type> key is displayed with its
6235    high-order half in the <structfield>classid</> column, its low-order half
6236    in the <structfield>objid</> column, and <structfield>objsubid</> equal
6237    to 1.  Integer keys are displayed with the first key in the
6238    <structfield>classid</> column, the second key in the <structfield>objid</>
6239    column, and <structfield>objsubid</> equal to 2.  The actual meaning of
6240    the keys is up to the user.  Advisory locks are local to each database,
6241    so the <structfield>database</> column is meaningful for an advisory lock.
6242   </para>
6243
6244   <para>
6245    When the <structname>pg_locks</structname> view is accessed, the
6246    internal lock manager data structures are momentarily locked, and
6247    a copy is made for the view to display.  This ensures that the
6248    view produces a consistent set of results, while not blocking
6249    normal lock manager operations longer than necessary.  Nonetheless
6250    there could be some impact on database performance if this view is
6251    frequently accessed.
6252   </para>
6253
6254   <para>
6255    <structname>pg_locks</structname> provides a global view of all locks
6256    in the database cluster, not only those relevant to the current database.
6257    Although its <structfield>relation</structfield> column can be joined
6258    against <structname>pg_class</>.<structfield>oid</> to identify locked
6259    relations, this will only work correctly for relations in the current
6260    database (those for which the <structfield>database</structfield> column
6261    is either the current database's OID or zero).
6262   </para>
6263
6264   <para>
6265    The <structfield>pid</structfield> column can be joined to the
6266    <structfield>procpid</structfield> column of the
6267    <structname>pg_stat_activity</structname> view to get more
6268    information on the session holding or waiting to hold each lock.
6269    Also, if you are using prepared transactions, the
6270    <structfield>transaction</> column can be joined to the
6271    <structfield>transaction</structfield> column of the
6272    <structname>pg_prepared_xacts</structname> view to get more
6273    information on prepared transactions that hold locks.
6274    (A prepared transaction can never be waiting for a lock,
6275    but it continues to hold the locks it acquired while running.)
6276   </para>
6277
6278  </sect1>
6279
6280  <sect1 id="view-pg-prepared-statements">
6281   <title><structname>pg_prepared_statements</structname></title>
6282
6283   <indexterm zone="view-pg-prepared-statements">
6284    <primary>pg_prepared_statements</primary>
6285   </indexterm>
6286
6287   <para>
6288    The <structname>pg_prepared_statements</structname> view displays
6289    all the prepared statements that are available in the current
6290    session. See <xref linkend="sql-prepare"
6291    endterm="sql-prepare-title"> for more information about prepared
6292    statements.
6293   </para>
6294
6295   <para>
6296    <structname>pg_prepared_statements</structname> contains one row
6297    for each prepared statement. Rows are added to the view when a new
6298    prepared statement is created and removed when a prepared statement
6299    is released (for example, via the <xref linkend="sql-deallocate"
6300    endterm="sql-deallocate-title"> command).
6301   </para>
6302
6303   <table>
6304    <title><structname>pg_prepared_statements</> Columns</title>
6305
6306    <tgroup cols="3">
6307     <thead>
6308      <row>
6309       <entry>Name</entry>
6310       <entry>Type</entry>
6311       <entry>Description</entry>
6312      </row>
6313     </thead>
6314     <tbody>
6315      <row>
6316       <entry><structfield>name</structfield></entry>
6317       <entry><type>text</type></entry>
6318       <entry>
6319        The identifier of the prepared statement
6320       </entry>
6321      </row>
6322      <row>
6323       <entry><structfield>statement</structfield></entry>
6324       <entry><type>text</type></entry>
6325       <entry>
6326        The query string submitted by the client to create this
6327        prepared statement. For prepared statements created via SQL,
6328        this is the <command>PREPARE</command> statement submitted by
6329        the client. For prepared statements created via the
6330        frontend/backend protocol, this is the text of the prepared
6331        statement itself
6332       </entry>
6333      </row>
6334      <row>
6335       <entry><structfield>prepare_time</structfield></entry>
6336       <entry><type>timestamptz</type></entry>
6337       <entry>
6338        The time at which the prepared statement was created
6339       </entry>
6340      </row>
6341      <row>
6342       <entry><structfield>parameter_types</structfield></entry>
6343       <entry><type>regtype[]</type></entry>
6344       <entry>
6345        The expected parameter types for the prepared statement in the
6346        form of an array of <type>regtype</type>. The OID corresponding
6347        to an element of this array can be obtained by casting the
6348        <type>regtype</type> value to <type>oid</type>
6349       </entry>
6350      </row>
6351      <row>
6352       <entry><structfield>from_sql</structfield></entry>
6353       <entry><type>boolean</type></entry>
6354       <entry>
6355        <literal>true</literal> if the prepared statement was created
6356        via the <command>PREPARE</command> SQL statement;
6357        <literal>false</literal> if the statement was prepared via the
6358        frontend/backend protocol
6359       </entry>
6360      </row>
6361     </tbody>
6362    </tgroup>
6363   </table>
6364
6365   <para>
6366    The <structname>pg_prepared_statements</structname> view is read only.
6367   </para>
6368  </sect1>
6369
6370  <sect1 id="view-pg-prepared-xacts">
6371   <title><structname>pg_prepared_xacts</structname></title>
6372
6373   <indexterm zone="view-pg-prepared-xacts">
6374    <primary>pg_prepared_xacts</primary>
6375   </indexterm>
6376
6377   <para>
6378    The view <structname>pg_prepared_xacts</structname> displays
6379    information about transactions that are currently prepared for two-phase
6380    commit (see <xref linkend="sql-prepare-transaction"
6381    endterm="sql-prepare-transaction-title"> for details).
6382   </para>
6383
6384   <para>
6385    <structname>pg_prepared_xacts</structname> contains one row per prepared
6386    transaction.  An entry is removed when the transaction is committed or
6387    rolled back.
6388   </para>
6389
6390   <table>
6391    <title><structname>pg_prepared_xacts</> Columns</title>
6392
6393    <tgroup cols="4">
6394     <thead>
6395      <row>
6396       <entry>Name</entry>
6397       <entry>Type</entry>
6398       <entry>References</entry>
6399       <entry>Description</entry>
6400      </row>
6401     </thead>
6402     <tbody>
6403      <row>
6404       <entry><structfield>transaction</structfield></entry>
6405       <entry><type>xid</type></entry>
6406       <entry></entry>
6407       <entry>
6408        Numeric transaction identifier of the prepared transaction
6409       </entry>
6410      </row>
6411      <row>
6412       <entry><structfield>gid</structfield></entry>
6413       <entry><type>text</type></entry>
6414       <entry></entry>
6415       <entry>
6416        Global transaction identifier that was assigned to the transaction
6417       </entry>
6418      </row>
6419      <row>
6420       <entry><structfield>prepared</structfield></entry>
6421       <entry><type>timestamp with time zone</type></entry>
6422       <entry></entry>
6423       <entry>
6424        Time at which the transaction was prepared for commit
6425       </entry>
6426      </row>
6427      <row>
6428       <entry><structfield>owner</structfield></entry>
6429       <entry><type>name</type></entry>
6430       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6431       <entry>
6432        Name of the user that executed the transaction
6433       </entry>
6434      </row>
6435      <row>
6436       <entry><structfield>database</structfield></entry>
6437       <entry><type>name</type></entry>
6438       <entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
6439       <entry>
6440        Name of the database in which the transaction was executed
6441       </entry>
6442      </row>
6443     </tbody>
6444    </tgroup>
6445   </table>
6446
6447   <para>
6448    When the <structname>pg_prepared_xacts</structname> view is accessed, the
6449    internal transaction manager data structures are momentarily locked, and
6450    a copy is made for the view to display.  This ensures that the
6451    view produces a consistent set of results, while not blocking
6452    normal operations longer than necessary.  Nonetheless
6453    there could be some impact on database performance if this view is
6454    frequently accessed.
6455   </para>
6456
6457  </sect1>
6458
6459  <sect1 id="view-pg-roles">
6460   <title><structname>pg_roles</structname></title>
6461
6462   <indexterm zone="view-pg-roles">
6463    <primary>pg_roles</primary>
6464   </indexterm>
6465
6466   <para>
6467    The view <structname>pg_roles</structname> provides access to
6468    information about database roles.  This is simply a publicly
6469    readable view of
6470    <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>
6471    that blanks out the password field.
6472   </para>
6473
6474   <para>
6475    This view explicitly exposes the OID column of the underlying table,
6476    since that is needed to do joins to other catalogs.
6477   </para>
6478
6479   <table>
6480    <title><structname>pg_roles</> Columns</title>
6481
6482    <tgroup cols="4">
6483     <thead>
6484      <row>
6485       <entry>Name</entry>
6486       <entry>Type</entry>
6487       <entry>References</entry>
6488       <entry>Description</entry>
6489      </row>
6490     </thead>
6491
6492     <tbody>
6493      <row>
6494       <entry><structfield>rolname</structfield></entry>
6495       <entry><type>name</type></entry>
6496       <entry></entry>
6497       <entry>Role name</entry>
6498      </row>
6499
6500      <row>
6501       <entry><structfield>rolsuper</structfield></entry>
6502       <entry><type>bool</type></entry>
6503       <entry></entry>
6504       <entry>Role has superuser privileges</entry>
6505      </row>
6506
6507      <row>
6508       <entry><structfield>rolinherit</structfield></entry>
6509       <entry><type>bool</type></entry>
6510       <entry></entry>
6511       <entry>Role automatically inherits privileges of roles it is a
6512        member of</entry>
6513      </row>
6514
6515      <row>
6516       <entry><structfield>rolcreaterole</structfield></entry>
6517       <entry><type>bool</type></entry>
6518       <entry></entry>
6519       <entry>Role can create more roles</entry>
6520      </row>
6521
6522      <row>
6523       <entry><structfield>rolcreatedb</structfield></entry>
6524       <entry><type>bool</type></entry>
6525       <entry></entry>
6526       <entry>Role can create databases</entry>
6527      </row>
6528
6529      <row>
6530       <entry><structfield>rolcatupdate</structfield></entry>
6531       <entry><type>bool</type></entry>
6532       <entry></entry>
6533       <entry>
6534        Role can update system catalogs directly.  (Even a superuser cannot do
6535        this unless this column is true.)
6536       </entry>
6537      </row>
6538
6539      <row>
6540       <entry><structfield>rolcanlogin</structfield></entry>
6541       <entry><type>bool</type></entry>
6542       <entry></entry>
6543       <entry>
6544        Role can log in. That is, this role can be given as the initial
6545        session authorization identifier
6546       </entry>
6547      </row>
6548
6549      <row>
6550       <entry><structfield>rolconnlimit</structfield></entry>
6551       <entry><type>int4</type></entry>
6552       <entry></entry>
6553       <entry>
6554        For roles that can log in, this sets maximum number of concurrent
6555        connections this role can make.  -1 means no limit
6556       </entry>
6557      </row>
6558
6559      <row>
6560       <entry><structfield>rolpassword</structfield></entry>
6561       <entry><type>text</type></entry>
6562       <entry></entry>
6563       <entry>Not the password (always reads as <literal>********</>)</entry>
6564      </row>
6565
6566      <row>
6567       <entry><structfield>rolvaliduntil</structfield></entry>
6568       <entry><type>timestamptz</type></entry>
6569       <entry></entry>
6570       <entry>Password expiry time (only used for password authentication);
6571        NULL if no expiration</entry>
6572      </row>
6573
6574      <row>
6575       <entry><structfield>rolconfig</structfield></entry>
6576       <entry><type>text[]</type></entry>
6577       <entry></entry>
6578       <entry>Session defaults for run-time configuration variables</entry>
6579      </row>
6580
6581      <row>
6582       <entry><structfield>oid</structfield></entry>
6583       <entry><type>oid</type></entry>
6584       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6585       <entry>ID of role</entry>
6586      </row>
6587     </tbody>
6588    </tgroup>
6589   </table>
6590
6591  </sect1>
6592
6593  <sect1 id="view-pg-rules">
6594   <title><structname>pg_rules</structname></title>
6595
6596   <indexterm zone="view-pg-rules">
6597    <primary>pg_rules</primary>
6598   </indexterm>
6599
6600   <para>
6601    The view <structname>pg_rules</structname> provides access to
6602    useful information about query rewrite rules.
6603   </para>
6604
6605   <table>
6606    <title><structname>pg_rules</> Columns</title>
6607
6608    <tgroup cols="4">
6609     <thead>
6610      <row>
6611       <entry>Name</entry>
6612       <entry>Type</entry>
6613       <entry>References</entry>
6614       <entry>Description</entry>
6615      </row>
6616     </thead>
6617     <tbody>
6618      <row>
6619       <entry><structfield>schemaname</structfield></entry>
6620       <entry><type>name</type></entry>
6621       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6622       <entry>Name of schema containing table</entry>
6623      </row>
6624      <row>
6625       <entry><structfield>tablename</structfield></entry>
6626       <entry><type>name</type></entry>
6627       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6628       <entry>Name of table the rule is for</entry>
6629      </row>
6630      <row>
6631       <entry><structfield>rulename</structfield></entry>
6632       <entry><type>name</type></entry>
6633       <entry><literal><link linkend="catalog-pg-rewrite"><structname>pg_rewrite</structname></link>.rulename</literal></entry>
6634       <entry>Name of rule</entry>
6635      </row>
6636      <row>
6637       <entry><structfield>definition</structfield></entry>
6638       <entry><type>text</type></entry>
6639       <entry></entry>
6640       <entry>Rule definition (a reconstructed creation command)</entry>
6641      </row>
6642     </tbody>
6643    </tgroup>
6644   </table>
6645
6646   <para>
6647    The <structname>pg_rules</> view excludes the <literal>ON SELECT</> rules
6648    of views; those can be seen in <structname>pg_views</>.
6649   </para>
6650
6651  </sect1>
6652
6653  <sect1 id="view-pg-settings">
6654   <title><structname>pg_settings</structname></title>
6655
6656   <indexterm zone="view-pg-settings">
6657    <primary>pg_settings</primary>
6658   </indexterm>
6659
6660   <para>
6661    The view <structname>pg_settings</structname> provides access to
6662    run-time parameters of the server.  It is essentially an alternative
6663    interface to the <xref linkend="sql-show" endterm="sql-show-title">
6664    and <xref linkend="sql-set" endterm="sql-set-title"> commands.
6665    It also provides access to some facts about each parameter that are
6666    not directly available from <command>SHOW</>, such as minimum and
6667    maximum values.
6668   </para>
6669
6670   <table>
6671    <title><structname>pg_settings</> Columns</title>
6672
6673    <tgroup cols="3">
6674     <thead>
6675      <row>
6676       <entry>Name</entry>
6677       <entry>Type</entry>
6678       <entry>Description</entry>
6679      </row>
6680     </thead>
6681     <tbody>
6682      <row>
6683       <entry><structfield>name</structfield></entry>
6684       <entry><type>text</type></entry>
6685       <entry>Run-time configuration parameter name</entry>
6686      </row>
6687      <row>
6688       <entry><structfield>setting</structfield></entry>
6689       <entry><type>text</type></entry>
6690       <entry>Current value of the parameter</entry>
6691      </row>
6692      <row>
6693       <entry><structfield>unit</structfield></entry>
6694       <entry><type>text</type></entry>
6695       <entry>Implicit unit of the parameter</entry>
6696      </row>
6697      <row>
6698       <entry><structfield>category</structfield></entry>
6699       <entry><type>text</type></entry>
6700       <entry>Logical group of the parameter</entry>
6701      </row>
6702      <row>
6703       <entry><structfield>short_desc</structfield></entry>
6704       <entry><type>text</type></entry>
6705       <entry>A brief description of the parameter</entry>
6706      </row>
6707      <row>
6708       <entry><structfield>extra_desc</structfield></entry>
6709       <entry><type>text</type></entry>
6710       <entry>Additional, more detailed, description of the parameter</entry>
6711      </row>
6712      <row>
6713       <entry><structfield>context</structfield></entry>
6714       <entry><type>text</type></entry>
6715       <entry>Context required to set the parameter's value</entry>
6716      </row>
6717      <row>
6718       <entry><structfield>vartype</structfield></entry>
6719       <entry><type>text</type></entry>
6720       <entry>Parameter type (<literal>bool</>, <literal>enum</>,
6721        <literal>integer</>, <literal>real</>, or <literal>string</>)
6722       </entry>
6723      </row>
6724      <row>
6725       <entry><structfield>source</structfield></entry>
6726       <entry><type>text</type></entry>
6727       <entry>Source of the current parameter value</entry>
6728      </row>
6729      <row>
6730       <entry><structfield>min_val</structfield></entry>
6731       <entry><type>text</type></entry>
6732       <entry>Minimum allowed value of the parameter (NULL for non-numeric
6733       values)</entry>
6734      </row>
6735      <row>
6736       <entry><structfield>max_val</structfield></entry>
6737       <entry><type>text</type></entry>
6738       <entry>Maximum allowed value of the parameter (NULL for non-numeric
6739       values)</entry>
6740      </row>
6741      <row>
6742       <entry><structfield>enumvals</structfield></entry>
6743       <entry><type>text[]</type></entry>
6744       <entry>Allowed values of an enum parameter (NULL for non-enum
6745       values)</entry>
6746      </row>
6747      <row>
6748       <entry><structfield>boot_val</structfield></entry>
6749       <entry><type>text</type></entry>
6750       <entry>Parameter value assumed at server startup if the parameter is
6751       not otherwise set</entry>
6752      </row>
6753      <row>
6754       <entry><structfield>reset_val</structfield></entry>
6755       <entry><type>text</type></entry>
6756       <entry>Value that <command>RESET</command> would reset the parameter to
6757       in the current session</entry>
6758      </row>
6759      <row>
6760       <entry><structfield>sourcefile</structfield></entry>
6761       <entry><type>text</type></entry>
6762       <entry>Configuration file the current value was set in (NULL for
6763       values set from sources other than configuration files, or when
6764       examined by a non-superuser).
6765       Helpful when using configuration include directives</entry>
6766      </row>
6767      <row>
6768       <entry><structfield>sourceline</structfield></entry>
6769       <entry><type>integer</type></entry>
6770       <entry>Line number within the configuration file the current value was
6771       set at (NULL for values set from sources other than configuration files,
6772       or when examined by a non-superuser)
6773       </entry>
6774      </row>
6775     </tbody>
6776    </tgroup>
6777   </table>
6778
6779   <para>
6780    The <structname>pg_settings</structname> view cannot be inserted into or
6781    deleted from, but it can be updated.  An <command>UPDATE</command> applied
6782    to a row of <structname>pg_settings</structname> is equivalent to executing
6783    the <xref linkend="sql-set" endterm="sql-set-title"> command on that named
6784    parameter. The change only affects the value used by the current
6785    session. If an <command>UPDATE</command> is issued within a transaction
6786    that is later aborted, the effects of the <command>UPDATE</command> command
6787    disappear when the transaction is rolled back. Once the surrounding
6788    transaction is committed, the effects will persist until the end of the
6789    session, unless overridden by another <command>UPDATE</command> or
6790    <command>SET</command>.
6791   </para>
6792
6793  </sect1>
6794
6795  <sect1 id="view-pg-shadow">
6796   <title><structname>pg_shadow</structname></title>
6797
6798   <indexterm zone="view-pg-shadow">
6799    <primary>pg_shadow</primary>
6800   </indexterm>
6801
6802   <para>
6803    The view <structname>pg_shadow</structname> exists for backwards
6804    compatibility: it emulates a catalog that existed in
6805    <productname>PostgreSQL</productname> before version 8.1.
6806    It shows properties of all roles that are marked as
6807    <structfield>rolcanlogin</>.
6808   </para>
6809
6810   <para>
6811    The name stems from the fact that this table
6812    should not be readable by the public since it contains passwords.
6813    <link linkend="view-pg-user"><structname>pg_user</structname></link>
6814    is a publicly readable view on
6815    <structname>pg_shadow</structname> that blanks out the password field.
6816   </para>
6817
6818   <table>
6819    <title><structname>pg_shadow</> Columns</title>
6820
6821    <tgroup cols="4">
6822     <thead>
6823      <row>
6824       <entry>Name</entry>
6825       <entry>Type</entry>
6826       <entry>References</entry>
6827       <entry>Description</entry>
6828      </row>
6829     </thead>
6830
6831     <tbody>
6832      <row>
6833       <entry><structfield>usename</structfield></entry>
6834       <entry><type>name</type></entry>
6835       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
6836       <entry>User name</entry>
6837      </row>
6838
6839      <row>
6840       <entry><structfield>usesysid</structfield></entry>
6841       <entry><type>oid</type></entry>
6842       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
6843       <entry>ID of this user</entry>
6844      </row>
6845
6846      <row>
6847       <entry><structfield>usecreatedb</structfield></entry>
6848       <entry><type>bool</type></entry>
6849       <entry></entry>
6850       <entry>User can create databases</entry>
6851      </row>
6852
6853      <row>
6854       <entry><structfield>usesuper</structfield></entry>
6855       <entry><type>bool</type></entry>
6856       <entry></entry>
6857       <entry>User is a superuser</entry>
6858      </row>
6859
6860      <row>
6861       <entry><structfield>usecatupd</structfield></entry>
6862       <entry><type>bool</type></entry>
6863       <entry></entry>
6864       <entry>
6865        User can update system catalogs.  (Even a superuser cannot do
6866        this unless this column is true.)
6867       </entry>
6868      </row>
6869
6870      <row>
6871       <entry><structfield>passwd</structfield></entry>
6872       <entry><type>text</type></entry>
6873       <entry></entry>
6874       <entry>Password (possibly encrypted)</entry>
6875      </row>
6876
6877      <row>
6878       <entry><structfield>valuntil</structfield></entry>
6879       <entry><type>abstime</type></entry>
6880       <entry></entry>
6881       <entry>Password expiry time (only used for password authentication)</entry>
6882      </row>
6883
6884      <row>
6885       <entry><structfield>useconfig</structfield></entry>
6886       <entry><type>text[]</type></entry>
6887       <entry></entry>
6888       <entry>Session defaults for run-time configuration variables</entry>
6889      </row>
6890     </tbody>
6891    </tgroup>
6892   </table>
6893
6894  </sect1>
6895
6896  <sect1 id="view-pg-stats">
6897   <title><structname>pg_stats</structname></title>
6898
6899   <indexterm zone="view-pg-stats">
6900    <primary>pg_stats</primary>
6901   </indexterm>
6902
6903   <para>
6904    The view <structname>pg_stats</structname> provides access to
6905    the information stored in the <link
6906    linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
6907    catalog.  This view allows access only to rows of
6908    <structname>pg_statistic</structname> that correspond to tables the
6909    user has permission to read, and therefore it is safe to allow public
6910    read access to this view.
6911   </para>
6912
6913   <para>
6914    <structname>pg_stats</structname> is also designed to present the
6915    information in a more readable format than the underlying catalog
6916    &mdash; at the cost that its schema must be extended whenever new slot types
6917    are defined for <structname>pg_statistic</structname>.
6918   </para>
6919
6920   <table>
6921    <title><structname>pg_stats</> Columns</title>
6922
6923    <tgroup cols="4">
6924     <thead>
6925      <row>
6926       <entry>Name</entry>
6927       <entry>Type</entry>
6928       <entry>References</entry>
6929       <entry>Description</entry>
6930      </row>
6931     </thead>
6932     <tbody>
6933      <row>
6934       <entry><structfield>schemaname</structfield></entry>
6935       <entry><type>name</type></entry>
6936       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
6937       <entry>Name of schema containing table</entry>
6938      </row>
6939
6940      <row>
6941       <entry><structfield>tablename</structfield></entry>
6942       <entry><type>name</type></entry>
6943       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
6944       <entry>Name of table</entry>
6945      </row>
6946
6947      <row>
6948       <entry><structfield>attname</structfield></entry>
6949       <entry><type>name</type></entry>
6950       <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attname</literal></entry>
6951       <entry>Name of the column described by this row</entry>
6952      </row>
6953
6954      <row>
6955       <entry><structfield>null_frac</structfield></entry>
6956       <entry><type>real</type></entry>
6957       <entry></entry>
6958       <entry>Fraction of column entries that are null</entry>
6959      </row>
6960
6961      <row>
6962       <entry><structfield>avg_width</structfield></entry>
6963       <entry><type>integer</type></entry>
6964       <entry></entry>
6965       <entry>Average width in bytes of column's entries</entry>
6966      </row>
6967
6968      <row>
6969       <entry><structfield>n_distinct</structfield></entry>
6970       <entry><type>real</type></entry>
6971       <entry></entry>
6972       <entry>
6973        If greater than zero, the estimated number of distinct values in the
6974        column.  If less than zero, the negative of the number of distinct
6975        values divided by the number of rows.  (The negated form is used when
6976        <command>ANALYZE</> believes that the number of distinct values is
6977        likely to increase as the table grows; the positive form is used when
6978        the column seems to have a fixed number of possible values.)  For
6979        example, -1 indicates a unique column in which the number of distinct
6980        values is the same as the number of rows
6981       </entry>
6982      </row>
6983
6984      <row>
6985       <entry><structfield>most_common_vals</structfield></entry>
6986       <entry><type>anyarray</type></entry>
6987       <entry></entry>
6988       <entry>
6989        A list of the most common values in the column. (NULL if
6990        no values seem to be more common than any others.)
6991        For some datatypes such as <type>tsvector</>, this is a list of
6992        the most common element values rather than values of the type itself.
6993       </entry>
6994      </row>
6995
6996      <row>
6997       <entry><structfield>most_common_freqs</structfield></entry>
6998       <entry><type>real[]</type></entry>
6999       <entry></entry>
7000       <entry>
7001        A list of the frequencies of the most common values or elements,
7002        i.e., number of occurrences of each divided by total number of rows.
7003        (NULL when <structfield>most_common_vals</structfield> is.)
7004        For some datatypes such as <type>tsvector</>, it can also store some
7005        additional information, making it longer than the
7006        <structfield>most_common_vals</> array.
7007       </entry>
7008      </row>
7009
7010      <row>
7011       <entry><structfield>histogram_bounds</structfield></entry>
7012       <entry><type>anyarray</type></entry>
7013       <entry></entry>
7014       <entry>
7015        A list of values that divide the column's values into groups of
7016        approximately equal population.  The values in
7017        <structfield>most_common_vals</>, if present, are omitted from this
7018        histogram calculation.  (This column is NULL if the column data type
7019        does not have a <literal>&lt;</> operator or if the
7020        <structfield>most_common_vals</> list accounts for the entire
7021        population.)
7022       </entry>
7023      </row>
7024
7025      <row>
7026       <entry><structfield>correlation</structfield></entry>
7027       <entry><type>real</type></entry>
7028       <entry></entry>
7029       <entry>
7030        Statistical correlation between physical row ordering and
7031        logical ordering of the column values.  This ranges from -1 to +1.
7032        When the value is near -1 or +1, an index scan on the column will
7033        be estimated to be cheaper than when it is near zero, due to reduction
7034        of random access to the disk.  (This column is NULL if the column data
7035        type does not have a <literal>&lt;</> operator.)
7036       </entry>
7037      </row>
7038     </tbody>
7039    </tgroup>
7040   </table>
7041
7042   <para>
7043    The maximum number of entries in the <structfield>most_common_vals</>
7044    and <structfield>histogram_bounds</> arrays can be set on a
7045    column-by-column basis using the <command>ALTER TABLE SET STATISTICS</>
7046    command, or globally by setting the
7047    <xref linkend="guc-default-statistics-target"> run-time parameter.
7048   </para>
7049
7050  </sect1>
7051
7052  <sect1 id="view-pg-tables">
7053   <title><structname>pg_tables</structname></title>
7054
7055   <indexterm zone="view-pg-tables">
7056    <primary>pg_tables</primary>
7057   </indexterm>
7058
7059   <para>
7060    The view <structname>pg_tables</structname> provides access to
7061    useful information about each table in the database.
7062   </para>
7063
7064   <table>
7065    <title><structname>pg_tables</> Columns</title>
7066
7067    <tgroup cols="4">
7068     <thead>
7069      <row>
7070       <entry>Name</entry>
7071       <entry>Type</entry>
7072       <entry>References</entry>
7073       <entry>Description</entry>
7074      </row>
7075     </thead>
7076     <tbody>
7077      <row>
7078       <entry><structfield>schemaname</structfield></entry>
7079       <entry><type>name</type></entry>
7080       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7081       <entry>Name of schema containing table</entry>
7082      </row>
7083      <row>
7084       <entry><structfield>tablename</structfield></entry>
7085       <entry><type>name</type></entry>
7086       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7087       <entry>Name of table</entry>
7088      </row>
7089      <row>
7090       <entry><structfield>tableowner</structfield></entry>
7091       <entry><type>name</type></entry>
7092       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7093       <entry>Name of table's owner</entry>
7094      </row>
7095      <row>
7096       <entry><structfield>tablespace</structfield></entry>
7097       <entry><type>name</type></entry>
7098       <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.spcname</literal></entry>
7099       <entry>Name of tablespace containing table (NULL if default for database)</entry>
7100      </row>
7101      <row>
7102       <entry><structfield>hasindexes</structfield></entry>
7103       <entry><type>boolean</type></entry>
7104       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasindex</literal></entry>
7105       <entry>true if table has (or recently had) any indexes</entry>
7106      </row>
7107      <row>
7108       <entry><structfield>hasrules</structfield></entry>
7109       <entry><type>boolean</type></entry>
7110       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhasrules</literal></entry>
7111       <entry>true if table has (or once had) rules</entry>
7112      </row>
7113      <row>
7114       <entry><structfield>hastriggers</structfield></entry>
7115       <entry><type>boolean</type></entry>
7116       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relhastriggers</literal></entry>
7117       <entry>true if table has (or once had) triggers</entry>
7118      </row>
7119     </tbody>
7120    </tgroup>
7121   </table>
7122
7123  </sect1>
7124
7125  <sect1 id="view-pg-timezone-abbrevs">
7126   <title><structname>pg_timezone_abbrevs</structname></title>
7127
7128   <indexterm zone="view-pg-timezone-abbrevs">
7129    <primary>pg_timezone_abbrevs</primary>
7130   </indexterm>
7131
7132   <para>
7133    The view <structname>pg_timezone_abbrevs</structname> provides a list
7134    of time zone abbreviations that are currently recognized by the datetime
7135    input routines.  The contents of this view change when the
7136    <xref linkend="guc-timezone-abbreviations"> run-time parameter is modified.
7137   </para>
7138
7139   <table>
7140    <title><structname>pg_timezone_abbrevs</> Columns</title>
7141
7142    <tgroup cols="3">
7143     <thead>
7144      <row>
7145       <entry>Name</entry>
7146       <entry>Type</entry>
7147       <entry>Description</entry>
7148      </row>
7149     </thead>
7150     <tbody>
7151      <row>
7152       <entry><structfield>abbrev</structfield></entry>
7153       <entry><type>text</type></entry>
7154       <entry>Time zone abbreviation</entry>
7155      </row>
7156      <row>
7157       <entry><structfield>utc_offset</structfield></entry>
7158       <entry><type>interval</type></entry>
7159       <entry>Offset from UTC (positive means east of Greenwich)</entry>
7160      </row>
7161      <row>
7162       <entry><structfield>is_dst</structfield></entry>
7163       <entry><type>boolean</type></entry>
7164       <entry>True if this is a daylight-savings abbreviation</entry>
7165      </row>
7166     </tbody>
7167    </tgroup>
7168   </table>
7169
7170  </sect1>
7171
7172  <sect1 id="view-pg-timezone-names">
7173   <title><structname>pg_timezone_names</structname></title>
7174
7175   <indexterm zone="view-pg-timezone-names">
7176    <primary>pg_timezone_names</primary>
7177   </indexterm>
7178
7179   <para>
7180    The view <structname>pg_timezone_names</structname> provides a list
7181    of time zone names that are recognized by <command>SET TIMEZONE</>,
7182    along with their associated abbreviations, UTC offsets,
7183    and daylight-savings status.
7184    Unlike the abbreviations shown in <link
7185    linkend="view-pg-timezone-abbrevs"><structname>pg_timezone_abbrevs</structname></link>, many of these names imply a set of daylight-savings transition
7186    date rules.  Therefore, the associated information changes across local DST
7187    boundaries.  The displayed information is computed based on the current
7188    value of <function>CURRENT_TIMESTAMP</>.
7189   </para>
7190
7191   <table>
7192    <title><structname>pg_timezone_names</> Columns</title>
7193
7194    <tgroup cols="3">
7195     <thead>
7196      <row>
7197       <entry>Name</entry>
7198       <entry>Type</entry>
7199       <entry>Description</entry>
7200      </row>
7201     </thead>
7202     <tbody>
7203      <row>
7204       <entry><structfield>name</structfield></entry>
7205       <entry><type>text</type></entry>
7206       <entry>Time zone name</entry>
7207      </row>
7208      <row>
7209       <entry><structfield>abbrev</structfield></entry>
7210       <entry><type>text</type></entry>
7211       <entry>Time zone abbreviation</entry>
7212      </row>
7213      <row>
7214       <entry><structfield>utc_offset</structfield></entry>
7215       <entry><type>interval</type></entry>
7216       <entry>Offset from UTC (positive means east of Greenwich)</entry>
7217      </row>
7218      <row>
7219       <entry><structfield>is_dst</structfield></entry>
7220       <entry><type>boolean</type></entry>
7221       <entry>True if currently observing daylight savings</entry>
7222      </row>
7223     </tbody>
7224    </tgroup>
7225   </table>
7226
7227  </sect1>
7228
7229  <sect1 id="view-pg-user">
7230   <title><structname>pg_user</structname></title>
7231
7232   <indexterm zone="view-pg-user">
7233    <primary>pg_user</primary>
7234   </indexterm>
7235
7236   <para>
7237    The view <structname>pg_user</structname> provides access to
7238    information about database users.  This is simply a publicly
7239    readable view of
7240    <link linkend="view-pg-shadow"><structname>pg_shadow</structname></link>
7241    that blanks out the password field.
7242   </para>
7243
7244   <table>
7245    <title><structname>pg_user</> Columns</title>
7246
7247    <tgroup cols="3">
7248     <thead>
7249      <row>
7250       <entry>Name</entry>
7251       <entry>Type</entry>
7252       <entry>Description</entry>
7253      </row>
7254     </thead>
7255     <tbody>
7256      <row>
7257       <entry><structfield>usename</structfield></entry>
7258       <entry><type>name</type></entry>
7259       <entry>User name</entry>
7260      </row>
7261
7262      <row>
7263       <entry><structfield>usesysid</structfield></entry>
7264       <entry><type>int4</type></entry>
7265       <entry>User ID (arbitrary number used to reference this user)</entry>
7266      </row>
7267
7268      <row>
7269       <entry><structfield>usecreatedb</structfield></entry>
7270       <entry><type>bool</type></entry>
7271       <entry>User can create databases</entry>
7272      </row>
7273
7274      <row>
7275       <entry><structfield>usesuper</structfield></entry>
7276       <entry><type>bool</type></entry>
7277       <entry>User is a superuser</entry>
7278      </row>
7279
7280      <row>
7281       <entry><structfield>usecatupd</structfield></entry>
7282       <entry><type>bool</type></entry>
7283       <entry>
7284        User can update system catalogs.  (Even a superuser cannot do
7285        this unless this column is true.)
7286       </entry>
7287      </row>
7288
7289      <row>
7290       <entry><structfield>passwd</structfield></entry>
7291       <entry><type>text</type></entry>
7292       <entry>Not the password (always reads as <literal>********</>)</entry>
7293      </row>
7294
7295      <row>
7296       <entry><structfield>valuntil</structfield></entry>
7297       <entry><type>abstime</type></entry>
7298       <entry>Password expiry time (only used for password authentication)</entry>
7299      </row>
7300
7301      <row>
7302       <entry><structfield>useconfig</structfield></entry>
7303       <entry><type>text[]</type></entry>
7304       <entry>Session defaults for run-time configuration variables</entry>
7305      </row>
7306     </tbody>
7307    </tgroup>
7308   </table>
7309
7310  </sect1>
7311
7312  <sect1 id="view-pg-user-mappings">
7313   <title><structname>pg_user_mappings</structname></title>
7314
7315   <indexterm zone="view-pg-user-mappings">
7316    <primary>pg_user_mappings</primary>
7317   </indexterm>
7318
7319   <para>
7320    The view <structname>pg_user_mappings</structname> provides access
7321    to information about user mappings.  This is essentially a publicly
7322    readable view of
7323    <link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>
7324    that leaves out the options field if the user has no rights to use
7325    it.
7326   </para>
7327
7328   <table>
7329    <title><structname>pg_user_mappings</> Columns</title>
7330
7331    <tgroup cols="3">
7332     <thead>
7333      <row>
7334       <entry>Name</entry>
7335       <entry>Type</entry>
7336       <entry>References</entry>
7337       <entry>Description</entry>
7338      </row>
7339     </thead>
7340
7341     <tbody>
7342      <row>
7343       <entry><structfield>umid</structfield></entry>
7344       <entry><type>oid</type></entry>
7345       <entry><literal><link linkend="catalog-pg-user-mapping"><structname>pg_user_mapping</structname></link>.oid</literal></entry>
7346       <entry>OID of the user mapping</entry>
7347      </row>
7348
7349      <row>
7350       <entry><structfield>srvid</structfield></entry>
7351       <entry><type>oid</type></entry>
7352       <entry><literal><link linkend="catalog-pg-foreign-server"><structname>pg_foreign_server</structname></link>.oid</literal></entry>
7353       <entry>
7354        The OID of the foreign server that contains this mapping
7355       </entry>
7356      </row>
7357
7358      <row>
7359       <entry><structfield>srvname</structfield></entry>
7360       <entry><type>text</type></entry>
7361       <entry></entry>
7362       <entry>
7363        Name of the foreign server
7364       </entry>
7365      </row>
7366
7367      <row>
7368       <entry><structfield>umuser</structfield></entry>
7369       <entry><type>oid</type></entry>
7370       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
7371       <entry>OID of the local role being mapped, 0 if the user mapping is public</entry>
7372      </row>
7373
7374      <row>
7375       <entry><structfield>usename</structfield></entry>
7376       <entry><type>name</type></entry>
7377       <entry></entry>
7378       <entry>Name of the local user to be mapped</entry>
7379      </row>
7380
7381      <row>
7382       <entry><structfield>umoptions</structfield></entry>
7383       <entry><type>text[]</type></entry>
7384       <entry></entry>
7385       <entry>
7386        User mapping specific options, as <quote>keyword=value</>
7387        strings, if the current user is the owner of the foreign
7388        server, else null.
7389       </entry>
7390      </row>
7391     </tbody>
7392    </tgroup>
7393   </table>
7394  </sect1>
7395
7396
7397  <sect1 id="view-pg-views">
7398   <title><structname>pg_views</structname></title>
7399
7400   <indexterm zone="view-pg-views">
7401    <primary>pg_views</primary>
7402   </indexterm>
7403
7404   <para>
7405    The view <structname>pg_views</structname> provides access to
7406    useful information about each view in the database.
7407   </para>
7408
7409   <table>
7410    <title><structname>pg_views</> Columns</title>
7411
7412    <tgroup cols="4">
7413     <thead>
7414      <row>
7415       <entry>Name</entry>
7416       <entry>Type</entry>
7417       <entry>References</entry>
7418       <entry>Description</entry>
7419      </row>
7420     </thead>
7421     <tbody>
7422      <row>
7423       <entry><structfield>schemaname</structfield></entry>
7424       <entry><type>name</type></entry>
7425       <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.nspname</literal></entry>
7426       <entry>Name of schema containing view</entry>
7427      </row>
7428      <row>
7429       <entry><structfield>viewname</structfield></entry>
7430       <entry><type>name</type></entry>
7431       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.relname</literal></entry>
7432       <entry>Name of view</entry>
7433      </row>
7434      <row>
7435       <entry><structfield>viewowner</structfield></entry>
7436       <entry><type>name</type></entry>
7437       <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.rolname</literal></entry>
7438       <entry>Name of view's owner</entry>
7439      </row>
7440      <row>
7441       <entry><structfield>definition</structfield></entry>
7442       <entry><type>text</type></entry>
7443       <entry></entry>
7444       <entry>View definition (a reconstructed <command>SELECT</command> query)</entry>
7445      </row>
7446     </tbody>
7447    </tgroup>
7448   </table>
7449
7450  </sect1>
7451
7452 </chapter>