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