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