]> granicus.if.org Git - postgresql/blob - doc/src/sgml/catalogs.sgml
Improvement to CREATE TRIGGER and catalog documentation.
[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.64 2002/12/17 17:41:30 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>
1072        True if this is a table and it has (or recently had) any
1073        indexes. This is set by <command>CREATE INDEX</command>, but
1074        not cleared immediately by <command>DROP INDEX</command>.
1075        <command>VACUUM</command> clears relhasindex if it finds the
1076        table has no indexes.
1077       </entry>
1078      </row>
1079
1080      <row>
1081       <entry>relisshared</entry>
1082       <entry><type>bool</type></entry>
1083       <entry></entry>
1084       <entry>True if this table is shared across all databases in the
1085       cluster.  Only certain system catalogs (such as
1086       <structname>pg_database</structname>) are shared.</entry>
1087      </row>
1088
1089      <row>
1090       <entry>relkind</entry>
1091       <entry><type>char</type></entry>
1092       <entry></entry>
1093       <entry>
1094        'r' = ordinary table, 'i' = index, 'S' = sequence, 'v' = view,
1095        'c' = composite type, 's' = special, 't' = TOAST table
1096       </entry>
1097      </row>
1098
1099      <row>
1100       <entry>relnatts</entry>
1101       <entry><type>int2</type></entry>
1102       <entry></entry>
1103       <entry>
1104        Number of user columns in the relation (system columns not counted).
1105        There must be this many corresponding entries in
1106        <structname>pg_attribute</structname>.  See also
1107        <structname>pg_attribute</structname>.<structfield>attnum</structfield>.
1108       </entry>
1109      </row>
1110
1111      <row>
1112       <entry>relchecks</entry>
1113       <entry><type>int2</type></entry>
1114       <entry></entry>
1115       <entry>
1116        Number of check constraints on the table; see
1117        <structname>pg_constraint</structname> catalog
1118       </entry>
1119      </row>
1120
1121      <row>
1122       <entry>reltriggers</entry>
1123       <entry><type>int2</type></entry>
1124       <entry></entry>
1125       <entry>
1126        Number of triggers on the table; see
1127        <structname>pg_trigger</structname> catalog
1128       </entry>
1129      </row>
1130
1131      <row>
1132       <entry>relukeys</entry>
1133       <entry><type>int2</type></entry>
1134       <entry></entry>
1135       <entry>unused  (<emphasis>Not</emphasis> the number of unique keys)</entry>
1136      </row>
1137
1138      <row>
1139       <entry>relfkeys</entry>
1140       <entry><type>int2</type></entry>
1141       <entry></entry>
1142       <entry>unused  (<emphasis>Not</emphasis> the number of foreign keys on the table)</entry>
1143      </row>
1144
1145      <row>
1146       <entry>relrefs</entry>
1147       <entry><type>int2</type></entry>
1148       <entry></entry>
1149       <entry>unused</entry>
1150      </row>
1151
1152      <row>
1153       <entry>relhasoids</entry>
1154       <entry><type>bool</type></entry>
1155       <entry></entry>
1156       <entry>
1157        True if we generate an OID for each row of the relation.
1158       </entry>
1159      </row>
1160
1161      <row>
1162       <entry>relhaspkey</entry>
1163       <entry><type>bool</type></entry>
1164       <entry></entry>
1165       <entry>
1166        True if the table has (or once had) a primary key.
1167       </entry>
1168      </row>
1169
1170      <row>
1171       <entry>relhasrules</entry>
1172       <entry><type>bool</type></entry>
1173       <entry></entry>
1174       <entry>Table has rules; see
1175        <structname>pg_rewrite</structname> catalog
1176       </entry>
1177      </row>
1178
1179      <row>
1180       <entry>relhassubclass</entry>
1181       <entry><type>bool</type></entry>
1182       <entry></entry>
1183       <entry>At least one table inherits from this one</entry>
1184      </row>
1185
1186      <row>
1187       <entry>relacl</entry>
1188       <entry><type>aclitem[]</type></entry>
1189       <entry></entry>
1190       <entry>
1191        Access permissions.  See the descriptions of
1192        <command>GRANT</command> and <command>REVOKE</command> for
1193        details.
1194       </entry>
1195      </row>
1196     </tbody>
1197    </tgroup>
1198   </table>
1199  </sect1>
1200
1201  <sect1 id="catalog-pg-constraint">
1202   <title>pg_constraint</title>
1203
1204   <para>
1205    This system catalog stores CHECK, PRIMARY KEY, UNIQUE, and FOREIGN KEY
1206    constraints on tables.  (Column
1207    constraints are not treated specially.  Every column constraint is
1208    equivalent to some table constraint.)  See under <command>CREATE
1209    TABLE</command> for more information.
1210   </para>
1211
1212   <note>
1213    <para>
1214     NOT NULL constraints are represented in the <structname>pg_attribute</>
1215     catalog.
1216    </para>
1217   </note>
1218
1219   <para>
1220    CHECK constraints on domains are stored here, too.  Global ASSERTIONS
1221    (a currently-unsupported SQL feature) may someday appear here as well.
1222   </para>
1223
1224   <table>
1225    <title>pg_constraint Columns</title>
1226
1227    <tgroup cols=4>
1228     <thead>
1229      <row>
1230       <entry>Name</entry>
1231       <entry>Type</entry>
1232       <entry>References</entry>
1233       <entry>Description</entry>
1234      </row>
1235     </thead>
1236
1237     <tbody>
1238      <row>
1239       <entry>conname</entry>
1240       <entry><type>name</type></entry>
1241       <entry></entry>
1242       <entry>Constraint name (not necessarily unique!)</entry>
1243      </row>
1244
1245      <row>
1246       <entry>connamespace</entry>
1247       <entry><type>oid</type></entry>
1248       <entry>pg_namespace.oid</entry>
1249       <entry>
1250        The OID of the namespace that contains this constraint
1251       </entry>
1252      </row>
1253
1254      <row>
1255       <entry>contype</entry>
1256       <entry><type>char</type></entry>
1257       <entry></entry>
1258       <entry>
1259         'c' = check constraint,
1260         'f' = foreign key constraint,
1261         'p' = primary key constraint,
1262         'u' = unique constraint
1263       </entry>
1264      </row>
1265
1266      <row>
1267       <entry>condeferrable</entry>
1268       <entry><type>boolean</type></entry>
1269       <entry></entry>
1270       <entry>Is the constraint deferrable?</entry>
1271      </row>
1272
1273      <row>
1274       <entry>condeferred</entry>
1275       <entry><type>boolean</type></entry>
1276       <entry></entry>
1277       <entry>Is the constraint deferred by default?</entry>
1278      </row>
1279
1280      <row>
1281       <entry>conrelid</entry>
1282       <entry><type>oid</type></entry>
1283       <entry>pg_class.oid</entry>
1284       <entry>The table this constraint is on; 0 if not a table constraint</entry>
1285      </row>
1286
1287      <row>
1288       <entry>contypid</entry>
1289       <entry><type>oid</type></entry>
1290       <entry>pg_type.oid</entry>
1291       <entry>The domain this constraint is on; 0 if not a domain constraint</entry>
1292      </row>
1293
1294      <row>
1295       <entry>confrelid</entry>
1296       <entry><type>oid</type></entry>
1297       <entry>pg_class.oid</entry>
1298       <entry>If a foreign key, the referenced table; else 0</entry>
1299      </row>
1300
1301      <row>
1302       <entry>confupdtype</entry>
1303       <entry><type>char</type></entry>
1304       <entry></entry>
1305       <entry>Foreign key update action code</entry>
1306      </row>
1307
1308      <row>
1309       <entry>confdeltype</entry>
1310       <entry><type>char</type></entry>
1311       <entry></entry>
1312       <entry>Foreign key deletion action code</entry>
1313      </row>
1314
1315      <row>
1316       <entry>confmatchtype</entry>
1317       <entry><type>char</type></entry>
1318       <entry></entry>
1319       <entry>Foreign key match type</entry>
1320      </row>
1321
1322      <row>
1323       <entry>conkey</entry>
1324       <entry><type>int2[]</type></entry>
1325       <entry>pg_attribute.attnum</entry>
1326       <entry>If a table constraint, list of columns which the constraint constrains</entry>
1327      </row>
1328
1329      <row>
1330       <entry>confkey</entry>
1331       <entry><type>int2[]</type></entry>
1332       <entry>pg_attribute.attnum</entry>
1333       <entry>If a foreign key, list of the referenced columns</entry>
1334      </row>
1335
1336      <row>
1337       <entry>conbin</entry>
1338       <entry><type>text</type></entry>
1339       <entry></entry>
1340       <entry>If a check constraint, an internal representation of the expression</entry>
1341      </row>
1342
1343      <row>
1344       <entry>consrc</entry>
1345       <entry><type>text</type></entry>
1346       <entry></entry>
1347       <entry>If a check constraint, a human-readable representation of the expression</entry>
1348      </row>
1349     </tbody>
1350    </tgroup>
1351   </table>
1352
1353   <note>
1354    <para>
1355     <structname>pg_class</structname>.<structfield>relchecks</structfield>
1356     needs to agree with the number of check-constraint entries found in this
1357     table for the given relation.
1358    </para>
1359   </note>
1360
1361  </sect1>
1362
1363  <sect1 id="catalog-pg-conversion">
1364   <title>pg_conversion</title>
1365
1366   <para>
1367    This system catalog stores encoding conversion information. See
1368    <command>CREATE CONVERSION</command> for more information.
1369   </para>
1370
1371   <table>
1372    <title>pg_conversion Columns</title>
1373
1374    <tgroup cols=4>
1375     <thead>
1376      <row>
1377       <entry>Name</entry>
1378       <entry>Type</entry>
1379       <entry>References</entry>
1380       <entry>Description</entry>
1381      </row>
1382     </thead>
1383
1384     <tbody>
1385      <row>
1386       <entry>conname</entry>
1387       <entry><type>name</type></entry>
1388       <entry></entry>
1389       <entry>Conversion name (unique within a namespace)</entry>
1390      </row>
1391
1392      <row>
1393       <entry>connamespace</entry>
1394       <entry><type>oid</type></entry>
1395       <entry>pg_namespace.oid</entry>
1396       <entry>
1397        The OID of the namespace that contains this conversion
1398       </entry>
1399      </row>
1400
1401      <row>
1402       <entry>conowner</entry>
1403       <entry><type>int4</type></entry>
1404       <entry>pg_shadow.usesysid</entry>
1405       <entry>Owner (creator) of the namespace</entry>
1406      </row>
1407
1408      <row>
1409       <entry>conforencoding</entry>
1410       <entry><type>int4</type></entry>
1411       <entry></entry>
1412       <entry>Source(for) encoding ID</entry>
1413      </row>
1414
1415      <row>
1416       <entry>contoencoding</entry>
1417       <entry><type>int4</type></entry>
1418       <entry></entry>
1419       <entry>Destination(to) encoding ID</entry>
1420      </row>
1421
1422      <row>
1423       <entry>conproc</entry>
1424       <entry><type>regproc</type></entry>
1425       <entry>pg_proc.oid</entry>
1426       <entry>Conversion procedure</entry>
1427      </row>
1428
1429      <row>
1430       <entry>condefault</entry>
1431       <entry><type>boolean</type></entry>
1432       <entry></entry>
1433       <entry>true if this is the default conversion</entry>
1434      </row>
1435
1436     </tbody>
1437    </tgroup>
1438   </table>
1439
1440  </sect1>
1441
1442  <sect1 id="catalog-pg-database">
1443   <title>pg_database</title>
1444
1445   <para>
1446    The <structname>pg_database</structname> catalog stores information
1447    about the available databases.  Databases are created with the
1448    <command>CREATE DATABASE</command> command.  Consult the
1449    <citetitle>Administrator's Guide</citetitle> for details about the
1450    meaning of some of the parameters.
1451   </para>
1452
1453   <para>
1454    Unlike most system catalogs, <structname>pg_database</structname>
1455    is shared across all databases of a cluster: there is only one
1456    copy of <structname>pg_database</structname> per cluster, not
1457    one per database.
1458   </para>
1459
1460   <table>
1461    <title>pg_database Columns</title>
1462
1463    <tgroup cols=4>
1464     <thead>
1465      <row>
1466       <entry>Name</entry>
1467       <entry>Type</entry>
1468       <entry>References</entry>
1469       <entry>Description</entry>
1470      </row>
1471     </thead>
1472
1473     <tbody>
1474      <row>
1475       <entry>datname</entry>
1476       <entry><type>name</type></entry>
1477       <entry></entry>
1478       <entry>Database name</entry>
1479      </row>
1480
1481      <row>
1482       <entry>datdba</entry>
1483       <entry><type>int4</type></entry>
1484       <entry>pg_shadow.usesysid</entry>
1485       <entry>Owner of the database, usually the user who created it</entry>
1486      </row>
1487
1488      <row>
1489       <entry>encoding</entry>
1490       <entry><type>int4</type></entry>
1491       <entry></entry>
1492       <entry>Character/multibyte encoding for this database</entry>
1493      </row>
1494
1495      <row>
1496       <entry>datistemplate</entry>
1497       <entry><type>bool</type></entry>
1498       <entry></entry>
1499       <entry>
1500        If true then this database can be used in the
1501        <quote>TEMPLATE</quote> clause of <command>CREATE
1502        DATABASE</command> to create a new database as a clone of
1503        this one.
1504       </entry>
1505      </row>
1506
1507      <row>
1508       <entry>datallowconn</entry>
1509       <entry><type>bool</type></entry>
1510       <entry></entry>
1511       <entry>
1512        If false then no one can connect to this database.  This is
1513        used to protect the template0 database from being altered.
1514       </entry>
1515      </row>
1516
1517      <row>
1518       <entry>datlastsysoid</entry>
1519       <entry><type>oid</type></entry>
1520       <entry></entry>
1521       <entry>
1522        Last system OID in the database; useful
1523        particularly to <application>pg_dump</application>
1524       </entry>
1525      </row>
1526
1527      <row>
1528       <entry>datvacuumxid</entry>
1529       <entry><type>xid</type></entry>
1530       <entry></entry>
1531       <entry>
1532        All tuples inserted or deleted by transaction IDs before this one
1533        have been marked as known committed or known aborted in this database.
1534        This is used to determine when commit-log space can be recycled.
1535       </entry>
1536      </row>
1537
1538      <row>
1539       <entry>datfrozenxid</entry>
1540       <entry><type>xid</type></entry>
1541       <entry></entry>
1542       <entry>
1543        All tuples inserted by transaction IDs before this one have been
1544        relabeled with a permanent (<quote>frozen</>) transaction ID in this
1545        database.  This is useful to check whether a database must be vacuumed
1546        soon to avoid transaction ID wraparound problems.
1547       </entry>
1548      </row>
1549
1550      <row>
1551       <entry>datpath</entry>
1552       <entry><type>text</type></entry>
1553       <entry></entry>
1554       <entry>
1555        If the database is stored at an alternative location then this
1556        records the location.  It's either an environment variable name
1557        or an absolute path, depending how it was entered.
1558       </entry>
1559      </row>
1560
1561      <row>
1562       <entry>datconfig</entry>
1563       <entry><type>text[]</type></entry>
1564       <entry></entry>
1565       <entry>Session defaults for run-time configuration variables</entry>
1566      </row>
1567
1568      <row>
1569       <entry>datacl</entry>
1570       <entry><type>aclitem[]</type></entry>
1571       <entry></entry>
1572       <entry>Access permissions</entry>
1573      </row>
1574     </tbody>
1575    </tgroup>
1576   </table>
1577  </sect1>
1578
1579
1580  <sect1 id="catalog-pg-depend">
1581   <title>pg_depend</title>
1582
1583   <para>
1584    The <structname>pg_depend</structname> table records the dependency
1585    relationships between database objects.  This information allows
1586    <command>DROP</> commands to find which other objects must be dropped
1587    by <command>DROP CASCADE</>, or prevent dropping in the <command>DROP
1588    RESTRICT</> case.
1589   </para>
1590
1591   <table>
1592    <title>pg_depend Columns</title>
1593
1594    <tgroup cols=4>
1595     <thead>
1596      <row>
1597       <entry>Name</entry>
1598       <entry>Type</entry>
1599       <entry>References</entry>
1600       <entry>Description</entry>
1601      </row>
1602     </thead>
1603
1604     <tbody>
1605      <row>
1606       <entry>classid</entry>
1607       <entry><type>oid</type></entry>
1608       <entry>pg_class.oid</entry>
1609       <entry>The oid of the system catalog the dependent object is in</entry>
1610      </row>
1611
1612      <row>
1613       <entry>objid</entry>
1614       <entry><type>oid</type></entry>
1615       <entry>any oid attribute</entry>
1616       <entry>The oid of the specific dependent object</entry>
1617      </row>
1618
1619      <row>
1620       <entry>objsubid</entry>
1621       <entry><type>int4</type></entry>
1622       <entry></entry>
1623       <entry>For a table attribute, this is the attribute's
1624        column number (the objid and classid refer to the table itself).
1625        For all other object types, this field is presently zero.
1626       </entry>
1627      </row>
1628
1629      <row>
1630       <entry>refclassid</entry>
1631       <entry><type>oid</type></entry>
1632       <entry>pg_class.oid</entry>
1633       <entry>The oid of the system catalog the referenced object is in</entry>
1634      </row>
1635
1636      <row>
1637       <entry>refobjid</entry>
1638       <entry><type>oid</type></entry>
1639       <entry>any oid attribute</entry>
1640       <entry>The oid of the specific referenced object</entry>
1641      </row>
1642
1643      <row>
1644       <entry>refobjsubid</entry>
1645       <entry><type>int4</type></entry>
1646       <entry></entry>
1647       <entry>For a table attribute, this is the attribute's
1648        column number (the refobjid and refclassid refer to the table itself).
1649        For all other object types, this field is presently zero.
1650       </entry>
1651      </row>
1652
1653      <row>
1654       <entry>deptype</entry>
1655       <entry><type>char</type></entry>
1656       <entry></entry>
1657       <entry>
1658        A code defining the specific semantics of this dependency relationship.
1659       </entry>
1660      </row>
1661
1662     </tbody>
1663    </tgroup>
1664   </table>
1665
1666   <para>
1667    In all cases, a <structname>pg_depend</structname> entry indicates that the
1668    referenced object may not be dropped without also dropping the dependent
1669    object.  However, there are several subflavors identified by
1670    <structfield>deptype</>:
1671
1672    <itemizedlist>
1673     <listitem>
1674      <para>
1675       DEPENDENCY_NORMAL ('n'): normal relationship between separately-created
1676       objects.  The dependent object may be dropped without affecting the
1677       referenced object.  The referenced object may only be dropped by
1678       specifying CASCADE, in which case the dependent object is dropped too.
1679       Example: a table column has a normal dependency on its datatype.
1680      </para>
1681     </listitem>
1682
1683     <listitem>
1684      <para>
1685       DEPENDENCY_AUTO ('a'): the dependent object can be dropped separately
1686       from the referenced object, and should be automatically dropped
1687       (regardless of RESTRICT or CASCADE mode) if the referenced object
1688       is dropped.
1689       Example: a named constraint on a table is made auto-dependent on
1690       the table, so that it will go away if the table is dropped.
1691      </para>
1692     </listitem>
1693
1694     <listitem>
1695      <para>
1696       DEPENDENCY_INTERNAL ('i'): the dependent object was created as part
1697       of creation of the referenced object, and is really just a part of
1698       its internal implementation.  A DROP of the dependent object will be
1699       disallowed outright (we'll tell the user to issue a DROP against the
1700       referenced object, instead).  A DROP of the referenced object will be
1701       propagated through to drop the dependent object whether CASCADE is
1702       specified or not.
1703       Example: a trigger that's created to enforce a foreign-key constraint
1704       is made internally dependent on the constraint's pg_constraint entry.
1705      </para>
1706     </listitem>
1707
1708     <listitem>
1709      <para>
1710       DEPENDENCY_PIN ('p'): there is no dependent object; this type of entry
1711       is a signal that the system itself depends on the referenced object,
1712       and so that object must never be deleted.  Entries of this type are
1713       created only during initdb.  The fields for the dependent object
1714       contain zeroes.
1715      </para>
1716     </listitem>
1717    </itemizedlist>
1718
1719    Other dependency flavors may be needed in future.
1720   </para>
1721
1722  </sect1>
1723
1724
1725  <sect1 id="catalog-pg-description">
1726   <title>pg_description</title>
1727
1728   <para>
1729    The pg_description table can store an optional description or
1730    comment for each database object.  Descriptions can be manipulated
1731    with the <command>COMMENT</command> command and viewed with
1732    <application>psql</application>'s <literal>\d</literal> commands.
1733    Descriptions of many built-in system objects are provided in the initial
1734    contents of pg_description.
1735   </para>
1736
1737   <table>
1738    <title>pg_description Columns</title>
1739
1740    <tgroup cols=4>
1741     <thead>
1742      <row>
1743       <entry>Name</entry>
1744       <entry>Type</entry>
1745       <entry>References</entry>
1746       <entry>Description</entry>
1747      </row>
1748     </thead>
1749
1750     <tbody>
1751      <row>
1752       <entry>objoid</entry>
1753       <entry><type>oid</type></entry>
1754       <entry>any oid attribute</entry>
1755       <entry>The oid of the object this description pertains to</entry>
1756      </row>
1757
1758      <row>
1759       <entry>classoid</entry>
1760       <entry><type>oid</type></entry>
1761       <entry>pg_class.oid</entry>
1762       <entry>The oid of the system catalog this object appears in</entry>
1763      </row>
1764
1765      <row>
1766       <entry>objsubid</entry>
1767       <entry><type>int4</type></entry>
1768       <entry></entry>
1769       <entry>For a comment on a table attribute, this is the attribute's
1770        column number (the objoid and classoid refer to the table itself).
1771        For all other object types, this field is presently zero.
1772       </entry>
1773      </row>
1774
1775      <row>
1776       <entry>description</entry>
1777       <entry><type>text</type></entry>
1778       <entry></entry>
1779       <entry>Arbitrary text that serves as the description of this object.</entry>
1780      </row>
1781     </tbody>
1782    </tgroup>
1783   </table>
1784
1785  </sect1>
1786
1787
1788  <sect1 id="catalog-pg-group">
1789   <title>pg_group</title>
1790
1791   <para>
1792    This catalog defines groups and stores what users belong to what
1793    groups.  Groups are created with the <command>CREATE
1794    GROUP</command> command.  Consult the <citetitle>Administrator's
1795    Guide</citetitle> for information about user permission management.
1796   </para>
1797
1798   <para>
1799    Because user and group identities are cluster-wide,
1800    <structname>pg_group</structname>
1801    is shared across all databases of a cluster: there is only one
1802    copy of <structname>pg_group</structname> per cluster, not
1803    one per database.
1804   </para>
1805
1806   <table>
1807    <title>pg_group Columns</title>
1808
1809    <tgroup cols=4>
1810     <thead>
1811      <row>
1812       <entry>Name</entry>
1813       <entry>Type</entry>
1814       <entry>References</entry>
1815       <entry>Description</entry>
1816      </row>
1817     </thead>
1818
1819     <tbody>
1820      <row>
1821       <entry>groname</entry>
1822       <entry><type>name</type></entry>
1823       <entry></entry>
1824       <entry>Name of the group</entry>
1825      </row>
1826
1827      <row>
1828       <entry>grosysid</entry>
1829       <entry><type>int4</type></entry>
1830       <entry></entry>
1831       <entry>An arbitrary number to identify this group</entry>
1832      </row>
1833
1834      <row>
1835       <entry>grolist</entry>
1836       <entry><type>int4[]</type></entry>
1837       <entry>pg_shadow.usesysid</entry>
1838       <entry>An array containing the ids of the users in this group</entry>
1839      </row>
1840     </tbody>
1841    </tgroup>
1842   </table>
1843
1844  </sect1>
1845
1846
1847  <sect1 id="catalog-pg-index">
1848   <title>pg_index</title>
1849
1850   <para>
1851    <structname>pg_index</structname> contains part of the information
1852    about indexes.  The rest is mostly in
1853    <structname>pg_class</structname>.
1854   </para>
1855
1856   <table>
1857    <title>pg_index Columns</title>
1858
1859    <tgroup cols=4>
1860     <thead>
1861      <row>
1862       <entry>Name</entry>
1863       <entry>Type</entry>
1864       <entry>References</entry>
1865       <entry>Description</entry>
1866      </row>
1867     </thead>
1868
1869     <tbody>
1870      <row>
1871       <entry>indexrelid</entry>
1872       <entry><type>oid</type></entry>
1873       <entry>pg_class.oid</entry>
1874       <entry>The OID of the pg_class entry for this index</entry>
1875      </row>
1876
1877      <row>
1878       <entry>indrelid</entry>
1879       <entry><type>oid</type></entry>
1880       <entry>pg_class.oid</entry>
1881       <entry>The OID of the pg_class entry for the table this index is for</entry>
1882      </row>
1883
1884      <row>
1885       <entry>indproc</entry>
1886       <entry><type>regproc</type></entry>
1887       <entry>pg_proc.oid</entry>
1888       <entry>The function's OID if this is a functional index,
1889       else zero</entry>
1890      </row>
1891
1892      <row>
1893       <entry>indkey</entry>
1894       <entry><type>int2vector</type></entry>
1895       <entry>pg_attribute.attnum</entry>
1896       <entry>
1897        This is a vector (array) of up to
1898        <symbol>INDEX_MAX_KEYS</symbol> values that indicate which
1899        table columns this index pertains to.  For example a value of
1900        <literal>1 3</literal> would mean that the first and the third
1901        column make up the index key.  For a functional index, these
1902        columns are the inputs to the function, and the function's return
1903        value is the index key.
1904       </entry>
1905      </row>
1906
1907      <row>
1908       <entry>indclass</entry>
1909       <entry><type>oidvector</type></entry>
1910       <entry>pg_opclass.oid</entry>
1911       <entry>
1912        For each column in the index key this contains a reference to
1913        the <quote>operator class</quote> to use.  See
1914        <structname>pg_opclass</structname> for details.
1915       </entry>
1916      </row>
1917
1918      <row>
1919       <entry>indisclustered</entry>
1920       <entry><type>bool</type></entry>
1921       <entry></entry>
1922       <entry>If true, the table was last clustered on this index.</entry>
1923      </row>
1924
1925      <row>
1926       <entry>indisunique</entry>
1927       <entry><type>bool</type></entry>
1928       <entry></entry>
1929       <entry>If true, this is a unique index.</entry>
1930      </row>
1931
1932      <row>
1933       <entry>indisprimary</entry>
1934       <entry><type>bool</type></entry>
1935       <entry></entry>
1936       <entry>If true, this index represents the primary key of the table.
1937       (indisunique should always be true when this is true.)</entry>
1938      </row>
1939
1940      <row>
1941       <entry>indreference</entry>
1942       <entry><type>oid</type></entry>
1943       <entry></entry>
1944       <entry>unused</entry>
1945      </row>
1946
1947      <row>
1948       <entry>indpred</entry>
1949       <entry><type>text</type></entry>
1950       <entry></entry>
1951       <entry>Expression tree (in the form of a nodeToString representation)
1952       for partial index predicate.  Empty string if not a partial
1953       index.</entry>
1954      </row>
1955     </tbody>
1956    </tgroup>
1957   </table>
1958
1959  </sect1>
1960
1961
1962  <sect1 id="catalog-pg-inherits">
1963   <title>pg_inherits</title>
1964
1965   <para>
1966    This catalog records information about table inheritance hierarchies.
1967   </para>
1968
1969   <table>
1970    <title>pg_inherits Columns</title>
1971
1972    <tgroup cols=4>
1973     <thead>
1974      <row>
1975       <entry>Name</entry>
1976       <entry>Type</entry>
1977       <entry>References</entry>
1978       <entry>Description</entry>
1979      </row>
1980     </thead>
1981
1982     <tbody>
1983      <row>
1984       <entry>inhrelid</entry>
1985       <entry><type>oid</type></entry>
1986       <entry>pg_class.oid</entry>
1987       <entry>
1988        The OID of the child table.
1989       </entry>
1990      </row>
1991
1992      <row>
1993       <entry>inhparent</entry>
1994       <entry><type>oid</type></entry>
1995       <entry>pg_class.oid</entry>
1996       <entry>
1997        The OID of the parent table.
1998       </entry>
1999      </row>
2000
2001      <row>
2002       <entry>inhseqno</entry>
2003       <entry><type>int4</type></entry>
2004       <entry></entry>
2005       <entry>
2006        If there is more than one parent for a child table (multiple
2007        inheritance), this number tells the order in which the
2008        inherited columns are to be arranged.  The count starts at 1.
2009       </entry>
2010      </row>
2011     </tbody>
2012    </tgroup>
2013   </table>
2014
2015  </sect1>
2016
2017
2018  <sect1 id="catalog-pg-language">
2019   <title>pg_language</title>
2020
2021   <para>
2022    <structname>pg_language</structname> registers call interfaces or
2023    languages in which you can write functions or stored procedures.
2024    See under <command>CREATE LANGUAGE</command> and in the
2025    <citetitle>Programmer's Guide</citetitle> for more information
2026    about language handlers.
2027   </para>
2028
2029   <table>
2030    <title>pg_language Columns</title>
2031
2032    <tgroup cols=4>
2033     <thead>
2034      <row>
2035       <entry>Name</entry>
2036       <entry>Type</entry>
2037       <entry>References</entry>
2038       <entry>Description</entry>
2039      </row>
2040     </thead>
2041
2042     <tbody>
2043      <row>
2044       <entry>lanname</entry>
2045       <entry><type>name</type></entry>
2046       <entry></entry>
2047       <entry>Name of the language (to be specified when creating a function)</entry>
2048      </row>
2049
2050      <row>
2051       <entry>lanispl</entry>
2052       <entry><type>bool</type></entry>
2053       <entry></entry>
2054       <entry>
2055        This is false for internal languages (such as
2056        <acronym>SQL</acronym>) and true for user-defined languages.
2057        Currently, <application>pg_dump</application> still uses this
2058        to determine which languages need to be dumped, but this may be
2059        replaced by a different mechanism sometime.
2060       </entry>
2061      </row>
2062
2063      <row>
2064       <entry>lanpltrusted</entry>
2065       <entry><type>bool</type></entry>
2066       <entry></entry>
2067       <entry>
2068        This is a trusted language.  See under <command>CREATE
2069        LANGUAGE</command> what this means.  If this is an internal
2070        language (<structfield>lanispl</structfield> is false) then
2071        this field is meaningless.
2072       </entry>
2073      </row>
2074
2075      <row>
2076       <entry>lanplcallfoid</entry>
2077       <entry><type>oid</type></entry>
2078       <entry>pg_proc.oid</entry>
2079       <entry>
2080        For non-internal languages this references the language
2081        handler, which is a special function that is responsible for
2082        executing all functions that are written in the particular
2083        language.
2084       </entry>
2085      </row>
2086
2087      <row>
2088       <entry>lanvalidator</entry>
2089       <entry><type>oid</type></entry>
2090       <entry>pg_proc.oid</entry>
2091       <entry>
2092        This references a language validator function that is responsible
2093        for checking the syntax and validity of new functions when they
2094        are created. See under <command>CREATE LANGUAGE</command> for
2095        further information about validators.
2096       </entry>
2097      </row>
2098
2099      <row>
2100       <entry>lanacl</entry>
2101       <entry><type>aclitem[]</type></entry>
2102       <entry></entry>
2103       <entry>Access permissions</entry>
2104      </row>
2105     </tbody>
2106    </tgroup>
2107   </table>
2108
2109  </sect1>
2110
2111
2112  <sect1 id="catalog-pg-largeobject">
2113   <title>pg_largeobject</title>
2114
2115   <para>
2116    <structname>pg_largeobject</structname> holds the data making up
2117    <quote>large objects</quote>.  A large object is identified by an
2118    OID assigned when it is created.  Each large object is broken into
2119    segments or <quote>pages</> small enough to be conveniently stored as rows
2120    in <structname>pg_largeobject</structname>.
2121    The amount of data per page is defined to be LOBLKSIZE (which is currently
2122    BLCKSZ/4, or typically 2Kbytes).
2123   </para>
2124
2125   <table>
2126    <title>pg_largeobject Columns</title>
2127
2128    <tgroup cols=4>
2129     <thead>
2130      <row>
2131       <entry>Name</entry>
2132       <entry>Type</entry>
2133       <entry>References</entry>
2134       <entry>Description</entry>
2135      </row>
2136     </thead>
2137
2138     <tbody>
2139      <row>
2140       <entry>loid</entry>
2141       <entry><type>oid</type></entry>
2142       <entry></entry>
2143       <entry>Identifier of the large object that includes this page</entry>
2144      </row>
2145
2146      <row>
2147       <entry>pageno</entry>
2148       <entry><type>int4</type></entry>
2149       <entry></entry>
2150       <entry>Page number of this page within its large object
2151       (counting from zero)</entry>
2152      </row>
2153
2154      <row>
2155       <entry>data</entry>
2156       <entry><type>bytea</type></entry>
2157       <entry></entry>
2158       <entry>
2159        Actual data stored in the large object.
2160        This will never be more than LOBLKSIZE bytes, and may be less.
2161       </entry>
2162      </row>
2163     </tbody>
2164    </tgroup>
2165   </table>
2166
2167   <para>
2168    Each row of <structname>pg_largeobject</structname> holds data
2169    for one page of a large object, beginning at
2170    byte offset (pageno * LOBLKSIZE) within the object.  The implementation
2171    allows sparse storage: pages may be missing, and may be shorter than
2172    LOBLKSIZE bytes even if they are not the last page of the object.
2173    Missing regions within a large object read as zeroes.
2174   </para>
2175
2176  </sect1>
2177
2178
2179  <sect1 id="catalog-pg-listener">
2180   <title>pg_listener</title>
2181
2182   <para>
2183    <structname>pg_listener</structname> supports the <command>LISTEN</>
2184    and <command>NOTIFY</> commands.  A listener creates an entry in
2185    <structname>pg_listener</structname> for each notification name
2186    it is listening for.  A notifier scans <structname>pg_listener</structname>
2187    and updates each matching entry to show that a notification has occurred.
2188    The notifier also sends a signal (using the PID recorded in the table)
2189    to awaken the listener from sleep.
2190   </para>
2191
2192   <table>
2193    <title>pg_listener Columns</title>
2194
2195    <tgroup cols=4>
2196     <thead>
2197      <row>
2198       <entry>Name</entry>
2199       <entry>Type</entry>
2200       <entry>References</entry>
2201       <entry>Description</entry>
2202      </row>
2203     </thead>
2204
2205     <tbody>
2206      <row>
2207       <entry>relname</entry>
2208       <entry><type>name</type></entry>
2209       <entry></entry>
2210       <entry>Notify condition name.  (The name need not match any actual
2211       relation in the database; the term <quote>relname</> is historical.)
2212       </entry>
2213      </row>
2214
2215      <row>
2216       <entry>listenerpid</entry>
2217       <entry><type>int4</type></entry>
2218       <entry></entry>
2219       <entry>PID of the backend process that created this entry.</entry>
2220      </row>
2221
2222      <row>
2223       <entry>notification</entry>
2224       <entry><type>int4</type></entry>
2225       <entry></entry>
2226       <entry>
2227        Zero if no event is pending for this listener.  If an event is
2228        pending, the PID of the backend that sent the notification.
2229       </entry>
2230      </row>
2231     </tbody>
2232    </tgroup>
2233   </table>
2234
2235  </sect1>
2236
2237
2238  <sect1 id="catalog-pg-namespace">
2239   <title>pg_namespace</title>
2240
2241   <para>
2242    A namespace is the structure underlying SQL92 schemas: each namespace
2243    can have a separate collection of relations, types, etc without name
2244    conflicts.
2245   </para>
2246
2247   <table>
2248    <title>pg_namespace Columns</title>
2249
2250    <tgroup cols=4>
2251     <thead>
2252      <row>
2253       <entry>Name</entry>
2254       <entry>Type</entry>
2255       <entry>References</entry>
2256       <entry>Description</entry>
2257      </row>
2258     </thead>
2259
2260     <tbody>
2261      <row>
2262       <entry>nspname</entry>
2263       <entry><type>name</type></entry>
2264       <entry></entry>
2265       <entry>Name of the namespace</entry>
2266      </row>
2267
2268      <row>
2269       <entry>nspowner</entry>
2270       <entry><type>int4</type></entry>
2271       <entry>pg_shadow.usesysid</entry>
2272       <entry>Owner (creator) of the namespace</entry>
2273      </row>
2274
2275      <row>
2276       <entry>nspacl</entry>
2277       <entry><type>aclitem[]</type></entry>
2278       <entry></entry>
2279       <entry>Access permissions</entry>
2280      </row>
2281     </tbody>
2282    </tgroup>
2283   </table>
2284
2285  </sect1>
2286
2287
2288  <sect1 id="catalog-pg-opclass">
2289   <title>pg_opclass</title>
2290
2291   <para>
2292    <structname>pg_opclass</structname> defines
2293    index access method operator classes.  Each operator class defines
2294    semantics for index columns of a particular datatype and a particular
2295    index access method.  Note that there can be multiple operator classes
2296    for a given datatype/access method combination, thus supporting multiple
2297    behaviors.
2298   </para>
2299
2300   <para>
2301    Operator classes are described at length in the
2302    <citetitle>Programmer's Guide</citetitle>.
2303   </para>
2304
2305   <table>
2306    <title>pg_opclass Columns</title>
2307
2308    <tgroup cols=4>
2309     <thead>
2310      <row>
2311       <entry>Name</entry>
2312       <entry>Type</entry>
2313       <entry>References</entry>
2314       <entry>Description</entry>
2315      </row>
2316     </thead>
2317     <tbody>
2318
2319      <row>
2320       <entry>opcamid</entry>
2321       <entry><type>oid</type></entry>
2322       <entry>pg_am.oid</entry>
2323       <entry>index access method opclass is for</entry>
2324      </row>
2325
2326      <row>
2327       <entry>opcname</entry>
2328       <entry><type>name</type></entry>
2329       <entry></entry>
2330       <entry>name of this opclass</entry>
2331      </row>
2332
2333      <row>
2334       <entry>opcnamespace</entry>
2335       <entry><type>oid</type></entry>
2336       <entry>pg_namespace.oid</entry>
2337       <entry>namespace of this opclass</entry>
2338      </row>
2339
2340      <row>
2341       <entry>opcowner</entry>
2342       <entry><type>int4</type></entry>
2343       <entry>pg_shadow.usesysid</entry>
2344       <entry>opclass owner</entry>
2345      </row>
2346
2347      <row>
2348       <entry>opcintype</entry>
2349       <entry><type>oid</type></entry>
2350       <entry>pg_type.oid</entry>
2351       <entry>type of input data for opclass</entry>
2352      </row>
2353
2354      <row>
2355       <entry>opcdefault</entry>
2356       <entry><type>bool</type></entry>
2357       <entry></entry>
2358       <entry>true if opclass is default for opcintype</entry>
2359      </row>
2360
2361      <row>
2362       <entry>opckeytype</entry>
2363       <entry><type>oid</type></entry>
2364       <entry>pg_type.oid</entry>
2365       <entry>type of index data, or zero if same as opcintype</entry>
2366      </row>
2367
2368     </tbody>
2369    </tgroup>
2370   </table>
2371
2372   <para>
2373    The majority of the information defining an operator class is actually
2374    not in its <structname>pg_opclass</structname> row, but in the associated
2375    rows in <structname>pg_amop</structname> and
2376    <structname>pg_amproc</structname>.  Those rows are considered to be
2377    part of the operator class definition --- this is not unlike the way
2378    that a relation is defined by a single <structname>pg_class</structname>
2379    row, plus associated rows in <structname>pg_attribute</structname> and
2380    other tables.
2381   </para>
2382
2383  </sect1>
2384
2385
2386  <sect1 id="catalog-pg-operator">
2387   <title>pg_operator</title>
2388
2389   <para>
2390    See <command>CREATE OPERATOR</command> and the
2391    <citetitle>Programmer's Guide</citetitle> for details on these
2392    operator parameters.
2393   </para>
2394
2395   <table>
2396    <title>pg_operator Columns</title>
2397
2398    <tgroup cols=4>
2399     <thead>
2400      <row>
2401       <entry>Name</entry>
2402       <entry>Type</entry>
2403       <entry>References</entry>
2404       <entry>Description</entry>
2405      </row>
2406     </thead>
2407
2408     <tbody>
2409      <row>
2410       <entry>oprname</entry>
2411       <entry><type>name</type></entry>
2412       <entry></entry>
2413       <entry>Name of the operator</entry>
2414      </row>
2415
2416      <row>
2417       <entry>oprnamespace</entry>
2418       <entry><type>oid</type></entry>
2419       <entry>pg_namespace.oid</entry>
2420       <entry>
2421        The OID of the namespace that contains this operator
2422       </entry>
2423      </row>
2424
2425      <row>
2426       <entry>oprowner</entry>
2427       <entry><type>int4</type></entry>
2428       <entry>pg_shadow.usesysid</entry>
2429       <entry>Owner (creator) of the operator</entry>
2430      </row>
2431
2432      <row>
2433       <entry>oprkind</entry>
2434       <entry><type>char</type></entry>
2435       <entry></entry>
2436       <entry>
2437        'b' = infix (<quote>both</quote>), 'l' = prefix
2438        (<quote>left</quote>), 'r' = postfix (<quote>right</quote>)
2439       </entry>
2440      </row>
2441
2442      <row>
2443       <entry>oprcanhash</entry>
2444       <entry><type>bool</type></entry>
2445       <entry></entry>
2446       <entry>This operator supports hash joins.</entry>
2447      </row>
2448
2449      <row>
2450       <entry>oprleft</entry>
2451       <entry><type>oid</type></entry>
2452       <entry>pg_type.oid</entry>
2453       <entry>Type of the left operand</entry>
2454      </row>
2455
2456      <row>
2457       <entry>oprright</entry>
2458       <entry><type>oid</type></entry>
2459       <entry>pg_type.oid</entry>
2460       <entry>Type of the right operand</entry>
2461      </row>
2462
2463      <row>
2464       <entry>oprresult</entry>
2465       <entry><type>oid</type></entry>
2466       <entry>pg_type.oid</entry>
2467       <entry>Type of the result</entry>
2468      </row>
2469
2470      <row>
2471       <entry>oprcom</entry>
2472       <entry><type>oid</type></entry>
2473       <entry>pg_operator.oid</entry>
2474       <entry>Commutator of this operator, if any</entry>
2475      </row>
2476
2477      <row>
2478       <entry>oprnegate</entry>
2479       <entry><type>oid</type></entry>
2480       <entry>pg_operator.oid</entry>
2481       <entry>Negator of this operator, if any</entry>
2482      </row>
2483
2484      <row>
2485       <entry>oprlsortop</entry>
2486       <entry><type>oid</type></entry>
2487       <entry>pg_operator.oid</entry>
2488       <entry>
2489        If this operator supports merge joins, the operator that sorts
2490        the type of the left-hand operand (<literal>L&lt;L</>)
2491       </entry>
2492      </row>
2493
2494      <row>
2495       <entry>oprrsortop</entry>
2496       <entry><type>oid</type></entry>
2497       <entry>pg_operator.oid</entry>
2498       <entry>
2499        If this operator supports merge joins, the operator that sorts
2500        the type of the right-hand operand (<literal>R&lt;R</>)
2501       </entry>
2502      </row>
2503
2504      <row>
2505       <entry>oprltcmpop</entry>
2506       <entry><type>oid</type></entry>
2507       <entry>pg_operator.oid</entry>
2508       <entry>
2509        If this operator supports merge joins, the less-than operator that
2510        compares the left and right operand types (<literal>L&lt;R</>)
2511       </entry>
2512      </row>
2513
2514      <row>
2515       <entry>oprgtcmpop</entry>
2516       <entry><type>oid</type></entry>
2517       <entry>pg_operator.oid</entry>
2518       <entry>
2519        If this operator supports merge joins, the greater-than operator that
2520        compares the left and right operand types (<literal>L&gt;R</>)
2521       </entry>
2522      </row>
2523
2524      <row>
2525       <entry>oprcode</entry>
2526       <entry><type>regproc</type></entry>
2527       <entry>pg_proc.oid</entry>
2528       <entry>Function that implements this operator</entry>
2529      </row>
2530
2531      <row>
2532       <entry>oprrest</entry>
2533       <entry><type>regproc</type></entry>
2534       <entry>pg_proc.oid</entry>
2535       <entry>Restriction selectivity estimation function for this operator</entry>
2536      </row>
2537
2538      <row>
2539       <entry>oprjoin</entry>
2540       <entry><type>regproc</type></entry>
2541       <entry>pg_proc.oid</entry>
2542       <entry>Join selectivity estimation function for this operator</entry>
2543      </row>
2544     </tbody>
2545    </tgroup>
2546   </table>
2547
2548   <para>
2549    Unused fields contain zeroes, for example oprleft is zero for a
2550    prefix operator.
2551   </para>
2552
2553  </sect1>
2554
2555
2556  <sect1 id="catalog-pg-proc">
2557   <title>pg_proc</title>
2558
2559   <para>
2560    This catalog stores information about functions (or procedures).
2561    The description of <command>CREATE FUNCTION</command> and the
2562    <citetitle>Programmer's Guide</citetitle> contain more information
2563    about the meaning of some fields.
2564   </para>
2565
2566   <para>
2567    The table contains data for aggregate functions as well as plain functions.
2568    If <structfield>proisagg</structfield> is true, there should be a matching
2569    row in <structname>pg_aggregate</structname>.
2570   </para>
2571
2572   <table>
2573    <title>pg_proc Columns</title>
2574
2575    <tgroup cols=4>
2576     <thead>
2577      <row>
2578       <entry>Name</entry>
2579       <entry>Type</entry>
2580       <entry>References</entry>
2581       <entry>Description</entry>
2582      </row>
2583     </thead>
2584
2585     <tbody>
2586      <row>
2587       <entry>proname</entry>
2588       <entry><type>name</type></entry>
2589       <entry></entry>
2590       <entry>Name of the function</entry>
2591      </row>
2592
2593      <row>
2594       <entry>pronamespace</entry>
2595       <entry><type>oid</type></entry>
2596       <entry>pg_namespace.oid</entry>
2597       <entry>
2598        The OID of the namespace that contains this function
2599       </entry>
2600      </row>
2601
2602      <row>
2603       <entry>proowner</entry>
2604       <entry><type>int4</type></entry>
2605       <entry>pg_shadow.usesysid</entry>
2606       <entry>Owner (creator) of the function</entry>
2607      </row>
2608
2609      <row>
2610       <entry>prolang</entry>
2611       <entry><type>oid</type></entry>
2612       <entry>pg_language.oid</entry>
2613       <entry>Implementation language or call interface of this function</entry>
2614      </row>
2615
2616      <row>
2617       <entry>proisagg</entry>
2618       <entry><type>bool</type></entry>
2619       <entry></entry>
2620       <entry>Function is an aggregate function</entry>
2621      </row>
2622
2623      <row>
2624       <entry>prosecdef</entry>
2625       <entry><type>bool</type></entry>
2626       <entry></entry>
2627       <entry>Function is a security definer (i.e., a <quote>setuid</>
2628       function)</entry>
2629      </row>
2630
2631      <row>
2632       <entry>proisstrict</entry>
2633       <entry><type>bool</type></entry>
2634       <entry></entry>
2635       <entry>
2636        Function returns null if any call argument is null.  In that
2637        case the function won't actually be called at all.  Functions
2638        that are not <quote>strict</quote> must be prepared to handle
2639        null inputs.
2640       </entry>
2641      </row>
2642
2643      <row>
2644       <entry>proretset</entry>
2645       <entry><type>bool</type></entry>
2646       <entry></entry>
2647       <entry>Function returns a set (ie, multiple values of the specified
2648       data type)</entry>
2649      </row>
2650
2651      <row>
2652       <entry>provolatile</entry>
2653       <entry><type>char</type></entry>
2654       <entry></entry>
2655       <entry>
2656        <structfield>provolatile</structfield> tells whether the function's
2657        result depends only on its input arguments, or is affected by outside
2658        factors.
2659        It is <literal>i</literal> for <quote>immutable</> functions,
2660        which always deliver the same result for the same inputs.
2661        It is <literal>s</literal> for <quote>stable</> functions,
2662        whose results (for fixed inputs) do not change within a scan.
2663        It is <literal>v</literal> for <quote>volatile</> functions,
2664        whose results may change at any time.  (Use <literal>v</literal> also
2665        for functions with side-effects, so that calls to them cannot get
2666        optimized away.)
2667       </entry>
2668      </row>
2669
2670      <row>
2671       <entry>pronargs</entry>
2672       <entry><type>int2</type></entry>
2673       <entry></entry>
2674       <entry>Number of arguments</entry>
2675      </row>
2676
2677      <row>
2678       <entry>prorettype</entry>
2679       <entry><type>oid</type></entry>
2680       <entry>pg_type.oid</entry>
2681       <entry>Data type of the return value</entry>
2682      </row>
2683
2684      <row>
2685       <entry>proargtypes</entry>
2686       <entry><type>oidvector</type></entry>
2687       <entry>pg_type.oid</entry>
2688       <entry>A vector with the data types of the function arguments</entry>
2689      </row>
2690
2691      <row>
2692       <entry>prosrc</entry>
2693       <entry><type>text</type></entry>
2694       <entry></entry>
2695       <entry>
2696        This tells the function handler how to invoke the function.  It
2697        might be the actual source code of the function for interpreted
2698        languages, a link symbol, a file name, or just about anything
2699        else, depending on the implementation language/call convention.
2700       </entry>
2701      </row>
2702
2703      <row>
2704       <entry>probin</entry>
2705       <entry><type>bytea</type></entry>
2706       <entry></entry>
2707       <entry>Additional information about how to invoke the function.
2708       Again, the interpretation is language-specific.
2709       </entry>
2710      </row>
2711
2712      <row>
2713       <entry>proacl</entry>
2714       <entry><type>aclitem[]</type></entry>
2715       <entry></entry>
2716       <entry>Access permissions</entry>
2717      </row>
2718     </tbody>
2719    </tgroup>
2720   </table>
2721
2722   <para>
2723   Currently, prosrc contains the function's C-language name (link symbol)
2724   for compiled functions, both built-in and dynamically loaded.  For all
2725   other language types, prosrc contains the function's source text.
2726   </para>
2727
2728   <para>
2729   Currently, probin is unused except for dynamically-loaded C functions,
2730   for which it gives the name of the shared library file containing the
2731   function.
2732   </para>
2733
2734  </sect1>
2735
2736  <sect1 id="catalog-pg-rewrite">
2737   <title>pg_rewrite</title>
2738
2739   <para>
2740    This system catalog stores rewrite rules for tables and views.
2741   </para>
2742
2743   <table>
2744    <title>pg_rewrite Columns</title>
2745
2746    <tgroup cols=4>
2747     <thead>
2748      <row>
2749       <entry>Name</entry>
2750       <entry>Type</entry>
2751       <entry>References</entry>
2752       <entry>Description</entry>
2753      </row>
2754     </thead>
2755
2756     <tbody>
2757      <row>
2758       <entry>rulename</entry>
2759       <entry><type>name</type></entry>
2760       <entry></entry>
2761       <entry>Rule name</entry>
2762      </row>
2763
2764      <row>
2765       <entry>ev_class</entry>
2766       <entry><type>oid</type></entry>
2767       <entry>pg_class.oid</entry>
2768       <entry>The table this rule is for</entry>
2769      </row>
2770
2771      <row>
2772       <entry>ev_attr</entry>
2773       <entry><type>int2</type></entry>
2774       <entry></entry>
2775       <entry>The column this rule is for (currently, always zero to
2776       indicate the whole table)</entry>
2777      </row>
2778
2779      <row>
2780       <entry>ev_type</entry>
2781       <entry><type>char</type></entry>
2782       <entry></entry>
2783       <entry>Event type that the rule is for: '1' = SELECT,
2784       '2' = UPDATE, '3' = INSERT, '4' = DELETE</entry>
2785      </row>
2786
2787      <row>
2788       <entry>is_instead</entry>
2789       <entry><type>bool</type></entry>
2790       <entry></entry>
2791       <entry>True if the rule is an INSTEAD rule</entry>
2792      </row>
2793
2794      <row>
2795       <entry>ev_qual</entry>
2796       <entry><type>text</type></entry>
2797       <entry></entry>
2798       <entry>Expression tree (in the form of a nodeToString representation)
2799       for the rule's qualifying condition</entry>
2800      </row>
2801
2802      <row>
2803       <entry>ev_action</entry>
2804       <entry><type>text</type></entry>
2805       <entry></entry>
2806       <entry>Query tree (in the form of a nodeToString representation)
2807       for the rule's action</entry>
2808      </row>
2809     </tbody>
2810    </tgroup>
2811   </table>
2812
2813   <note>
2814    <para>
2815     <structname>pg_class</structname>.<structfield>relhasrules</structfield>
2816     must be true if a table has any rules in this catalog.
2817    </para>
2818   </note>
2819
2820  </sect1>
2821
2822
2823  <sect1 id="catalog-pg-shadow">
2824   <title>pg_shadow</title>
2825
2826   <para>
2827    <structname>pg_shadow</structname> contains information about
2828    database users.  The name stems from the fact that this table
2829    should not be readable by the public since it contains passwords.
2830    <structname>pg_user</structname> is a publicly readable view on
2831    <structname>pg_shadow</structname> that blanks out the password field.
2832   </para>
2833
2834   <para>
2835    The <citetitle>Administrator's Guide</citetitle> contains detailed
2836    information about user and permission management.
2837   </para>
2838
2839   <para>
2840    Because user identities are cluster-wide,
2841    <structname>pg_shadow</structname>
2842    is shared across all databases of a cluster: there is only one
2843    copy of <structname>pg_shadow</structname> per cluster, not
2844    one per database.
2845   </para>
2846
2847   <table>
2848    <title>pg_shadow Columns</title>
2849
2850    <tgroup cols=4>
2851     <thead>
2852      <row>
2853       <entry>Name</entry>
2854       <entry>Type</entry>
2855       <entry>References</entry>
2856       <entry>Description</entry>
2857      </row>
2858     </thead>
2859
2860     <tbody>
2861      <row>
2862       <entry>usename</entry>
2863       <entry><type>name</type></entry>
2864       <entry></entry>
2865       <entry>User name</entry>
2866      </row>
2867
2868      <row>
2869       <entry>usesysid</entry>
2870       <entry><type>int4</type></entry>
2871       <entry></entry>
2872       <entry>User id (arbitrary number used to reference this user)</entry>
2873      </row>
2874
2875      <row>
2876       <entry>usecreatedb</entry>
2877       <entry><type>bool</type></entry>
2878       <entry></entry>
2879       <entry>User may create databases</entry>
2880      </row>
2881
2882      <row>
2883       <entry>usesuper</entry>
2884       <entry><type>bool</type></entry>
2885       <entry></entry>
2886       <entry>User is a superuser</entry>
2887      </row>
2888
2889      <row>
2890       <entry>usecatupd</entry>
2891       <entry><type>bool</type></entry>
2892       <entry></entry>
2893       <entry>
2894        User may update system catalogs.  (Even a superuser may not do
2895        this unless this attribute is true.)
2896       </entry>
2897      </row>
2898
2899      <row>
2900       <entry>passwd</entry>
2901       <entry><type>text</type></entry>
2902       <entry></entry>
2903       <entry>Password</entry>
2904      </row>
2905
2906      <row>
2907       <entry>valuntil</entry>
2908       <entry><type>abstime</type></entry>
2909       <entry></entry>
2910       <entry>Account expiry time (only used for password authentication)</entry>
2911      </row>
2912
2913      <row>
2914       <entry>useconfig</entry>
2915       <entry><type>text[]</type></entry>
2916       <entry></entry>
2917       <entry>Session defaults for run-time configuration variables</entry>
2918      </row>
2919     </tbody>
2920    </tgroup>
2921   </table>
2922
2923  </sect1>
2924
2925
2926  <sect1 id="catalog-pg-statistic">
2927   <title>pg_statistic</title>
2928
2929   <para>
2930    <structname>pg_statistic</structname> stores statistical data about
2931    the contents of the database.  Entries are created by
2932    <command>ANALYZE</command> and subsequently used by the query planner.
2933    There is one entry for each table column that has been analyzed.
2934    Note that all the statistical data is inherently approximate,
2935    even assuming that it is up-to-date.
2936   </para>
2937
2938   <para>
2939    Since different kinds of statistics may be appropriate for different
2940    kinds of data, <structname>pg_statistic</structname> is designed not
2941    to assume very much about what sort of statistics it stores.  Only
2942    extremely general statistics (such as NULL-ness) are given dedicated
2943    columns in <structname>pg_statistic</structname>.  Everything else
2944    is stored in <quote>slots</quote>, which are groups of associated columns whose
2945    content is identified by a code number in one of the slot's columns.
2946    For more information see
2947    <filename>src/include/catalog/pg_statistic.h</filename>.
2948   </para>
2949
2950   <para>
2951    <structname>pg_statistic</structname> should not be readable by the
2952    public, since even statistical information about a table's contents
2953    may be considered sensitive.  (Example: minimum and maximum values
2954    of a salary column might be quite interesting.)
2955    <structname>pg_stats</structname> is a publicly readable view on
2956    <structname>pg_statistic</structname> that only exposes information
2957    about those tables that are readable by the current user.
2958    <structname>pg_stats</structname> is also designed to present the
2959    information in a more readable format than the underlying
2960    <structname>pg_statistic</structname> table --- at the cost that
2961    its schema must be extended whenever new slot types are added.
2962   </para>
2963
2964   <table>
2965    <title>pg_statistic Columns</title>
2966
2967    <tgroup cols=4>
2968     <thead>
2969      <row>
2970       <entry>Name</entry>
2971       <entry>Type</entry>
2972       <entry>References</entry>
2973       <entry>Description</entry>
2974      </row>
2975     </thead>
2976
2977     <tbody>
2978      <row>
2979       <entry>starelid</entry>
2980       <entry><type>oid</type></entry>
2981       <entry>pg_class.oid</entry>
2982       <entry>The table that the described column belongs to</entry>
2983      </row>
2984
2985      <row>
2986       <entry>staattnum</entry>
2987       <entry><type>int2</type></entry>
2988       <entry>pg_attribute.attnum</entry>
2989       <entry>The number of the described column</entry>
2990      </row>
2991
2992      <row>
2993       <entry>stanullfrac</entry>
2994       <entry><type>float4</type></entry>
2995       <entry></entry>
2996       <entry>The fraction of the column's entries that are NULL</entry>
2997      </row>
2998
2999      <row>
3000       <entry>stawidth</entry>
3001       <entry><type>int4</type></entry>
3002       <entry></entry>
3003       <entry>The average stored width, in bytes, of non-NULL entries</entry>
3004      </row>
3005
3006      <row>
3007       <entry>stadistinct</entry>
3008       <entry><type>float4</type></entry>
3009       <entry></entry>
3010       <entry>The number of distinct non-NULL data values in the column.
3011       A value greater than zero is the actual number of distinct values.
3012       A value less than zero is the negative of a fraction of the number
3013       of rows in the table (for example, a column in which values appear about
3014       twice on the average could be represented by stadistinct = -0.5).
3015       A zero value means the number of distinct values is unknown.
3016       </entry>
3017      </row>
3018
3019      <row>
3020       <entry>stakindN</entry>
3021       <entry><type>int2</type></entry>
3022       <entry></entry>
3023       <entry>A code number indicating the kind of statistics stored in the Nth
3024       <quote>slot</quote> of the <structname>pg_statistic</structname> row.
3025       </entry>
3026      </row>
3027
3028      <row>
3029       <entry>staopN</entry>
3030       <entry><type>oid</type></entry>
3031       <entry>pg_operator.oid</entry>
3032       <entry>An operator used to derive the statistics stored in the
3033       Nth <quote>slot</quote>.  For example, a histogram slot would show the <literal>&lt;</literal>
3034       operator that defines the sort order of the data.
3035       </entry>
3036      </row>
3037
3038      <row>
3039       <entry>stanumbersN</entry>
3040       <entry><type>float4[]</type></entry>
3041       <entry></entry>
3042       <entry>Numerical statistics of the appropriate kind for the Nth
3043       <quote>slot</quote>, or NULL if the slot kind does not involve numerical values.
3044       </entry>
3045      </row>
3046
3047      <row>
3048       <entry>stavaluesN</entry>
3049       <entry><type>text[]</type></entry>
3050       <entry></entry>
3051       <entry>Column data values of the appropriate kind for the Nth
3052       <quote>slot</quote>, or NULL if the slot kind does not store any data values.
3053       For data-type independence, all column data values are converted
3054       to external textual form and stored as TEXT datums.
3055       </entry>
3056      </row>
3057     </tbody>
3058    </tgroup>
3059   </table>
3060
3061  </sect1>
3062
3063
3064  <sect1 id="catalog-pg-trigger">
3065   <title>pg_trigger</title>
3066
3067   <para>
3068    This system catalog stores triggers on tables.  See under
3069    <command>CREATE TRIGGER</command> for more information.
3070   </para>
3071
3072   <table>
3073    <title>pg_trigger Columns</title>
3074
3075    <tgroup cols=4>
3076     <thead>
3077      <row>
3078       <entry>Name</entry>
3079       <entry>Type</entry>
3080       <entry>References</entry>
3081       <entry>Description</entry>
3082      </row>
3083     </thead>
3084
3085     <tbody>
3086      <row>
3087       <entry>tgrelid</entry>
3088       <entry><type>oid</type></entry>
3089       <entry>pg_class.oid</entry>
3090       <entry>The table this trigger is on</entry>
3091      </row>
3092
3093      <row>
3094       <entry>tgname</entry>
3095       <entry><type>name</type></entry>
3096       <entry></entry>
3097       <entry>Trigger name (must be unique among triggers of same table)</entry>
3098      </row>
3099
3100      <row>
3101       <entry>tgfoid</entry>
3102       <entry><type>oid</type></entry>
3103       <entry>pg_proc.oid</entry>
3104       <entry>The function to be called</entry>
3105      </row>
3106
3107      <row>
3108       <entry>tgtype</entry>
3109       <entry><type>int2</type></entry>
3110       <entry></entry>
3111       <entry>Bitmask identifying trigger conditions</entry>
3112      </row>
3113
3114      <row>
3115       <entry>tgenabled</entry>
3116       <entry><type>bool</type></entry>
3117       <entry></entry>
3118       <entry>True if trigger is enabled (not presently checked everywhere
3119       it should be, so disabling a trigger by setting this false does not
3120       work reliably)</entry>
3121      </row>
3122
3123      <row>
3124       <entry>tgisconstraint</entry>
3125       <entry><type>bool</type></entry>
3126       <entry></entry>
3127       <entry>True if trigger implements an RI constraint</entry>
3128      </row>
3129
3130      <row>
3131       <entry>tgconstrname</entry>
3132       <entry><type>name</type></entry>
3133       <entry></entry>
3134       <entry>RI constraint name</entry>
3135      </row>
3136
3137      <row>
3138       <entry>tgconstrrelid</entry>
3139       <entry><type>oid</type></entry>
3140       <entry>pg_class.oid</entry>
3141       <entry>The table referenced by an RI constraint</entry>
3142      </row>
3143
3144      <row>
3145       <entry>tgdeferrable</entry>
3146       <entry><type>bool</type></entry>
3147       <entry></entry>
3148       <entry>True if deferrable</entry>
3149      </row>
3150
3151      <row>
3152       <entry>tginitdeferred</entry>
3153       <entry><type>bool</type></entry>
3154       <entry></entry>
3155       <entry>True if initially deferred</entry>
3156      </row>
3157
3158      <row>
3159       <entry>tgnargs</entry>
3160       <entry><type>int2</type></entry>
3161       <entry></entry>
3162       <entry>Number of argument strings passed to trigger function</entry>
3163      </row>
3164
3165      <row>
3166       <entry>tgattr</entry>
3167       <entry><type>int2vector</type></entry>
3168       <entry></entry>
3169       <entry>Currently unused</entry>
3170      </row>
3171
3172      <row>
3173       <entry>tgargs</entry>
3174       <entry><type>bytea</type></entry>
3175       <entry></entry>
3176       <entry>Argument strings to pass to trigger, each null-terminated</entry>
3177      </row>
3178     </tbody>
3179    </tgroup>
3180   </table>
3181
3182   <note>
3183    <para>
3184     <structname>pg_class</structname>.<structfield>reltriggers</structfield>
3185     needs to match up with the entries in this table.
3186    </para>
3187   </note>
3188
3189  </sect1>
3190
3191
3192  <sect1 id="catalog-pg-type">
3193   <title>pg_type</title>
3194
3195   <para>
3196    This catalog stores information about data types.  Scalar types
3197    (<quote>base types</>) are created with <command>CREATE TYPE</command>.
3198    A complex type is automatically created for each table in the database, to
3199    represent the row structure of the table.  It is also possible to create
3200    complex types with <command>CREATE TYPE AS</command>, and
3201    derived types with <command>CREATE DOMAIN</command>.
3202   </para>
3203
3204   <table>
3205    <title>pg_type Columns</title>
3206
3207    <tgroup cols=4>
3208     <thead>
3209      <row>
3210       <entry>Name</entry>
3211       <entry>Type</entry>
3212       <entry>References</entry>
3213       <entry>Description</entry>
3214      </row>
3215     </thead>
3216
3217     <tbody>
3218      <row>
3219       <entry>typname</entry>
3220       <entry><type>name</type></entry>
3221       <entry></entry>
3222       <entry>Data type name</entry>
3223      </row>
3224
3225      <row>
3226       <entry>typnamespace</entry>
3227       <entry><type>oid</type></entry>
3228       <entry>pg_namespace.oid</entry>
3229       <entry>
3230        The OID of the namespace that contains this type
3231       </entry>
3232      </row>
3233
3234      <row>
3235       <entry>typowner</entry>
3236       <entry><type>int4</type></entry>
3237       <entry>pg_shadow.usesysid</entry>
3238       <entry>Owner (creator) of the type</entry>
3239      </row>
3240
3241      <row>
3242       <entry>typlen</entry>
3243       <entry><type>int2</type></entry>
3244       <entry></entry>
3245       <entry>
3246        For a fixed-size type, <structfield>typlen</structfield> is the number
3247        of bytes in the internal representation of the type.  But for a
3248        variable-length type, <structfield>typlen</structfield> is negative.
3249        -1 indicates a <quote>varlena</> type (one that has a length word),
3250        -2 indicates a null-terminated C string.
3251       </entry>
3252      </row>
3253
3254      <row>
3255       <entry>typbyval</entry>
3256       <entry><type>bool</type></entry>
3257       <entry></entry>
3258       <entry>
3259        <structfield>typbyval</structfield> determines whether internal
3260        routines pass a value of this type by value or by reference.
3261        Only <type>char</type>, <type>short</type>, and
3262        <type>int</type> equivalent items can be passed by value, so if
3263        the type is not 1, 2, or 4 bytes long,
3264        <productname>PostgreSQL</> does not have
3265        the option of passing by value and so
3266        <structfield>typbyval</structfield> had better be false.
3267        Variable-length types are always passed by reference. Note that
3268        <structfield>typbyval</structfield> can be false even if the
3269        length would allow pass-by-value; this is currently true for
3270        type <type>float4</type>, for example.
3271       </entry>
3272      </row>
3273
3274      <row>
3275       <entry>typtype</entry>
3276       <entry><type>char</type></entry>
3277       <entry></entry>
3278       <entry>
3279        <structfield>typtype</structfield> is <literal>b</literal> for
3280        a base type, <literal>c</literal> for a complex type (i.e.,
3281        a table's row type), <literal>d</literal> for a derived type (i.e.,
3282        a domain), or <literal>p</literal> for a pseudo-type.  See also
3283        <structfield>typrelid</structfield>
3284        and <structfield>typbasetype</structfield>.
3285       </entry>
3286      </row>
3287
3288      <row>
3289       <entry>typisdefined</entry>
3290       <entry><type>bool</type></entry>
3291       <entry></entry>
3292       <entry>True if the type is defined, false if this is a placeholder
3293       entry for a not-yet-defined type.  When typisdefined is false,
3294       nothing except the type name, namespace, and OID can be relied on.
3295       </entry>
3296      </row>
3297
3298      <row>
3299       <entry>typdelim</entry>
3300       <entry><type>char</type></entry>
3301       <entry></entry>
3302       <entry>Character that separates two values of this type when parsing
3303       array input.  Note that the delimiter is associated with the array
3304       element data type, not the array data type.</entry>
3305      </row>
3306
3307      <row>
3308       <entry>typrelid</entry>
3309       <entry><type>oid</type></entry>
3310       <entry>pg_class.oid</entry>
3311       <entry>
3312        If this is a complex type (see
3313        <structfield>typtype</structfield>), then this field points to
3314        the <structname>pg_class</structname> entry that defines the
3315        corresponding table.  (For a free-standing composite type, the
3316        <structname>pg_class</structname> entry doesn't really represent
3317        a table, but it is needed anyway for the type's
3318        <structname>pg_attribute</structname> entries to link to.)
3319        Zero for non-complex types.
3320       </entry>
3321      </row>
3322
3323      <row>
3324       <entry>typelem</entry>
3325       <entry><type>oid</type></entry>
3326       <entry>pg_type.oid</entry>
3327       <entry>
3328        If <structfield>typelem</structfield> is not 0 then it
3329        identifies another row in <structname>pg_type</structname>.
3330        The current type can then be subscripted like an array yielding
3331        values of type <structfield>typelem</structfield>.  A
3332        <quote>true</quote> array type is variable length
3333        (<structfield>typlen</structfield> = -1),
3334        but some fixed-length (<structfield>typlen</structfield> &gt; 0) types
3335        also have nonzero <structfield>typelem</structfield>, for example
3336        <type>name</type> and <type>oidvector</type>.
3337        If a fixed-length type has a <structfield>typelem</structfield> then
3338        its internal representation must be N values of the
3339        <structfield>typelem</structfield> data type with no other data.
3340        Variable-length array types have a header defined by the array
3341        subroutines.
3342       </entry>
3343      </row>
3344
3345      <row>
3346       <entry>typinput</entry>
3347       <entry><type>regproc</type></entry>
3348       <entry>pg_proc.oid</entry>
3349       <entry>Input conversion function</entry>
3350      </row>
3351
3352      <row>
3353       <entry>typoutput</entry>
3354       <entry><type>regproc</type></entry>
3355       <entry>pg_proc.oid</entry>
3356       <entry>Output conversion function</entry>
3357      </row>
3358
3359      <row>
3360       <entry>typalign</entry>
3361       <entry><type>char</type></entry>
3362       <entry></entry>
3363       <entry><para>
3364
3365        <structfield>typalign</structfield> is the alignment required
3366        when storing a value of this type.  It applies to storage on
3367        disk as well as most representations of the value inside
3368        <productname>PostgreSQL</>.
3369        When multiple values are stored consecutively, such
3370        as in the representation of a complete row on disk, padding is
3371        inserted before a datum of this type so that it begins on the
3372        specified boundary.  The alignment reference is the beginning
3373        of the first datum in the sequence.
3374       </para><para>
3375        Possible values are:
3376        <itemizedlist>
3377         <listitem>
3378          <para>'c' = CHAR alignment, i.e., no alignment needed.</para>
3379         </listitem>
3380         <listitem>
3381          <para>'s' = SHORT alignment (2 bytes on most machines).</para>
3382         </listitem>
3383         <listitem>
3384          <para>'i' = INT alignment (4 bytes on most machines).</para>
3385         </listitem>
3386         <listitem>
3387          <para>'d' = DOUBLE alignment (8 bytes on many machines, but by no means all).</para>
3388         </listitem>
3389        </itemizedlist>
3390       </para><note>
3391        <para>
3392         For types used in system tables, it is critical that the size
3393         and alignment defined in <structname>pg_type</structname>
3394         agree with the way that the compiler will lay out the field in
3395         a struct representing a table row.
3396        </para>
3397       </note></entry>
3398      </row>
3399
3400      <row>
3401       <entry>typstorage</entry>
3402       <entry><type>char</type></entry>
3403       <entry></entry>
3404       <entry><para>
3405        <structfield>typstorage</structfield> tells for varlena
3406        types (those with <structfield>typlen</structfield> = -1) if
3407        the type is prepared for toasting and what the default strategy
3408        for attributes of this type should be.
3409        Possible values are
3410        <itemizedlist>
3411         <listitem>
3412          <para>'p': Value must always be stored plain.</para>
3413         </listitem>
3414         <listitem>
3415          <para>
3416           'e': Value can be stored in a <quote>secondary</quote>
3417           relation (if relation has one, see
3418           <structname>pg_class</structname>.<structfield>reltoastrelid</structfield>).
3419          </para>
3420         </listitem>
3421         <listitem>
3422          <para>'m': Value can be stored compressed inline.</para>
3423         </listitem>
3424         <listitem>
3425          <para>'x': Value can be stored compressed inline or in <quote>secondary</quote>.</para>
3426         </listitem>
3427        </itemizedlist>
3428        Note that 'm' fields can also be moved out to secondary
3429        storage, but only as a last resort ('e' and 'x' fields are
3430        moved first).
3431       </para></entry>
3432      </row>
3433
3434      <row>
3435       <entry>typnotnull</entry>
3436       <entry><type>bool</type></entry>
3437       <entry></entry>
3438       <entry><para>
3439        <structfield>typnotnull</structfield> represents a NOT NULL
3440        constraint on a type.  Presently used for domains only.
3441       </para></entry>
3442      </row>
3443
3444      <row>
3445       <entry>typbasetype</entry>
3446       <entry><type>oid</type></entry>
3447       <entry>pg_type.oid</entry>
3448       <entry><para>
3449        If this is a derived type (see <structfield>typtype</structfield>),
3450        then <structfield>typbasetype</structfield> identifies
3451        the type that this one is based on.  Zero if not a derived type.
3452       </para></entry>
3453      </row>
3454
3455      <row>
3456       <entry>typtypmod</entry>
3457       <entry><type>int4</type></entry>
3458       <entry></entry>
3459       <entry><para>
3460        Domains use <structfield>typtypmod</structfield> to record the typmod
3461        to be applied to their base type (-1 if base type does not use a
3462        typmod).  -1 if this type is not a domain.
3463       </para></entry>
3464      </row>
3465
3466      <row>
3467       <entry>typndims</entry>
3468       <entry><type>int4</type></entry>
3469       <entry></entry>
3470       <entry><para>
3471        <structfield>typndims</structfield> is the number of array dimensions
3472        for a domain that is an array (that is, typbasetype is an array type;
3473        the domain's typelem will match the base type's typelem).
3474        Zero for non-domains and non-array domains.
3475        </para></entry>
3476      </row>
3477
3478      <row>
3479       <entry>typdefaultbin</entry>
3480       <entry><type>text</type></entry>
3481       <entry></entry>
3482       <entry><para>
3483        If <structfield>typdefaultbin</> is not NULL, it is the nodeToString
3484        representation of a default expression for the type.  Currently this is
3485        only used for domains.
3486       </para></entry>
3487      </row>
3488
3489      <row>
3490       <entry>typdefault</entry>
3491       <entry><type>text</type></entry>
3492       <entry></entry>
3493       <entry><para>
3494        <structfield>typdefault</> is NULL if the type has no associated
3495        default value. If <structfield>typdefaultbin</> is not NULL,
3496        <structfield>typdefault</> must contain a human-readable version of the
3497        default expression represented by <structfield>typdefaultbin</>.  If
3498        <structfield>typdefaultbin</> is NULL and <structfield>typdefault</> is
3499        not, then <structfield>typdefault</> is the external representation of
3500        the type's default value, which may be fed to the type's input
3501        converter to produce a constant.
3502       </para></entry>
3503      </row>
3504     </tbody>
3505    </tgroup>
3506   </table>
3507  </sect1>
3508 </chapter>
3509
3510 <!-- Keep this comment at the end of the file
3511 Local variables:
3512 mode:sgml
3513 sgml-omittag:nil
3514 sgml-shorttag:t
3515 sgml-minimize-attributes:nil
3516 sgml-always-quote-attributes:t
3517 sgml-indent-step:1
3518 sgml-indent-tabs-mode:nil
3519 sgml-indent-data:t
3520 sgml-parent-document:nil
3521 sgml-default-dtd-file:"./reference.ced"
3522 sgml-exposed-tags:nil
3523 sgml-local-catalogs:("/usr/share/sgml/catalog")
3524 sgml-local-ecat-files:nil
3525 End:
3526 -->