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