]> granicus.if.org Git - postgresql/blob - doc/src/sgml/catalogs.sgml
5921f476b73dc9a736723964062ab9e76c7ab7e8
[postgresql] / doc / src / sgml / catalogs.sgml
1 <!--
2  Documentation of the system catalogs, directed toward PostgreSQL developers
3  $Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.63 2002/10/14 04:29:23 momjian Exp $
4  -->
5
6 <chapter id="catalogs">
7  <title>System Catalogs</title>
8
9  <sect1 id="catalogs-overview">
10   <title>Overview</title>
11
12   <para>
13    The system catalogs are the place where a relational database
14    management system stores schema metadata, such as information about
15    tables and columns, and internal bookkeeping information.
16    <productname>PostgreSQL</productname>'s system catalogs are regular
17    tables.  You can drop and recreate the tables, add columns, insert
18    and update values, and severely mess up your system that way.
19    Normally one should not change the system catalogs by hand, there
20    are always SQL commands to do that.  (For example, <command>CREATE
21    DATABASE</command> inserts a row into the
22    <structname>pg_database</structname> catalog -- and actually
23    creates the database on disk.)  There are some exceptions for
24    especially esoteric operations, such as adding index access methods.
25   </para>
26   <para>
27    Most system catalogs are copied from the template database during
28    database creation, and are thereafter database-specific. A few
29    catalogs are physically shared across all databases in an installation;
30    these are marked in the descriptions of the individual catalogs.
31   </para>
32
33   <table>
34    <title>System Catalogs</title>
35
36    <tgroup cols="2">
37     <thead>
38      <row>
39       <entry>Catalog Name</entry>
40       <entry>Purpose</entry>
41      </row>
42     </thead>
43
44     <tbody>
45      <row>
46       <entry><link linkend="catalog-pg-aggregate">
47        <database class="table">pg_aggregate</database></link></entry>
48       <entry>aggregate functions</entry>
49      </row>
50
51      <row>
52       <entry>pg_am</entry>
53       <entry>index access methods</entry>
54      </row>
55
56      <row>
57       <entry>pg_amop</entry>
58       <entry>access method operators</entry>
59      </row>
60
61      <row>
62       <entry>pg_amproc</entry>
63       <entry>access method support procedures</entry>
64      </row>
65
66      <row>
67       <entry><link linkend="catalog-pg-attrdef">
68        <database class="table">pg_attrdef</database></link></entry>
69       <entry>column default values</entry>
70      </row>
71
72      <row>
73       <entry><link linkend="catalog-pg-attribute">
74        <database class="table">pg_attribute</database></link></entry>
75       <entry>table columns (<quote>attributes</quote>, <quote>fields</quote>)</entry>
76      </row>
77
78      <row>
79       <entry><link linkend="catalog-pg-cast">
80        <database class="table">pg_cast</database></link></entry>
81       <entry>casts (data type conversions)</entry>
82      </row>
83
84      <row>
85       <entry><link linkend="catalog-pg-class">
86        <database class="table">pg_class</database></link></entry>
87       <entry>tables, indexes, sequences (<quote>relations</quote>)</entry>
88      </row>
89
90      <row>
91       <entry><link linkend="catalog-pg-constraint">
92        <database class="table">pg_constraint</database></link></entry>
93       <entry>check constraints, unique / primary key constraints, foreign key constraints</entry>
94      </row>
95
96      <row>
97       <entry><link linkend="catalog-pg-conversion">
98        <database class="table">pg_conversion</database></link></entry>
99       <entry>encoding conversion information</entry>
100      </row>
101
102      <row>
103       <entry><link linkend="catalog-pg-database">
104        <database class="table">pg_database</database></link></entry>
105       <entry>databases within this database cluster</entry>
106      </row>
107
108      <row>
109       <entry><link linkend="catalog-pg-depend">
110        <database class="table">pg_depend</database></link></entry>
111       <entry>dependencies between database objects</entry>
112      </row>
113
114      <row>
115       <entry><link linkend="catalog-pg-description">
116        <database class="table">pg_description</database></link></entry>
117       <entry>descriptions or comments on database objects</entry>
118      </row>
119
120      <row>
121       <entry><link linkend="catalog-pg-group">
122        <database class="table">pg_group</database></link></entry>
123       <entry>groups of database users</entry>
124      </row>
125
126      <row>
127       <entry><link linkend="catalog-pg-index">
128        <database class="table">pg_index</database></link></entry>
129       <entry>additional index information</entry>
130      </row>
131
132      <row>
133       <entry><link linkend="catalog-pg-inherits">
134        <database class="table">pg_inherits</database></link></entry>
135       <entry>table inheritance hierarchy</entry>
136      </row>
137
138      <row>
139       <entry><link linkend="catalog-pg-language">
140        <database class="table">pg_language</database></link></entry>
141       <entry>languages for writing functions</entry>
142      </row>
143
144      <row>
145       <entry><link linkend="catalog-pg-largeobject">
146        <database class="table">pg_largeobject</database></link></entry>
147       <entry>large objects</entry>
148      </row>
149
150      <row>
151       <entry><link linkend="catalog-pg-listener">
152        <database class="table">pg_listener</database></link></entry>
153       <entry>asynchronous notification</entry>
154      </row>
155
156      <row>
157       <entry><link linkend="catalog-pg-namespace">
158        <database class="table">pg_namespace</database></link></entry>
159       <entry>namespaces (schemas)</entry>
160      </row>
161
162      <row>
163       <entry><link linkend="catalog-pg-opclass">
164        <database class="table">pg_opclass</database></link></entry>
165       <entry>index access method operator classes</entry>
166      </row>
167
168      <row>
169       <entry><link linkend="catalog-pg-operator">
170        <database class="table">pg_operator</database></link></entry>
171       <entry>operators</entry>
172      </row>
173
174      <row>
175       <entry><link linkend="catalog-pg-proc">
176        <database class="table">pg_proc</database></link></entry>
177       <entry>functions and procedures</entry>
178      </row>
179
180      <row>
181       <entry><link linkend="catalog-pg-rewrite">
182        <database class="table">pg_rewrite</database></link></entry>
183       <entry>query rewriter rules</entry>
184      </row>
185
186      <row>
187       <entry><link linkend="catalog-pg-shadow">
188        <database class="table">pg_shadow</database></link></entry>
189       <entry>database users</entry>
190      </row>
191
192      <row>
193       <entry><link linkend="catalog-pg-statistic">
194        <database class="table">pg_statistic</database></link></entry>
195       <entry>optimizer statistics</entry>
196      </row>
197
198      <row>
199       <entry><link linkend="catalog-pg-trigger">
200        <database class="table">pg_trigger</database></link></entry>
201       <entry>triggers</entry>
202      </row>
203
204      <row>
205       <entry><link linkend="catalog-pg-type">
206        <database class="table">pg_type</database></link></entry>
207       <entry>data types</entry>
208      </row>
209     </tbody>
210    </tgroup>
211   </table>
212
213   <para>
214    More detailed documentation of each catalog follows below.
215   </para>
216
217  </sect1>
218
219
220  <sect1 id="catalog-pg-aggregate">
221   <title>pg_aggregate</title>
222
223   <para>
224    <structname>pg_aggregate</structname> stores information about
225    aggregate functions.  An aggregate function is a function that
226    operates on a set of values (typically one column from each row
227    that matches a query condition) and returns a single value computed
228    from all these values.  Typical aggregate functions are
229    <function>sum</function>, <function>count</function>, and
230    <function>max</function>.  Each entry in
231    <structname>pg_aggregate</structname> is an extension of an entry
232    in <structname>pg_proc</structname>.  The <structname>pg_proc</structname>
233    entry carries the aggregate's name, input and output datatypes, and
234    other information that is similar to ordinary functions.
235   </para>
236
237   <table>
238    <title>pg_aggregate Columns</title>
239
240    <tgroup cols=4>
241     <thead>
242      <row>
243       <entry>Name</entry>
244       <entry>Type</entry>
245       <entry>References</entry>
246       <entry>Description</entry>
247      </row>
248     </thead>
249     <tbody>
250      <row>
251       <entry>aggfnoid</entry>
252       <entry><type>regproc</type></entry>
253       <entry>pg_proc.oid</entry>
254       <entry>pg_proc OID of the aggregate function</entry>
255      </row>
256      <row>
257       <entry>aggtransfn</entry>
258       <entry><type>regproc</type></entry>
259       <entry>pg_proc.oid</entry>
260       <entry>Transition function</entry>
261      </row>
262      <row>
263       <entry>aggfinalfn</entry>
264       <entry><type>regproc</type></entry>
265       <entry>pg_proc.oid</entry>
266       <entry>Final function (zero if none)</entry>
267      </row>
268      <row>
269       <entry>aggtranstype</entry>
270       <entry><type>oid</type></entry>
271       <entry>pg_type.oid</entry>
272       <entry>The type of the aggregate function's internal transition (state) data</entry>
273      </row>
274      <row>
275       <entry>agginitval</entry>
276       <entry><type>text</type></entry>
277       <entry></entry>
278       <entry>
279        The initial value of the transition state.  This is a text
280        field containing the initial value in its external string
281        representation.  If the field is NULL, the transition state
282        value starts out NULL.
283       </entry>
284      </row>
285     </tbody>
286    </tgroup>
287   </table>
288
289   <para>
290    New aggregate functions are registered with the <command>CREATE
291    AGGREGATE</command> command.  See the <citetitle>Programmer's
292    Guide</citetitle> for more information about writing aggregate
293    functions and the meaning of the transition functions, etc.
294   </para>
295
296  </sect1>
297
298
299  <sect1 id="catalog-pg-am">
300   <title>pg_am</title>
301
302   <para>
303    <structname>pg_am</structname> stores information about index access
304    methods.  There is one row for each index access method supported by
305    the system.
306   </para>
307
308   <table>
309    <title>pg_am Columns</title>
310
311    <tgroup cols=4>
312     <thead>
313      <row>
314       <entry>Name</entry>
315       <entry>Type</entry>
316       <entry>References</entry>
317       <entry>Description</entry>
318      </row>
319     </thead>
320     <tbody>
321
322      <row>
323       <entry>amname</entry>
324       <entry><type>name</type></entry>
325       <entry></entry>
326       <entry>name of the access method</entry>
327      </row>
328
329      <row>
330       <entry>amowner</entry>
331       <entry><type>int4</type></entry>
332       <entry>pg_shadow.usesysid</entry>
333       <entry>user ID of the owner (currently not used)</entry>
334      </row>
335
336      <row>
337       <entry>amstrategies</entry>
338       <entry><type>int2</type></entry>
339       <entry></entry>
340       <entry>number of operator strategies for this access method</entry>
341      </row>
342
343      <row>
344       <entry>amsupport</entry>
345       <entry><type>int2</type></entry>
346       <entry></entry>
347       <entry>number of support routines for this access method</entry>
348      </row>
349
350      <row>
351       <entry>amorderstrategy</entry>
352       <entry><type>int2</type></entry>
353       <entry></entry>
354       <entry>zero if the index offers no sort order, otherwise the strategy
355       number of the strategy operator that describes the sort order</entry>
356      </row>
357
358      <row>
359       <entry>amcanunique</entry>
360       <entry><type>bool</type></entry>
361       <entry></entry>
362       <entry>does AM support unique indexes?</entry>
363      </row>
364
365      <row>
366       <entry>amcanmulticol</entry>
367       <entry><type>bool</type></entry>
368       <entry></entry>
369       <entry>does AM support multicolumn indexes?</entry>
370      </row>
371
372      <row>
373       <entry>amindexnulls</entry>
374       <entry><type>bool</type></entry>
375       <entry></entry>
376       <entry>does AM support NULL index entries?</entry>
377      </row>
378
379      <row>
380       <entry>amconcurrent</entry>
381       <entry><type>bool</type></entry>
382       <entry></entry>
383       <entry>does AM support concurrent updates?</entry>
384      </row>
385
386      <row>
387       <entry>amgettuple</entry>
388       <entry><type>regproc</type></entry>
389       <entry>pg_proc.oid</entry>
390       <entry><quote>next valid tuple</quote> function</entry>
391      </row>
392
393      <row>
394       <entry>aminsert</entry>
395       <entry><type>regproc</type></entry>
396       <entry>pg_proc.oid</entry>
397       <entry><quote>insert this tuple</quote> function</entry>
398      </row>
399
400      <row>
401       <entry>ambeginscan</entry>
402       <entry><type>regproc</type></entry>
403       <entry>pg_proc.oid</entry>
404       <entry><quote>start new scan</quote> function</entry>
405      </row>
406
407      <row>
408       <entry>amrescan</entry>
409       <entry><type>regproc</type></entry>
410       <entry>pg_proc.oid</entry>
411       <entry><quote>restart this scan</quote> function</entry>
412      </row>
413
414      <row>
415       <entry>amendscan</entry>
416       <entry><type>regproc</type></entry>
417       <entry>pg_proc.oid</entry>
418       <entry><quote>end this scan</quote> function</entry>
419      </row>
420
421      <row>
422       <entry>ammarkpos</entry>
423       <entry><type>regproc</type></entry>
424       <entry>pg_proc.oid</entry>
425       <entry><quote>mark current scan position</quote> function</entry>
426      </row>
427
428      <row>
429       <entry>amrestrpos</entry>
430       <entry><type>regproc</type></entry>
431       <entry>pg_proc.oid</entry>
432       <entry><quote>restore marked scan position</quote> function</entry>
433      </row>
434
435      <row>
436       <entry>ambuild</entry>
437       <entry><type>regproc</type></entry>
438       <entry>pg_proc.oid</entry>
439       <entry><quote>build new index</quote> function</entry>
440      </row>
441
442      <row>
443       <entry>ambulkdelete</entry>
444       <entry><type>regproc</type></entry>
445       <entry>pg_proc.oid</entry>
446       <entry>bulk-delete function</entry>
447      </row>
448
449      <row>
450       <entry>amcostestimate</entry>
451       <entry><type>regproc</type></entry>
452       <entry>pg_proc.oid</entry>
453       <entry>estimate cost of an indexscan</entry>
454      </row>
455
456     </tbody>
457    </tgroup>
458   </table>
459
460    <para>
461     An index AM that supports multiple columns (has
462     <structfield>amcanmulticol</structfield> true) <emphasis>must</>
463     support indexing nulls in columns after the first, because the planner
464     will assume the index can be used for queries on just the first
465     column(s).  For example, consider an index on (a,b) and a query
466     WHERE a = 4.  The system will assume the index can be used to scan for
467     rows with a = 4, which is wrong if the index omits rows where b is null.
468     However it is okay to omit rows where the first indexed column is null.
469     (GiST currently does so.)
470     <structfield>amindexnulls</structfield> should be set true only if the
471     index AM indexes all rows, including arbitrary combinations of nulls.
472    </para>
473
474  </sect1>
475
476
477  <sect1 id="catalog-pg-amop">
478   <title>pg_amop</title>
479
480   <para>
481    <structname>pg_amop</structname> stores information about operators
482    associated with index access method operator classes.  There is one
483    row for each operator that is a member of an operator class.
484   </para>
485
486   <table>
487    <title>pg_amop Columns</title>
488
489    <tgroup cols=4>
490     <thead>
491      <row>
492       <entry>Name</entry>
493       <entry>Type</entry>
494       <entry>References</entry>
495       <entry>Description</entry>
496      </row>
497     </thead>
498     <tbody>
499
500      <row>
501       <entry>amopclaid</entry>
502       <entry><type>oid</type></entry>
503       <entry>pg_opclass.oid</entry>
504       <entry>the index opclass this entry is for</entry>
505      </row>
506
507      <row>
508       <entry>amopstrategy</entry>
509       <entry><type>int2</type></entry>
510       <entry></entry>
511       <entry>operator strategy number</entry>
512      </row>
513
514      <row>
515       <entry>amopreqcheck</entry>
516       <entry><type>bool</type></entry>
517       <entry></entry>
518       <entry>index hit must be rechecked</entry>
519      </row>
520
521      <row>
522       <entry>amopopr</entry>
523       <entry><type>oid</type></entry>
524       <entry>pg_operator.oid</entry>
525       <entry>the operator's pg_operator OID</entry>
526      </row>
527
528     </tbody>
529    </tgroup>
530   </table>
531
532  </sect1>
533
534
535  <sect1 id="catalog-pg-amproc">
536   <title>pg_amproc</title>
537
538   <para>
539    <structname>pg_amproc</structname> stores information about support
540    procedures
541    associated with index access method operator classes.  There is one
542    row for each support procedure belonging to an operator class.
543   </para>
544
545   <table>
546    <title>pg_amproc Columns</title>
547
548    <tgroup cols=4>
549     <thead>
550      <row>
551       <entry>Name</entry>
552       <entry>Type</entry>
553       <entry>References</entry>
554       <entry>Description</entry>
555      </row>
556     </thead>
557     <tbody>
558
559      <row>
560       <entry>amopclaid</entry>
561       <entry><type>oid</type></entry>
562       <entry>pg_opclass.oid</entry>
563       <entry>the index opclass this entry is for</entry>
564      </row>
565
566      <row>
567       <entry>amprocnum</entry>
568       <entry><type>int2</type></entry>
569       <entry></entry>
570       <entry>support procedure index</entry>
571      </row>
572
573      <row>
574       <entry>amproc</entry>
575       <entry><type>regproc</type></entry>
576       <entry>pg_proc.oid</entry>
577       <entry>OID of the proc</entry>
578      </row>
579
580     </tbody>
581    </tgroup>
582   </table>
583
584  </sect1>
585
586
587  <sect1 id="catalog-pg-attrdef">
588   <title>pg_attrdef</title>
589
590   <para>
591    This catalog stores column default values.  The main information
592    about columns is stored in <structname>pg_attribute</structname>
593    (see below).  Only columns that explicitly specify a default value
594    (when the table is created or the column is added) will have an
595    entry here.
596   </para>
597
598   <table>
599    <title>pg_attrdef Columns</title>
600
601    <tgroup cols=4>
602     <thead>
603      <row>
604       <entry>Name</entry>
605       <entry>Type</entry>
606       <entry>References</entry>
607       <entry>Description</entry>
608      </row>
609     </thead>
610
611     <tbody>
612      <row>
613       <entry>adrelid</entry>
614       <entry><type>oid</type></entry>
615       <entry>pg_class.oid</entry>
616       <entry>The table this column belongs to</entry>
617      </row>
618
619      <row>
620       <entry>adnum</entry>
621       <entry><type>int2</type></entry>
622       <entry>pg_attribute.attnum</entry>
623       <entry>The number of the column</entry>
624      </row>
625
626      <row>
627       <entry>adbin</entry>
628       <entry><type>text</type></entry>
629       <entry></entry>
630       <entry>An internal representation of the column default value</entry>
631      </row>
632
633      <row>
634       <entry>adsrc</entry>
635       <entry><type>text</type></entry>
636       <entry></entry>
637       <entry>A human-readable representation of the default value</entry>
638      </row>
639     </tbody>
640    </tgroup>
641   </table>
642
643  </sect1>
644
645
646  <sect1 id="catalog-pg-attribute">
647   <title>pg_attribute</title>
648
649   <para>
650    <structname>pg_attribute</structname> stores information about
651    table columns.  There will be exactly one
652    <structname>pg_attribute</structname> row for every column in every
653    table in the database.  (There will also be attribute entries for
654    indexes and other objects.  See <structname>pg_class</structname>.)
655   </para>
656
657   <para>
658    The term attribute is equivalent to column and is used for
659    historical reasons.
660   </para>
661
662   <table>
663    <title>pg_attribute Columns</title>
664
665    <tgroup cols=4>
666     <thead>
667      <row>
668       <entry>Name</entry>
669       <entry>Type</entry>
670       <entry>References</entry>
671       <entry>Description</entry>
672      </row>
673     </thead>
674
675     <tbody>
676      <row>
677       <entry>attrelid</entry>
678       <entry><type>oid</type></entry>
679       <entry>pg_class.oid</entry>
680       <entry>The table this column belongs to</entry>
681      </row>
682
683      <row>
684       <entry>attname</entry>
685       <entry><type>name</type></entry>
686       <entry></entry>
687       <entry>Column name</entry>
688      </row>
689
690      <row>
691       <entry>atttypid</entry>
692       <entry><type>oid</type></entry>
693       <entry>pg_type.oid</entry>
694       <entry>The data type of this column</entry>
695      </row>
696
697      <row>
698       <entry>attstattarget</entry>
699       <entry><type>int4</type></entry>
700       <entry></entry>
701       <entry>
702        <structfield>attstattarget</structfield> controls the level of detail
703        of statistics accumulated for this column by
704        <command>ANALYZE</command>.
705        A zero value indicates that no statistics should be collected.
706        A negative value says to use the system default statistics target.
707        The exact meaning of positive values is datatype-dependent.
708        For scalar datatypes, <structfield>attstattarget</structfield>
709        is both the target number of <quote>most common values</quote>
710        to collect, and the target number of histogram bins to create.
711       </entry>
712      </row>
713
714      <row>
715       <entry>attlen</entry>
716       <entry><type>int2</type></entry>
717       <entry></entry>
718       <entry>
719        This is a copy of
720        <structname>pg_type</structname>.<structfield>typlen</structfield>
721        of this column's type.
722       </entry>
723      </row>
724
725      <row>
726       <entry>attnum</entry>
727       <entry><type>int2</type></entry>
728       <entry></entry>
729       <entry>
730        The number of the column.  Ordinary columns are numbered from 1
731        up.  System columns, such as <structfield>oid</structfield>,
732        have (arbitrary) negative numbers.
733       </entry>
734      </row>
735
736      <row>
737       <entry>attndims</entry>
738       <entry><type>int4</type></entry>
739       <entry></entry>
740       <entry>
741        Number of dimensions, if the column is an array type; otherwise 0.
742        (Presently, the number of dimensions of an array is not enforced,
743        so any nonzero value effectively means <quote>it's an array</>.)
744       </entry>
745      </row>
746
747      <row>
748       <entry>attcacheoff</entry>
749       <entry><type>int4</type></entry>
750       <entry></entry>
751       <entry>
752        Always -1 in storage, but when loaded into a tuple descriptor
753        in memory this may be updated to cache the offset of the attribute
754        within the tuple.
755       </entry>
756      </row>
757
758      <row>
759       <entry>atttypmod</entry>
760       <entry><type>int4</type></entry>
761       <entry></entry>
762       <entry>
763        <structfield>atttypmod</structfield> records type-specific data
764        supplied at table creation time (for example, the maximum
765        length of a <type>varchar</type> column).  It is passed to
766        type-specific input functions and length coercion functions.
767        The value will generally be -1 for types that do not need typmod.
768       </entry>
769      </row>
770
771      <row>
772       <entry>attbyval</entry>
773       <entry><type>bool</type></entry>
774       <entry></entry>
775       <entry>
776        A copy of
777        <structname>pg_type</structname>.<structfield>typbyval</structfield>
778        of this column's type
779       </entry>
780      </row>
781
782      <row>
783       <entry>attstorage</entry>
784       <entry><type>char</type></entry>
785       <entry></entry>
786       <entry>
787        Normally a copy of
788        <structname>pg_type</structname>.<structfield>typstorage</structfield>
789        of this column's type.  For TOASTable datatypes, this can be altered
790        after column creation to control storage policy.
791       </entry>
792      </row>
793
794      <row>
795       <entry>attisset</entry>
796       <entry><type>bool</type></entry>
797       <entry></entry>
798       <entry>
799        If true, this attribute is a set.  In that case, what is really
800        stored in the attribute is the OID of a tuple in the
801        <structname>pg_proc</structname> catalog.  The
802        <structname>pg_proc</structname> tuple contains the query
803        string that defines this set - i.e., the query to run to get
804        the set.  So the <structfield>atttypid</structfield> (see
805        above) refers to the type returned by this query, but the
806        actual length of this attribute is the length (size) of an
807        <type>oid</type>.  --- At least this is the theory.  All this
808        is probably quite broken these days.
809       </entry>
810      </row>
811
812      <row>
813       <entry>attalign</entry>
814       <entry><type>char</type></entry>
815       <entry></entry>
816       <entry>
817        A copy of
818        <structname>pg_type</structname>.<structfield>typalign</structfield>
819        of this column's type
820       </entry>
821      </row>
822
823      <row>
824       <entry>attnotnull</entry>
825       <entry><type>bool</type></entry>
826       <entry></entry>
827       <entry>
828        This represents a NOT NULL constraint.  It is possible to
829        change this field to enable or disable the constraint.
830       </entry>
831      </row>
832
833      <row>
834       <entry>atthasdef</entry>
835       <entry><type>bool</type></entry>
836       <entry></entry>
837       <entry>
838        This column has a default value, in which case there will be a
839        corresponding entry in the <structname>pg_attrdef</structname>
840        catalog that actually defines the value.
841       </entry>
842      </row>
843
844      <row>
845       <entry>attisdropped</entry>
846       <entry><type>bool</type></entry>
847       <entry></entry>
848       <entry>
849        This column has been dropped and is no longer valid.  A dropped
850        column is still physically present in the table, but is
851        ignored by the parser and so cannot be accessed via SQL.
852       </entry>
853      </row>
854
855      <row>
856       <entry>attislocal</entry>
857       <entry><type>bool</type></entry>
858       <entry></entry>
859       <entry>
860        This column is defined locally in the relation.  Note that a column may
861        be locally defined and inherited simultaneously.
862       </entry>
863      </row>
864
865      <row>
866       <entry>attinhcount</entry>
867       <entry><type>int4</type></entry>
868       <entry></entry>
869       <entry>
870        The number of direct ancestors this column has.  A column with a 
871        nonzero number of ancestors cannot be dropped nor renamed.
872       </entry>
873      </row>
874
875     </tbody>
876    </tgroup>
877   </table>
878  </sect1>
879
880
881  <sect1 id="catalog-pg-cast">
882   <title>pg_cast</title>
883
884   <para>
885    <structname>pg_cast</structname> stores data type conversion paths,
886    both built-in paths and those defined with <command>CREATE CAST</command>.
887   </para>
888
889   <table>
890    <title>pg_cast Columns</title>
891
892    <tgroup cols=4>
893     <thead>
894      <row>
895       <entry>Name</entry>
896       <entry>Type</entry>
897       <entry>References</entry>
898       <entry>Description</entry>
899      </row>
900     </thead>
901
902     <tbody>
903      <row>
904       <entry>castsource</entry>
905       <entry><type>oid</type></entry>
906       <entry>pg_type.oid</entry>
907       <entry>OID of the source data type</entry>
908      </row>
909
910      <row>
911       <entry>casttarget</entry>
912       <entry><type>oid</type></entry>
913       <entry>pg_type.oid</entry>
914       <entry>OID of the target data type</entry>
915      </row>
916
917      <row>
918       <entry>castfunc</entry>
919       <entry><type>oid</type></entry>
920       <entry>pg_proc.oid</entry>
921       <entry>
922        The OID of the function to use to perform this cast.  Zero is
923        stored if the data types are binary coercible (that is, no
924        run-time operation is needed to perform the cast).
925       </entry>
926      </row>
927
928      <row>
929       <entry>castcontext</entry>
930       <entry><type>char</type></entry>
931       <entry></entry>
932       <entry>
933        Indicates what contexts the cast may be invoked in.
934        <literal>e</> means only as an explicit cast (using
935        <literal>CAST</>, <literal>::</>, or function-call syntax).
936        <literal>a</> means implicitly in assignment
937        to a target column, as well as explicitly.
938        <literal>i</> means implicitly in expressions, as well as the
939        other cases.
940       </entry>
941      </row>
942     </tbody>
943    </tgroup>
944   </table>
945  </sect1>
946
947  <sect1 id="catalog-pg-class">
948   <title>pg_class</title>
949
950   <para>
951    <structname>pg_class</structname> catalogs tables and most
952    everything else that has columns or is otherwise similar to a
953    table.  This includes indexes (but see also
954    <structname>pg_index</structname>), sequences, views, and some
955    kinds of special relation; see <structfield>relkind</>.
956    Below, when we mean all of these
957    kinds of objects we speak of <quote>relations</quote>.  Not all
958    fields are meaningful for all relation types.
959   </para>
960
961   <table>
962    <title>pg_class Columns</title>
963
964    <tgroup cols=4>
965     <thead>
966      <row>
967       <entry>Name</entry>
968       <entry>Type</entry>
969       <entry>References</entry>
970       <entry>Description</entry>
971      </row>
972     </thead>
973
974     <tbody>
975      <row>
976       <entry>relname</entry>
977       <entry><type>name</type></entry>
978       <entry></entry>
979       <entry>Name of the table, index, view, etc.</entry>
980      </row>
981
982      <row>
983       <entry>relnamespace</entry>
984       <entry><type>oid</type></entry>
985       <entry>pg_namespace.oid</entry>
986       <entry>
987        The OID of the namespace that contains this relation
988       </entry>
989      </row>
990
991      <row>
992       <entry>reltype</entry>
993       <entry><type>oid</type></entry>
994       <entry>pg_type.oid</entry>
995       <entry>
996        The OID of the data type that corresponds to this table, if any
997        (zero for indexes, which have no pg_type entry)
998       </entry>
999      </row>
1000
1001      <row>
1002       <entry>relowner</entry>
1003       <entry><type>int4</type></entry>
1004       <entry>pg_shadow.usesysid</entry>
1005       <entry>Owner of the relation</entry>
1006      </row>
1007
1008      <row>
1009       <entry>relam</entry>
1010       <entry><type>oid</type></entry>
1011       <entry>pg_am.oid</entry>
1012       <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry>
1013      </row>
1014
1015      <row>
1016       <entry>relfilenode</entry>
1017       <entry><type>oid</type></entry>
1018       <entry></entry>
1019       <entry>Name of the on-disk file of this relation; 0 if none</entry>
1020      </row>
1021
1022      <row>
1023       <entry>relpages</entry>
1024       <entry><type>int4</type></entry>
1025       <entry></entry>
1026       <entry>
1027        Size of the on-disk representation of this table in pages (size
1028        <symbol>BLCKSZ</symbol>).
1029        This is only an estimate used by the planner.
1030        It is updated by <command>VACUUM</command>,
1031        <command>ANALYZE</command>, and <command>CREATE INDEX</command>.
1032       </entry>
1033      </row>
1034
1035      <row>
1036       <entry>reltuples</entry>
1037       <entry><type>float4</type></entry>
1038       <entry></entry>
1039       <entry>
1040        Number of tuples in the table.
1041        This is only an estimate used by the planner.
1042        It is updated by <command>VACUUM</command>,
1043        <command>ANALYZE</command>, and <command>CREATE INDEX</command>.
1044       </entry>
1045      </row>
1046
1047      <row>
1048       <entry>reltoastrelid</entry>
1049       <entry><type>oid</type></entry>
1050       <entry>pg_class.oid</entry>
1051       <entry>
1052        OID of the TOAST table associated with this table, 0 if none.
1053        The TOAST table stores large attributes <quote>out of
1054        line</quote> in a secondary table.
1055       </entry>
1056      </row>
1057
1058      <row>
1059       <entry>reltoastidxid</entry>
1060       <entry><type>oid</type></entry>
1061       <entry>pg_class.oid</entry>
1062       <entry>
1063        For a TOAST table, the OID of its index.  0 if not a TOAST table.
1064       </entry>
1065      </row>
1066
1067      <row>
1068       <entry>relhasindex</entry>
1069       <entry><type>bool</type></entry>
1070       <entry></entry>
1071       <entry>True if this is a table and it has (or recently had) any indexes.
1072        This is set by CREATE INDEX, but not cleared immediately by DROP INDEX.
1073        VACUUM clears relhasindex if it finds the table has no indexes.
1074       </entry>
1075      </row>
1076
1077      <row>
1078       <entry>relisshared</entry>
1079       <entry><type>bool</type></entry>
1080       <entry></entry>
1081       <entry>True if this table is shared across all databases in the
1082       cluster.  Only certain system catalogs (such as
1083       <structname>pg_database</structname>) are shared.</entry>
1084      </row>
1085
1086      <row>
1087       <entry>relkind</entry>
1088       <entry><type>char</type></entry>
1089       <entry></entry>
1090       <entry>
1091        'r' = ordinary table, 'i' = index, 'S' = sequence, 'v' = view,
1092        'c' = composite type, 's' = special, 't' = TOAST table
1093       </entry>
1094      </row>
1095
1096      <row>
1097       <entry>relnatts</entry>
1098       <entry><type>int2</type></entry>
1099       <entry></entry>
1100       <entry>
1101        Number of user columns in the relation (system columns not counted).
1102        There must be this many corresponding entries in
1103        <structname>pg_attribute</structname>.  See also
1104        <structname>pg_attribute</structname>.<structfield>attnum</structfield>.
1105       </entry>
1106      </row>
1107
1108      <row>
1109       <entry>relchecks</entry>
1110       <entry><type>int2</type></entry>
1111       <entry></entry>
1112       <entry>
1113        Number of check constraints on the table; see
1114        <structname>pg_constraint</structname> catalog
1115       </entry>
1116      </row>
1117
1118      <row>
1119       <entry>reltriggers</entry>
1120       <entry><type>int2</type></entry>
1121       <entry></entry>
1122       <entry>
1123        Number of triggers on the table; see
1124        <structname>pg_trigger</structname> catalog
1125       </entry>
1126      </row>
1127
1128      <row>
1129       <entry>relukeys</entry>
1130       <entry><type>int2</type></entry>
1131       <entry></entry>
1132       <entry>unused  (<emphasis>Not</emphasis> the number of unique keys)</entry>
1133      </row>
1134
1135      <row>
1136       <entry>relfkeys</entry>
1137       <entry><type>int2</type></entry>
1138       <entry></entry>
1139       <entry>unused  (<emphasis>Not</emphasis> the number of foreign keys on the table)</entry>
1140      </row>
1141
1142      <row>
1143       <entry>relrefs</entry>
1144       <entry><type>int2</type></entry>
1145       <entry></entry>
1146       <entry>unused</entry>
1147      </row>
1148
1149      <row>
1150       <entry>relhasoids</entry>
1151       <entry><type>bool</type></entry>
1152       <entry></entry>
1153       <entry>
1154        True if we generate an OID for each row of the relation.
1155       </entry>
1156      </row>
1157
1158      <row>
1159       <entry>relhaspkey</entry>
1160       <entry><type>bool</type></entry>
1161       <entry></entry>
1162       <entry>
1163        True if the table has (or once had) a primary key.
1164       </entry>
1165      </row>
1166
1167      <row>
1168       <entry>relhasrules</entry>
1169       <entry><type>bool</type></entry>
1170       <entry></entry>
1171       <entry>Table has rules; see
1172        <structname>pg_rewrite</structname> catalog
1173       </entry>
1174      </row>
1175
1176      <row>
1177       <entry>relhassubclass</entry>
1178       <entry><type>bool</type></entry>
1179       <entry></entry>
1180       <entry>At least one table inherits from this one</entry>
1181      </row>
1182
1183      <row>
1184       <entry>relacl</entry>
1185       <entry><type>aclitem[]</type></entry>
1186       <entry></entry>
1187       <entry>
1188        Access permissions.  See the descriptions of
1189        <command>GRANT</command> and <command>REVOKE</command> for
1190        details.
1191       </entry>
1192      </row>
1193     </tbody>
1194    </tgroup>
1195   </table>
1196  </sect1>
1197
1198  <sect1 id="catalog-pg-constraint">
1199   <title>pg_constraint</title>
1200
1201   <para>
1202    This system catalog stores CHECK, PRIMARY KEY, UNIQUE, and FOREIGN KEY
1203    constraints on tables.  (Column
1204    constraints are not treated specially.  Every column constraint is
1205    equivalent to some table constraint.)  See under <command>CREATE
1206    TABLE</command> for more information.
1207   </para>
1208
1209   <note>
1210    <para>
1211     NOT NULL constraints are represented in the <structname>pg_attribute</>
1212     catalog.
1213    </para>
1214   </note>
1215
1216   <para>
1217    CHECK constraints on domains are stored here, too.  Global ASSERTIONS
1218    (a currently-unsupported SQL feature) may someday appear here as well.
1219   </para>
1220
1221   <table>
1222    <title>pg_constraint Columns</title>
1223
1224    <tgroup cols=4>
1225     <thead>
1226      <row>
1227       <entry>Name</entry>
1228       <entry>Type</entry>
1229       <entry>References</entry>
1230       <entry>Description</entry>
1231      </row>
1232     </thead>
1233
1234     <tbody>
1235      <row>
1236       <entry>conname</entry>
1237       <entry><type>name</type></entry>
1238       <entry></entry>
1239       <entry>Constraint name (not necessarily unique!)</entry>
1240      </row>
1241
1242      <row>
1243       <entry>connamespace</entry>
1244       <entry><type>oid</type></entry>
1245       <entry>pg_namespace.oid</entry>
1246       <entry>
1247        The OID of the namespace that contains this constraint
1248       </entry>
1249      </row>
1250
1251      <row>
1252       <entry>contype</entry>
1253       <entry><type>char</type></entry>
1254       <entry></entry>
1255       <entry>
1256         'c' = check constraint,
1257         'f' = foreign key constraint,
1258         'p' = primary key constraint,
1259         'u' = unique constraint
1260       </entry>
1261      </row>
1262
1263      <row>
1264       <entry>condeferrable</entry>
1265       <entry><type>boolean</type></entry>
1266       <entry></entry>
1267       <entry>Is the constraint deferrable?</entry>
1268      </row>
1269
1270      <row>
1271       <entry>condeferred</entry>
1272       <entry><type>boolean</type></entry>
1273       <entry></entry>
1274       <entry>Is the constraint deferred by default?</entry>
1275      </row>
1276
1277      <row>
1278       <entry>conrelid</entry>
1279       <entry><type>oid</type></entry>
1280       <entry>pg_class.oid</entry>
1281       <entry>The table this constraint is on; 0 if not a table constraint</entry>
1282      </row>
1283
1284      <row>
1285       <entry>contypid</entry>
1286       <entry><type>oid</type></entry>
1287       <entry>pg_type.oid</entry>
1288       <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1289      </row>
1290
1291      <row>
1292       <entry>confrelid</entry>
1293       <entry><type>oid</type></entry>
1294       <entry>pg_class.oid</entry>
1295       <entry>If a foreign key, the referenced table; else 0</entry>
1296      </row>
1297
1298      <row>
1299       <entry>confupdtype</entry>
1300       <entry><type>char</type></entry>
1301       <entry></entry>
1302       <entry>Foreign key update action code</entry>
1303      </row>
1304
1305      <row>
1306       <entry>confdeltype</entry>
1307       <entry><type>char</type></entry>
1308       <entry></entry>
1309       <entry>Foreign key deletion action code</entry>
1310      </row>
1311
1312      <row>
1313       <entry>confmatchtype</entry>
1314       <entry><type>char</type></entry>
1315       <entry></entry>
1316       <entry>Foreign key match type</entry>
1317      </row>
1318
1319      <row>
1320       <entry>conkey</entry>
1321       <entry><type>int2[]</type></entry>
1322       <entry>pg_attribute.attnum</entry>
1323       <entry>If a table constraint, list of columns which the constraint constrains</entry>
1324      </row>
1325
1326      <row>
1327       <entry>confkey</entry>
1328       <entry><type>int2[]</type></entry>
1329       <entry>pg_attribute.attnum</entry>
1330       <entry>If a foreign key, list of the referenced columns</entry>
1331      </row>
1332
1333      <row>
1334       <entry>conbin</entry>
1335       <entry><type>text</type></entry>
1336       <entry></entry>
1337       <entry>If a check constraint, an internal representation of the expression</entry>
1338      </row>
1339
1340      <row>
1341       <entry>consrc</entry>
1342       <entry><type>text</type></entry>
1343       <entry></entry>
1344       <entry>If a check constraint, a human-readable representation of the expression</entry>
1345      </row>
1346     </tbody>
1347    </tgroup>
1348   </table>
1349
1350   <note>
1351    <para>
1352     <structname>pg_class</structname>.<structfield>relchecks</structfield>
1353     needs to agree with the number of check-constraint entries found in this
1354     table for the given relation.
1355    </para>
1356   </note>
1357
1358  </sect1>
1359
1360  <sect1 id="catalog-pg-conversion">
1361   <title>pg_conversion</title>
1362
1363   <para>
1364    This system catalog stores encoding conversion information. See
1365    <command>CREATE CONVERSION</command> for more information.
1366   </para>
1367
1368   <table>
1369    <title>pg_conversion Columns</title>
1370
1371    <tgroup cols=4>
1372     <thead>
1373      <row>
1374       <entry>Name</entry>
1375       <entry>Type</entry>
1376       <entry>References</entry>
1377       <entry>Description</entry>
1378      </row>
1379     </thead>
1380
1381     <tbody>
1382      <row>
1383       <entry>conname</entry>
1384       <entry><type>name</type></entry>
1385       <entry></entry>
1386       <entry>Conversion name (unique within a namespace)</entry>
1387      </row>
1388
1389      <row>
1390       <entry>connamespace</entry>
1391       <entry><type>oid</type></entry>
1392       <entry>pg_namespace.oid</entry>
1393       <entry>
1394        The OID of the namespace that contains this conversion
1395       </entry>
1396      </row>
1397
1398      <row>
1399       <entry>conowner</entry>
1400       <entry><type>int4</type></entry>
1401       <entry>pg_shadow.usesysid</entry>
1402       <entry>Owner (creator) of the namespace</entry>
1403      </row>
1404
1405      <row>
1406       <entry>conforencoding</entry>
1407       <entry><type>int4</type></entry>
1408       <entry></entry>
1409       <entry>Source(for) encoding ID</entry>
1410      </row>
1411
1412      <row>
1413       <entry>contoencoding</entry>
1414       <entry><type>int4</type></entry>
1415       <entry></entry>
1416       <entry>Destination(to) encoding ID</entry>
1417      </row>
1418
1419      <row>
1420       <entry>conproc</entry>
1421       <entry><type>regproc</type></entry>
1422       <entry>pg_proc.oid</entry>
1423       <entry>Conversion procedure</entry>
1424      </row>
1425
1426      <row>
1427       <entry>condefault</entry>
1428       <entry><type>boolean</type></entry>
1429       <entry></entry>
1430       <entry>true if this is the default conversion</entry>
1431      </row>
1432
1433     </tbody>
1434    </tgroup>
1435   </table>
1436
1437  </sect1>
1438
1439  <sect1 id="catalog-pg-database">
1440   <title>pg_database</title>
1441
1442   <para>
1443    The <structname>pg_database</structname> catalog stores information
1444    about the available databases.  Databases are created with the
1445    <command>CREATE DATABASE</command> command.  Consult the
1446    <citetitle>Administrator's Guide</citetitle> for details about the
1447    meaning of some of the parameters.
1448   </para>
1449
1450   <para>
1451    Unlike most system catalogs, <structname>pg_database</structname>
1452    is shared across all databases of a cluster: there is only one
1453    copy of <structname>pg_database</structname> per cluster, not
1454    one per database.
1455   </para>
1456
1457   <table>
1458    <title>pg_database Columns</title>
1459
1460    <tgroup cols=4>
1461     <thead>
1462      <row>
1463       <entry>Name</entry>
1464       <entry>Type</entry>
1465       <entry>References</entry>
1466       <entry>Description</entry>
1467      </row>
1468     </thead>
1469
1470     <tbody>
1471      <row>
1472       <entry>datname</entry>
1473       <entry><type>name</type></entry>
1474       <entry></entry>
1475       <entry>Database name</entry>
1476      </row>
1477
1478      <row>
1479       <entry>datdba</entry>
1480       <entry><type>int4</type></entry>
1481       <entry>pg_shadow.usesysid</entry>
1482       <entry>Owner of the database, usually the user who created it</entry>
1483      </row>
1484
1485      <row>
1486       <entry>encoding</entry>
1487       <entry><type>int4</type></entry>
1488       <entry></entry>
1489       <entry>Character/multibyte encoding for this database</entry>
1490      </row>
1491
1492      <row>
1493       <entry>datistemplate</entry>
1494       <entry><type>bool</type></entry>
1495       <entry></entry>
1496       <entry>
1497        If true then this database can be used in the
1498        <quote>TEMPLATE</quote> clause of <command>CREATE
1499        DATABASE</command> to create a new database as a clone of
1500        this one.
1501       </entry>
1502      </row>
1503
1504      <row>
1505       <entry>datallowconn</entry>
1506       <entry><type>bool</type></entry>
1507       <entry></entry>
1508       <entry>
1509        If false then no one can connect to this database.  This is
1510        used to protect the template0 database from being altered.
1511       </entry>
1512      </row>
1513
1514      <row>
1515       <entry>datlastsysoid</entry>
1516       <entry><type>oid</type></entry>
1517       <entry></entry>
1518       <entry>
1519        Last system OID in the database; useful
1520        particularly to <application>pg_dump</application>
1521       </entry>
1522      </row>
1523
1524      <row>
1525       <entry>datvacuumxid</entry>
1526       <entry><type>xid</type></entry>
1527       <entry></entry>
1528       <entry>
1529        All tuples inserted or deleted by transaction IDs before this one
1530        have been marked as known committed or known aborted in this database.
1531        This is used to determine when commit-log space can be recycled.
1532       </entry>
1533      </row>
1534
1535      <row>
1536       <entry>datfrozenxid</entry>
1537       <entry><type>xid</type></entry>
1538       <entry></entry>
1539       <entry>
1540        All tuples inserted by transaction IDs before this one have been
1541        relabeled with a permanent (<quote>frozen</>) transaction ID in this
1542        database.  This is useful to check whether a database must be vacuumed
1543        soon to avoid transaction ID wraparound problems.
1544       </entry>
1545      </row>
1546
1547      <row>
1548       <entry>datpath</entry>
1549       <entry><type>text</type></entry>
1550       <entry></entry>
1551       <entry>
1552        If the database is stored at an alternative location then this
1553        records the location.  It's either an environment variable name
1554        or an absolute path, depending how it was entered.
1555       </entry>
1556      </row>
1557
1558      <row>
1559       <entry>datconfig</entry>
1560       <entry><type>text[]</type></entry>
1561       <entry></entry>
1562       <entry>Session defaults for run-time configuration variables</entry>
1563      </row>
1564
1565      <row>
1566       <entry>datacl</entry>
1567       <entry><type>aclitem[]</type></entry>
1568       <entry></entry>
1569       <entry>Access permissions</entry>
1570      </row>
1571     </tbody>
1572    </tgroup>
1573   </table>
1574  </sect1>
1575
1576
1577  <sect1 id="catalog-pg-depend">
1578   <title>pg_depend</title>
1579
1580   <para>
1581    The <structname>pg_depend</structname> table records the dependency
1582    relationships between database objects.  This information allows
1583    <command>DROP</> commands to find which other objects must be dropped
1584    by <command>DROP CASCADE</>, or prevent dropping in the <command>DROP
1585    RESTRICT</> case.
1586   </para>
1587
1588   <table>
1589    <title>pg_depend Columns</title>
1590
1591    <tgroup cols=4>
1592     <thead>
1593      <row>
1594       <entry>Name</entry>
1595       <entry>Type</entry>
1596       <entry>References</entry>
1597       <entry>Description</entry>
1598      </row>
1599     </thead>
1600
1601     <tbody>
1602      <row>
1603       <entry>classid</entry>
1604       <entry><type>oid</type></entry>
1605       <entry>pg_class.oid</entry>
1606       <entry>The oid of the system catalog the dependent object is in</entry>
1607      </row>
1608
1609      <row>
1610       <entry>objid</entry>
1611       <entry><type>oid</type></entry>
1612       <entry>any oid attribute</entry>
1613       <entry>The oid of the specific dependent object</entry>
1614      </row>
1615
1616      <row>
1617       <entry>objsubid</entry>
1618       <entry><type>int4</type></entry>
1619       <entry></entry>
1620       <entry>For a table attribute, this is the attribute's
1621        column number (the objid and classid refer to the table itself).
1622        For all other object types, this field is presently zero.
1623       </entry>
1624      </row>
1625
1626      <row>
1627       <entry>refclassid</entry>
1628       <entry><type>oid</type></entry>
1629       <entry>pg_class.oid</entry>
1630       <entry>The oid of the system catalog the referenced object is in</entry>
1631      </row>
1632
1633      <row>
1634       <entry>refobjid</entry>
1635       <entry><type>oid</type></entry>
1636       <entry>any oid attribute</entry>
1637       <entry>The oid of the specific referenced object</entry>
1638      </row>
1639
1640      <row>
1641       <entry>refobjsubid</entry>
1642       <entry><type>int4</type></entry>
1643       <entry></entry>
1644       <entry>For a table attribute, this is the attribute's
1645        column number (the refobjid and refclassid refer to the table itself).
1646        For all other object types, this field is presently zero.
1647       </entry>
1648      </row>
1649
1650      <row>
1651       <entry>deptype</entry>
1652       <entry><type>char</type></entry>
1653       <entry></entry>
1654       <entry>
1655        A code defining the specific semantics of this dependency relationship.
1656       </entry>
1657      </row>
1658
1659     </tbody>
1660    </tgroup>
1661   </table>
1662
1663   <para>
1664    In all cases, a <structname>pg_depend</structname> entry indicates that the
1665    referenced object may not be dropped without also dropping the dependent
1666    object.  However, there are several subflavors identified by
1667    <structfield>deptype</>:
1668
1669    <itemizedlist>
1670     <listitem>
1671      <para>
1672       DEPENDENCY_NORMAL ('n'): normal relationship between separately-created
1673       objects.  The dependent object may be dropped without affecting the
1674       referenced object.  The referenced object may only be dropped by
1675       specifying CASCADE, in which case the dependent object is dropped too.
1676       Example: a table column has a normal dependency on its datatype.
1677      </para>
1678     </listitem>
1679
1680     <listitem>
1681      <para>
1682       DEPENDENCY_AUTO ('a'): the dependent object can be dropped separately
1683       from the referenced object, and should be automatically dropped
1684       (regardless of RESTRICT or CASCADE mode) if the referenced object
1685       is dropped.
1686       Example: a named constraint on a table is made auto-dependent on
1687       the table, so that it will go away if the table is dropped.
1688      </para>
1689     </listitem>
1690
1691     <listitem>
1692      <para>
1693       DEPENDENCY_INTERNAL ('i'): the dependent object was created as part
1694       of creation of the referenced object, and is really just a part of
1695       its internal implementation.  A DROP of the dependent object will be
1696       disallowed outright (we'll tell the user to issue a DROP against the
1697       referenced object, instead).  A DROP of the referenced object will be
1698       propagated through to drop the dependent object whether CASCADE is
1699       specified or not.
1700       Example: a trigger that's created to enforce a foreign-key constraint
1701       is made internally dependent on the constraint's pg_constraint entry.
1702      </para>
1703     </listitem>
1704
1705     <listitem>
1706      <para>
1707       DEPENDENCY_PIN ('p'): there is no dependent object; this type of entry
1708       is a signal that the system itself depends on the referenced object,
1709       and so that object must never be deleted.  Entries of this type are
1710       created only during initdb.  The fields for the dependent object
1711       contain zeroes.
1712      </para>
1713     </listitem>
1714    </itemizedlist>
1715
1716    Other dependency flavors may be needed in future.
1717   </para>
1718
1719  </sect1>
1720
1721
1722  <sect1 id="catalog-pg-description">
1723   <title>pg_description</title>
1724
1725   <para>
1726    The pg_description table can store an optional description or
1727    comment for each database object.  Descriptions can be manipulated
1728    with the <command>COMMENT</command> command and viewed with
1729    <application>psql</application>'s <literal>\d</literal> commands.
1730    Descriptions of many built-in system objects are provided in the initial
1731    contents of pg_description.
1732   </para>
1733
1734   <table>
1735    <title>pg_description Columns</title>
1736
1737    <tgroup cols=4>
1738     <thead>
1739      <row>
1740       <entry>Name</entry>
1741       <entry>Type</entry>
1742       <entry>References</entry>
1743       <entry>Description</entry>
1744      </row>
1745     </thead>
1746
1747     <tbody>
1748      <row>
1749       <entry>objoid</entry>
1750       <entry><type>oid</type></entry>
1751       <entry>any oid attribute</entry>
1752       <entry>The oid of the object this description pertains to</entry>
1753      </row>
1754
1755      <row>
1756       <entry>classoid</entry>
1757       <entry><type>oid</type></entry>
1758       <entry>pg_class.oid</entry>
1759       <entry>The oid of the system catalog this object appears in</entry>
1760      </row>
1761
1762      <row>
1763       <entry>objsubid</entry>
1764       <entry><type>int4</type></entry>
1765       <entry></entry>
1766       <entry>For a comment on a table attribute, this is the attribute's
1767        column number (the objoid and classoid refer to the table itself).
1768        For all other object types, this field is presently zero.
1769       </entry>
1770      </row>
1771
1772      <row>
1773       <entry>description</entry>
1774       <entry><type>text</type></entry>
1775       <entry></entry>
1776       <entry>Arbitrary text that serves as the description of this object.</entry>
1777      </row>
1778     </tbody>
1779    </tgroup>
1780   </table>
1781
1782  </sect1>
1783
1784
1785  <sect1 id="catalog-pg-group">
1786   <title>pg_group</title>
1787
1788   <para>
1789    This catalog defines groups and stores what users belong to what
1790    groups.  Groups are created with the <command>CREATE
1791    GROUP</command> command.  Consult the <citetitle>Administrator's
1792    Guide</citetitle> for information about user permission management.
1793   </para>
1794
1795   <para>
1796    Because user and group identities are cluster-wide,
1797    <structname>pg_group</structname>
1798    is shared across all databases of a cluster: there is only one
1799    copy of <structname>pg_group</structname> per cluster, not
1800    one per database.
1801   </para>
1802
1803   <table>
1804    <title>pg_group Columns</title>
1805
1806    <tgroup cols=4>
1807     <thead>
1808      <row>
1809       <entry>Name</entry>
1810       <entry>Type</entry>
1811       <entry>References</entry>
1812       <entry>Description</entry>
1813      </row>
1814     </thead>
1815
1816     <tbody>
1817      <row>
1818       <entry>groname</entry>
1819       <entry><type>name</type></entry>
1820       <entry></entry>
1821       <entry>Name of the group</entry>
1822      </row>
1823
1824      <row>
1825       <entry>grosysid</entry>
1826       <entry><type>int4</type></entry>
1827       <entry></entry>
1828       <entry>An arbitrary number to identify this group</entry>
1829      </row>
1830
1831      <row>
1832       <entry>grolist</entry>
1833       <entry><type>int4[]</type></entry>
1834       <entry>pg_shadow.usesysid</entry>
1835       <entry>An array containing the ids of the users in this group</entry>
1836      </row>
1837     </tbody>
1838    </tgroup>
1839   </table>
1840
1841  </sect1>
1842
1843
1844  <sect1 id="catalog-pg-index">
1845   <title>pg_index</title>
1846
1847   <para>
1848    <structname>pg_index</structname> contains part of the information
1849    about indexes.  The rest is mostly in
1850    <structname>pg_class</structname>.
1851   </para>
1852
1853   <table>
1854    <title>pg_index Columns</title>
1855
1856    <tgroup cols=4>
1857     <thead>
1858      <row>
1859       <entry>Name</entry>
1860       <entry>Type</entry>
1861       <entry>References</entry>
1862       <entry>Description</entry>
1863      </row>
1864     </thead>
1865
1866     <tbody>
1867      <row>
1868       <entry>indexrelid</entry>
1869       <entry><type>oid</type></entry>
1870       <entry>pg_class.oid</entry>
1871       <entry>The OID of the pg_class entry for this index</entry>
1872      </row>
1873
1874      <row>
1875       <entry>indrelid</entry>
1876       <entry><type>oid</type></entry>
1877       <entry>pg_class.oid</entry>
1878       <entry>The OID of the pg_class entry for the table this index is for</entry>
1879      </row>
1880
1881      <row>
1882       <entry>indproc</entry>
1883       <entry><type>regproc</type></entry>
1884       <entry>pg_proc.oid</entry>
1885       <entry>The function's OID if this is a functional index,
1886       else zero</entry>
1887      </row>
1888
1889      <row>
1890       <entry>indkey</entry>
1891       <entry><type>int2vector</type></entry>
1892       <entry>pg_attribute.attnum</entry>
1893       <entry>
1894        This is a vector (array) of up to
1895        <symbol>INDEX_MAX_KEYS</symbol> values that indicate which
1896        table columns this index pertains to.  For example a value of
1897        <literal>1 3</literal> would mean that the first and the third
1898        column make up the index key.  For a functional index, these
1899        columns are the inputs to the function, and the function's return
1900        value is the index key.
1901       </entry>
1902      </row>
1903
1904      <row>
1905       <entry>indclass</entry>
1906       <entry><type>oidvector</type></entry>
1907       <entry>pg_opclass.oid</entry>
1908       <entry>
1909        For each column in the index key this contains a reference to
1910        the <quote>operator class</quote> to use.  See
1911        <structname>pg_opclass</structname> for details.
1912       </entry>
1913      </row>
1914
1915      <row>
1916       <entry>indisclustered</entry>
1917       <entry><type>bool</type></entry>
1918       <entry></entry>
1919       <entry>If true, the table was last clustered on this index.</entry>
1920      </row>
1921
1922      <row>
1923       <entry>indisunique</entry>
1924       <entry><type>bool</type></entry>
1925       <entry></entry>
1926       <entry>If true, this is a unique index.</entry>
1927      </row>
1928
1929      <row>
1930       <entry>indisprimary</entry>
1931       <entry><type>bool</type></entry>
1932       <entry></entry>
1933       <entry>If true, this index represents the primary key of the table.
1934       (indisunique should always be true when this is true.)</entry>
1935      </row>
1936
1937      <row>
1938       <entry>indreference</entry>
1939       <entry><type>oid</type></entry>
1940       <entry></entry>
1941       <entry>unused</entry>
1942      </row>
1943
1944      <row>
1945       <entry>indpred</entry>
1946       <entry><type>text</type></entry>
1947       <entry></entry>
1948       <entry>Expression tree (in the form of a nodeToString representation)
1949       for partial index predicate.  Empty string if not a partial
1950       index.</entry>
1951      </row>
1952     </tbody>
1953    </tgroup>
1954   </table>
1955
1956  </sect1>
1957
1958
1959  <sect1 id="catalog-pg-inherits">
1960   <title>pg_inherits</title>
1961
1962   <para>
1963    This catalog records information about table inheritance hierarchies.
1964   </para>
1965
1966   <table>
1967    <title>pg_inherits Columns</title>
1968
1969    <tgroup cols=4>
1970     <thead>
1971      <row>
1972       <entry>Name</entry>
1973       <entry>Type</entry>
1974       <entry>References</entry>
1975       <entry>Description</entry>
1976      </row>
1977     </thead>
1978
1979     <tbody>
1980      <row>
1981       <entry>inhrelid</entry>
1982       <entry><type>oid</type></entry>
1983       <entry>pg_class.oid</entry>
1984       <entry>
1985        The OID of the child table.
1986       </entry>
1987      </row>
1988
1989      <row>
1990       <entry>inhparent</entry>
1991       <entry><type>oid</type></entry>
1992       <entry>pg_class.oid</entry>
1993       <entry>
1994        The OID of the parent table.
1995       </entry>
1996      </row>
1997
1998      <row>
1999       <entry>inhseqno</entry>
2000       <entry><type>int4</type></entry>
2001       <entry></entry>
2002       <entry>
2003        If there is more than one parent for a child table (multiple
2004        inheritance), this number tells the order in which the
2005        inherited columns are to be arranged.  The count starts at 1.
2006       </entry>
2007      </row>
2008     </tbody>
2009    </tgroup>
2010   </table>
2011
2012  </sect1>
2013
2014
2015  <sect1 id="catalog-pg-language">
2016   <title>pg_language</title>
2017
2018   <para>
2019    <structname>pg_language</structname> registers call interfaces or
2020    languages in which you can write functions or stored procedures.
2021    See under <command>CREATE LANGUAGE</command> and in the
2022    <citetitle>Programmer's Guide</citetitle> for more information
2023    about language handlers.
2024   </para>
2025
2026   <table>
2027    <title>pg_language Columns</title>
2028
2029    <tgroup cols=4>
2030     <thead>
2031      <row>
2032       <entry>Name</entry>
2033       <entry>Type</entry>
2034       <entry>References</entry>
2035       <entry>Description</entry>
2036      </row>
2037     </thead>
2038
2039     <tbody>
2040      <row>
2041       <entry>lanname</entry>
2042       <entry><type>name</type></entry>
2043       <entry></entry>
2044       <entry>Name of the language (to be specified when creating a function)</entry>
2045      </row>
2046
2047      <row>
2048       <entry>lanispl</entry>
2049       <entry><type>bool</type></entry>
2050       <entry></entry>
2051       <entry>
2052        This is false for internal languages (such as SQL) and true for
2053        user-defined languages.  Currently,
2054        <application>pg_dump</application> still uses this to determine
2055        which languages need to be dumped, but this may be replaced by
2056        a different mechanism sometime.
2057       </entry>
2058      </row>
2059
2060      <row>
2061       <entry>lanpltrusted</entry>
2062       <entry><type>bool</type></entry>
2063       <entry></entry>
2064       <entry>
2065        This is a trusted language.  See under <command>CREATE
2066        LANGUAGE</command> what this means.  If this is an internal
2067        language (<structfield>lanispl</structfield> is false) then
2068        this field is meaningless.
2069       </entry>
2070      </row>
2071
2072      <row>
2073       <entry>lanplcallfoid</entry>
2074       <entry><type>oid</type></entry>
2075       <entry>pg_proc.oid</entry>
2076       <entry>
2077        For non-internal languages this references the language
2078        handler, which is a special function that is responsible for
2079        executing all functions that are written in the particular
2080        language.
2081       </entry>
2082      </row>
2083
2084      <row>
2085       <entry>lanvalidator</entry>
2086       <entry><type>oid</type></entry>
2087       <entry>pg_proc.oid</entry>
2088       <entry>
2089        This references a language validator function that is responsible
2090        for checking the syntax and validity of new functions when they
2091        are created. See under <command>CREATE LANGUAGE</command> for
2092        further information about validators.
2093       </entry>
2094      </row>
2095
2096      <row>
2097       <entry>lanacl</entry>
2098       <entry><type>aclitem[]</type></entry>
2099       <entry></entry>
2100       <entry>Access permissions</entry>
2101      </row>
2102     </tbody>
2103    </tgroup>
2104   </table>
2105
2106  </sect1>
2107
2108
2109  <sect1 id="catalog-pg-largeobject">
2110   <title>pg_largeobject</title>
2111
2112   <para>
2113    <structname>pg_largeobject</structname> holds the data making up
2114    <quote>large objects</quote>.  A large object is identified by an
2115    OID assigned when it is created.  Each large object is broken into
2116    segments or <quote>pages</> small enough to be conveniently stored as rows
2117    in <structname>pg_largeobject</structname>.
2118    The amount of data per page is defined to be LOBLKSIZE (which is currently
2119    BLCKSZ/4, or typically 2Kbytes).
2120   </para>
2121
2122   <table>
2123    <title>pg_largeobject Columns</title>
2124
2125    <tgroup cols=4>
2126     <thead>
2127      <row>
2128       <entry>Name</entry>
2129       <entry>Type</entry>
2130       <entry>References</entry>
2131       <entry>Description</entry>
2132      </row>
2133     </thead>
2134
2135     <tbody>
2136      <row>
2137       <entry>loid</entry>
2138       <entry><type>oid</type></entry>
2139       <entry></entry>
2140       <entry>Identifier of the large object that includes this page</entry>
2141      </row>
2142
2143      <row>
2144       <entry>pageno</entry>
2145       <entry><type>int4</type></entry>
2146       <entry></entry>
2147       <entry>Page number of this page within its large object
2148       (counting from zero)</entry>
2149      </row>
2150
2151      <row>
2152       <entry>data</entry>
2153       <entry><type>bytea</type></entry>
2154       <entry></entry>
2155       <entry>
2156        Actual data stored in the large object.
2157        This will never be more than LOBLKSIZE bytes, and may be less.
2158       </entry>
2159      </row>
2160     </tbody>
2161    </tgroup>
2162   </table>
2163
2164   <para>
2165    Each row of <structname>pg_largeobject</structname> holds data
2166    for one page of a large object, beginning at
2167    byte offset (pageno * LOBLKSIZE) within the object.  The implementation
2168    allows sparse storage: pages may be missing, and may be shorter than
2169    LOBLKSIZE bytes even if they are not the last page of the object.
2170    Missing regions within a large object read as zeroes.
2171   </para>
2172
2173  </sect1>
2174
2175
2176  <sect1 id="catalog-pg-listener">
2177   <title>pg_listener</title>
2178
2179   <para>
2180    <structname>pg_listener</structname> supports the <command>LISTEN</>
2181    and <command>NOTIFY</> commands.  A listener creates an entry in
2182    <structname>pg_listener</structname> for each notification name
2183    it is listening for.  A notifier scans <structname>pg_listener</structname>
2184    and updates each matching entry to show that a notification has occurred.
2185    The notifier also sends a signal (using the PID recorded in the table)
2186    to awaken the listener from sleep.
2187   </para>
2188
2189   <table>
2190    <title>pg_listener Columns</title>
2191
2192    <tgroup cols=4>
2193     <thead>
2194      <row>
2195       <entry>Name</entry>
2196       <entry>Type</entry>
2197       <entry>References</entry>
2198       <entry>Description</entry>
2199      </row>
2200     </thead>
2201
2202     <tbody>
2203      <row>
2204       <entry>relname</entry>
2205       <entry><type>name</type></entry>
2206       <entry></entry>
2207       <entry>Notify condition name.  (The name need not match any actual
2208       relation in the database; the term <quote>relname</> is historical.)
2209       </entry>
2210      </row>
2211
2212      <row>
2213       <entry>listenerpid</entry>
2214       <entry><type>int4</type></entry>
2215       <entry></entry>
2216       <entry>PID of the backend process that created this entry.</entry>
2217      </row>
2218
2219      <row>
2220       <entry>notification</entry>
2221       <entry><type>int4</type></entry>
2222       <entry></entry>
2223       <entry>
2224        Zero if no event is pending for this listener.  If an event is
2225        pending, the PID of the backend that sent the notification.
2226       </entry>
2227      </row>
2228     </tbody>
2229    </tgroup>
2230   </table>
2231
2232  </sect1>
2233
2234
2235  <sect1 id="catalog-pg-namespace">
2236   <title>pg_namespace</title>
2237
2238   <para>
2239    A namespace is the structure underlying SQL92 schemas: each namespace
2240    can have a separate collection of relations, types, etc without name
2241    conflicts.
2242   </para>
2243
2244   <table>
2245    <title>pg_namespace Columns</title>
2246
2247    <tgroup cols=4>
2248     <thead>
2249      <row>
2250       <entry>Name</entry>
2251       <entry>Type</entry>
2252       <entry>References</entry>
2253       <entry>Description</entry>
2254      </row>
2255     </thead>
2256
2257     <tbody>
2258      <row>
2259       <entry>nspname</entry>
2260       <entry><type>name</type></entry>
2261       <entry></entry>
2262       <entry>Name of the namespace</entry>
2263      </row>
2264
2265      <row>
2266       <entry>nspowner</entry>
2267       <entry><type>int4</type></entry>
2268       <entry>pg_shadow.usesysid</entry>
2269       <entry>Owner (creator) of the namespace</entry>
2270      </row>
2271
2272      <row>
2273       <entry>nspacl</entry>
2274       <entry><type>aclitem[]</type></entry>
2275       <entry></entry>
2276       <entry>Access permissions</entry>
2277      </row>
2278     </tbody>
2279    </tgroup>
2280   </table>
2281
2282  </sect1>
2283
2284
2285  <sect1 id="catalog-pg-opclass">
2286   <title>pg_opclass</title>
2287
2288   <para>
2289    <structname>pg_opclass</structname> defines
2290    index access method operator classes.  Each operator class defines
2291    semantics for index columns of a particular datatype and a particular
2292    index access method.  Note that there can be multiple operator classes
2293    for a given datatype/access method combination, thus supporting multiple
2294    behaviors.
2295   </para>
2296
2297   <para>
2298    Operator classes are described at length in the
2299    <citetitle>Programmer's Guide</citetitle>.
2300   </para>
2301
2302   <table>
2303    <title>pg_opclass Columns</title>
2304
2305    <tgroup cols=4>
2306     <thead>
2307      <row>
2308       <entry>Name</entry>
2309       <entry>Type</entry>
2310       <entry>References</entry>
2311       <entry>Description</entry>
2312      </row>
2313     </thead>
2314     <tbody>
2315
2316      <row>
2317       <entry>opcamid</entry>
2318       <entry><type>oid</type></entry>
2319       <entry>pg_am.oid</entry>
2320       <entry>index access method opclass is for</entry>
2321      </row>
2322
2323      <row>
2324       <entry>opcname</entry>
2325       <entry><type>name</type></entry>
2326       <entry></entry>
2327       <entry>name of this opclass</entry>
2328      </row>
2329
2330      <row>
2331       <entry>opcnamespace</entry>
2332       <entry><type>oid</type></entry>
2333       <entry>pg_namespace.oid</entry>
2334       <entry>namespace of this opclass</entry>
2335      </row>
2336
2337      <row>
2338       <entry>opcowner</entry>
2339       <entry><type>int4</type></entry>
2340       <entry>pg_shadow.usesysid</entry>
2341       <entry>opclass owner</entry>
2342      </row>
2343
2344      <row>
2345       <entry>opcintype</entry>
2346       <entry><type>oid</type></entry>
2347       <entry>pg_type.oid</entry>
2348       <entry>type of input data for opclass</entry>
2349      </row>
2350
2351      <row>
2352       <entry>opcdefault</entry>
2353       <entry><type>bool</type></entry>
2354       <entry></entry>
2355       <entry>true if opclass is default for opcintype</entry>
2356      </row>
2357
2358      <row>
2359       <entry>opckeytype</entry>
2360       <entry><type>oid</type></entry>
2361       <entry>pg_type.oid</entry>
2362       <entry>type of index data, or zero if same as opcintype</entry>
2363      </row>
2364
2365     </tbody>
2366    </tgroup>
2367   </table>
2368
2369   <para>
2370    The majority of the information defining an operator class is actually
2371    not in its <structname>pg_opclass</structname> row, but in the associated
2372    rows in <structname>pg_amop</structname> and
2373    <structname>pg_amproc</structname>.  Those rows are considered to be
2374    part of the operator class definition --- this is not unlike the way
2375    that a relation is defined by a single <structname>pg_class</structname>
2376    row, plus associated rows in <structname>pg_attribute</structname> and
2377    other tables.
2378   </para>
2379
2380  </sect1>
2381
2382
2383  <sect1 id="catalog-pg-operator">
2384   <title>pg_operator</title>
2385
2386   <para>
2387    See <command>CREATE OPERATOR</command> and the
2388    <citetitle>Programmer's Guide</citetitle> for details on these
2389    operator parameters.
2390   </para>
2391
2392   <table>
2393    <title>pg_operator Columns</title>
2394
2395    <tgroup cols=4>
2396     <thead>
2397      <row>
2398       <entry>Name</entry>
2399       <entry>Type</entry>
2400       <entry>References</entry>
2401       <entry>Description</entry>
2402      </row>
2403     </thead>
2404
2405     <tbody>
2406      <row>
2407       <entry>oprname</entry>
2408       <entry><type>name</type></entry>
2409       <entry></entry>
2410       <entry>Name of the operator</entry>
2411      </row>
2412
2413      <row>
2414       <entry>oprnamespace</entry>
2415       <entry><type>oid</type></entry>
2416       <entry>pg_namespace.oid</entry>
2417       <entry>
2418        The OID of the namespace that contains this operator
2419       </entry>
2420      </row>
2421
2422      <row>
2423       <entry>oprowner</entry>
2424       <entry><type>int4</type></entry>
2425       <entry>pg_shadow.usesysid</entry>
2426       <entry>Owner (creator) of the operator</entry>
2427      </row>
2428
2429      <row>
2430       <entry>oprkind</entry>
2431       <entry><type>char</type></entry>
2432       <entry></entry>
2433       <entry>
2434        'b' = infix (<quote>both</quote>), 'l' = prefix
2435        (<quote>left</quote>), 'r' = postfix (<quote>right</quote>)
2436       </entry>
2437      </row>
2438
2439      <row>
2440       <entry>oprcanhash</entry>
2441       <entry><type>bool</type></entry>
2442       <entry></entry>
2443       <entry>This operator supports hash joins.</entry>
2444      </row>
2445
2446      <row>
2447       <entry>oprleft</entry>
2448       <entry><type>oid</type></entry>
2449       <entry>pg_type.oid</entry>
2450       <entry>Type of the left operand</entry>
2451      </row>
2452
2453      <row>
2454       <entry>oprright</entry>
2455       <entry><type>oid</type></entry>
2456       <entry>pg_type.oid</entry>
2457       <entry>Type of the right operand</entry>
2458      </row>
2459
2460      <row>
2461       <entry>oprresult</entry>
2462       <entry><type>oid</type></entry>
2463       <entry>pg_type.oid</entry>
2464       <entry>Type of the result</entry>
2465      </row>
2466
2467      <row>
2468       <entry>oprcom</entry>
2469       <entry><type>oid</type></entry>
2470       <entry>pg_operator.oid</entry>
2471       <entry>Commutator of this operator, if any</entry>
2472      </row>
2473
2474      <row>
2475       <entry>oprnegate</entry>
2476       <entry><type>oid</type></entry>
2477       <entry>pg_operator.oid</entry>
2478       <entry>Negator of this operator, if any</entry>
2479      </row>
2480
2481      <row>
2482       <entry>oprlsortop</entry>
2483       <entry><type>oid</type></entry>
2484       <entry>pg_operator.oid</entry>
2485       <entry>
2486        If this operator supports merge joins, the operator that sorts
2487        the type of the left-hand operand (<literal>L&lt;L</>)
2488       </entry>
2489      </row>
2490
2491      <row>
2492       <entry>oprrsortop</entry>
2493       <entry><type>oid</type></entry>
2494       <entry>pg_operator.oid</entry>
2495       <entry>
2496        If this operator supports merge joins, the operator that sorts
2497        the type of the right-hand operand (<literal>R&lt;R</>)
2498       </entry>
2499      </row>
2500
2501      <row>
2502       <entry>oprltcmpop</entry>
2503       <entry><type>oid</type></entry>
2504       <entry>pg_operator.oid</entry>
2505       <entry>
2506        If this operator supports merge joins, the less-than operator that
2507        compares the left and right operand types (<literal>L&lt;R</>)
2508       </entry>
2509      </row>
2510
2511      <row>
2512       <entry>oprgtcmpop</entry>
2513       <entry><type>oid</type></entry>
2514       <entry>pg_operator.oid</entry>
2515       <entry>
2516        If this operator supports merge joins, the greater-than operator that
2517        compares the left and right operand types (<literal>L&gt;R</>)
2518       </entry>
2519      </row>
2520
2521      <row>
2522       <entry>oprcode</entry>
2523       <entry><type>regproc</type></entry>
2524       <entry>pg_proc.oid</entry>
2525       <entry>Function that implements this operator</entry>
2526      </row>
2527
2528      <row>
2529       <entry>oprrest</entry>
2530       <entry><type>regproc</type></entry>
2531       <entry>pg_proc.oid</entry>
2532       <entry>Restriction selectivity estimation function for this operator</entry>
2533      </row>
2534
2535      <row>
2536       <entry>oprjoin</entry>
2537       <entry><type>regproc</type></entry>
2538       <entry>pg_proc.oid</entry>
2539       <entry>Join selectivity estimation function for this operator</entry>
2540      </row>
2541     </tbody>
2542    </tgroup>
2543   </table>
2544
2545   <para>
2546    Unused fields contain zeroes, for example oprleft is zero for a
2547    prefix operator.
2548   </para>
2549
2550  </sect1>
2551
2552
2553  <sect1 id="catalog-pg-proc">
2554   <title>pg_proc</title>
2555
2556   <para>
2557    This catalog stores information about functions (or procedures).
2558    The description of <command>CREATE FUNCTION</command> and the
2559    <citetitle>Programmer's Guide</citetitle> contain more information
2560    about the meaning of some fields.
2561   </para>
2562
2563   <para>
2564    The table contains data for aggregate functions as well as plain functions.
2565    If <structfield>proisagg</structfield> is true, there should be a matching
2566    row in <structname>pg_aggregate</structname>.
2567   </para>
2568
2569   <table>
2570    <title>pg_proc Columns</title>
2571
2572    <tgroup cols=4>
2573     <thead>
2574      <row>
2575       <entry>Name</entry>
2576       <entry>Type</entry>
2577       <entry>References</entry>
2578       <entry>Description</entry>
2579      </row>
2580     </thead>
2581
2582     <tbody>
2583      <row>
2584       <entry>proname</entry>
2585       <entry><type>name</type></entry>
2586       <entry></entry>
2587       <entry>Name of the function</entry>
2588      </row>
2589
2590      <row>
2591       <entry>pronamespace</entry>
2592       <entry><type>oid</type></entry>
2593       <entry>pg_namespace.oid</entry>
2594       <entry>
2595        The OID of the namespace that contains this function
2596       </entry>
2597      </row>
2598
2599      <row>
2600       <entry>proowner</entry>
2601       <entry><type>int4</type></entry>
2602       <entry>pg_shadow.usesysid</entry>
2603       <entry>Owner (creator) of the function</entry>
2604      </row>
2605
2606      <row>
2607       <entry>prolang</entry>
2608       <entry><type>oid</type></entry>
2609       <entry>pg_language.oid</entry>
2610       <entry>Implementation language or call interface of this function</entry>
2611      </row>
2612
2613      <row>
2614       <entry>proisagg</entry>
2615       <entry><type>bool</type></entry>
2616       <entry></entry>
2617       <entry>Function is an aggregate function</entry>
2618      </row>
2619
2620      <row>
2621       <entry>prosecdef</entry>
2622       <entry><type>bool</type></entry>
2623       <entry></entry>
2624       <entry>Function is a security definer (i.e., a <quote>setuid</>
2625       function)</entry>
2626      </row>
2627
2628      <row>
2629       <entry>proisstrict</entry>
2630       <entry><type>bool</type></entry>
2631       <entry></entry>
2632       <entry>
2633        Function returns null if any call argument is null.  In that
2634        case the function won't actually be called at all.  Functions
2635        that are not <quote>strict</quote> must be prepared to handle
2636        null inputs.
2637       </entry>
2638      </row>
2639
2640      <row>
2641       <entry>proretset</entry>
2642       <entry><type>bool</type></entry>
2643       <entry></entry>
2644       <entry>Function returns a set (ie, multiple values of the specified
2645       data type)</entry>
2646      </row>
2647
2648      <row>
2649       <entry>provolatile</entry>
2650       <entry><type>char</type></entry>
2651       <entry></entry>
2652       <entry>
2653        <structfield>provolatile</structfield> tells whether the function's
2654        result depends only on its input arguments, or is affected by outside
2655        factors.
2656        It is <literal>i</literal> for <quote>immutable</> functions,
2657        which always deliver the same result for the same inputs.
2658        It is <literal>s</literal> for <quote>stable</> functions,
2659        whose results (for fixed inputs) do not change within a scan.
2660        It is <literal>v</literal> for <quote>volatile</> functions,
2661        whose results may change at any time.  (Use <literal>v</literal> also
2662        for functions with side-effects, so that calls to them cannot get
2663        optimized away.)
2664       </entry>
2665      </row>
2666
2667      <row>
2668       <entry>pronargs</entry>
2669       <entry><type>int2</type></entry>
2670       <entry></entry>
2671       <entry>Number of arguments</entry>
2672      </row>
2673
2674      <row>
2675       <entry>prorettype</entry>
2676       <entry><type>oid</type></entry>
2677       <entry>pg_type.oid</entry>
2678       <entry>Data type of the return value</entry>
2679      </row>
2680
2681      <row>
2682       <entry>proargtypes</entry>
2683       <entry><type>oidvector</type></entry>
2684       <entry>pg_type.oid</entry>
2685       <entry>A vector with the data types of the function arguments</entry>
2686      </row>
2687
2688      <row>
2689       <entry>prosrc</entry>
2690       <entry><type>text</type></entry>
2691       <entry></entry>
2692       <entry>
2693        This tells the function handler how to invoke the function.  It
2694        might be the actual source code of the function for interpreted
2695        languages, a link symbol, a file name, or just about anything
2696        else, depending on the implementation language/call convention.
2697       </entry>
2698      </row>
2699
2700      <row>
2701       <entry>probin</entry>
2702       <entry><type>bytea</type></entry>
2703       <entry></entry>
2704       <entry>Additional information about how to invoke the function.
2705       Again, the interpretation is language-specific.
2706       </entry>
2707      </row>
2708
2709      <row>
2710       <entry>proacl</entry>
2711       <entry><type>aclitem[]</type></entry>
2712       <entry></entry>
2713       <entry>Access permissions</entry>
2714      </row>
2715     </tbody>
2716    </tgroup>
2717   </table>
2718
2719   <para>
2720   Currently, prosrc contains the function's C-language name (link symbol)
2721   for compiled functions, both built-in and dynamically loaded.  For all
2722   other language types, prosrc contains the function's source text.
2723   </para>
2724
2725   <para>
2726   Currently, probin is unused except for dynamically-loaded C functions,
2727   for which it gives the name of the shared library file containing the
2728   function.
2729   </para>
2730
2731  </sect1>
2732
2733  <sect1 id="catalog-pg-rewrite">
2734   <title>pg_rewrite</title>
2735
2736   <para>
2737    This system catalog stores rewrite rules for tables and views.
2738   </para>
2739
2740   <table>
2741    <title>pg_rewrite Columns</title>
2742
2743    <tgroup cols=4>
2744     <thead>
2745      <row>
2746       <entry>Name</entry>
2747       <entry>Type</entry>
2748       <entry>References</entry>
2749       <entry>Description</entry>
2750      </row>
2751     </thead>
2752
2753     <tbody>
2754      <row>
2755       <entry>rulename</entry>
2756       <entry><type>name</type></entry>
2757       <entry></entry>
2758       <entry>Rule name</entry>
2759      </row>
2760
2761      <row>
2762       <entry>ev_class</entry>
2763       <entry><type>oid</type></entry>
2764       <entry>pg_class.oid</entry>
2765       <entry>The table this rule is for</entry>
2766      </row>
2767
2768      <row>
2769       <entry>ev_attr</entry>
2770       <entry><type>int2</type></entry>
2771       <entry></entry>
2772       <entry>The column this rule is for (currently, always zero to
2773       indicate the whole table)</entry>
2774      </row>
2775
2776      <row>
2777       <entry>ev_type</entry>
2778       <entry><type>char</type></entry>
2779       <entry></entry>
2780       <entry>Event type that the rule is for: '1' = SELECT,
2781       '2' = UPDATE, '3' = INSERT, '4' = DELETE</entry>
2782      </row>
2783
2784      <row>
2785       <entry>is_instead</entry>
2786       <entry><type>bool</type></entry>
2787       <entry></entry>
2788       <entry>True if the rule is an INSTEAD rule</entry>
2789      </row>
2790
2791      <row>
2792       <entry>ev_qual</entry>
2793       <entry><type>text</type></entry>
2794       <entry></entry>
2795       <entry>Expression tree (in the form of a nodeToString representation)
2796       for the rule's qualifying condition</entry>
2797      </row>
2798
2799      <row>
2800       <entry>ev_action</entry>
2801       <entry><type>text</type></entry>
2802       <entry></entry>
2803       <entry>Query tree (in the form of a nodeToString representation)
2804       for the rule's action</entry>
2805      </row>
2806     </tbody>
2807    </tgroup>
2808   </table>
2809
2810   <note>
2811    <para>
2812     <structname>pg_class</structname>.<structfield>relhasrules</structfield>
2813     must be true if a table has any rules in this catalog.
2814    </para>
2815   </note>
2816
2817  </sect1>
2818
2819
2820  <sect1 id="catalog-pg-shadow">
2821   <title>pg_shadow</title>
2822
2823   <para>
2824    <structname>pg_shadow</structname> contains information about
2825    database users.  The name stems from the fact that this table
2826    should not be readable by the public since it contains passwords.
2827    <structname>pg_user</structname> is a publicly readable view on
2828    <structname>pg_shadow</structname> that blanks out the password field.
2829   </para>
2830
2831   <para>
2832    The <citetitle>Administrator's Guide</citetitle> contains detailed
2833    information about user and permission management.
2834   </para>
2835
2836   <para>
2837    Because user identities are cluster-wide,
2838    <structname>pg_shadow</structname>
2839    is shared across all databases of a cluster: there is only one
2840    copy of <structname>pg_shadow</structname> per cluster, not
2841    one per database.
2842   </para>
2843
2844   <table>
2845    <title>pg_shadow Columns</title>
2846
2847    <tgroup cols=4>
2848     <thead>
2849      <row>
2850       <entry>Name</entry>
2851       <entry>Type</entry>
2852       <entry>References</entry>
2853       <entry>Description</entry>
2854      </row>
2855     </thead>
2856
2857     <tbody>
2858      <row>
2859       <entry>usename</entry>
2860       <entry><type>name</type></entry>
2861       <entry></entry>
2862       <entry>User name</entry>
2863      </row>
2864
2865      <row>
2866       <entry>usesysid</entry>
2867       <entry><type>int4</type></entry>
2868       <entry></entry>
2869       <entry>User id (arbitrary number used to reference this user)</entry>
2870      </row>
2871
2872      <row>
2873       <entry>usecreatedb</entry>
2874       <entry><type>bool</type></entry>
2875       <entry></entry>
2876       <entry>User may create databases</entry>
2877      </row>
2878
2879      <row>
2880       <entry>usesuper</entry>
2881       <entry><type>bool</type></entry>
2882       <entry></entry>
2883       <entry>User is a superuser</entry>
2884      </row>
2885
2886      <row>
2887       <entry>usecatupd</entry>
2888       <entry><type>bool</type></entry>
2889       <entry></entry>
2890       <entry>
2891        User may update system catalogs.  (Even a superuser may not do
2892        this unless this attribute is true.)
2893       </entry>
2894      </row>
2895
2896      <row>
2897       <entry>passwd</entry>
2898       <entry><type>text</type></entry>
2899       <entry></entry>
2900       <entry>Password</entry>
2901      </row>
2902
2903      <row>
2904       <entry>valuntil</entry>
2905       <entry><type>abstime</type></entry>
2906       <entry></entry>
2907       <entry>Account expiry time (only used for password authentication)</entry>
2908      </row>
2909
2910      <row>
2911       <entry>useconfig</entry>
2912       <entry><type>text[]</type></entry>
2913       <entry></entry>
2914       <entry>Session defaults for run-time configuration variables</entry>
2915      </row>
2916     </tbody>
2917    </tgroup>
2918   </table>
2919
2920  </sect1>
2921
2922
2923  <sect1 id="catalog-pg-statistic">
2924   <title>pg_statistic</title>
2925
2926   <para>
2927    <structname>pg_statistic</structname> stores statistical data about
2928    the contents of the database.  Entries are created by
2929    <command>ANALYZE</command> and subsequently used by the query planner.
2930    There is one entry for each table column that has been analyzed.
2931    Note that all the statistical data is inherently approximate,
2932    even assuming that it is up-to-date.
2933   </para>
2934
2935   <para>
2936    Since different kinds of statistics may be appropriate for different
2937    kinds of data, <structname>pg_statistic</structname> is designed not
2938    to assume very much about what sort of statistics it stores.  Only
2939    extremely general statistics (such as NULL-ness) are given dedicated
2940    columns in <structname>pg_statistic</structname>.  Everything else
2941    is stored in <quote>slots</quote>, which are groups of associated columns whose
2942    content is identified by a code number in one of the slot's columns.
2943    For more information see
2944    <filename>src/include/catalog/pg_statistic.h</filename>.
2945   </para>
2946
2947   <para>
2948    <structname>pg_statistic</structname> should not be readable by the
2949    public, since even statistical information about a table's contents
2950    may be considered sensitive.  (Example: minimum and maximum values
2951    of a salary column might be quite interesting.)
2952    <structname>pg_stats</structname> is a publicly readable view on
2953    <structname>pg_statistic</structname> that only exposes information
2954    about those tables that are readable by the current user.
2955    <structname>pg_stats</structname> is also designed to present the
2956    information in a more readable format than the underlying
2957    <structname>pg_statistic</structname> table --- at the cost that
2958    its schema must be extended whenever new slot types are added.
2959   </para>
2960
2961   <table>
2962    <title>pg_statistic Columns</title>
2963
2964    <tgroup cols=4>
2965     <thead>
2966      <row>
2967       <entry>Name</entry>
2968       <entry>Type</entry>
2969       <entry>References</entry>
2970       <entry>Description</entry>
2971      </row>
2972     </thead>
2973
2974     <tbody>
2975      <row>
2976       <entry>starelid</entry>
2977       <entry><type>oid</type></entry>
2978       <entry>pg_class.oid</entry>
2979       <entry>The table that the described column belongs to</entry>
2980      </row>
2981
2982      <row>
2983       <entry>staattnum</entry>
2984       <entry><type>int2</type></entry>
2985       <entry>pg_attribute.attnum</entry>
2986       <entry>The number of the described column</entry>
2987      </row>
2988
2989      <row>
2990       <entry>stanullfrac</entry>
2991       <entry><type>float4</type></entry>
2992       <entry></entry>
2993       <entry>The fraction of the column's entries that are NULL</entry>
2994      </row>
2995
2996      <row>
2997       <entry>stawidth</entry>
2998       <entry><type>int4</type></entry>
2999       <entry></entry>
3000       <entry>The average stored width, in bytes, of non-NULL entries</entry>
3001      </row>
3002
3003      <row>
3004       <entry>stadistinct</entry>
3005       <entry><type>float4</type></entry>
3006       <entry></entry>
3007       <entry>The number of distinct non-NULL data values in the column.
3008       A value greater than zero is the actual number of distinct values.
3009       A value less than zero is the negative of a fraction of the number
3010       of rows in the table (for example, a column in which values appear about
3011       twice on the average could be represented by stadistinct = -0.5).
3012       A zero value means the number of distinct values is unknown.
3013       </entry>
3014      </row>
3015
3016      <row>
3017       <entry>stakindN</entry>
3018       <entry><type>int2</type></entry>
3019       <entry></entry>
3020       <entry>A code number indicating the kind of statistics stored in the Nth
3021       <quote>slot</quote> of the <structname>pg_statistic</structname> row.
3022       </entry>
3023      </row>
3024
3025      <row>
3026       <entry>staopN</entry>
3027       <entry><type>oid</type></entry>
3028       <entry>pg_operator.oid</entry>
3029       <entry>An operator used to derive the statistics stored in the
3030       Nth <quote>slot</quote>.  For example, a histogram slot would show the <literal>&lt;</literal>
3031       operator that defines the sort order of the data.
3032       </entry>
3033      </row>
3034
3035      <row>
3036       <entry>stanumbersN</entry>
3037       <entry><type>float4[]</type></entry>
3038       <entry></entry>
3039       <entry>Numerical statistics of the appropriate kind for the Nth
3040       <quote>slot</quote>, or NULL if the slot kind does not involve numerical values.
3041       </entry>
3042      </row>
3043
3044      <row>
3045       <entry>stavaluesN</entry>
3046       <entry><type>text[]</type></entry>
3047       <entry></entry>
3048       <entry>Column data values of the appropriate kind for the Nth
3049       <quote>slot</quote>, or NULL if the slot kind does not store any data values.
3050       For data-type independence, all column data values are converted
3051       to external textual form and stored as TEXT datums.
3052       </entry>
3053      </row>
3054     </tbody>
3055    </tgroup>
3056   </table>
3057
3058  </sect1>
3059
3060
3061  <sect1 id="catalog-pg-trigger">
3062   <title>pg_trigger</title>
3063
3064   <para>
3065    This system catalog stores triggers on tables.  See under
3066    <command>CREATE TRIGGER</command> for more information.
3067   </para>
3068
3069   <table>
3070    <title>pg_trigger Columns</title>
3071
3072    <tgroup cols=4>
3073     <thead>
3074      <row>
3075       <entry>Name</entry>
3076       <entry>Type</entry>
3077       <entry>References</entry>
3078       <entry>Description</entry>
3079      </row>
3080     </thead>
3081
3082     <tbody>
3083      <row>
3084       <entry>tgrelid</entry>
3085       <entry><type>oid</type></entry>
3086       <entry>pg_class.oid</entry>
3087       <entry>The table this trigger is on</entry>
3088      </row>
3089
3090      <row>
3091       <entry>tgname</entry>
3092       <entry><type>name</type></entry>
3093       <entry></entry>
3094       <entry>Trigger name (must be unique among triggers of same table)</entry>
3095      </row>
3096
3097      <row>
3098       <entry>tgfoid</entry>
3099       <entry><type>oid</type></entry>
3100       <entry>pg_proc.oid</entry>
3101       <entry>The function to be called</entry>
3102      </row>
3103
3104      <row>
3105       <entry>tgtype</entry>
3106       <entry><type>int2</type></entry>
3107       <entry></entry>
3108       <entry>Bitmask identifying trigger conditions</entry>
3109      </row>
3110
3111      <row>
3112       <entry>tgenabled</entry>
3113       <entry><type>bool</type></entry>
3114       <entry></entry>
3115       <entry>True if trigger is enabled (not presently checked everywhere
3116       it should be, so disabling a trigger by setting this false does not
3117       work reliably)</entry>
3118      </row>
3119
3120      <row>
3121       <entry>tgisconstraint</entry>
3122       <entry><type>bool</type></entry>
3123       <entry></entry>
3124       <entry>True if trigger implements an RI constraint</entry>
3125      </row>
3126
3127      <row>
3128       <entry>tgconstrname</entry>
3129       <entry><type>name</type></entry>
3130       <entry></entry>
3131       <entry>RI constraint name</entry>
3132      </row>
3133
3134      <row>
3135       <entry>tgconstrrelid</entry>
3136       <entry><type>oid</type></entry>
3137       <entry>pg_class.oid</entry>
3138       <entry>The table referenced by an RI constraint</entry>
3139      </row>
3140
3141      <row>
3142       <entry>tgdeferrable</entry>
3143       <entry><type>bool</type></entry>
3144       <entry></entry>
3145       <entry>True if deferrable</entry>
3146      </row>
3147
3148      <row>
3149       <entry>tginitdeferred</entry>
3150       <entry><type>bool</type></entry>
3151       <entry></entry>
3152       <entry>True if initially deferred</entry>
3153      </row>
3154
3155      <row>
3156       <entry>tgnargs</entry>
3157       <entry><type>int2</type></entry>
3158       <entry></entry>
3159       <entry>Number of argument strings passed to trigger function</entry>
3160      </row>
3161
3162      <row>
3163       <entry>tgattr</entry>
3164       <entry><type>int2vector</type></entry>
3165       <entry></entry>
3166       <entry>Currently unused</entry>
3167      </row>
3168
3169      <row>
3170       <entry>tgargs</entry>
3171       <entry><type>bytea</type></entry>
3172       <entry></entry>
3173       <entry>Argument strings to pass to trigger, each null-terminated</entry>
3174      </row>
3175     </tbody>
3176    </tgroup>
3177   </table>
3178
3179   <note>
3180    <para>
3181     <structname>pg_class</structname>.<structfield>reltriggers</structfield>
3182     needs to match up with the entries in this table.
3183    </para>
3184   </note>
3185
3186  </sect1>
3187
3188
3189  <sect1 id="catalog-pg-type">
3190   <title>pg_type</title>
3191
3192   <para>
3193    This catalog stores information about data types.  Scalar types
3194    (<quote>base types</>) are created with <command>CREATE TYPE</command>.
3195    A complex type is automatically created for each table in the database, to
3196    represent the row structure of the table.  It is also possible to create
3197    complex types with <command>CREATE TYPE AS</command>, and
3198    derived types with <command>CREATE DOMAIN</command>.
3199   </para>
3200
3201   <table>
3202    <title>pg_type Columns</title>
3203
3204    <tgroup cols=4>
3205     <thead>
3206      <row>
3207       <entry>Name</entry>
3208       <entry>Type</entry>
3209       <entry>References</entry>
3210       <entry>Description</entry>
3211      </row>
3212     </thead>
3213
3214     <tbody>
3215      <row>
3216       <entry>typname</entry>
3217       <entry><type>name</type></entry>
3218       <entry></entry>
3219       <entry>Data type name</entry>
3220      </row>
3221
3222      <row>
3223       <entry>typnamespace</entry>
3224       <entry><type>oid</type></entry>
3225       <entry>pg_namespace.oid</entry>
3226       <entry>
3227        The OID of the namespace that contains this type
3228       </entry>
3229      </row>
3230
3231      <row>
3232       <entry>typowner</entry>
3233       <entry><type>int4</type></entry>
3234       <entry>pg_shadow.usesysid</entry>
3235       <entry>Owner (creator) of the type</entry>
3236      </row>
3237
3238      <row>
3239       <entry>typlen</entry>
3240       <entry><type>int2</type></entry>
3241       <entry></entry>
3242       <entry>
3243        For a fixed-size type, <structfield>typlen</structfield> is the number
3244        of bytes in the internal representation of the type.  But for a
3245        variable-length type, <structfield>typlen</structfield> is negative.
3246        -1 indicates a <quote>varlena</> type (one that has a length word),
3247        -2 indicates a null-terminated C string.
3248       </entry>
3249      </row>
3250
3251      <row>
3252       <entry>typbyval</entry>
3253       <entry><type>bool</type></entry>
3254       <entry></entry>
3255       <entry>
3256        <structfield>typbyval</structfield> determines whether internal
3257        routines pass a value of this type by value or by reference.
3258        Only <type>char</type>, <type>short</type>, and
3259        <type>int</type> equivalent items can be passed by value, so if
3260        the type is not 1, 2, or 4 bytes long,
3261        <productname>PostgreSQL</> does not have
3262        the option of passing by value and so
3263        <structfield>typbyval</structfield> had better be false.
3264        Variable-length types are always passed by reference. Note that
3265        <structfield>typbyval</structfield> can be false even if the
3266        length would allow pass-by-value; this is currently true for
3267        type <type>float4</type>, for example.
3268       </entry>
3269      </row>
3270
3271      <row>
3272       <entry>typtype</entry>
3273       <entry><type>char</type></entry>
3274       <entry></entry>
3275       <entry>
3276        <structfield>typtype</structfield> is <literal>b</literal> for
3277        a base type, <literal>c</literal> for a complex type (i.e.,
3278        a table's row type), <literal>d</literal> for a derived type (i.e.,
3279        a domain), or <literal>p</literal> for a pseudo-type.  See also
3280        <structfield>typrelid</structfield>
3281        and <structfield>typbasetype</structfield>.
3282       </entry>
3283      </row>
3284
3285      <row>
3286       <entry>typisdefined</entry>
3287       <entry><type>bool</type></entry>
3288       <entry></entry>
3289       <entry>True if the type is defined, false if this is a placeholder
3290       entry for a not-yet-defined type.  When typisdefined is false,
3291       nothing except the type name, namespace, and OID can be relied on.
3292       </entry>
3293      </row>
3294
3295      <row>
3296       <entry>typdelim</entry>
3297       <entry><type>char</type></entry>
3298       <entry></entry>
3299       <entry>Character that separates two values of this type when parsing
3300       array input.  Note that the delimiter is associated with the array
3301       element data type, not the array data type.</entry>
3302      </row>
3303
3304      <row>
3305       <entry>typrelid</entry>
3306       <entry><type>oid</type></entry>
3307       <entry>pg_class.oid</entry>
3308       <entry>
3309        If this is a complex type (see
3310        <structfield>typtype</structfield>), then this field points to
3311        the <structname>pg_class</structname> entry that defines the
3312        corresponding table.  (For a free-standing composite type, the
3313        <structname>pg_class</structname> entry doesn't really represent
3314        a table, but it is needed anyway for the type's
3315        <structname>pg_attribute</structname> entries to link to.)
3316        Zero for non-complex types.
3317       </entry>
3318      </row>
3319
3320      <row>
3321       <entry>typelem</entry>
3322       <entry><type>oid</type></entry>
3323       <entry>pg_type.oid</entry>
3324       <entry>
3325        If <structfield>typelem</structfield> is not 0 then it
3326        identifies another row in <structname>pg_type</structname>.
3327        The current type can then be subscripted like an array yielding
3328        values of type <structfield>typelem</structfield>.  A
3329        <quote>true</quote> array type is variable length
3330        (<structfield>typlen</structfield> = -1),
3331        but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
3332        also have nonzero <structfield>typelem</structfield>, for example
3333        <type>name</type> and <type>oidvector</type>.
3334        If a fixed-length type has a <structfield>typelem</structfield> then
3335        its internal representation must be N values of the
3336        <structfield>typelem</structfield> data type with no other data.
3337        Variable-length array types have a header defined by the array
3338        subroutines.
3339       </entry>
3340      </row>
3341
3342      <row>
3343       <entry>typinput</entry>
3344       <entry><type>regproc</type></entry>
3345       <entry>pg_proc.oid</entry>
3346       <entry>Input conversion function</entry>
3347      </row>
3348
3349      <row>
3350       <entry>typoutput</entry>
3351       <entry><type>regproc</type></entry>
3352       <entry>pg_proc.oid</entry>
3353       <entry>Output conversion function</entry>
3354      </row>
3355
3356      <row>
3357       <entry>typalign</entry>
3358       <entry><type>char</type></entry>
3359       <entry></entry>
3360       <entry><para>
3361
3362        <structfield>typalign</structfield> is the alignment required
3363        when storing a value of this type.  It applies to storage on
3364        disk as well as most representations of the value inside
3365        <productname>PostgreSQL</>.
3366        When multiple values are stored consecutively, such
3367        as in the representation of a complete row on disk, padding is
3368        inserted before a datum of this type so that it begins on the
3369        specified boundary.  The alignment reference is the beginning
3370        of the first datum in the sequence.
3371       </para><para>
3372        Possible values are:
3373        <itemizedlist>
3374         <listitem>
3375          <para>'c' = CHAR alignment, i.e., no alignment needed.</para>
3376         </listitem>
3377         <listitem>
3378          <para>'s' = SHORT alignment (2 bytes on most machines).</para>
3379         </listitem>
3380         <listitem>
3381          <para>'i' = INT alignment (4 bytes on most machines).</para>
3382         </listitem>
3383         <listitem>
3384          <para>'d' = DOUBLE alignment (8 bytes on many machines, but by no means all).</para>
3385         </listitem>
3386        </itemizedlist>
3387       </para><note>
3388        <para>
3389         For types used in system tables, it is critical that the size
3390         and alignment defined in <structname>pg_type</structname>
3391         agree with the way that the compiler will lay out the field in
3392         a struct representing a table row.
3393        </para>
3394       </note></entry>
3395      </row>
3396
3397      <row>
3398       <entry>typstorage</entry>
3399       <entry><type>char</type></entry>
3400       <entry></entry>
3401       <entry><para>
3402        <structfield>typstorage</structfield> tells for varlena
3403        types (those with <structfield>typlen</structfield> = -1) if
3404        the type is prepared for toasting and what the default strategy
3405        for attributes of this type should be.
3406        Possible values are
3407        <itemizedlist>
3408         <listitem>
3409          <para>'p': Value must always be stored plain.</para>
3410         </listitem>
3411         <listitem>
3412          <para>
3413           'e': Value can be stored in a <quote>secondary</quote>
3414           relation (if relation has one, see
3415           <structname>pg_class</structname>.<structfield>reltoastrelid</structfield>).
3416          </para>
3417         </listitem>
3418         <listitem>
3419          <para>'m': Value can be stored compressed inline.</para>
3420         </listitem>
3421         <listitem>
3422          <para>'x': Value can be stored compressed inline or in <quote>secondary</quote>.</para>
3423         </listitem>
3424        </itemizedlist>
3425        Note that 'm' fields can also be moved out to secondary
3426        storage, but only as a last resort ('e' and 'x' fields are
3427        moved first).
3428       </para></entry>
3429      </row>
3430
3431      <row>
3432       <entry>typnotnull</entry>
3433       <entry><type>bool</type></entry>
3434       <entry></entry>
3435       <entry><para>
3436        <structfield>typnotnull</structfield> represents a NOT NULL
3437        constraint on a type.  Presently used for domains only.
3438       </para></entry>
3439      </row>
3440
3441      <row>
3442       <entry>typbasetype</entry>
3443       <entry><type>oid</type></entry>
3444       <entry>pg_type.oid</entry>
3445       <entry><para>
3446        If this is a derived type (see <structfield>typtype</structfield>),
3447        then <structfield>typbasetype</structfield> identifies
3448        the type that this one is based on.  Zero if not a derived type.
3449       </para></entry>
3450      </row>
3451
3452      <row>
3453       <entry>typtypmod</entry>
3454       <entry><type>int4</type></entry>
3455       <entry></entry>
3456       <entry><para>
3457        Domains use <structfield>typtypmod</structfield> to record the typmod
3458        to be applied to their base type (-1 if base type does not use a
3459        typmod).  -1 if this type is not a domain.
3460       </para></entry>
3461      </row>
3462
3463      <row>
3464       <entry>typndims</entry>
3465       <entry><type>int4</type></entry>
3466       <entry></entry>
3467       <entry><para>
3468        <structfield>typndims</structfield> is the number of array dimensions
3469        for a domain that is an array (that is, typbasetype is an array type;
3470        the domain's typelem will match the base type's typelem).
3471        Zero for non-domains and non-array domains.
3472        </para></entry>
3473      </row>
3474
3475      <row>
3476       <entry>typdefaultbin</entry>
3477       <entry><type>text</type></entry>
3478       <entry></entry>
3479       <entry><para>
3480        If <structfield>typdefaultbin</> is not NULL, it is the nodeToString
3481        representation of a default expression for the type.  Currently this is
3482        only used for domains.
3483       </para></entry>
3484      </row>
3485
3486      <row>
3487       <entry>typdefault</entry>
3488       <entry><type>text</type></entry>
3489       <entry></entry>
3490       <entry><para>
3491        <structfield>typdefault</> is NULL if the type has no associated
3492        default value. If <structfield>typdefaultbin</> is not NULL,
3493        <structfield>typdefault</> must contain a human-readable version of the
3494        default expression represented by <structfield>typdefaultbin</>.  If
3495        <structfield>typdefaultbin</> is NULL and <structfield>typdefault</> is
3496        not, then <structfield>typdefault</> is the external representation of
3497        the type's default value, which may be fed to the type's input
3498        converter to produce a constant.
3499       </para></entry>
3500      </row>
3501     </tbody>
3502    </tgroup>
3503   </table>
3504  </sect1>
3505 </chapter>
3506
3507 <!-- Keep this comment at the end of the file
3508 Local variables:
3509 mode:sgml
3510 sgml-omittag:nil
3511 sgml-shorttag:t
3512 sgml-minimize-attributes:nil
3513 sgml-always-quote-attributes:t
3514 sgml-indent-step:1
3515 sgml-indent-tabs-mode:nil
3516 sgml-indent-data:t
3517 sgml-parent-document:nil
3518 sgml-default-dtd-file:"./reference.ced"
3519 sgml-exposed-tags:nil
3520 sgml-local-catalogs:("/usr/share/sgml/catalog")
3521 sgml-local-ecat-files:nil
3522 End:
3523 -->