OSDN Git Service

Add composite-type attributes to information_schema.element_types view
[pg-rex/syncrep.git] / doc / src / sgml / information_schema.sgml
1 <!-- doc/src/sgml/information_schema.sgml -->
2
3 <chapter id="information-schema">
4  <title>The Information Schema</title>
5
6  <indexterm zone="information-schema">
7   <primary>information schema</primary>
8  </indexterm>
9
10  <para>
11   The information schema consists of a set of views that contain
12   information about the objects defined in the current database.  The
13   information schema is defined in the SQL standard and can therefore
14   be expected to be portable and remain stable &mdash; unlike the system
15   catalogs, which are specific to
16   <productname>PostgreSQL</productname> and are modelled after
17   implementation concerns.  The information schema views do not,
18   however, contain information about
19   <productname>PostgreSQL</productname>-specific features; to inquire
20   about those you need to query the system catalogs or other
21   <productname>PostgreSQL</productname>-specific views.
22  </para>
23
24  <note>
25   <para>
26    When querying the database for constraint information, it is possible
27    for a standard-compliant query that expects to return one row to
28    return several.  This is because the SQL standard requires constraint
29    names to be unique within a schema, but
30    <productname>PostgreSQL</productname> does not enforce this
31    restriction.  <productname>PostgreSQL</productname>
32    automatically-generated constraint names avoid duplicates in the
33    same schema, but users can specify such duplicate names.
34   </para>
35
36   <para>
37    This problem can appear when querying information schema views such
38    as <literal>check_constraint_routine_usage</>,
39    <literal>check_constraints</>, <literal>domain_constraints</>, and
40    <literal>referential_constraints</>.  Some other views have similar
41    issues but contain the table name to help distinguish duplicate
42    rows, e.g., <literal>constraint_column_usage</>,
43    <literal>constraint_table_usage</>, <literal>table_constraints</>.
44   </para>
45  </note>
46
47
48  <sect1 id="infoschema-schema">
49   <title>The Schema</title>
50
51   <para>
52    The information schema itself is a schema named
53    <literal>information_schema</literal>.  This schema automatically
54    exists in all databases.  The owner of this schema is the initial
55    database user in the cluster, and that user naturally has all the
56    privileges on this schema, including the ability to drop it (but
57    the space savings achieved by that are minuscule).
58   </para>
59
60   <para>
61    By default, the information schema is not in the schema search
62    path, so you need to access all objects in it through qualified
63    names.  Since the names of some of the objects in the information
64    schema are generic names that might occur in user applications, you
65    should be careful if you want to put the information schema in the
66    path.
67   </para>
68  </sect1>
69
70  <sect1 id="infoschema-datatypes">
71   <title>Data Types</title>
72
73   <para>
74    The columns of the information schema views use special data types
75    that are defined in the information schema.  These are defined as
76    simple domains over ordinary built-in types.  You should not use
77    these types for work outside the information schema, but your
78    applications must be prepared for them if they select from the
79    information schema.
80   </para>
81
82   <para>
83    These types are:
84
85    <variablelist>
86     <varlistentry>
87      <term><type>cardinal_number</type></term>
88      <listitem>
89       <para>
90        A nonnegative integer.
91       </para>
92      </listitem>
93     </varlistentry>
94
95     <varlistentry>
96      <term><type>character_data</type></term>
97      <listitem>
98       <para>
99        A character string (without specific maximum length).
100       </para>
101      </listitem>
102     </varlistentry>
103
104     <varlistentry>
105      <term><type>sql_identifier</type></term>
106      <listitem>
107       <para>
108        A character string.  This type is used for SQL identifiers, the
109        type <type>character_data</type> is used for any other kind of
110        text data.
111       </para>
112      </listitem>
113     </varlistentry>
114
115     <varlistentry>
116      <term><type>time_stamp</type></term>
117      <listitem>
118       <para>
119        A domain over the type <type>timestamp with time zone</type>
120       </para>
121      </listitem>
122     </varlistentry>
123
124     <varlistentry>
125      <term><type>yes_or_no</type></term>
126      <listitem>
127       <para>
128        A character string domain that contains
129        either <literal>YES</literal> or <literal>NO</literal>.  This
130        is used to represent Boolean (true/false) data in the
131        information schema.  (The information schema was invented
132        before the type <type>boolean</type> was added to the SQL
133        standard, so this convention is necessary to keep the
134        information schema backward compatible.)
135       </para>
136      </listitem>
137     </varlistentry>
138    </variablelist>
139
140    Every column in the information schema has one of these five types.
141   </para>
142  </sect1>
143
144  <sect1 id="infoschema-information-schema-catalog-name">
145   <title><literal>information_schema_catalog_name</literal></title>
146
147   <para>
148    <literal>information_schema_catalog_name</literal> is a table that
149    always contains one row and one column containing the name of the
150    current database (current catalog, in SQL terminology).
151   </para>
152
153   <table>
154    <title><literal>information_schema_catalog_name</literal> Columns</title>
155
156    <tgroup cols="3">
157     <thead>
158      <row>
159       <entry>Name</entry>
160       <entry>Data Type</entry>
161       <entry>Description</entry>
162      </row>
163     </thead>
164
165     <tbody>
166      <row>
167       <entry><literal>catalog_name</literal></entry>
168       <entry><type>sql_identifier</type></entry>
169       <entry>Name of the database that contains this information schema</entry>
170      </row>
171     </tbody>
172    </tgroup>
173   </table>
174  </sect1>
175
176  <sect1 id="infoschema-administrable-role-authorizations">
177   <title><literal>administrable_role_authorizations</literal></title>
178
179   <para>
180    The view <literal>administrable_role_authorizations</literal>
181    identifies all roles that the current user has the admin option
182    for.
183   </para>
184
185   <table>
186    <title><literal>administrable_role_authorizations</literal> Columns</title>
187
188    <tgroup cols="3">
189     <thead>
190      <row>
191       <entry>Name</entry>
192       <entry>Data Type</entry>
193       <entry>Description</entry>
194      </row>
195     </thead>
196
197     <tbody>
198      <row>
199       <entry><literal>grantee</literal></entry>
200       <entry><type>sql_identifier</type></entry>
201       <entry>
202        Name of the role to which this role membership was granted (can
203        be the current user, or a different role in case of nested role
204        memberships)
205       </entry>
206      </row>
207
208      <row>
209       <entry><literal>role_name</literal></entry>
210       <entry><type>sql_identifier</type></entry>
211       <entry>Name of a role</entry>
212      </row>
213
214      <row>
215       <entry><literal>is_grantable</literal></entry>
216       <entry><type>yes_or_no</type></entry>
217       <entry>Always <literal>YES</literal></entry>
218      </row>
219     </tbody>
220    </tgroup>
221   </table>
222  </sect1>
223
224  <sect1 id="infoschema-applicable-roles">
225   <title><literal>applicable_roles</literal></title>
226
227   <para>
228    The view <literal>applicable_roles</literal> identifies all roles
229    whose privileges the current user can use.  This means there is
230    some chain of role grants from the current user to the role in
231    question.  The current user itself is also an applicable role.  The
232    set of applicable roles is generally used for permission checking.
233    <indexterm><primary>applicable role</primary></indexterm>
234    <indexterm><primary>role</primary><secondary>applicable</secondary></indexterm>
235   </para>
236
237   <table>
238    <title><literal>applicable_roles</literal> Columns</title>
239
240    <tgroup cols="3">
241     <thead>
242      <row>
243       <entry>Name</entry>
244       <entry>Data Type</entry>
245       <entry>Description</entry>
246      </row>
247     </thead>
248
249     <tbody>
250      <row>
251       <entry><literal>grantee</literal></entry>
252       <entry><type>sql_identifier</type></entry>
253       <entry>
254        Name of the role to which this role membership was granted (can
255        be the current user, or a different role in case of nested role
256        memberships)
257       </entry>
258      </row>
259
260      <row>
261       <entry><literal>role_name</literal></entry>
262       <entry><type>sql_identifier</type></entry>
263       <entry>Name of a role</entry>
264      </row>
265
266      <row>
267       <entry><literal>is_grantable</literal></entry>
268       <entry><type>yes_or_no</type></entry>
269       <entry>
270        <literal>YES</literal> if the grantee has the admin option on
271        the role, <literal>NO</literal> if not
272       </entry>
273      </row>
274     </tbody>
275    </tgroup>
276   </table>
277  </sect1>
278
279  <sect1 id="infoschema-attributes">
280   <title><literal>attributes</literal></title>
281
282   <para>
283    The view <literal>attributes</literal> contains information about
284    the attributes of composite data types defined in the database.
285    (Note that the view does not give information about table columns,
286    which are sometimes called attributes in PostgreSQL contexts.)
287   </para>
288
289   <table>
290    <title><literal>attributes</literal> Columns</title>
291
292    <tgroup cols="3">
293     <thead>
294      <row>
295       <entry>Name</entry>
296       <entry>Data Type</entry>
297       <entry>Description</entry>
298      </row>
299     </thead>
300
301     <tbody>
302      <row>
303       <entry><literal>udt_catalog</literal></entry>
304       <entry><type>sql_identifier</type></entry>
305       <entry>Name of the database containing the data type (always the current database)</entry>
306      </row>
307
308      <row>
309       <entry><literal>udt_schema</literal></entry>
310       <entry><type>sql_identifier</type></entry>
311       <entry>Name of the schema containing the data type</entry>
312      </row>
313
314      <row>
315       <entry><literal>udt_name</literal></entry>
316       <entry><type>sql_identifier</type></entry>
317       <entry>Name of the data type</entry>
318      </row>
319
320      <row>
321       <entry><literal>attribute_name</literal></entry>
322       <entry><type>sql_identifier</type></entry>
323       <entry>Name of the attribute</entry>
324      </row>
325
326      <row>
327       <entry><literal>ordinal_position</literal></entry>
328       <entry><type>cardinal_number</type></entry>
329       <entry>Ordinal position of the attribute within the data type (count starts at 1)</entry>
330      </row>
331
332      <row>
333       <entry><literal>attribute_default</literal></entry>
334       <entry><type>character_data</type></entry>
335       <entry>Default expression of the attribute</entry>
336      </row>
337
338      <row>
339       <entry><literal>is_nullable</literal></entry>
340       <entry><type>yes_or_no</type></entry>
341       <entry>
342        <literal>YES</literal> if the attribute is possibly nullable,
343        <literal>NO</literal> if it is known not nullable.
344       </entry>
345      </row>
346
347      <row>
348       <entry><literal>data_type</literal></entry>
349       <entry><type>character_data</type></entry>
350       <entry>
351        Data type of the attribute, if it is a built-in type, or
352        <literal>ARRAY</literal> if it is some array (in that case, see
353        the view <literal>element_types</literal>), else
354        <literal>USER-DEFINED</literal> (in that case, the type is
355        identified in <literal>attribute_udt_name</literal> and
356        associated columns).
357       </entry>
358      </row>
359
360      <row>
361       <entry><literal>character_maximum_length</literal></entry>
362       <entry><type>cardinal_number</type></entry>
363       <entry>
364        If <literal>data_type</literal> identifies a character or bit
365        string type, the declared maximum length; null for all other
366        data types or if no maximum length was declared.
367       </entry>
368      </row>
369
370      <row>
371       <entry><literal>character_octet_length</literal></entry>
372       <entry><type>cardinal_number</type></entry>
373       <entry>
374        If <literal>data_type</literal> identifies a character type,
375        the maximum possible length in octets (bytes) of a datum; null
376        for all other data types.  The maximum octet length depends on
377        the declared character maximum length (see above) and the
378        server encoding.
379       </entry>
380      </row>
381
382      <row>
383       <entry><literal>numeric_precision</literal></entry>
384       <entry><type>cardinal_number</type></entry>
385       <entry>
386        If <literal>data_type</literal> identifies a numeric type, this
387        column contains the (declared or implicit) precision of the
388        type for this attribute.  The precision indicates the number of
389        significant digits.  It can be expressed in decimal (base 10)
390        or binary (base 2) terms, as specified in the column
391        <literal>numeric_precision_radix</literal>.  For all other data
392        types, this column is null.
393       </entry>
394      </row>
395
396      <row>
397       <entry><literal>numeric_precision_radix</literal></entry>
398       <entry><type>cardinal_number</type></entry>
399       <entry>
400        If <literal>data_type</literal> identifies a numeric type, this
401        column indicates in which base the values in the columns
402        <literal>numeric_precision</literal> and
403        <literal>numeric_scale</literal> are expressed.  The value is
404        either 2 or 10.  For all other data types, this column is null.
405       </entry>
406      </row>
407
408      <row>
409       <entry><literal>numeric_scale</literal></entry>
410       <entry><type>cardinal_number</type></entry>
411       <entry>
412        If <literal>data_type</literal> identifies an exact numeric
413        type, this column contains the (declared or implicit) scale of
414        the type for this attribute.  The scale indicates the number of
415        significant digits to the right of the decimal point.  It can
416        be expressed in decimal (base 10) or binary (base 2) terms, as
417        specified in the column
418        <literal>numeric_precision_radix</literal>.  For all other data
419        types, this column is null.
420       </entry>
421      </row>
422
423      <row>
424       <entry><literal>datetime_precision</literal></entry>
425       <entry><type>cardinal_number</type></entry>
426       <entry>
427        If <literal>data_type</literal> identifies a date, time,
428        timestamp, or interval type, this column contains the (declared
429        or implicit) fractional seconds precision of the type for this
430        attribute, that is, the number of decimal digits maintained
431        following the decimal point in the seconds value.  For all
432        other data types, this column is null.
433       </entry>
434      </row>
435
436      <row>
437       <entry><literal>interval_type</literal></entry>
438       <entry><type>character_data</type></entry>
439       <entry>Not yet implemented</entry>
440      </row>
441
442      <row>
443       <entry><literal>interval_precision</literal></entry>
444       <entry><type>character_data</type></entry>
445       <entry>Not yet implemented</entry>
446      </row>
447
448      <row>
449       <entry><literal>attribute_udt_catalog</literal></entry>
450       <entry><type>sql_identifier</type></entry>
451       <entry>
452        Name of the database that the attribute data type is defined in
453        (always the current database)
454       </entry>
455      </row>
456
457      <row>
458       <entry><literal>attribute_udt_schema</literal></entry>
459       <entry><type>sql_identifier</type></entry>
460       <entry>
461        Name of the schema that the attribute data type is defined in
462       </entry>
463      </row>
464
465      <row>
466       <entry><literal>attribute_udt_name</literal></entry>
467       <entry><type>sql_identifier</type></entry>
468       <entry>
469        Name of the attribute data type
470       </entry>
471      </row>
472
473      <row>
474       <entry><literal>scope_catalog</literal></entry>
475       <entry><type>sql_identifier</type></entry>
476       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
477      </row>
478
479      <row>
480       <entry><literal>scope_schema</literal></entry>
481       <entry><type>sql_identifier</type></entry>
482       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
483      </row>
484
485      <row>
486       <entry><literal>scope_name</literal></entry>
487       <entry><type>sql_identifier</type></entry>
488       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
489      </row>
490
491      <row>
492       <entry><literal>maximum_cardinality</literal></entry>
493       <entry><type>cardinal_number</type></entry>
494       <entry>Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</></entry>
495      </row>
496
497      <row>
498       <entry><literal>dtd_identifier</literal></entry>
499       <entry><type>sql_identifier</type></entry>
500       <entry>
501        An identifier of the data type descriptor of the column, unique
502        among the data type descriptors pertaining to the table.  This
503        is mainly useful for joining with other instances of such
504        identifiers.  (The specific format of the identifier is not
505        defined and not guaranteed to remain the same in future
506        versions.)
507       </entry>
508      </row>
509
510      <row>
511       <entry><literal>is_derived_reference_attribute</literal></entry>
512       <entry><type>yes_or_no</type></entry>
513       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
514      </row>
515     </tbody>
516    </tgroup>
517   </table>
518
519   <para>
520    See also under <xref linkend="infoschema-columns">, a similarly
521    structured view, for further information on some of the columns.
522   </para>
523  </sect1>
524
525  <sect1 id="infoschema-character-sets">
526   <title><literal>character_sets</literal></title>
527
528   <para>
529    The view <literal>character_sets</literal> identifies the character
530    sets available in the current database.  Since PostgreSQL does not
531    support multiple character sets within one database, this view only
532    shows one, which is the database encoding.
533   </para>
534
535   <para>
536    Take note of how the following terms are used in the SQL standard:
537    <variablelist>
538     <varlistentry>
539      <term>character repertoire</term>
540      <listitem>
541       <para>
542        An abstract collection of characters, for
543        example <literal>UNICODE</literal>, <literal>UCS</literal>, or
544        <literal>LATIN1</literal>.  Not exposed as an SQL object, but
545        visible in this view.
546       </para>
547      </listitem>
548     </varlistentry>
549
550     <varlistentry>
551      <term>character encoding form</term>
552      <listitem>
553       <para>
554        An encoding of some character repertoire.  Most older character
555        repertoires only use one encoding form, and so there are no
556        separate names for them (e.g., <literal>LATIN1</literal> is an
557        encoding form applicable to the <literal>LATIN1</literal>
558        repertoire).  But for example Unicode has the encoding forms
559        <literal>UTF8</literal>, <literal>UTF16</literal>, etc. (not
560        all supported by PostgreSQL).  Encoding forms are not exposed
561        as an SQL object, but are visible in this view.
562       </para>
563      </listitem>
564     </varlistentry>
565
566     <varlistentry>
567      <term>character set</term>
568      <listitem>
569       <para>
570        A named SQL object that identifies a character repertoire, a
571        character encoding, and a default collation.  A predefined
572        character set would typically have the same name as an encoding
573        form, but users could define other names.  For example, the
574        character set <literal>UTF8</literal> would typically identify
575        the character repertoire <literal>UCS</literal>, encoding
576        form <literal>UTF8</literal>, and some default collation.
577       </para>
578      </listitem>
579     </varlistentry>
580    </variablelist>
581
582    You can think of an <quote>encoding</quote> in PostgreSQL either as
583    a character set or a character encoding form.  They will have the
584    same name, and there can only be one in one database.
585   </para>
586
587   <table>
588    <title><literal>character_sets</literal> Columns</title>
589
590    <tgroup cols="3">
591     <thead>
592      <row>
593       <entry>Name</entry>
594       <entry>Data Type</entry>
595       <entry>Description</entry>
596      </row>
597     </thead>
598
599     <tbody>
600      <row>
601       <entry><literal>character_set_catalog</literal></entry>
602       <entry><literal>sql_identifier</literal></entry>
603       <entry>Character sets are currently not implemented as schema objects, so this column is null.</entry>
604      </row>
605
606      <row>
607       <entry><literal>character_set_schema</literal></entry>
608       <entry><literal>sql_identifier</literal></entry>
609       <entry>Character sets are currently not implemented as schema objects, so this column is null.</entry>
610      </row>
611
612      <row>
613       <entry><literal>character_set_name</literal></entry>
614       <entry><literal>sql_identifier</literal></entry>
615       <entry>Name of the character set, currently implemented as showing the name of the database encoding</entry>
616      </row>
617
618      <row>
619       <entry><literal>character_repertoire</literal></entry>
620       <entry><literal>sql_identifier</literal></entry>
621       <entry>Character repertoire, showing <literal>UCS</literal> if the encoding is <literal>UTF8</literal>, else just the encoding name</entry>
622      </row>
623
624      <row>
625       <entry><literal>form_of_use</literal></entry>
626       <entry><literal>sql_identifier</literal></entry>
627       <entry>Character encoding form, same as the database encoding</entry>
628      </row>
629
630      <row>
631       <entry><literal>default_collate_catalog</literal></entry>
632       <entry><literal>sql_identifier</literal></entry>
633       <entry>Name of the database containing the default collation (always the current database, if any collation is identified)</entry>
634      </row>
635
636      <row>
637       <entry><literal>default_collate_schema</literal></entry>
638       <entry><literal>sql_identifier</literal></entry>
639       <entry>Name of the schema containing the default collation</entry>
640      </row>
641
642      <row>
643       <entry><literal>default_collate_name</literal></entry>
644       <entry><literal>sql_identifier</literal></entry>
645       <entry>
646        Name of the default collation.  The default collation is
647        identified as the collation that matches
648        the <literal>COLLATE</literal> and <literal>CTYPE</literal>
649        settings of the current database.  If there is no such
650        collation, then this column and the associated schema and
651        catalog columns are null.
652       </entry>
653      </row>
654     </tbody>
655    </tgroup>
656   </table>
657  </sect1>
658
659  <sect1 id="infoschema-check-constraint-routine-usage">
660   <title><literal>check_constraint_routine_usage</literal></title>
661
662   <para>
663    The view <literal>check_constraint_routine_usage</literal>
664    identifies routines (functions and procedures) that are used by a
665    check constraint.  Only those routines are shown that are owned by
666    a currently enabled role.
667   </para>
668
669   <table>
670    <title><literal>check_constraint_routine_usage</literal> Columns</title>
671
672    <tgroup cols="3">
673     <thead>
674      <row>
675       <entry>Name</entry>
676       <entry>Data Type</entry>
677       <entry>Description</entry>
678      </row>
679     </thead>
680
681     <tbody>
682      <row>
683       <entry><literal>constraint_catalog</literal></entry>
684       <entry><literal>sql_identifier</literal></entry>
685       <entry>Name of the database containing the constraint (always the current database)</entry>
686      </row>
687
688      <row>
689       <entry><literal>constraint_schema</literal></entry>
690       <entry><literal>sql_identifier</literal></entry>
691       <entry>Name of the schema containing the constraint</entry>
692      </row>
693
694      <row>
695       <entry><literal>constraint_name</literal></entry>
696       <entry><literal>sql_identifier</literal></entry>
697       <entry>Name of the constraint</entry>
698      </row>
699
700      <row>
701       <entry><literal>specific_catalog</literal></entry>
702       <entry><literal>sql_identifier</literal></entry>
703       <entry>Name of the database containing the function (always the current database)</entry>
704      </row>
705
706      <row>
707       <entry><literal>specific_schema</literal></entry>
708       <entry><literal>sql_identifier</literal></entry>
709       <entry>Name of the schema containing the function</entry>
710      </row>
711
712      <row>
713       <entry><literal>specific_name</literal></entry>
714       <entry><literal>sql_identifier</literal></entry>
715       <entry>
716        The <quote>specific name</quote> of the function.  See <xref
717        linkend="infoschema-routines"> for more information.
718       </entry>
719      </row>
720     </tbody>
721    </tgroup>
722   </table>
723  </sect1>
724
725  <sect1 id="infoschema-check-constraints">
726   <title><literal>check_constraints</literal></title>
727
728   <para>
729    The view <literal>check_constraints</literal> contains all check
730    constraints, either defined on a table or on a domain, that are
731    owned by a currently enabled role.  (The owner of the table or
732    domain is the owner of the constraint.)
733   </para>
734
735   <table>
736    <title><literal>check_constraints</literal> Columns</title>
737
738    <tgroup cols="3">
739     <thead>
740      <row>
741       <entry>Name</entry>
742       <entry>Data Type</entry>
743       <entry>Description</entry>
744      </row>
745     </thead>
746
747     <tbody>
748      <row>
749       <entry><literal>constraint_catalog</literal></entry>
750       <entry><literal>sql_identifier</literal></entry>
751       <entry>Name of the database containing the constraint (always the current database)</entry>
752      </row>
753
754      <row>
755       <entry><literal>constraint_schema</literal></entry>
756       <entry><literal>sql_identifier</literal></entry>
757       <entry>Name of the schema containing the constraint</entry>
758      </row>
759
760      <row>
761       <entry><literal>constraint_name</literal></entry>
762       <entry><literal>sql_identifier</literal></entry>
763       <entry>Name of the constraint</entry>
764      </row>
765
766      <row>
767       <entry><literal>check_clause</literal></entry>
768       <entry><literal>character_data</literal></entry>
769       <entry>The check expression of the check constraint</entry>
770      </row>
771     </tbody>
772    </tgroup>
773   </table>
774  </sect1>
775
776  <sect1 id="infoschema-collations">
777   <title><literal>collations</literal></title>
778
779   <para>
780    The view <literal>collations</literal> contains the collations
781    available in the current database.
782   </para>
783
784   <table>
785    <title><literal>collations</literal> Columns</title>
786
787    <tgroup cols="3">
788     <thead>
789      <row>
790       <entry>Name</entry>
791       <entry>Data Type</entry>
792       <entry>Description</entry>
793      </row>
794     </thead>
795
796     <tbody>
797      <row>
798       <entry><literal>collation_catalog</literal></entry>
799       <entry><literal>sql_identifier</literal></entry>
800       <entry>Name of the database containing the collation (always the current database)</entry>
801      </row>
802
803      <row>
804       <entry><literal>collation_schema</literal></entry>
805       <entry><literal>sql_identifier</literal></entry>
806       <entry>Name of the schema containing the collation</entry>
807      </row>
808
809      <row>
810       <entry><literal>collation_name</literal></entry>
811       <entry><literal>sql_identifier</literal></entry>
812       <entry>Name of the default collation</entry>
813      </row>
814
815      <row>
816       <entry><literal>pad_attribute</literal></entry>
817       <entry><literal>character_data</literal></entry>
818       <entry>
819        Always <literal>NO PAD</literal> (The alternative <literal>PAD
820        SPACE</literal> is not supported by PostgreSQL.)
821       </entry>
822      </row>
823     </tbody>
824    </tgroup>
825   </table>
826  </sect1>
827
828  <sect1 id="infoschema-collation-character-set-applicab"> <!-- max 44 characters -->
829   <title><literal>collation_character_set_applicability</literal></title>
830
831   <para>
832    The view <literal>collation_character_set_applicability</literal>
833    identifies which character set the available collations are
834    applicable to.  In PostgreSQL, there is only one character set per
835    database (see explanation
836    in <xref linkend="infoschema-character-sets">), so this view does
837    not provide much useful information.
838   </para>
839
840   <table>
841    <title><literal>collation_character_set_applicability</literal> Columns</title>
842
843    <tgroup cols="3">
844     <thead>
845      <row>
846       <entry>Name</entry>
847       <entry>Data Type</entry>
848       <entry>Description</entry>
849      </row>
850     </thead>
851
852     <tbody>
853      <row>
854       <entry><literal>collation_catalog</literal></entry>
855       <entry><literal>sql_identifier</literal></entry>
856       <entry>Name of the database containing the collation (always the current database)</entry>
857      </row>
858
859      <row>
860       <entry><literal>collation_schema</literal></entry>
861       <entry><literal>sql_identifier</literal></entry>
862       <entry>Name of the schema containing the collation</entry>
863      </row>
864
865      <row>
866       <entry><literal>collation_name</literal></entry>
867       <entry><literal>sql_identifier</literal></entry>
868       <entry>Name of the default collation</entry>
869      </row>
870
871      <row>
872       <entry><literal>character_set_catalog</literal></entry>
873       <entry><literal>sql_identifier</literal></entry>
874       <entry>Character sets are currently not implemented as schema objects, so this column is null</entry>
875      </row>
876
877      <row>
878       <entry><literal>character_set_schema</literal></entry>
879       <entry><literal>sql_identifier</literal></entry>
880       <entry>Character sets are currently not implemented as schema objects, so this column is null</entry>
881      </row>
882
883      <row>
884       <entry><literal>character_set_name</literal></entry>
885       <entry><literal>sql_identifier</literal></entry>
886       <entry>Name of the character set</entry>
887      </row>
888     </tbody>
889    </tgroup>
890   </table>
891  </sect1>
892
893  <sect1 id="infoschema-column-domain-usage">
894   <title><literal>column_domain_usage</literal></title>
895
896   <para>
897    The view <literal>column_domain_usage</literal> identifies all
898    columns (of a table or a view) that make use of some domain defined
899    in the current database and owned by a currently enabled role.
900   </para>
901
902   <table>
903    <title><literal>column_domain_usage</literal> Columns</title>
904
905    <tgroup cols="3">
906     <thead>
907      <row>
908       <entry>Name</entry>
909       <entry>Data Type</entry>
910       <entry>Description</entry>
911      </row>
912     </thead>
913
914     <tbody>
915      <row>
916       <entry><literal>domain_catalog</literal></entry>
917       <entry><type>sql_identifier</type></entry>
918       <entry>Name of the database containing the domain (always the current database)</entry>
919      </row>
920
921      <row>
922       <entry><literal>domain_schema</literal></entry>
923       <entry><type>sql_identifier</type></entry>
924       <entry>Name of the schema containing the domain</entry>
925      </row>
926
927      <row>
928       <entry><literal>domain_name</literal></entry>
929       <entry><type>sql_identifier</type></entry>
930       <entry>Name of the domain</entry>
931      </row>
932
933      <row>
934       <entry><literal>table_catalog</literal></entry>
935       <entry><type>sql_identifier</type></entry>
936       <entry>Name of the database containing the table (always the current database)</entry>
937      </row>
938
939      <row>
940       <entry><literal>table_schema</literal></entry>
941       <entry><type>sql_identifier</type></entry>
942       <entry>Name of the schema containing the table</entry>
943      </row>
944
945      <row>
946       <entry><literal>table_name</literal></entry>
947       <entry><type>sql_identifier</type></entry>
948       <entry>Name of the table</entry>
949      </row>
950
951      <row>
952       <entry><literal>column_name</literal></entry>
953       <entry><type>sql_identifier</type></entry>
954       <entry>Name of the column</entry>
955      </row>
956     </tbody>
957    </tgroup>
958   </table>
959  </sect1>
960
961  <sect1 id="infoschema-column-privileges">
962   <title><literal>column_privileges</literal></title>
963
964   <para>
965    The view <literal>column_privileges</literal> identifies all
966    privileges granted on columns to a currently enabled role or by a
967    currently enabled role.  There is one row for each combination of
968    column, grantor, and grantee.
969   </para>
970
971   <para>
972    If a privilege has been granted on an entire table, it will show up in
973    this view as a grant for each column, but only for the
974    privilege types where column granularity is possible:
975    <literal>SELECT</literal>, <literal>INSERT</literal>,
976    <literal>UPDATE</literal>, <literal>REFERENCES</literal>.
977   </para>
978
979   <table>
980    <title><literal>column_privileges</literal> Columns</title>
981
982    <tgroup cols="3">
983     <thead>
984      <row>
985       <entry>Name</entry>
986       <entry>Data Type</entry>
987       <entry>Description</entry>
988      </row>
989     </thead>
990
991     <tbody>
992      <row>
993       <entry><literal>grantor</literal></entry>
994       <entry><type>sql_identifier</type></entry>
995       <entry>Name of the role that granted the privilege</entry>
996      </row>
997
998      <row>
999       <entry><literal>grantee</literal></entry>
1000       <entry><type>sql_identifier</type></entry>
1001       <entry>Name of the role that the privilege was granted to</entry>
1002      </row>
1003
1004      <row>
1005       <entry><literal>table_catalog</literal></entry>
1006       <entry><type>sql_identifier</type></entry>
1007       <entry>Name of the database that contains the table that contains the column (always the current database)</entry>
1008      </row>
1009
1010      <row>
1011       <entry><literal>table_schema</literal></entry>
1012       <entry><type>sql_identifier</type></entry>
1013       <entry>Name of the schema that contains the table that contains the column</entry>
1014      </row>
1015
1016      <row>
1017       <entry><literal>table_name</literal></entry>
1018       <entry><type>sql_identifier</type></entry>
1019       <entry>Name of the table that contains the column</entry>
1020      </row>
1021
1022      <row>
1023       <entry><literal>column_name</literal></entry>
1024       <entry><type>sql_identifier</type></entry>
1025       <entry>Name of the column</entry>
1026      </row>
1027
1028      <row>
1029       <entry><literal>privilege_type</literal></entry>
1030       <entry><type>character_data</type></entry>
1031       <entry>
1032        Type of the privilege: <literal>SELECT</literal>,
1033        <literal>INSERT</literal>, <literal>UPDATE</literal>, or
1034        <literal>REFERENCES</literal>
1035       </entry>
1036      </row>
1037
1038      <row>
1039       <entry><literal>is_grantable</literal></entry>
1040       <entry><type>yes_or_no</type></entry>
1041       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
1042      </row>
1043     </tbody>
1044    </tgroup>
1045   </table>
1046  </sect1>
1047
1048  <sect1 id="infoschema-column-udt-usage">
1049   <title><literal>column_udt_usage</literal></title>
1050
1051   <para>
1052    The view <literal>column_udt_usage</literal> identifies all columns
1053    that use data types owned by a currently enabled role.  Note that in
1054    <productname>PostgreSQL</productname>, built-in data types behave
1055    like user-defined types, so they are included here as well.  See
1056    also <xref linkend="infoschema-columns"> for details.
1057   </para>
1058
1059   <table>
1060    <title><literal>column_udt_usage</literal> Columns</title>
1061
1062    <tgroup cols="3">
1063     <thead>
1064      <row>
1065       <entry>Name</entry>
1066       <entry>Data Type</entry>
1067       <entry>Description</entry>
1068      </row>
1069     </thead>
1070
1071     <tbody>
1072      <row>
1073       <entry><literal>udt_catalog</literal></entry>
1074       <entry><type>sql_identifier</type></entry>
1075       <entry>
1076        Name of the database that the column data type (the underlying
1077        type of the domain, if applicable) is defined in (always the
1078        current database)
1079       </entry>
1080      </row>
1081
1082      <row>
1083       <entry><literal>udt_schema</literal></entry>
1084       <entry><type>sql_identifier</type></entry>
1085       <entry>
1086        Name of the schema that the column data type (the underlying
1087        type of the domain, if applicable) is defined in
1088       </entry>
1089      </row>
1090
1091      <row>
1092       <entry><literal>udt_name</literal></entry>
1093       <entry><type>sql_identifier</type></entry>
1094       <entry>
1095        Name of the column data type (the underlying type of the
1096        domain, if applicable)
1097       </entry>
1098      </row>
1099
1100      <row>
1101       <entry><literal>table_catalog</literal></entry>
1102       <entry><type>sql_identifier</type></entry>
1103       <entry>Name of the database containing the table (always the current database)</entry>
1104      </row>
1105
1106      <row>
1107       <entry><literal>table_schema</literal></entry>
1108       <entry><type>sql_identifier</type></entry>
1109       <entry>Name of the schema containing the table</entry>
1110      </row>
1111
1112      <row>
1113       <entry><literal>table_name</literal></entry>
1114       <entry><type>sql_identifier</type></entry>
1115       <entry>Name of the table</entry>
1116      </row>
1117
1118      <row>
1119       <entry><literal>column_name</literal></entry>
1120       <entry><type>sql_identifier</type></entry>
1121       <entry>Name of the column</entry>
1122      </row>
1123     </tbody>
1124    </tgroup>
1125   </table>
1126  </sect1>
1127
1128  <sect1 id="infoschema-columns">
1129   <title><literal>columns</literal></title>
1130
1131   <para>
1132    The view <literal>columns</literal> contains information about all
1133    table columns (or view columns) in the database.  System columns
1134    (<literal>oid</>, etc.) are not included.  Only those columns are
1135    shown that the current user has access to (by way of being the
1136    owner or having some privilege).
1137   </para>
1138
1139   <table>
1140    <title><literal>columns</literal> Columns</title>
1141
1142    <tgroup cols="3">
1143     <thead>
1144      <row>
1145       <entry>Name</entry>
1146       <entry>Data Type</entry>
1147       <entry>Description</entry>
1148      </row>
1149     </thead>
1150
1151     <tbody>
1152      <row>
1153       <entry><literal>table_catalog</literal></entry>
1154       <entry><type>sql_identifier</type></entry>
1155       <entry>Name of the database containing the table (always the current database)</entry>
1156      </row>
1157
1158      <row>
1159       <entry><literal>table_schema</literal></entry>
1160       <entry><type>sql_identifier</type></entry>
1161       <entry>Name of the schema containing the table</entry>
1162      </row>
1163
1164      <row>
1165       <entry><literal>table_name</literal></entry>
1166       <entry><type>sql_identifier</type></entry>
1167       <entry>Name of the table</entry>
1168      </row>
1169
1170      <row>
1171       <entry><literal>column_name</literal></entry>
1172       <entry><type>sql_identifier</type></entry>
1173       <entry>Name of the column</entry>
1174      </row>
1175
1176      <row>
1177       <entry><literal>ordinal_position</literal></entry>
1178       <entry><type>cardinal_number</type></entry>
1179       <entry>Ordinal position of the column within the table (count starts at 1)</entry>
1180      </row>
1181
1182      <row>
1183       <entry><literal>column_default</literal></entry>
1184       <entry><type>character_data</type></entry>
1185       <entry>Default expression of the column</entry>
1186      </row>
1187
1188      <row>
1189       <entry><literal>is_nullable</literal></entry>
1190       <entry><type>yes_or_no</type></entry>
1191       <entry>
1192        <literal>YES</literal> if the column is possibly nullable,
1193        <literal>NO</literal> if it is known not nullable.  A not-null
1194        constraint is one way a column can be known not nullable, but
1195        there can be others.
1196       </entry>
1197      </row>
1198
1199      <row>
1200       <entry><literal>data_type</literal></entry>
1201       <entry><type>character_data</type></entry>
1202       <entry>
1203        Data type of the column, if it is a built-in type, or
1204        <literal>ARRAY</literal> if it is some array (in that case, see
1205        the view <literal>element_types</literal>), else
1206        <literal>USER-DEFINED</literal> (in that case, the type is
1207        identified in <literal>udt_name</literal> and associated
1208        columns).  If the column is based on a domain, this column
1209        refers to the type underlying the domain (and the domain is
1210        identified in <literal>domain_name</literal> and associated
1211        columns).
1212       </entry>
1213      </row>
1214
1215      <row>
1216       <entry><literal>character_maximum_length</literal></entry>
1217       <entry><type>cardinal_number</type></entry>
1218       <entry>
1219        If <literal>data_type</literal> identifies a character or bit
1220        string type, the declared maximum length; null for all other
1221        data types or if no maximum length was declared.
1222       </entry>
1223      </row>
1224
1225      <row>
1226       <entry><literal>character_octet_length</literal></entry>
1227       <entry><type>cardinal_number</type></entry>
1228       <entry>
1229        If <literal>data_type</literal> identifies a character type,
1230        the maximum possible length in octets (bytes) of a datum; null
1231        for all other data types.  The maximum octet length depends on
1232        the declared character maximum length (see above) and the
1233        server encoding.
1234       </entry>
1235      </row>
1236
1237      <row>
1238       <entry><literal>numeric_precision</literal></entry>
1239       <entry><type>cardinal_number</type></entry>
1240       <entry>
1241        If <literal>data_type</literal> identifies a numeric type, this
1242        column contains the (declared or implicit) precision of the
1243        type for this column.  The precision indicates the number of
1244        significant digits.  It can be expressed in decimal (base 10)
1245        or binary (base 2) terms, as specified in the column
1246        <literal>numeric_precision_radix</literal>.  For all other data
1247        types, this column is null.
1248       </entry>
1249      </row>
1250
1251      <row>
1252       <entry><literal>numeric_precision_radix</literal></entry>
1253       <entry><type>cardinal_number</type></entry>
1254       <entry>
1255        If <literal>data_type</literal> identifies a numeric type, this
1256        column indicates in which base the values in the columns
1257        <literal>numeric_precision</literal> and
1258        <literal>numeric_scale</literal> are expressed.  The value is
1259        either 2 or 10.  For all other data types, this column is null.
1260       </entry>
1261      </row>
1262
1263      <row>
1264       <entry><literal>numeric_scale</literal></entry>
1265       <entry><type>cardinal_number</type></entry>
1266       <entry>
1267        If <literal>data_type</literal> identifies an exact numeric
1268        type, this column contains the (declared or implicit) scale of
1269        the type for this column.  The scale indicates the number of
1270        significant digits to the right of the decimal point.  It can
1271        be expressed in decimal (base 10) or binary (base 2) terms, as
1272        specified in the column
1273        <literal>numeric_precision_radix</literal>.  For all other data
1274        types, this column is null.
1275       </entry>
1276      </row>
1277
1278      <row>
1279       <entry><literal>datetime_precision</literal></entry>
1280       <entry><type>cardinal_number</type></entry>
1281       <entry>
1282        If <literal>data_type</literal> identifies a date, time,
1283        timestamp, or interval type, this column contains the (declared
1284        or implicit) fractional seconds precision of the type for this
1285        column, that is, the number of decimal digits maintained
1286        following the decimal point in the seconds value.  For all
1287        other data types, this column is null.
1288       </entry>
1289      </row>
1290
1291      <row>
1292       <entry><literal>interval_type</literal></entry>
1293       <entry><type>character_data</type></entry>
1294       <entry>Not yet implemented</entry>
1295      </row>
1296
1297      <row>
1298       <entry><literal>interval_precision</literal></entry>
1299       <entry><type>character_data</type></entry>
1300       <entry>Not yet implemented</entry>
1301      </row>
1302
1303      <row>
1304       <entry><literal>character_set_catalog</literal></entry>
1305       <entry><type>sql_identifier</type></entry>
1306       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1307      </row>
1308
1309      <row>
1310       <entry><literal>character_set_schema</literal></entry>
1311       <entry><type>sql_identifier</type></entry>
1312       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1313      </row>
1314
1315      <row>
1316       <entry><literal>character_set_name</literal></entry>
1317       <entry><type>sql_identifier</type></entry>
1318       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1319      </row>
1320
1321      <row>
1322       <entry><literal>collation_catalog</literal></entry>
1323       <entry><type>sql_identifier</type></entry>
1324       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1325      </row>
1326
1327      <row>
1328       <entry><literal>collation_schema</literal></entry>
1329       <entry><type>sql_identifier</type></entry>
1330       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1331      </row>
1332
1333      <row>
1334       <entry><literal>collation_name</literal></entry>
1335       <entry><type>sql_identifier</type></entry>
1336       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1337      </row>
1338
1339      <row>
1340       <entry><literal>domain_catalog</literal></entry>
1341       <entry><type>sql_identifier</type></entry>
1342       <entry>
1343        If the column has a domain type, the name of the database that
1344        the domain is defined in (always the current database), else
1345        null.
1346       </entry>
1347      </row>
1348
1349      <row>
1350       <entry><literal>domain_schema</literal></entry>
1351       <entry><type>sql_identifier</type></entry>
1352       <entry>
1353        If the column has a domain type, the name of the schema that
1354        the domain is defined in, else null.
1355       </entry>
1356      </row>
1357
1358      <row>
1359       <entry><literal>domain_name</literal></entry>
1360       <entry><type>sql_identifier</type></entry>
1361       <entry>If the column has a domain type, the name of the domain, else null.</entry>
1362      </row>
1363
1364      <row>
1365       <entry><literal>udt_catalog</literal></entry>
1366       <entry><type>sql_identifier</type></entry>
1367       <entry>
1368        Name of the database that the column data type (the underlying
1369        type of the domain, if applicable) is defined in (always the
1370        current database)
1371       </entry>
1372      </row>
1373
1374      <row>
1375       <entry><literal>udt_schema</literal></entry>
1376       <entry><type>sql_identifier</type></entry>
1377       <entry>
1378        Name of the schema that the column data type (the underlying
1379        type of the domain, if applicable) is defined in
1380       </entry>
1381      </row>
1382
1383      <row>
1384       <entry><literal>udt_name</literal></entry>
1385       <entry><type>sql_identifier</type></entry>
1386       <entry>
1387        Name of the column data type (the underlying type of the
1388        domain, if applicable)
1389       </entry>
1390      </row>
1391
1392      <row>
1393       <entry><literal>scope_catalog</literal></entry>
1394       <entry><type>sql_identifier</type></entry>
1395       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1396      </row>
1397
1398      <row>
1399       <entry><literal>scope_schema</literal></entry>
1400       <entry><type>sql_identifier</type></entry>
1401       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1402      </row>
1403
1404      <row>
1405       <entry><literal>scope_name</literal></entry>
1406       <entry><type>sql_identifier</type></entry>
1407       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1408      </row>
1409
1410      <row>
1411       <entry><literal>maximum_cardinality</literal></entry>
1412       <entry><type>cardinal_number</type></entry>
1413       <entry>Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</></entry>
1414      </row>
1415
1416      <row>
1417       <entry><literal>dtd_identifier</literal></entry>
1418       <entry><type>sql_identifier</type></entry>
1419       <entry>
1420        An identifier of the data type descriptor of the column, unique
1421        among the data type descriptors pertaining to the table.  This
1422        is mainly useful for joining with other instances of such
1423        identifiers.  (The specific format of the identifier is not
1424        defined and not guaranteed to remain the same in future
1425        versions.)
1426       </entry>
1427      </row>
1428
1429      <row>
1430       <entry><literal>is_self_referencing</literal></entry>
1431       <entry><type>yes_or_no</type></entry>
1432       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1433      </row>
1434
1435      <row>
1436       <entry><literal>is_identity</literal></entry>
1437       <entry><type>yes_or_no</type></entry>
1438       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1439      </row>
1440
1441      <row>
1442       <entry><literal>identity_generation</literal></entry>
1443       <entry><type>character_data</type></entry>
1444       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1445      </row>
1446
1447      <row>
1448       <entry><literal>identity_start</literal></entry>
1449       <entry><type>character_data</type></entry>
1450       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1451      </row>
1452
1453      <row>
1454       <entry><literal>identity_increment</literal></entry>
1455       <entry><type>character_data</type></entry>
1456       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1457      </row>
1458
1459      <row>
1460       <entry><literal>identity_maximum</literal></entry>
1461       <entry><type>character_data</type></entry>
1462       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1463      </row>
1464
1465      <row>
1466       <entry><literal>identity_minimum</literal></entry>
1467       <entry><type>character_data</type></entry>
1468       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1469      </row>
1470
1471      <row>
1472       <entry><literal>identity_cycle</literal></entry>
1473       <entry><type>yes_or_no</type></entry>
1474       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1475      </row>
1476
1477      <row>
1478       <entry><literal>is_generated</literal></entry>
1479       <entry><type>character_data</type></entry>
1480       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1481      </row>
1482
1483      <row>
1484       <entry><literal>generation_expression</literal></entry>
1485       <entry><type>character_data</type></entry>
1486       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1487      </row>
1488
1489      <row>
1490       <entry><literal>is_updatable</literal></entry>
1491       <entry><type>yes_or_no</type></entry>
1492       <entry>
1493        <literal>YES</literal> if the column is updatable,
1494        <literal>NO</literal> if not (Columns in base tables are always
1495        updatable, columns in views not necessarily)
1496       </entry>
1497      </row>
1498     </tbody>
1499    </tgroup>
1500   </table>
1501
1502   <para>
1503    Since data types can be defined in a variety of ways in SQL, and
1504    <productname>PostgreSQL</productname> contains additional ways to
1505    define data types, their representation in the information schema
1506    can be somewhat difficult.  The column <literal>data_type</literal>
1507    is supposed to identify the underlying built-in type of the column.
1508    In <productname>PostgreSQL</productname>, this means that the type
1509    is defined in the system catalog schema
1510    <literal>pg_catalog</literal>.  This column might be useful if the
1511    application can handle the well-known built-in types specially (for
1512    example, format the numeric types differently or use the data in
1513    the precision columns).  The columns <literal>udt_name</literal>,
1514    <literal>udt_schema</literal>, and <literal>udt_catalog</literal>
1515    always identify the underlying data type of the column, even if the
1516    column is based on a domain.  (Since
1517    <productname>PostgreSQL</productname> treats built-in types like
1518    user-defined types, built-in types appear here as well.  This is an
1519    extension of the SQL standard.)  These columns should be used if an
1520    application wants to process data differently according to the
1521    type, because in that case it wouldn't matter if the column is
1522    really based on a domain.  If the column is based on a domain, the
1523    identity of the domain is stored in the columns
1524    <literal>domain_name</literal>, <literal>domain_schema</literal>,
1525    and <literal>domain_catalog</literal>.  If you want to pair up
1526    columns with their associated data types and treat domains as
1527    separate types, you could write <literal>coalesce(domain_name,
1528    udt_name)</literal>, etc.
1529   </para>
1530  </sect1>
1531
1532  <sect1 id="infoschema-constraint-column-usage">
1533   <title><literal>constraint_column_usage</literal></title>
1534
1535   <para>
1536    The view <literal>constraint_column_usage</literal> identifies all
1537    columns in the current database that are used by some constraint.
1538    Only those columns are shown that are contained in a table owned by
1539    a currently enabled role.  For a check constraint, this view
1540    identifies the columns that are used in the check expression.  For
1541    a foreign key constraint, this view identifies the columns that the
1542    foreign key references.  For a unique or primary key constraint,
1543    this view identifies the constrained columns.
1544   </para>
1545
1546   <table>
1547    <title><literal>constraint_column_usage</literal> Columns</title>
1548
1549    <tgroup cols="3">
1550     <thead>
1551      <row>
1552       <entry>Name</entry>
1553       <entry>Data Type</entry>
1554       <entry>Description</entry>
1555      </row>
1556     </thead>
1557
1558     <tbody>
1559      <row>
1560       <entry><literal>table_catalog</literal></entry>
1561       <entry><type>sql_identifier</type></entry>
1562       <entry>
1563        Name of the database that contains the table that contains the
1564        column that is used by some constraint (always the current
1565        database)
1566       </entry>
1567      </row>
1568
1569      <row>
1570       <entry><literal>table_schema</literal></entry>
1571       <entry><type>sql_identifier</type></entry>
1572       <entry>
1573        Name of the schema that contains the table that contains the
1574        column that is used by some constraint
1575       </entry>
1576      </row>
1577
1578      <row>
1579       <entry><literal>table_name</literal></entry>
1580       <entry><type>sql_identifier</type></entry>
1581       <entry>
1582        Name of the table that contains the column that is used by some
1583        constraint
1584       </entry>
1585      </row>
1586
1587      <row>
1588       <entry><literal>column_name</literal></entry>
1589       <entry><type>sql_identifier</type></entry>
1590       <entry>
1591        Name of the column that is used by some constraint
1592       </entry>
1593      </row>
1594
1595      <row>
1596       <entry><literal>constraint_catalog</literal></entry>
1597       <entry><type>sql_identifier</type></entry>
1598       <entry>Name of the database that contains the constraint (always the current database)</entry>
1599      </row>
1600
1601      <row>
1602       <entry><literal>constraint_schema</literal></entry>
1603       <entry><type>sql_identifier</type></entry>
1604       <entry>Name of the schema that contains the constraint</entry>
1605      </row>
1606
1607      <row>
1608       <entry><literal>constraint_name</literal></entry>
1609       <entry><type>sql_identifier</type></entry>
1610       <entry>Name of the constraint</entry>
1611      </row>
1612     </tbody>
1613    </tgroup>
1614   </table>
1615  </sect1>
1616
1617  <sect1 id="infoschema-constraint-table-usage">
1618   <title><literal>constraint_table_usage</literal></title>
1619
1620   <para>
1621    The view <literal>constraint_table_usage</literal> identifies all
1622    tables in the current database that are used by some constraint and
1623    are owned by a currently enabled role.  (This is different from the
1624    view <literal>table_constraints</literal>, which identifies all
1625    table constraints along with the table they are defined on.)  For a
1626    foreign key constraint, this view identifies the table that the
1627    foreign key references.  For a unique or primary key constraint,
1628    this view simply identifies the table the constraint belongs to.
1629    Check constraints and not-null constraints are not included in this
1630    view.
1631   </para>
1632
1633   <table>
1634    <title><literal>constraint_table_usage</literal> Columns</title>
1635
1636    <tgroup cols="3">
1637     <thead>
1638      <row>
1639       <entry>Name</entry>
1640       <entry>Data Type</entry>
1641       <entry>Description</entry>
1642      </row>
1643     </thead>
1644
1645     <tbody>
1646      <row>
1647       <entry><literal>table_catalog</literal></entry>
1648       <entry><type>sql_identifier</type></entry>
1649       <entry>
1650        Name of the database that contains the table that is used by
1651        some constraint (always the current database)
1652       </entry>
1653      </row>
1654
1655      <row>
1656       <entry><literal>table_schema</literal></entry>
1657       <entry><type>sql_identifier</type></entry>
1658       <entry>
1659        Name of the schema that contains the table that is used by some
1660        constraint
1661       </entry>
1662      </row>
1663
1664      <row>
1665       <entry><literal>table_name</literal></entry>
1666       <entry><type>sql_identifier</type></entry>
1667       <entry>Name of the table that is used by some constraint</entry>
1668      </row>
1669
1670      <row>
1671       <entry><literal>constraint_catalog</literal></entry>
1672       <entry><type>sql_identifier</type></entry>
1673       <entry>Name of the database that contains the constraint (always the current database)</entry>
1674      </row>
1675
1676      <row>
1677       <entry><literal>constraint_schema</literal></entry>
1678       <entry><type>sql_identifier</type></entry>
1679       <entry>Name of the schema that contains the constraint</entry>
1680      </row>
1681
1682      <row>
1683       <entry><literal>constraint_name</literal></entry>
1684       <entry><type>sql_identifier</type></entry>
1685       <entry>Name of the constraint</entry>
1686      </row>
1687     </tbody>
1688    </tgroup>
1689   </table>
1690  </sect1>
1691
1692  <sect1 id="infoschema-data-type-privileges">
1693   <title><literal>data_type_privileges</literal></title>
1694
1695   <para>
1696    The view <literal>data_type_privileges</literal> identifies all
1697    data type descriptors that the current user has access to, by way
1698    of being the owner of the described object or having some privilege
1699    for it.  A data type descriptor is generated whenever a data type
1700    is used in the definition of a table column, a domain, or a
1701    function (as parameter or return type) and stores some information
1702    about how the data type is used in that instance (for example, the
1703    declared maximum length, if applicable).  Each data type
1704    descriptor is assigned an arbitrary identifier that is unique
1705    among the data type descriptor identifiers assigned for one object
1706    (table, domain, function).  This view is probably not useful for
1707    applications, but it is used to define some other views in the
1708    information schema.
1709   </para>
1710
1711   <table>
1712    <title><literal>data_type_privileges</literal> Columns</title>
1713
1714    <tgroup cols="3">
1715     <thead>
1716      <row>
1717       <entry>Name</entry>
1718       <entry>Data Type</entry>
1719       <entry>Description</entry>
1720      </row>
1721     </thead>
1722
1723     <tbody>
1724      <row>
1725       <entry><literal>object_catalog</literal></entry>
1726       <entry><type>sql_identifier</type></entry>
1727       <entry>Name of the database that contains the described object (always the current database)</entry>
1728      </row>
1729
1730      <row>
1731       <entry><literal>object_schema</literal></entry>
1732       <entry><type>sql_identifier</type></entry>
1733       <entry>Name of the schema that contains the described object</entry>
1734      </row>
1735
1736      <row>
1737       <entry><literal>object_name</literal></entry>
1738       <entry><type>sql_identifier</type></entry>
1739       <entry>Name of the described object</entry>
1740      </row>
1741
1742      <row>
1743       <entry><literal>object_type</literal></entry>
1744       <entry><type>character_data</type></entry>
1745       <entry>
1746        The type of the described object: one of
1747        <literal>TABLE</literal> (the data type descriptor pertains to
1748        a column of that table), <literal>DOMAIN</literal> (the data
1749        type descriptors pertains to that domain),
1750        <literal>ROUTINE</literal> (the data type descriptor pertains
1751        to a parameter or the return data type of that function).
1752       </entry>
1753      </row>
1754
1755      <row>
1756       <entry><literal>dtd_identifier</literal></entry>
1757       <entry><type>sql_identifier</type></entry>
1758       <entry>
1759        The identifier of the data type descriptor, which is unique
1760        among the data type descriptors for that same object.
1761       </entry>
1762      </row>
1763     </tbody>
1764    </tgroup>
1765   </table>
1766  </sect1>
1767
1768  <sect1 id="infoschema-domain-constraints">
1769   <title><literal>domain_constraints</literal></title>
1770
1771   <para>
1772    The view <literal>domain_constraints</literal> contains all
1773    constraints belonging to domains defined in the current database.
1774   </para>
1775
1776   <table>
1777    <title><literal>domain_constraints</literal> Columns</title>
1778
1779    <tgroup cols="3">
1780     <thead>
1781      <row>
1782       <entry>Name</entry>
1783       <entry>Data Type</entry>
1784       <entry>Description</entry>
1785      </row>
1786     </thead>
1787
1788     <tbody>
1789      <row>
1790       <entry><literal>constraint_catalog</literal></entry>
1791       <entry><type>sql_identifier</type></entry>
1792       <entry>Name of the database that contains the constraint (always the current database)</entry>
1793      </row>
1794
1795      <row>
1796       <entry><literal>constraint_schema</literal></entry>
1797       <entry><type>sql_identifier</type></entry>
1798       <entry>Name of the schema that contains the constraint</entry>
1799      </row>
1800
1801      <row>
1802       <entry><literal>constraint_name</literal></entry>
1803       <entry><type>sql_identifier</type></entry>
1804       <entry>Name of the constraint</entry>
1805      </row>
1806
1807      <row>
1808       <entry><literal>domain_catalog</literal></entry>
1809       <entry><type>sql_identifier</type></entry>
1810       <entry>Name of the database that contains the domain (always the current database)</entry>
1811      </row>
1812
1813      <row>
1814       <entry><literal>domain_schema</literal></entry>
1815       <entry><type>sql_identifier</type></entry>
1816       <entry>Name of the schema that contains the domain</entry>
1817      </row>
1818
1819      <row>
1820       <entry><literal>domain_name</literal></entry>
1821       <entry><type>sql_identifier</type></entry>
1822       <entry>Name of the domain</entry>
1823      </row>
1824
1825      <row>
1826       <entry><literal>is_deferrable</literal></entry>
1827       <entry><type>yes_or_no</type></entry>
1828       <entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry>
1829      </row>
1830
1831      <row>
1832       <entry><literal>initially_deferred</literal></entry>
1833       <entry><type>yes_or_no</type></entry>
1834       <entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry>
1835      </row>
1836     </tbody>
1837    </tgroup>
1838   </table>
1839  </sect1>
1840
1841  <sect1 id="infoschema-domain-udt-usage">
1842   <title><literal>domain_udt_usage</literal></title>
1843
1844   <para>
1845    The view <literal>domain_udt_usage</literal> identifies all domains
1846    that are based on data types owned by a currently enabled role.
1847    Note that in <productname>PostgreSQL</productname>, built-in data
1848    types behave like user-defined types, so they are included here as
1849    well.
1850   </para>
1851
1852   <table>
1853    <title><literal>domain_udt_usage</literal> Columns</title>
1854
1855    <tgroup cols="3">
1856     <thead>
1857      <row>
1858       <entry>Name</entry>
1859       <entry>Data Type</entry>
1860       <entry>Description</entry>
1861      </row>
1862     </thead>
1863
1864     <tbody>
1865      <row>
1866       <entry><literal>udt_catalog</literal></entry>
1867       <entry><type>sql_identifier</type></entry>
1868       <entry>Name of the database that the domain data type is defined in (always the current database)</entry>
1869      </row>
1870
1871      <row>
1872       <entry><literal>udt_schema</literal></entry>
1873       <entry><type>sql_identifier</type></entry>
1874       <entry>Name of the schema that the domain data type is defined in</entry>
1875      </row>
1876
1877      <row>
1878       <entry><literal>udt_name</literal></entry>
1879       <entry><type>sql_identifier</type></entry>
1880       <entry>Name of the domain data type</entry>
1881      </row>
1882
1883      <row>
1884       <entry><literal>domain_catalog</literal></entry>
1885       <entry><type>sql_identifier</type></entry>
1886       <entry>Name of the database that contains the domain (always the current database)</entry>
1887      </row>
1888
1889      <row>
1890       <entry><literal>domain_schema</literal></entry>
1891       <entry><type>sql_identifier</type></entry>
1892       <entry>Name of the schema that contains the domain</entry>
1893      </row>
1894
1895      <row>
1896       <entry><literal>domain_name</literal></entry>
1897       <entry><type>sql_identifier</type></entry>
1898       <entry>Name of the domain</entry>
1899      </row>
1900     </tbody>
1901    </tgroup>
1902   </table>
1903  </sect1>
1904
1905  <sect1 id="infoschema-domains">
1906   <title><literal>domains</literal></title>
1907
1908   <para>
1909    The view <literal>domains</literal> contains all domains defined in
1910    the current database.
1911   </para>
1912
1913   <table>
1914    <title><literal>domains</literal> Columns</title>
1915
1916    <tgroup cols="3">
1917     <thead>
1918      <row>
1919       <entry>Name</entry>
1920       <entry>Data Type</entry>
1921       <entry>Description</entry>
1922      </row>
1923     </thead>
1924
1925     <tbody>
1926      <row>
1927       <entry><literal>domain_catalog</literal></entry>
1928       <entry><type>sql_identifier</type></entry>
1929       <entry>Name of the database that contains the domain (always the current database)</entry>
1930      </row>
1931
1932      <row>
1933       <entry><literal>domain_schema</literal></entry>
1934       <entry><type>sql_identifier</type></entry>
1935       <entry>Name of the schema that contains the domain</entry>
1936      </row>
1937
1938      <row>
1939       <entry><literal>domain_name</literal></entry>
1940       <entry><type>sql_identifier</type></entry>
1941       <entry>Name of the domain</entry>
1942      </row>
1943
1944      <row>
1945       <entry><literal>data_type</literal></entry>
1946       <entry><type>character_data</type></entry>
1947       <entry>
1948        Data type of the domain, if it is a built-in type, or
1949        <literal>ARRAY</literal> if it is some array (in that case, see
1950        the view <literal>element_types</literal>), else
1951        <literal>USER-DEFINED</literal> (in that case, the type is
1952        identified in <literal>udt_name</literal> and associated
1953        columns).
1954       </entry>
1955      </row>
1956
1957      <row>
1958       <entry><literal>character_maximum_length</literal></entry>
1959       <entry><type>cardinal_number</type></entry>
1960       <entry>
1961        If the domain has a character or bit string type, the declared
1962        maximum length; null for all other data types or if no maximum
1963        length was declared.
1964       </entry>
1965      </row>
1966
1967      <row>
1968       <entry><literal>character_octet_length</literal></entry>
1969       <entry><type>cardinal_number</type></entry>
1970       <entry>
1971        If the domain has a character type, the maximum possible length
1972        in octets (bytes) of a datum; null for all other data types.
1973        The maximum octet length depends on the declared character
1974        maximum length (see above) and the server encoding.
1975       </entry>
1976      </row>
1977
1978      <row>
1979       <entry><literal>character_set_catalog</literal></entry>
1980       <entry><type>sql_identifier</type></entry>
1981       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1982      </row>
1983
1984      <row>
1985       <entry><literal>character_set_schema</literal></entry>
1986       <entry><type>sql_identifier</type></entry>
1987       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1988      </row>
1989
1990      <row>
1991       <entry><literal>character_set_name</literal></entry>
1992       <entry><type>sql_identifier</type></entry>
1993       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
1994      </row>
1995
1996      <row>
1997       <entry><literal>collation_catalog</literal></entry>
1998       <entry><type>sql_identifier</type></entry>
1999       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2000      </row>
2001
2002      <row>
2003       <entry><literal>collation_schema</literal></entry>
2004       <entry><type>sql_identifier</type></entry>
2005       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2006      </row>
2007
2008      <row>
2009       <entry><literal>collation_name</literal></entry>
2010       <entry><type>sql_identifier</type></entry>
2011       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2012      </row>
2013
2014      <row>
2015       <entry><literal>numeric_precision</literal></entry>
2016       <entry><type>cardinal_number</type></entry>
2017       <entry>
2018        If the domain has a numeric type, this column contains the
2019        (declared or implicit) precision of the type for this domain.
2020        The precision indicates the number of significant digits.  It
2021        can be expressed in decimal (base 10) or binary (base 2) terms,
2022        as specified in the column
2023        <literal>numeric_precision_radix</literal>.  For all other data
2024        types, this column is null.
2025       </entry>
2026      </row>
2027
2028      <row>
2029       <entry><literal>numeric_precision_radix</literal></entry>
2030       <entry><type>cardinal_number</type></entry>
2031       <entry>
2032        If the domain has a numeric type, this column indicates in
2033        which base the values in the columns
2034        <literal>numeric_precision</literal> and
2035        <literal>numeric_scale</literal> are expressed.  The value is
2036        either 2 or 10.  For all other data types, this column is null.
2037       </entry>
2038      </row>
2039
2040      <row>
2041       <entry><literal>numeric_scale</literal></entry>
2042       <entry><type>cardinal_number</type></entry>
2043       <entry>
2044        If the domain has an exact numeric type, this column contains
2045        the (declared or implicit) scale of the type for this domain.
2046        The scale indicates the number of significant digits to the
2047        right of the decimal point.  It can be expressed in decimal
2048        (base 10) or binary (base 2) terms, as specified in the column
2049        <literal>numeric_precision_radix</literal>.  For all other data
2050        types, this column is null.
2051       </entry>
2052      </row>
2053
2054      <row>
2055       <entry><literal>datetime_precision</literal></entry>
2056       <entry><type>cardinal_number</type></entry>
2057       <entry>
2058        If <literal>data_type</literal> identifies a date, time,
2059        timestamp, or interval type, this column contains the (declared
2060        or implicit) fractional seconds precision of the type for this
2061        domain, that is, the number of decimal digits maintained
2062        following the decimal point in the seconds value.  For all
2063        other data types, this column is null.
2064       </entry>
2065      </row>
2066
2067      <row>
2068       <entry><literal>interval_type</literal></entry>
2069       <entry><type>character_data</type></entry>
2070       <entry>Not yet implemented</entry>
2071      </row>
2072
2073      <row>
2074       <entry><literal>interval_precision</literal></entry>
2075       <entry><type>character_data</type></entry>
2076       <entry>Not yet implemented</entry>
2077      </row>
2078
2079      <row>
2080       <entry><literal>domain_default</literal></entry>
2081       <entry><type>character_data</type></entry>
2082       <entry>Default expression of the domain</entry>
2083      </row>
2084
2085      <row>
2086       <entry><literal>udt_catalog</literal></entry>
2087       <entry><type>sql_identifier</type></entry>
2088       <entry>Name of the database that the domain data type is defined in (always the current database)</entry>
2089      </row>
2090
2091      <row>
2092       <entry><literal>udt_schema</literal></entry>
2093       <entry><type>sql_identifier</type></entry>
2094       <entry>Name of the schema that the domain data type is defined in</entry>
2095      </row>
2096
2097      <row>
2098       <entry><literal>udt_name</literal></entry>
2099       <entry><type>sql_identifier</type></entry>
2100       <entry>Name of the domain data type</entry>
2101      </row>
2102
2103      <row>
2104       <entry><literal>scope_catalog</literal></entry>
2105       <entry><type>sql_identifier</type></entry>
2106       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2107      </row>
2108
2109      <row>
2110       <entry><literal>scope_schema</literal></entry>
2111       <entry><type>sql_identifier</type></entry>
2112       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2113      </row>
2114
2115      <row>
2116       <entry><literal>scope_name</literal></entry>
2117       <entry><type>sql_identifier</type></entry>
2118       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2119      </row>
2120
2121      <row>
2122       <entry><literal>maximum_cardinality</literal></entry>
2123       <entry><type>cardinal_number</type></entry>
2124       <entry>Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</></entry>
2125      </row>
2126
2127      <row>
2128       <entry><literal>dtd_identifier</literal></entry>
2129       <entry><type>sql_identifier</type></entry>
2130       <entry>
2131        An identifier of the data type descriptor of the domain, unique
2132        among the data type descriptors pertaining to the domain (which
2133        is trivial, because a domain only contains one data type
2134        descriptor).  This is mainly useful for joining with other
2135        instances of such identifiers.  (The specific format of the
2136        identifier is not defined and not guaranteed to remain the same
2137        in future versions.)
2138       </entry>
2139      </row>
2140     </tbody>
2141    </tgroup>
2142   </table>
2143  </sect1>
2144
2145  <sect1 id="infoschema-element-types">
2146   <title><literal>element_types</literal></title>
2147
2148   <para>
2149    The view <literal>element_types</literal> contains the data type
2150    descriptors of the elements of arrays.  When a table column, composite-type attribute,
2151    domain, function parameter, or function return value is defined to
2152    be of an array type, the respective information schema view only
2153    contains <literal>ARRAY</literal> in the column
2154    <literal>data_type</literal>.  To obtain information on the element
2155    type of the array, you can join the respective view with this view.
2156    For example, to show the columns of a table with data types and
2157    array element types, if applicable, you could do:
2158 <programlisting>
2159 SELECT c.column_name, c.data_type, e.data_type AS element_type
2160 FROM information_schema.columns c LEFT JOIN information_schema.element_types e
2161      ON ((c.table_catalog, c.table_schema, c.table_name, 'TABLE', c.dtd_identifier)
2162        = (e.object_catalog, e.object_schema, e.object_name, e.object_type, e.collection_type_identifier))
2163 WHERE c.table_schema = '...' AND c.table_name = '...'
2164 ORDER BY c.ordinal_position;
2165 </programlisting>
2166    This view only includes objects that the current user has access
2167    to, by way of being the owner or having some privilege.
2168   </para>
2169
2170   <table>
2171    <title><literal>element_types</literal> Columns</title>
2172
2173    <tgroup cols="3">
2174     <thead>
2175      <row>
2176       <entry>Name</entry>
2177       <entry>Data Type</entry>
2178       <entry>Description</entry>
2179      </row>
2180     </thead>
2181
2182     <tbody>
2183      <row>
2184       <entry><literal>object_catalog</literal></entry>
2185       <entry><type>sql_identifier</type></entry>
2186       <entry>
2187        Name of the database that contains the object that uses the
2188        array being described (always the current database)
2189       </entry>
2190      </row>
2191
2192      <row>
2193       <entry><literal>object_schema</literal></entry>
2194       <entry><type>sql_identifier</type></entry>
2195       <entry>
2196        Name of the schema that contains the object that uses the array
2197        being described
2198       </entry>
2199      </row>
2200
2201      <row>
2202       <entry><literal>object_name</literal></entry>
2203       <entry><type>sql_identifier</type></entry>
2204       <entry>
2205        Name of the object that uses the array being described
2206       </entry>
2207      </row>
2208
2209      <row>
2210       <entry><literal>object_type</literal></entry>
2211       <entry><type>character_data</type></entry>
2212       <entry>
2213        The type of the object that uses the array being described: one
2214        of <literal>TABLE</literal> (the array is used by a column of
2215        that table), <literal>USER-DEFINED TYPE</literal> (the array is
2216        used by an attribute of that composite type),
2217        <literal>DOMAIN</literal> (the array is used by that domain),
2218        <literal>ROUTINE</literal> (the array is used by a parameter or
2219        the return data type of that function).
2220       </entry>
2221      </row>
2222
2223      <row>
2224       <entry><literal>collection_type_identifier</literal></entry>
2225       <entry><type>sql_identifier</type></entry>
2226       <entry>
2227        The identifier of the data type descriptor of the array being
2228        described.  Use this to join with the
2229        <literal>dtd_identifier</literal> columns of other information
2230        schema views.
2231       </entry>
2232      </row>
2233
2234      <row>
2235       <entry><literal>data_type</literal></entry>
2236       <entry><type>character_data</type></entry>
2237       <entry>
2238        Data type of the array elements, if it is a built-in type, else
2239        <literal>USER-DEFINED</literal> (in that case, the type is
2240        identified in <literal>udt_name</literal> and associated
2241        columns).
2242       </entry>
2243      </row>
2244
2245      <row>
2246       <entry><literal>character_maximum_length</literal></entry>
2247       <entry><type>cardinal_number</type></entry>
2248       <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry>
2249      </row>
2250
2251      <row>
2252       <entry><literal>character_octet_length</literal></entry>
2253       <entry><type>cardinal_number</type></entry>
2254       <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry>
2255      </row>
2256
2257      <row>
2258       <entry><literal>character_set_catalog</literal></entry>
2259       <entry><type>sql_identifier</type></entry>
2260       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2261      </row>
2262
2263      <row>
2264       <entry><literal>character_set_schema</literal></entry>
2265       <entry><type>sql_identifier</type></entry>
2266       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2267      </row>
2268
2269      <row>
2270       <entry><literal>character_set_name</literal></entry>
2271       <entry><type>sql_identifier</type></entry>
2272       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2273      </row>
2274
2275      <row>
2276       <entry><literal>collation_catalog</literal></entry>
2277       <entry><type>sql_identifier</type></entry>
2278       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2279      </row>
2280
2281      <row>
2282       <entry><literal>collation_schema</literal></entry>
2283       <entry><type>sql_identifier</type></entry>
2284       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2285      </row>
2286
2287      <row>
2288       <entry><literal>collation_name</literal></entry>
2289       <entry><type>sql_identifier</type></entry>
2290       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2291      </row>
2292
2293      <row>
2294       <entry><literal>numeric_precision</literal></entry>
2295       <entry><type>cardinal_number</type></entry>
2296       <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry>
2297      </row>
2298
2299      <row>
2300       <entry><literal>numeric_precision_radix</literal></entry>
2301       <entry><type>cardinal_number</type></entry>
2302       <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry>
2303      </row>
2304
2305      <row>
2306       <entry><literal>numeric_scale</literal></entry>
2307       <entry><type>cardinal_number</type></entry>
2308       <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry>
2309      </row>
2310
2311      <row>
2312       <entry><literal>datetime_precision</literal></entry>
2313       <entry><type>cardinal_number</type></entry>
2314       <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry>
2315      </row>
2316
2317      <row>
2318       <entry><literal>interval_type</literal></entry>
2319       <entry><type>character_data</type></entry>
2320       <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry>
2321      </row>
2322
2323      <row>
2324       <entry><literal>interval_precision</literal></entry>
2325       <entry><type>character_data</type></entry>
2326       <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry>
2327      </row>
2328
2329      <row>
2330       <entry><literal>domain_default</literal></entry>
2331       <entry><type>character_data</type></entry>
2332       <entry>Not yet implemented</entry>
2333      </row>
2334
2335      <row>
2336       <entry><literal>udt_catalog</literal></entry>
2337       <entry><type>sql_identifier</type></entry>
2338       <entry>
2339        Name of the database that the data type of the elements is
2340        defined in (always the current database)
2341       </entry>
2342      </row>
2343
2344      <row>
2345       <entry><literal>udt_schema</literal></entry>
2346       <entry><type>sql_identifier</type></entry>
2347       <entry>
2348        Name of the schema that the data type of the elements is
2349        defined in
2350       </entry>
2351      </row>
2352
2353      <row>
2354       <entry><literal>udt_name</literal></entry>
2355       <entry><type>sql_identifier</type></entry>
2356       <entry>
2357        Name of the data type of the elements
2358       </entry>
2359      </row>
2360
2361      <row>
2362       <entry><literal>scope_catalog</literal></entry>
2363       <entry><type>sql_identifier</type></entry>
2364       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2365      </row>
2366
2367      <row>
2368       <entry><literal>scope_schema</literal></entry>
2369       <entry><type>sql_identifier</type></entry>
2370       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2371      </row>
2372
2373      <row>
2374       <entry><literal>scope_name</literal></entry>
2375       <entry><type>sql_identifier</type></entry>
2376       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2377      </row>
2378
2379      <row>
2380       <entry><literal>maximum_cardinality</literal></entry>
2381       <entry><type>cardinal_number</type></entry>
2382       <entry>Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</></entry>
2383      </row>
2384
2385      <row>
2386       <entry><literal>dtd_identifier</literal></entry>
2387       <entry><type>sql_identifier</type></entry>
2388       <entry>
2389        An identifier of the data type descriptor of the element.  This
2390        is currently not useful.
2391       </entry>
2392      </row>
2393     </tbody>
2394    </tgroup>
2395   </table>
2396  </sect1>
2397
2398  <sect1 id="infoschema-enabled-roles">
2399   <title><literal>enabled_roles</literal></title>
2400
2401   <para>
2402    The view <literal>enabled_roles</literal> identifies the currently
2403    <quote>enabled roles</quote>.  The enabled roles are recursively
2404    defined as the current user together with all roles that have been
2405    granted to the enabled roles with automatic inheritance.  In other
2406    words, these are all roles that the current user has direct or
2407    indirect, automatically inheriting membership in.
2408    <indexterm><primary>enabled role</primary></indexterm>
2409    <indexterm><primary>role</primary><secondary>enabled</secondary></indexterm>
2410   </para>
2411
2412   <para>
2413    For permission checking, the set of <quote>applicable roles</quote>
2414    is applied, which can be broader than the set of enabled roles.  So
2415    generally, it is better to use the view
2416    <literal>applicable_roles</literal> instead of this one; see also
2417    there.
2418   </para>
2419
2420   <table>
2421    <title><literal>enabled_roles</literal> Columns</title>
2422
2423    <tgroup cols="3">
2424     <thead>
2425      <row>
2426       <entry>Name</entry>
2427       <entry>Data Type</entry>
2428       <entry>Description</entry>
2429      </row>
2430     </thead>
2431
2432     <tbody>
2433      <row>
2434       <entry><literal>role_name</literal></entry>
2435       <entry><type>sql_identifier</type></entry>
2436       <entry>Name of a role</entry>
2437      </row>
2438     </tbody>
2439    </tgroup>
2440   </table>
2441  </sect1>
2442
2443  <sect1 id="infoschema-foreign-data-wrapper-options">
2444   <title><literal>foreign_data_wrapper_options</literal></title>
2445
2446   <para>
2447    The view <literal>foreign_data_wrapper_options</literal> contains
2448    all the options defined for foreign-data wrappers in the current
2449    database.  Only those foreign-data wrappers are shown that the
2450    current user has access to (by way of being the owner or having
2451    some privilege).
2452   </para>
2453
2454   <table>
2455    <title><literal>foreign_data_wrapper_options</literal> Columns</title>
2456
2457    <tgroup cols="3">
2458     <thead>
2459      <row>
2460       <entry>Name</entry>
2461       <entry>Data Type</entry>
2462       <entry>Description</entry>
2463      </row>
2464     </thead>
2465
2466     <tbody>
2467      <row>
2468       <entry><literal>foreign_data_wrapper_catalog</literal></entry>
2469       <entry><type>sql_identifier</type></entry>
2470       <entry>Name of the database that the foreign-data wrapper is defined in (always the current database)</entry>
2471      </row>
2472
2473      <row>
2474       <entry><literal>foreign_data_wrapper_name</literal></entry>
2475       <entry><type>sql_identifier</type></entry>
2476       <entry>Name of the foreign-data wrapper</entry>
2477      </row>
2478
2479      <row>
2480       <entry><literal>option_name</literal></entry>
2481       <entry><type>sql_identifier</type></entry>
2482       <entry>Name of an option</entry>
2483      </row>
2484
2485      <row>
2486       <entry><literal>option_value</literal></entry>
2487       <entry><type>character_data</type></entry>
2488       <entry>Value of the option</entry>
2489      </row>
2490     </tbody>
2491    </tgroup>
2492   </table>
2493  </sect1>
2494
2495  <sect1 id="infoschema-foreign-data-wrappers">
2496   <title><literal>foreign_data_wrappers</literal></title>
2497
2498   <para>
2499    The view <literal>foreign_data_wrappers</literal> contains all
2500    foreign-data wrappers defined in the current database.  Only those
2501    foreign-data wrappers are shown that the current user has access to
2502    (by way of being the owner or having some privilege).
2503   </para>
2504
2505   <table>
2506    <title><literal>foreign_data_wrappers</literal> Columns</title>
2507
2508    <tgroup cols="3">
2509     <thead>
2510      <row>
2511       <entry>Name</entry>
2512       <entry>Data Type</entry>
2513       <entry>Description</entry>
2514      </row>
2515     </thead>
2516
2517     <tbody>
2518      <row>
2519       <entry><literal>foreign_data_wrapper_catalog</literal></entry>
2520       <entry><type>sql_identifier</type></entry>
2521       <entry>Name of the database that contains the foreign-data
2522       wrapper (always the current database)</entry>
2523      </row>
2524
2525      <row>
2526       <entry><literal>foreign_data_wrapper_name</literal></entry>
2527       <entry><type>sql_identifier</type></entry>
2528       <entry>Name of the foreign-data wrapper</entry>
2529      </row>
2530
2531      <row>
2532       <entry><literal>authorization_identifier</literal></entry>
2533       <entry><type>sql_identifier</type></entry>
2534       <entry>Name of the owner of the foreign server</entry>
2535      </row>
2536
2537      <row>
2538       <entry><literal>library_name</literal></entry>
2539       <entry><type>character_data</type></entry>
2540       <entry>File name of the library that implementing this foreign-data wrapper</entry>
2541      </row>
2542
2543      <row>
2544       <entry><literal>foreign_data_wrapper_language</literal></entry>
2545       <entry><type>character_data</type></entry>
2546       <entry>Language used to implement this foreign-data wrapper</entry>
2547      </row>
2548     </tbody>
2549    </tgroup>
2550   </table>
2551  </sect1>
2552
2553  <sect1 id="infoschema-foreign-server-options">
2554   <title><literal>foreign_server_options</literal></title>
2555
2556   <para>
2557    The view <literal>foreign_server_options</literal> contains all the
2558    options defined for foreign servers in the current database.  Only
2559    those foreign servers are shown that the current user has access to
2560    (by way of being the owner or having some privilege).
2561   </para>
2562
2563   <table>
2564    <title><literal>foreign_server_options</literal> Columns</title>
2565
2566    <tgroup cols="3">
2567     <thead>
2568      <row>
2569       <entry>Name</entry>
2570       <entry>Data Type</entry>
2571       <entry>Description</entry>
2572      </row>
2573     </thead>
2574
2575     <tbody>
2576      <row>
2577       <entry><literal>foreign_server_catalog</literal></entry>
2578       <entry><type>sql_identifier</type></entry>
2579       <entry>Name of the database that the foreign server is defined in (always the current database)</entry>
2580      </row>
2581
2582      <row>
2583       <entry><literal>foreign_server_name</literal></entry>
2584       <entry><type>sql_identifier</type></entry>
2585       <entry>Name of the foreign server</entry>
2586      </row>
2587
2588      <row>
2589       <entry><literal>option_name</literal></entry>
2590       <entry><type>sql_identifier</type></entry>
2591       <entry>Name of an option</entry>
2592      </row>
2593
2594      <row>
2595       <entry><literal>option_value</literal></entry>
2596       <entry><type>character_data</type></entry>
2597       <entry>Value of the option</entry>
2598      </row>
2599     </tbody>
2600    </tgroup>
2601   </table>
2602  </sect1>
2603
2604  <sect1 id="infoschema-foreign-servers">
2605   <title><literal>foreign_servers</literal></title>
2606
2607   <para>
2608    The view <literal>foreign_servers</literal> contains all foreign
2609    servers defined in the current database.  Only those foreign
2610    servers are shown that the current user has access to (by way of
2611    being the owner or having some privilege).
2612   </para>
2613
2614   <table>
2615    <title><literal>foreign_servers</literal> Columns</title>
2616
2617    <tgroup cols="3">
2618     <thead>
2619      <row>
2620       <entry>Name</entry>
2621       <entry>Data Type</entry>
2622       <entry>Description</entry>
2623      </row>
2624     </thead>
2625
2626     <tbody>
2627      <row>
2628       <entry><literal>foreign_server_catalog</literal></entry>
2629       <entry><type>sql_identifier</type></entry>
2630       <entry>Name of the database that the foreign server is defined in (always the current database)</entry>
2631      </row>
2632
2633      <row>
2634       <entry><literal>foreign_server_name</literal></entry>
2635       <entry><type>sql_identifier</type></entry>
2636       <entry>Name of the foreign server</entry>
2637      </row>
2638
2639      <row>
2640       <entry><literal>foreign_data_wrapper_catalog</literal></entry>
2641       <entry><type>sql_identifier</type></entry>
2642       <entry>Name of the database that contains the foreign-data
2643       wrapper used by the foreign server (always the current database)</entry>
2644      </row>
2645
2646      <row>
2647       <entry><literal>foreign_data_wrapper_name</literal></entry>
2648       <entry><type>sql_identifier</type></entry>
2649       <entry>Name of the foreign-data wrapper used by the foreign server</entry>
2650      </row>
2651
2652      <row>
2653       <entry><literal>foreign_server_type</literal></entry>
2654       <entry><type>character_data</type></entry>
2655       <entry>Foreign server type information, if specified upon creation</entry>
2656      </row>
2657
2658      <row>
2659       <entry><literal>foreign_server_version</literal></entry>
2660       <entry><type>character_data</type></entry>
2661       <entry>Foreign server version information, if specified upon creation</entry>
2662      </row>
2663
2664      <row>
2665       <entry><literal>authorization_identifier</literal></entry>
2666       <entry><type>sql_identifier</type></entry>
2667       <entry>Name of the owner of the foreign server</entry>
2668      </row>
2669     </tbody>
2670    </tgroup>
2671   </table>
2672  </sect1>
2673
2674  <sect1 id="infoschema-foreign-table-options">
2675   <title><literal>foreign_table_options</literal></title>
2676
2677   <para>
2678    The view <literal>foreign_table_options</literal> contains all the
2679    options defined for foreign tables in the current database.  Only
2680    those foreign tables are shown that the current user has access to
2681    (by way of being the owner or having some privilege).
2682   </para>
2683
2684   <table>
2685    <title><literal>foreign_table_options</literal> Columns</title>
2686
2687    <tgroup cols="3">
2688     <thead>
2689      <row>
2690       <entry>Name</entry>
2691       <entry>Data Type</entry>
2692       <entry>Description</entry>
2693      </row>
2694     </thead>
2695
2696     <tbody>
2697      <row>
2698       <entry><literal>foreign_table_catalog</literal></entry>
2699       <entry><type>sql_identifier</type></entry>
2700       <entry>Name of the database that contains the foreign table (always the current database)</entry>
2701      </row>
2702
2703      <row>
2704       <entry><literal>foreign_table_schema</literal></entry>
2705       <entry><type>sql_identifier</type></entry>
2706       <entry>Name of the schema that contains the foreign table</entry>
2707      </row>
2708
2709      <row>
2710       <entry><literal>foreign_table_name</literal></entry>
2711       <entry><type>sql_identifier</type></entry>
2712       <entry>Name of the foreign table</entry>
2713      </row>
2714
2715      <row>
2716       <entry><literal>foreign_server_catalog</literal></entry>
2717       <entry><type>sql_identifier</type></entry>
2718       <entry>Name of the database that the foreign server is defined in (always the current database)</entry>
2719      </row>
2720
2721      <row>
2722       <entry><literal>foreign_server_name</literal></entry>
2723       <entry><type>sql_identifier</type></entry>
2724       <entry>Name of the foreign server</entry>
2725      </row>
2726
2727      <row>
2728       <entry><literal>option_name</literal></entry>
2729       <entry><type>sql_identifier</type></entry>
2730       <entry>Name of an option</entry>
2731      </row>
2732
2733      <row>
2734       <entry><literal>option_value</literal></entry>
2735       <entry><type>character_data</type></entry>
2736       <entry>Value of the option</entry>
2737      </row>
2738     </tbody>
2739    </tgroup>
2740   </table>
2741  </sect1>
2742
2743  <sect1 id="infoschema-foreign-tables">
2744   <title><literal>foreign_tables</literal></title>
2745
2746   <para>
2747    The view <literal>foreign_tables</literal> contains all foreign
2748    tables defined in the current database.  Only those foreign
2749    tables are shown that the current user has access to (by way of
2750    being the owner or having some privilege).
2751   </para>
2752
2753   <table>
2754    <title><literal>foreign_tables</literal> Columns</title>
2755
2756    <tgroup cols="3">
2757     <thead>
2758      <row>
2759       <entry>Name</entry>
2760       <entry>Data Type</entry>
2761       <entry>Description</entry>
2762      </row>
2763     </thead>
2764
2765     <tbody>
2766      <row>
2767       <entry><literal>foreign_table_catalog</literal></entry>
2768       <entry><type>sql_identifier</type></entry>
2769       <entry>Name of the database that the foreign table is defined in (always the current database)</entry>
2770      </row>
2771
2772      <row>
2773       <entry><literal>foreign_table_schema</literal></entry>
2774       <entry><type>sql_identifier</type></entry>
2775       <entry>Name of the schema that contains the foreign table</entry>
2776      </row>
2777
2778      <row>
2779       <entry><literal>foreign_table_name</literal></entry>
2780       <entry><type>sql_identifier</type></entry>
2781       <entry>Name of the foreign table</entry>
2782      </row>
2783
2784      <row>
2785       <entry><literal>foreign_server_catalog</literal></entry>
2786       <entry><type>sql_identifier</type></entry>
2787       <entry>Name of the database that the foreign server is defined in (always the current database)</entry>
2788      </row>
2789
2790      <row>
2791       <entry><literal>foreign_server_name</literal></entry>
2792       <entry><type>sql_identifier</type></entry>
2793       <entry>Name of the foreign server</entry>
2794      </row>
2795     </tbody>
2796    </tgroup>
2797   </table>
2798  </sect1>
2799
2800  <sect1 id="infoschema-key-column-usage">
2801   <title><literal>key_column_usage</literal></title>
2802
2803   <para>
2804    The view <literal>key_column_usage</literal> identifies all columns
2805    in the current database that are restricted by some unique, primary
2806    key, or foreign key constraint.  Check constraints are not included
2807    in this view.  Only those columns are shown that the current user
2808    has access to, by way of being the owner or having some privilege.
2809   </para>
2810
2811   <table>
2812    <title><literal>key_column_usage</literal> Columns</title>
2813
2814    <tgroup cols="3">
2815     <thead>
2816      <row>
2817       <entry>Name</entry>
2818       <entry>Data Type</entry>
2819       <entry>Description</entry>
2820      </row>
2821     </thead>
2822
2823     <tbody>
2824      <row>
2825       <entry><literal>constraint_catalog</literal></entry>
2826       <entry><type>sql_identifier</type></entry>
2827       <entry>Name of the database that contains the constraint (always the current database)</entry>
2828      </row>
2829
2830      <row>
2831       <entry><literal>constraint_schema</literal></entry>
2832       <entry><type>sql_identifier</type></entry>
2833       <entry>Name of the schema that contains the constraint</entry>
2834      </row>
2835
2836      <row>
2837       <entry><literal>constraint_name</literal></entry>
2838       <entry><type>sql_identifier</type></entry>
2839       <entry>Name of the constraint</entry>
2840      </row>
2841
2842      <row>
2843       <entry><literal>table_catalog</literal></entry>
2844       <entry><type>sql_identifier</type></entry>
2845       <entry>
2846        Name of the database that contains the table that contains the
2847        column that is restricted by this constraint (always the
2848        current database)
2849       </entry>
2850      </row>
2851
2852      <row>
2853       <entry><literal>table_schema</literal></entry>
2854       <entry><type>sql_identifier</type></entry>
2855       <entry>
2856        Name of the schema that contains the table that contains the
2857        column that is restricted by this constraint
2858       </entry>
2859      </row>
2860
2861      <row>
2862       <entry><literal>table_name</literal></entry>
2863       <entry><type>sql_identifier</type></entry>
2864       <entry>
2865        Name of the table that contains the column that is restricted
2866        by this constraint
2867       </entry>
2868      </row>
2869
2870      <row>
2871       <entry><literal>column_name</literal></entry>
2872       <entry><type>sql_identifier</type></entry>
2873       <entry>
2874        Name of the column that is restricted by this constraint
2875       </entry>
2876      </row>
2877
2878      <row>
2879       <entry><literal>ordinal_position</literal></entry>
2880       <entry><type>cardinal_number</type></entry>
2881       <entry>
2882        Ordinal position of the column within the constraint key (count
2883        starts at 1)
2884       </entry>
2885      </row>
2886
2887      <row>
2888       <entry><literal>position_in_unique_constraint</literal></entry>
2889       <entry><type>cardinal_number</type></entry>
2890       <entry>
2891        For a foreign-key constraint, ordinal position of the referenced
2892        column within its unique constraint (count starts at 1);
2893        otherwise null
2894       </entry>
2895      </row>
2896     </tbody>
2897    </tgroup>
2898   </table>
2899  </sect1>
2900
2901  <sect1 id="infoschema-parameters">
2902   <title><literal>parameters</literal></title>
2903
2904   <para>
2905    The view <literal>parameters</literal> contains information about
2906    the parameters (arguments) of all functions in the current database.
2907    Only those functions are shown that the current user has access to
2908    (by way of being the owner or having some privilege).
2909   </para>
2910
2911   <table>
2912    <title><literal>parameters</literal> Columns</title>
2913
2914    <tgroup cols="3">
2915     <thead>
2916      <row>
2917       <entry>Name</entry>
2918       <entry>Data Type</entry>
2919       <entry>Description</entry>
2920      </row>
2921     </thead>
2922
2923     <tbody>
2924      <row>
2925       <entry><literal>specific_catalog</literal></entry>
2926       <entry><type>sql_identifier</type></entry>
2927       <entry>Name of the database containing the function (always the current database)</entry>
2928      </row>
2929
2930      <row>
2931       <entry><literal>specific_schema</literal></entry>
2932       <entry><type>sql_identifier</type></entry>
2933       <entry>Name of the schema containing the function</entry>
2934      </row>
2935
2936      <row>
2937       <entry><literal>specific_name</literal></entry>
2938       <entry><type>sql_identifier</type></entry>
2939       <entry>
2940        The <quote>specific name</quote> of the function.  See <xref
2941        linkend="infoschema-routines"> for more information.
2942       </entry>
2943      </row>
2944
2945      <row>
2946       <entry><literal>ordinal_position</literal></entry>
2947       <entry><type>cardinal_number</type></entry>
2948       <entry>
2949        Ordinal position of the parameter in the argument list of the
2950        function (count starts at 1)
2951       </entry>
2952      </row>
2953
2954      <row>
2955       <entry><literal>parameter_mode</literal></entry>
2956       <entry><type>character_data</type></entry>
2957       <entry>
2958        <literal>IN</literal> for input parameter,
2959        <literal>OUT</literal> for output parameter,
2960        and <literal>INOUT</literal> for input/output parameter.
2961       </entry>
2962      </row>
2963
2964      <row>
2965       <entry><literal>is_result</literal></entry>
2966       <entry><type>yes_or_no</type></entry>
2967       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2968      </row>
2969
2970      <row>
2971       <entry><literal>as_locator</literal></entry>
2972       <entry><type>yes_or_no</type></entry>
2973       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
2974      </row>
2975
2976      <row>
2977       <entry><literal>parameter_name</literal></entry>
2978       <entry><type>sql_identifier</type></entry>
2979       <entry>Name of the parameter, or null if the parameter has no name</entry>
2980      </row>
2981
2982      <row>
2983       <entry><literal>data_type</literal></entry>
2984       <entry><type>character_data</type></entry>
2985       <entry>
2986        Data type of the parameter, if it is a built-in type, or
2987        <literal>ARRAY</literal> if it is some array (in that case, see
2988        the view <literal>element_types</literal>), else
2989        <literal>USER-DEFINED</literal> (in that case, the type is
2990        identified in <literal>udt_name</literal> and associated
2991        columns).
2992       </entry>
2993      </row>
2994
2995      <row>
2996       <entry><literal>character_maximum_length</literal></entry>
2997       <entry><type>cardinal_number</type></entry>
2998       <entry>Always null, since this information is not applied to parameter data types in <productname>PostgreSQL</></entry>
2999      </row>
3000
3001      <row>
3002       <entry><literal>character_octet_length</literal></entry>
3003       <entry><type>cardinal_number</type></entry>
3004       <entry>Always null, since this information is not applied to parameter data types in <productname>PostgreSQL</></entry>
3005      </row>
3006
3007      <row>
3008       <entry><literal>character_set_catalog</literal></entry>
3009       <entry><type>sql_identifier</type></entry>
3010       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3011      </row>
3012
3013      <row>
3014       <entry><literal>character_set_schema</literal></entry>
3015       <entry><type>sql_identifier</type></entry>
3016       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3017      </row>
3018
3019      <row>
3020       <entry><literal>character_set_name</literal></entry>
3021       <entry><type>sql_identifier</type></entry>
3022       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3023      </row>
3024
3025      <row>
3026       <entry><literal>collation_catalog</literal></entry>
3027       <entry><type>sql_identifier</type></entry>
3028       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3029      </row>
3030
3031      <row>
3032       <entry><literal>collation_schema</literal></entry>
3033       <entry><type>sql_identifier</type></entry>
3034       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3035      </row>
3036
3037      <row>
3038       <entry><literal>collation_name</literal></entry>
3039       <entry><type>sql_identifier</type></entry>
3040       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3041      </row>
3042
3043      <row>
3044       <entry><literal>numeric_precision</literal></entry>
3045       <entry><type>cardinal_number</type></entry>
3046       <entry>Always null, since this information is not applied to parameter data types in <productname>PostgreSQL</></entry>
3047      </row>
3048
3049      <row>
3050       <entry><literal>numeric_precision_radix</literal></entry>
3051       <entry><type>cardinal_number</type></entry>
3052       <entry>Always null, since this information is not applied to parameter data types in <productname>PostgreSQL</></entry>
3053      </row>
3054
3055      <row>
3056       <entry><literal>numeric_scale</literal></entry>
3057       <entry><type>cardinal_number</type></entry>
3058       <entry>Always null, since this information is not applied to parameter data types in <productname>PostgreSQL</></entry>
3059      </row>
3060
3061      <row>
3062       <entry><literal>datetime_precision</literal></entry>
3063       <entry><type>cardinal_number</type></entry>
3064       <entry>Always null, since this information is not applied to parameter data types in <productname>PostgreSQL</></entry>
3065      </row>
3066
3067      <row>
3068       <entry><literal>interval_type</literal></entry>
3069       <entry><type>character_data</type></entry>
3070       <entry>Always null, since this information is not applied to parameter data types in <productname>PostgreSQL</></entry>
3071      </row>
3072
3073      <row>
3074       <entry><literal>interval_precision</literal></entry>
3075       <entry><type>character_data</type></entry>
3076       <entry>Always null, since this information is not applied to parameter data types in <productname>PostgreSQL</></entry>
3077      </row>
3078
3079      <row>
3080       <entry><literal>udt_catalog</literal></entry>
3081       <entry><type>sql_identifier</type></entry>
3082       <entry>
3083        Name of the database that the data type of the parameter is
3084        defined in (always the current database)
3085       </entry>
3086      </row>
3087
3088      <row>
3089       <entry><literal>udt_schema</literal></entry>
3090       <entry><type>sql_identifier</type></entry>
3091       <entry>
3092        Name of the schema that the data type of the parameter is
3093        defined in
3094       </entry>
3095      </row>
3096
3097      <row>
3098       <entry><literal>udt_name</literal></entry>
3099       <entry><type>sql_identifier</type></entry>
3100       <entry>
3101        Name of the data type of the parameter
3102       </entry>
3103      </row>
3104
3105      <row>
3106       <entry><literal>scope_catalog</literal></entry>
3107       <entry><type>sql_identifier</type></entry>
3108       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3109      </row>
3110
3111      <row>
3112       <entry><literal>scope_schema</literal></entry>
3113       <entry><type>sql_identifier</type></entry>
3114       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3115      </row>
3116
3117      <row>
3118       <entry><literal>scope_name</literal></entry>
3119       <entry><type>sql_identifier</type></entry>
3120       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3121      </row>
3122
3123      <row>
3124       <entry><literal>maximum_cardinality</literal></entry>
3125       <entry><type>cardinal_number</type></entry>
3126       <entry>Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</></entry>
3127      </row>
3128
3129      <row>
3130       <entry><literal>dtd_identifier</literal></entry>
3131       <entry><type>sql_identifier</type></entry>
3132       <entry>
3133        An identifier of the data type descriptor of the parameter,
3134        unique among the data type descriptors pertaining to the
3135        function.  This is mainly useful for joining with other
3136        instances of such identifiers.  (The specific format of the
3137        identifier is not defined and not guaranteed to remain the same
3138        in future versions.)
3139       </entry>
3140      </row>
3141     </tbody>
3142    </tgroup>
3143   </table>
3144  </sect1>
3145
3146  <sect1 id="infoschema-referential-constraints">
3147   <title><literal>referential_constraints</literal></title>
3148
3149   <para>
3150    The view <literal>referential_constraints</literal> contains all
3151    referential (foreign key) constraints in the current database.
3152    Only those constraints are shown for which the current user has
3153    write access to the referencing table (by way of being the
3154    owner or having some privilege other than SELECT).
3155   </para>
3156
3157   <table>
3158    <title><literal>referential_constraints</literal> Columns</title>
3159
3160    <tgroup cols="3">
3161     <thead>
3162      <row>
3163       <entry>Name</entry>
3164       <entry>Data Type</entry>
3165       <entry>Description</entry>
3166      </row>
3167     </thead>
3168
3169     <tbody>
3170      <row>
3171       <entry><literal>constraint_catalog</literal></entry>
3172       <entry><literal>sql_identifier</literal></entry>
3173       <entry>Name of the database containing the constraint (always the current database)</entry>
3174      </row>
3175
3176      <row>
3177       <entry><literal>constraint_schema</literal></entry>
3178       <entry><literal>sql_identifier</literal></entry>
3179       <entry>Name of the schema containing the constraint</entry>
3180      </row>
3181
3182      <row>
3183       <entry><literal>constraint_name</literal></entry>
3184       <entry><literal>sql_identifier</literal></entry>
3185       <entry>Name of the constraint</entry>
3186      </row>
3187
3188      <row>
3189       <entry><literal>unique_constraint_catalog</literal></entry>
3190       <entry><literal>sql_identifier</literal></entry>
3191       <entry>
3192        Name of the database that contains the unique or primary key
3193        constraint that the foreign key constraint references (always
3194        the current database)
3195       </entry>
3196      </row>
3197
3198      <row>
3199       <entry><literal>unique_constraint_schema</literal></entry>
3200       <entry><literal>sql_identifier</literal></entry>
3201       <entry>
3202        Name of the schema that contains the unique or primary key
3203        constraint that the foreign key constraint references
3204       </entry>
3205      </row>
3206
3207      <row>
3208       <entry><literal>unique_constraint_name</literal></entry>
3209       <entry><literal>sql_identifier</literal></entry>
3210       <entry>
3211        Name of the unique or primary key constraint that the foreign
3212        key constraint references
3213       </entry>
3214      </row>
3215
3216      <row>
3217       <entry><literal>match_option</literal></entry>
3218       <entry><literal>character_data</literal></entry>
3219       <entry>
3220        Match option of the foreign key constraint:
3221        <literal>FULL</literal>, <literal>PARTIAL</literal>, or
3222        <literal>NONE</literal>.
3223       </entry>
3224      </row>
3225
3226      <row>
3227       <entry><literal>update_rule</literal></entry>
3228       <entry><literal>character_data</literal></entry>
3229       <entry>
3230        Update rule of the foreign key constraint:
3231        <literal>CASCADE</literal>, <literal>SET NULL</literal>,
3232        <literal>SET DEFAULT</literal>, <literal>RESTRICT</literal>, or
3233        <literal>NO ACTION</literal>.
3234       </entry>
3235      </row>
3236
3237      <row>
3238       <entry><literal>delete_rule</literal></entry>
3239       <entry><literal>character_data</literal></entry>
3240       <entry>
3241        Delete rule of the foreign key constraint:
3242        <literal>CASCADE</literal>, <literal>SET NULL</literal>,
3243        <literal>SET DEFAULT</literal>, <literal>RESTRICT</literal>, or
3244        <literal>NO ACTION</literal>.
3245       </entry>
3246      </row>
3247     </tbody>
3248    </tgroup>
3249   </table>
3250
3251  </sect1>
3252
3253  <sect1 id="infoschema-role-column-grants">
3254   <title><literal>role_column_grants</literal></title>
3255
3256   <para>
3257    The view <literal>role_column_grants</literal> identifies all
3258    privileges granted on columns where the grantor or grantee is a
3259    currently enabled role.  Further information can be found under
3260    <literal>column_privileges</literal>.  The only effective
3261    difference between this view
3262    and <literal>column_privileges</literal> is that this view omits
3263    columns that have been made accessible to the current user by way
3264    of a grant to <literal>PUBLIC</literal>.
3265   </para>
3266
3267   <table>
3268    <title><literal>role_column_grants</literal> Columns</title>
3269
3270    <tgroup cols="3">
3271     <thead>
3272      <row>
3273       <entry>Name</entry>
3274       <entry>Data Type</entry>
3275       <entry>Description</entry>
3276      </row>
3277     </thead>
3278
3279     <tbody>
3280      <row>
3281       <entry><literal>grantor</literal></entry>
3282       <entry><type>sql_identifier</type></entry>
3283       <entry>Name of the role that granted the privilege</entry>
3284      </row>
3285
3286      <row>
3287       <entry><literal>grantee</literal></entry>
3288       <entry><type>sql_identifier</type></entry>
3289       <entry>Name of the role that the privilege was granted to</entry>
3290      </row>
3291
3292      <row>
3293       <entry><literal>table_catalog</literal></entry>
3294       <entry><type>sql_identifier</type></entry>
3295       <entry>Name of the database that contains the table that contains the column (always the current database)</entry>
3296      </row>
3297
3298      <row>
3299       <entry><literal>table_schema</literal></entry>
3300       <entry><type>sql_identifier</type></entry>
3301       <entry>Name of the schema that contains the table that contains the column</entry>
3302      </row>
3303
3304      <row>
3305       <entry><literal>table_name</literal></entry>
3306       <entry><type>sql_identifier</type></entry>
3307       <entry>Name of the table that contains the column</entry>
3308      </row>
3309
3310      <row>
3311       <entry><literal>column_name</literal></entry>
3312       <entry><type>sql_identifier</type></entry>
3313       <entry>Name of the column</entry>
3314      </row>
3315
3316      <row>
3317       <entry><literal>privilege_type</literal></entry>
3318       <entry><type>character_data</type></entry>
3319       <entry>
3320        Type of the privilege: <literal>SELECT</literal>,
3321        <literal>INSERT</literal>, <literal>UPDATE</literal>, or
3322        <literal>REFERENCES</literal>
3323       </entry>
3324      </row>
3325
3326      <row>
3327       <entry><literal>is_grantable</literal></entry>
3328       <entry><type>yes_or_no</type></entry>
3329       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3330      </row>
3331     </tbody>
3332    </tgroup>
3333   </table>
3334  </sect1>
3335
3336  <sect1 id="infoschema-role-routine-grants">
3337   <title><literal>role_routine_grants</literal></title>
3338
3339   <para>
3340    The view <literal>role_routine_grants</literal> identifies all
3341    privileges granted on functions where the grantor or grantee is a
3342    currently enabled role.  Further information can be found under
3343    <literal>routine_privileges</literal>.  The only effective
3344    difference between this view
3345    and <literal>routine_privileges</literal> is that this view omits
3346    functions that have been made accessible to the current user by way
3347    of a grant to <literal>PUBLIC</literal>.
3348   </para>
3349
3350   <table>
3351    <title><literal>role_routine_grants</literal> Columns</title>
3352
3353    <tgroup cols="3">
3354     <thead>
3355      <row>
3356       <entry>Name</entry>
3357       <entry>Data Type</entry>
3358       <entry>Description</entry>
3359      </row>
3360     </thead>
3361
3362     <tbody>
3363      <row>
3364       <entry><literal>grantor</literal></entry>
3365       <entry><type>sql_identifier</type></entry>
3366       <entry>Name of the role that granted the privilege</entry>
3367      </row>
3368
3369      <row>
3370       <entry><literal>grantee</literal></entry>
3371       <entry><type>sql_identifier</type></entry>
3372       <entry>Name of the role that the privilege was granted to</entry>
3373      </row>
3374
3375      <row>
3376       <entry><literal>specific_catalog</literal></entry>
3377       <entry><type>sql_identifier</type></entry>
3378       <entry>Name of the database containing the function (always the current database)</entry>
3379      </row>
3380
3381      <row>
3382       <entry><literal>specific_schema</literal></entry>
3383       <entry><type>sql_identifier</type></entry>
3384       <entry>Name of the schema containing the function</entry>
3385      </row>
3386
3387      <row>
3388       <entry><literal>specific_name</literal></entry>
3389       <entry><type>sql_identifier</type></entry>
3390       <entry>
3391        The <quote>specific name</quote> of the function.  See <xref
3392        linkend="infoschema-routines"> for more information.
3393       </entry>
3394      </row>
3395
3396      <row>
3397       <entry><literal>routine_catalog</literal></entry>
3398       <entry><type>sql_identifier</type></entry>
3399       <entry>Name of the database containing the function (always the current database)</entry>
3400      </row>
3401
3402      <row>
3403       <entry><literal>routine_schema</literal></entry>
3404       <entry><type>sql_identifier</type></entry>
3405       <entry>Name of the schema containing the function</entry>
3406      </row>
3407
3408      <row>
3409       <entry><literal>routine_name</literal></entry>
3410       <entry><type>sql_identifier</type></entry>
3411       <entry>Name of the function (might be duplicated in case of overloading)</entry>
3412      </row>
3413
3414      <row>
3415       <entry><literal>privilege_type</literal></entry>
3416       <entry><type>character_data</type></entry>
3417       <entry>Always <literal>EXECUTE</literal> (the only privilege type for functions)</entry>
3418      </row>
3419
3420      <row>
3421       <entry><literal>is_grantable</literal></entry>
3422       <entry><type>yes_or_no</type></entry>
3423       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3424      </row>
3425     </tbody>
3426    </tgroup>
3427   </table>
3428  </sect1>
3429
3430  <sect1 id="infoschema-role-table-grants">
3431   <title><literal>role_table_grants</literal></title>
3432
3433   <para>
3434    The view <literal>role_table_grants</literal> identifies all
3435    privileges granted on tables or views where the grantor or grantee
3436    is a currently enabled role.  Further information can be found
3437    under <literal>table_privileges</literal>.  The only effective
3438    difference between this view
3439    and <literal>table_privileges</literal> is that this view omits
3440    tables that have been made accessible to the current user by way of
3441    a grant to <literal>PUBLIC</literal>.
3442   </para>
3443
3444   <table>
3445    <title><literal>role_table_grants</literal> Columns</title>
3446
3447    <tgroup cols="3">
3448     <thead>
3449      <row>
3450       <entry>Name</entry>
3451       <entry>Data Type</entry>
3452       <entry>Description</entry>
3453      </row>
3454     </thead>
3455
3456     <tbody>
3457      <row>
3458       <entry><literal>grantor</literal></entry>
3459       <entry><type>sql_identifier</type></entry>
3460       <entry>Name of the role that granted the privilege</entry>
3461      </row>
3462
3463      <row>
3464       <entry><literal>grantee</literal></entry>
3465       <entry><type>sql_identifier</type></entry>
3466       <entry>Name of the role that the privilege was granted to</entry>
3467      </row>
3468
3469      <row>
3470       <entry><literal>table_catalog</literal></entry>
3471       <entry><type>sql_identifier</type></entry>
3472       <entry>Name of the database that contains the table (always the current database)</entry>
3473      </row>
3474
3475      <row>
3476       <entry><literal>table_schema</literal></entry>
3477       <entry><type>sql_identifier</type></entry>
3478       <entry>Name of the schema that contains the table</entry>
3479      </row>
3480
3481      <row>
3482       <entry><literal>table_name</literal></entry>
3483       <entry><type>sql_identifier</type></entry>
3484       <entry>Name of the table</entry>
3485      </row>
3486
3487      <row>
3488       <entry><literal>privilege_type</literal></entry>
3489       <entry><type>character_data</type></entry>
3490       <entry>
3491        Type of the privilege: <literal>SELECT</literal>,
3492        <literal>INSERT</literal>, <literal>UPDATE</literal>,
3493        <literal>DELETE</literal>, <literal>TRUNCATE</literal>,
3494        <literal>REFERENCES</literal>, or <literal>TRIGGER</literal>
3495       </entry>
3496      </row>
3497
3498      <row>
3499       <entry><literal>is_grantable</literal></entry>
3500       <entry><type>yes_or_no</type></entry>
3501       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3502      </row>
3503
3504      <row>
3505       <entry><literal>with_hierarchy</literal></entry>
3506       <entry><type>yes_or_no</type></entry>
3507       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3508      </row>
3509     </tbody>
3510    </tgroup>
3511   </table>
3512  </sect1>
3513
3514  <sect1 id="infoschema-role-udt-grants">
3515   <title><literal>role_udt_grants</literal></title>
3516
3517   <para>
3518    The view <literal>role_udt_grants</literal> is intended to identify
3519    <literal>USAGE</literal> privileges granted on user-defined types
3520    where the grantor or grantee is a currently enabled role.  Further
3521    information can be found under
3522    <literal>udt_privileges</literal>.  The only effective difference
3523    between this view and <literal>udt_privileges</literal> is that
3524    this view omits objects that have been made accessible to the
3525    current user by way of a grant to <literal>PUBLIC</literal>.  Since
3526    data types do not have real privileges in PostgreSQL, but only an
3527    implicit grant to <literal>PUBLIC</literal>, this view is empty.
3528   </para>
3529
3530   <table>
3531    <title><literal>role_udt_grants</literal> Columns</title>
3532
3533    <tgroup cols="3">
3534     <thead>
3535      <row>
3536       <entry>Name</entry>
3537       <entry>Data Type</entry>
3538       <entry>Description</entry>
3539      </row>
3540     </thead>
3541
3542     <tbody>
3543      <row>
3544       <entry><literal>grantor</literal></entry>
3545       <entry><type>sql_identifier</type></entry>
3546       <entry>The name of the role that granted the privilege</entry>
3547      </row>
3548
3549      <row>
3550       <entry><literal>grantee</literal></entry>
3551       <entry><type>sql_identifier</type></entry>
3552       <entry>The name of the role that the privilege was granted to</entry>
3553      </row>
3554
3555      <row>
3556       <entry><literal>udt_catalog</literal></entry>
3557       <entry><type>sql_identifier</type></entry>
3558       <entry>Name of the database containing the type (always the current database)</entry>
3559      </row>
3560
3561      <row>
3562       <entry><literal>udt_schema</literal></entry>
3563       <entry><type>sql_identifier</type></entry>
3564       <entry>Name of the schema containing the type</entry>
3565      </row>
3566
3567      <row>
3568       <entry><literal>udt_name</literal></entry>
3569       <entry><type>sql_identifier</type></entry>
3570       <entry>Name of the type</entry>
3571      </row>
3572
3573      <row>
3574       <entry><literal>privilege_type</literal></entry>
3575       <entry><type>character_data</type></entry>
3576       <entry>Always <literal>TYPE USAGE</literal></entry>
3577      </row>
3578
3579      <row>
3580       <entry><literal>is_grantable</literal></entry>
3581       <entry><type>yes_or_no</type></entry>
3582       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3583      </row>
3584     </tbody>
3585    </tgroup>
3586   </table>
3587  </sect1>
3588
3589  <sect1 id="infoschema-role-usage-grants">
3590   <title><literal>role_usage_grants</literal></title>
3591
3592   <para>
3593    The view <literal>role_usage_grants</literal> identifies
3594    <literal>USAGE</literal> privileges granted on various kinds of
3595    objects where the grantor or grantee is a currently enabled role.
3596    Further information can be found under
3597    <literal>usage_privileges</literal>.  The only effective difference
3598    between this view and <literal>usage_privileges</literal> is that
3599    this view omits objects that have been made accessible to the
3600    current user by way of a grant to <literal>PUBLIC</literal>.
3601   </para>
3602
3603   <table>
3604    <title><literal>role_usage_grants</literal> Columns</title>
3605
3606    <tgroup cols="3">
3607     <thead>
3608      <row>
3609       <entry>Name</entry>
3610       <entry>Data Type</entry>
3611       <entry>Description</entry>
3612      </row>
3613     </thead>
3614
3615     <tbody>
3616      <row>
3617       <entry><literal>grantor</literal></entry>
3618       <entry><type>sql_identifier</type></entry>
3619       <entry>The name of the role that granted the privilege</entry>
3620      </row>
3621
3622      <row>
3623       <entry><literal>grantee</literal></entry>
3624       <entry><type>sql_identifier</type></entry>
3625       <entry>The name of the role that the privilege was granted to</entry>
3626      </row>
3627
3628      <row>
3629       <entry><literal>object_catalog</literal></entry>
3630       <entry><type>sql_identifier</type></entry>
3631       <entry>Name of the database containing the object (always the current database)</entry>
3632      </row>
3633
3634      <row>
3635       <entry><literal>object_schema</literal></entry>
3636       <entry><type>sql_identifier</type></entry>
3637       <entry>Name of the schema containing the object, if applicable,
3638       else an empty string</entry>
3639      </row>
3640
3641      <row>
3642       <entry><literal>object_name</literal></entry>
3643       <entry><type>sql_identifier</type></entry>
3644       <entry>Name of the object</entry>
3645      </row>
3646
3647      <row>
3648       <entry><literal>object_type</literal></entry>
3649       <entry><type>character_data</type></entry>
3650       <entry><literal>COLLATION</literal> or <literal>DOMAIN</literal> or <literal>FOREIGN DATA WRAPPER</literal> or <literal>FOREIGN SERVER</literal></entry>
3651      </row>
3652
3653      <row>
3654       <entry><literal>privilege_type</literal></entry>
3655       <entry><type>character_data</type></entry>
3656       <entry>Always <literal>USAGE</literal></entry>
3657      </row>
3658
3659      <row>
3660       <entry><literal>is_grantable</literal></entry>
3661       <entry><type>yes_or_no</type></entry>
3662       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3663      </row>
3664     </tbody>
3665    </tgroup>
3666   </table>
3667  </sect1>
3668
3669  <sect1 id="infoschema-routine-privileges">
3670   <title><literal>routine_privileges</literal></title>
3671
3672   <para>
3673    The view <literal>routine_privileges</literal> identifies all
3674    privileges granted on functions to a currently enabled role or by a
3675    currently enabled role.  There is one row for each combination of function,
3676    grantor, and grantee.
3677   </para>
3678
3679   <table>
3680    <title><literal>routine_privileges</literal> Columns</title>
3681
3682    <tgroup cols="3">
3683     <thead>
3684      <row>
3685       <entry>Name</entry>
3686       <entry>Data Type</entry>
3687       <entry>Description</entry>
3688      </row>
3689     </thead>
3690
3691     <tbody>
3692      <row>
3693       <entry><literal>grantor</literal></entry>
3694       <entry><type>sql_identifier</type></entry>
3695       <entry>Name of the role that granted the privilege</entry>
3696      </row>
3697
3698      <row>
3699       <entry><literal>grantee</literal></entry>
3700       <entry><type>sql_identifier</type></entry>
3701       <entry>Name of the role that the privilege was granted to</entry>
3702      </row>
3703
3704      <row>
3705       <entry><literal>specific_catalog</literal></entry>
3706       <entry><type>sql_identifier</type></entry>
3707       <entry>Name of the database containing the function (always the current database)</entry>
3708      </row>
3709
3710      <row>
3711       <entry><literal>specific_schema</literal></entry>
3712       <entry><type>sql_identifier</type></entry>
3713       <entry>Name of the schema containing the function</entry>
3714      </row>
3715
3716      <row>
3717       <entry><literal>specific_name</literal></entry>
3718       <entry><type>sql_identifier</type></entry>
3719       <entry>
3720        The <quote>specific name</quote> of the function.  See <xref
3721        linkend="infoschema-routines"> for more information.
3722       </entry>
3723      </row>
3724
3725      <row>
3726       <entry><literal>routine_catalog</literal></entry>
3727       <entry><type>sql_identifier</type></entry>
3728       <entry>Name of the database containing the function (always the current database)</entry>
3729      </row>
3730
3731      <row>
3732       <entry><literal>routine_schema</literal></entry>
3733       <entry><type>sql_identifier</type></entry>
3734       <entry>Name of the schema containing the function</entry>
3735      </row>
3736
3737      <row>
3738       <entry><literal>routine_name</literal></entry>
3739       <entry><type>sql_identifier</type></entry>
3740       <entry>Name of the function (might be duplicated in case of overloading)</entry>
3741      </row>
3742
3743      <row>
3744       <entry><literal>privilege_type</literal></entry>
3745       <entry><type>character_data</type></entry>
3746       <entry>Always <literal>EXECUTE</literal> (the only privilege type for functions)</entry>
3747      </row>
3748
3749      <row>
3750       <entry><literal>is_grantable</literal></entry>
3751       <entry><type>yes_or_no</type></entry>
3752       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3753      </row>
3754     </tbody>
3755    </tgroup>
3756   </table>
3757  </sect1>
3758
3759  <sect1 id="infoschema-routines">
3760   <title><literal>routines</literal></title>
3761
3762   <para>
3763    The view <literal>routines</literal> contains all functions in the
3764    current database.  Only those functions are shown that the current
3765    user has access to (by way of being the owner or having some
3766    privilege).
3767   </para>
3768
3769   <table>
3770    <title><literal>routines</literal> Columns</title>
3771
3772    <tgroup cols="3">
3773     <thead>
3774      <row>
3775       <entry>Name</entry>
3776       <entry>Data Type</entry>
3777       <entry>Description</entry>
3778      </row>
3779     </thead>
3780
3781     <tbody>
3782      <row>
3783       <entry><literal>specific_catalog</literal></entry>
3784       <entry><type>sql_identifier</type></entry>
3785       <entry>Name of the database containing the function (always the current database)</entry>
3786      </row>
3787
3788      <row>
3789       <entry><literal>specific_schema</literal></entry>
3790       <entry><type>sql_identifier</type></entry>
3791       <entry>Name of the schema containing the function</entry>
3792      </row>
3793
3794      <row>
3795       <entry><literal>specific_name</literal></entry>
3796       <entry><type>sql_identifier</type></entry>
3797       <entry>
3798        The <quote>specific name</quote> of the function.  This is a
3799        name that uniquely identifies the function in the schema, even
3800        if the real name of the function is overloaded.  The format of
3801        the specific name is not defined, it should only be used to
3802        compare it to other instances of specific routine names.
3803       </entry>
3804      </row>
3805
3806      <row>
3807       <entry><literal>routine_catalog</literal></entry>
3808       <entry><type>sql_identifier</type></entry>
3809       <entry>Name of the database containing the function (always the current database)</entry>
3810      </row>
3811
3812      <row>
3813       <entry><literal>routine_schema</literal></entry>
3814       <entry><type>sql_identifier</type></entry>
3815       <entry>Name of the schema containing the function</entry>
3816      </row>
3817
3818      <row>
3819       <entry><literal>routine_name</literal></entry>
3820       <entry><type>sql_identifier</type></entry>
3821       <entry>Name of the function (might be duplicated in case of overloading)</entry>
3822      </row>
3823
3824      <row>
3825       <entry><literal>routine_type</literal></entry>
3826       <entry><type>character_data</type></entry>
3827       <entry>
3828        Always <literal>FUNCTION</literal> (In the future there might
3829        be other types of routines.)
3830       </entry>
3831      </row>
3832
3833      <row>
3834       <entry><literal>module_catalog</literal></entry>
3835       <entry><type>sql_identifier</type></entry>
3836       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3837      </row>
3838
3839      <row>
3840       <entry><literal>module_schema</literal></entry>
3841       <entry><type>sql_identifier</type></entry>
3842       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3843      </row>
3844
3845      <row>
3846       <entry><literal>module_name</literal></entry>
3847       <entry><type>sql_identifier</type></entry>
3848       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3849      </row>
3850
3851      <row>
3852       <entry><literal>udt_catalog</literal></entry>
3853       <entry><type>sql_identifier</type></entry>
3854       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3855      </row>
3856
3857      <row>
3858       <entry><literal>udt_schema</literal></entry>
3859       <entry><type>sql_identifier</type></entry>
3860       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3861      </row>
3862
3863      <row>
3864       <entry><literal>udt_name</literal></entry>
3865       <entry><type>sql_identifier</type></entry>
3866       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3867      </row>
3868
3869      <row>
3870       <entry><literal>data_type</literal></entry>
3871       <entry><type>character_data</type></entry>
3872       <entry>
3873        Return data type of the function, if it is a built-in type, or
3874        <literal>ARRAY</literal> if it is some array (in that case, see
3875        the view <literal>element_types</literal>), else
3876        <literal>USER-DEFINED</literal> (in that case, the type is
3877        identified in <literal>type_udt_name</literal> and associated
3878        columns).
3879       </entry>
3880      </row>
3881
3882      <row>
3883       <entry><literal>character_maximum_length</literal></entry>
3884       <entry><type>cardinal_number</type></entry>
3885       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3886      </row>
3887
3888      <row>
3889       <entry><literal>character_octet_length</literal></entry>
3890       <entry><type>cardinal_number</type></entry>
3891       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3892      </row>
3893
3894      <row>
3895       <entry><literal>character_set_catalog</literal></entry>
3896       <entry><type>sql_identifier</type></entry>
3897       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3898      </row>
3899
3900      <row>
3901       <entry><literal>character_set_schema</literal></entry>
3902       <entry><type>sql_identifier</type></entry>
3903       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3904      </row>
3905
3906      <row>
3907       <entry><literal>character_set_name</literal></entry>
3908       <entry><type>sql_identifier</type></entry>
3909       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3910      </row>
3911
3912      <row>
3913       <entry><literal>collation_catalog</literal></entry>
3914       <entry><type>sql_identifier</type></entry>
3915       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3916      </row>
3917
3918      <row>
3919       <entry><literal>collation_schema</literal></entry>
3920       <entry><type>sql_identifier</type></entry>
3921       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3922      </row>
3923
3924      <row>
3925       <entry><literal>collation_name</literal></entry>
3926       <entry><type>sql_identifier</type></entry>
3927       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3928      </row>
3929
3930      <row>
3931       <entry><literal>numeric_precision</literal></entry>
3932       <entry><type>cardinal_number</type></entry>
3933       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3934      </row>
3935
3936      <row>
3937       <entry><literal>numeric_precision_radix</literal></entry>
3938       <entry><type>cardinal_number</type></entry>
3939       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3940      </row>
3941
3942      <row>
3943       <entry><literal>numeric_scale</literal></entry>
3944       <entry><type>cardinal_number</type></entry>
3945       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3946      </row>
3947
3948      <row>
3949       <entry><literal>datetime_precision</literal></entry>
3950       <entry><type>cardinal_number</type></entry>
3951       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3952      </row>
3953
3954      <row>
3955       <entry><literal>interval_type</literal></entry>
3956       <entry><type>character_data</type></entry>
3957       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3958      </row>
3959
3960      <row>
3961       <entry><literal>interval_precision</literal></entry>
3962       <entry><type>character_data</type></entry>
3963       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3964      </row>
3965
3966      <row>
3967       <entry><literal>type_udt_catalog</literal></entry>
3968       <entry><type>sql_identifier</type></entry>
3969       <entry>
3970        Name of the database that the return data type of the function
3971        is defined in (always the current database)
3972       </entry>
3973      </row>
3974
3975      <row>
3976       <entry><literal>type_udt_schema</literal></entry>
3977       <entry><type>sql_identifier</type></entry>
3978       <entry>
3979        Name of the schema that the return data type of the function is
3980        defined in
3981       </entry>
3982      </row>
3983
3984      <row>
3985       <entry><literal>type_udt_name</literal></entry>
3986       <entry><type>sql_identifier</type></entry>
3987       <entry>
3988        Name of the return data type of the function
3989       </entry>
3990      </row>
3991
3992      <row>
3993       <entry><literal>scope_catalog</literal></entry>
3994       <entry><type>sql_identifier</type></entry>
3995       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3996      </row>
3997
3998      <row>
3999       <entry><literal>scope_schema</literal></entry>
4000       <entry><type>sql_identifier</type></entry>
4001       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4002      </row>
4003
4004      <row>
4005       <entry><literal>scope_name</literal></entry>
4006       <entry><type>sql_identifier</type></entry>
4007       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4008      </row>
4009
4010      <row>
4011       <entry><literal>maximum_cardinality</literal></entry>
4012       <entry><type>cardinal_number</type></entry>
4013       <entry>Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</></entry>
4014      </row>
4015
4016      <row>
4017       <entry><literal>dtd_identifier</literal></entry>
4018       <entry><type>sql_identifier</type></entry>
4019       <entry>
4020        An identifier of the data type descriptor of the return data
4021        type of this function, unique among the data type descriptors
4022        pertaining to the function.  This is mainly useful for joining
4023        with other instances of such identifiers.  (The specific format
4024        of the identifier is not defined and not guaranteed to remain
4025        the same in future versions.)
4026       </entry>
4027      </row>
4028
4029      <row>
4030       <entry><literal>routine_body</literal></entry>
4031       <entry><type>character_data</type></entry>
4032       <entry>
4033        If the function is an SQL function, then
4034        <literal>SQL</literal>, else <literal>EXTERNAL</literal>.
4035       </entry>
4036      </row>
4037
4038      <row>
4039       <entry><literal>routine_definition</literal></entry>
4040       <entry><type>character_data</type></entry>
4041       <entry>
4042        The source text of the function (null if the function is not
4043        owned by a currently enabled role).  (According to the SQL
4044        standard, this column is only applicable if
4045        <literal>routine_body</literal> is <literal>SQL</literal>, but
4046        in <productname>PostgreSQL</productname> it will contain
4047        whatever source text was specified when the function was
4048        created.)
4049       </entry>
4050      </row>
4051
4052      <row>
4053       <entry><literal>external_name</literal></entry>
4054       <entry><type>character_data</type></entry>
4055       <entry>
4056        If this function is a C function, then the external name (link
4057        symbol) of the function; else null.  (This works out to be the
4058        same value that is shown in
4059        <literal>routine_definition</literal>.)
4060       </entry>
4061      </row>
4062
4063      <row>
4064       <entry><literal>external_language</literal></entry>
4065       <entry><type>character_data</type></entry>
4066       <entry>The language the function is written in</entry>
4067      </row>
4068
4069      <row>
4070       <entry><literal>parameter_style</literal></entry>
4071       <entry><type>character_data</type></entry>
4072       <entry>
4073        Always <literal>GENERAL</literal> (The SQL standard defines
4074        other parameter styles, which are not available in <productname>PostgreSQL</>.)
4075       </entry>
4076      </row>
4077
4078      <row>
4079       <entry><literal>is_deterministic</literal></entry>
4080       <entry><type>yes_or_no</type></entry>
4081       <entry>
4082        If the function is declared immutable (called deterministic in
4083        the SQL standard), then <literal>YES</literal>, else
4084        <literal>NO</literal>.  (You cannot query the other volatility
4085        levels available in <productname>PostgreSQL</> through the information schema.)
4086       </entry>
4087      </row>
4088
4089      <row>
4090       <entry><literal>sql_data_access</literal></entry>
4091       <entry><type>character_data</type></entry>
4092       <entry>
4093        Always <literal>MODIFIES</literal>, meaning that the function
4094        possibly modifies SQL data.  This information is not useful for
4095        <productname>PostgreSQL</>.
4096       </entry>
4097      </row>
4098
4099      <row>
4100       <entry><literal>is_null_call</literal></entry>
4101       <entry><type>yes_or_no</type></entry>
4102       <entry>
4103        If the function automatically returns null if any of its
4104        arguments are null, then <literal>YES</literal>, else
4105        <literal>NO</literal>.
4106       </entry>
4107      </row>
4108
4109      <row>
4110       <entry><literal>sql_path</literal></entry>
4111       <entry><type>character_data</type></entry>
4112       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4113      </row>
4114
4115      <row>
4116       <entry><literal>schema_level_routine</literal></entry>
4117       <entry><type>yes_or_no</type></entry>
4118       <entry>
4119        Always <literal>YES</literal> (The opposite would be a method
4120        of a user-defined type, which is a feature not available in
4121        <productname>PostgreSQL</>.)
4122       </entry>
4123      </row>
4124
4125      <row>
4126       <entry><literal>max_dynamic_result_sets</literal></entry>
4127       <entry><type>cardinal_number</type></entry>
4128       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4129      </row>
4130
4131      <row>
4132       <entry><literal>is_user_defined_cast</literal></entry>
4133       <entry><type>yes_or_no</type></entry>
4134       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4135      </row>
4136
4137      <row>
4138       <entry><literal>is_implicitly_invocable</literal></entry>
4139       <entry><type>yes_or_no</type></entry>
4140       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4141      </row>
4142
4143      <row>
4144       <entry><literal>security_type</literal></entry>
4145       <entry><type>character_data</type></entry>
4146       <entry>
4147        If the function runs with the privileges of the current user,
4148        then <literal>INVOKER</literal>, if the function runs with the
4149        privileges of the user who defined it, then
4150        <literal>DEFINER</literal>.
4151       </entry>
4152      </row>
4153
4154      <row>
4155       <entry><literal>to_sql_specific_catalog</literal></entry>
4156       <entry><type>sql_identifier</type></entry>
4157       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4158      </row>
4159
4160      <row>
4161       <entry><literal>to_sql_specific_schema</literal></entry>
4162       <entry><type>sql_identifier</type></entry>
4163       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4164      </row>
4165
4166      <row>
4167       <entry><literal>to_sql_specific_name</literal></entry>
4168       <entry><type>sql_identifier</type></entry>
4169       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4170      </row>
4171
4172      <row>
4173       <entry><literal>as_locator</literal></entry>
4174       <entry><type>yes_or_no</type></entry>
4175       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4176      </row>
4177
4178      <row>
4179       <entry><literal>created</literal></entry>
4180       <entry><type>time_stamp</type></entry>
4181       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4182      </row>
4183
4184      <row>
4185       <entry><literal>last_altered</literal></entry>
4186       <entry><type>time_stamp</type></entry>
4187       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4188      </row>
4189
4190      <row>
4191       <entry><literal>new_savepoint_level</literal></entry>
4192       <entry><type>yes_or_no</type></entry>
4193       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4194      </row>
4195
4196      <row>
4197       <entry><literal>is_udt_dependent</literal></entry>
4198       <entry><type>yes_or_no</type></entry>
4199       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4200      </row>
4201
4202      <row>
4203       <entry><literal>result_cast_from_data_type</literal></entry>
4204       <entry><type>character_data</type></entry>
4205       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4206      </row>
4207
4208      <row>
4209       <entry><literal>result_cast_as_locator</literal></entry>
4210       <entry><type>yes_or_no</type></entry>
4211       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4212      </row>
4213
4214      <row>
4215       <entry><literal>result_cast_char_max_length</literal></entry>
4216       <entry><type>cardinal_number</type></entry>
4217       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4218      </row>
4219
4220      <row>
4221       <entry><literal>result_cast_char_octet_length</literal></entry>
4222       <entry><type>character_data</type></entry>
4223       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4224      </row>
4225
4226      <row>
4227       <entry><literal>result_cast_char_set_catalog</literal></entry>
4228       <entry><type>sql_identifier</type></entry>
4229       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4230      </row>
4231
4232      <row>
4233       <entry><literal>result_cast_char_set_schema</literal></entry>
4234       <entry><type>sql_identifier</type></entry>
4235       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4236      </row>
4237
4238      <row>
4239       <entry><literal>result_cast_char_set_name</literal></entry>
4240       <entry><type>sql_identifier</type></entry>
4241       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4242      </row>
4243
4244      <row>
4245       <entry><literal>result_cast_collation_catalog</literal></entry>
4246       <entry><type>sql_identifier</type></entry>
4247       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4248      </row>
4249
4250      <row>
4251       <entry><literal>result_cast_collation_schema</literal></entry>
4252       <entry><type>sql_identifier</type></entry>
4253       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4254      </row>
4255
4256      <row>
4257       <entry><literal>result_cast_collation_name</literal></entry>
4258       <entry><type>sql_identifier</type></entry>
4259       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4260      </row>
4261
4262      <row>
4263       <entry><literal>result_cast_numeric_precision</literal></entry>
4264       <entry><type>cardinal_number</type></entry>
4265       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4266      </row>
4267
4268      <row>
4269       <entry><literal>result_cast_numeric_precision_radix</literal></entry>
4270       <entry><type>cardinal_number</type></entry>
4271       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4272      </row>
4273
4274      <row>
4275       <entry><literal>result_cast_numeric_scale</literal></entry>
4276       <entry><type>cardinal_number</type></entry>
4277       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4278      </row>
4279
4280      <row>
4281       <entry><literal>result_cast_datetime_precision</literal></entry>
4282       <entry><type>character_data</type></entry>
4283       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4284      </row>
4285
4286      <row>
4287       <entry><literal>result_cast_interval_type</literal></entry>
4288       <entry><type>character_data</type></entry>
4289       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4290      </row>
4291
4292      <row>
4293       <entry><literal>result_cast_interval_precision</literal></entry>
4294       <entry><type>character_data</type></entry>
4295       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4296      </row>
4297
4298      <row>
4299       <entry><literal>result_cast_type_udt_catalog</literal></entry>
4300       <entry><type>sql_identifier</type></entry>
4301       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4302      </row>
4303
4304      <row>
4305       <entry><literal>result_cast_type_udt_schema</literal></entry>
4306       <entry><type>sql_identifier</type></entry>
4307       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4308      </row>
4309
4310      <row>
4311       <entry><literal>result_cast_type_udt_name</literal></entry>
4312       <entry><type>sql_identifier</type></entry>
4313       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4314      </row>
4315
4316      <row>
4317       <entry><literal>result_cast_scope_catalog</literal></entry>
4318       <entry><type>sql_identifier</type></entry>
4319       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4320      </row>
4321
4322      <row>
4323       <entry><literal>result_cast_scope_schema</literal></entry>
4324       <entry><type>sql_identifier</type></entry>
4325       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4326      </row>
4327
4328      <row>
4329       <entry><literal>result_cast_scope_name</literal></entry>
4330       <entry><type>sql_identifier</type></entry>
4331       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4332      </row>
4333
4334      <row>
4335       <entry><literal>result_cast_maximum_cardinality</literal></entry>
4336       <entry><type>cardinal_number</type></entry>
4337       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4338      </row>
4339
4340      <row>
4341       <entry><literal>result_cast_dtd_identifier</literal></entry>
4342       <entry><type>sql_identifier</type></entry>
4343       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4344      </row>
4345     </tbody>
4346    </tgroup>
4347   </table>
4348  </sect1>
4349
4350  <sect1 id="infoschema-schemata">
4351   <title><literal>schemata</literal></title>
4352
4353   <para>
4354    The view <literal>schemata</literal> contains all schemas in the
4355    current database that are owned by a currently enabled role.
4356   </para>
4357
4358   <table>
4359    <title><literal>schemata</literal> Columns</title>
4360
4361    <tgroup cols="3">
4362     <thead>
4363      <row>
4364       <entry>Name</entry>
4365       <entry>Data Type</entry>
4366       <entry>Description</entry>
4367      </row>
4368     </thead>
4369
4370     <tbody>
4371      <row>
4372       <entry><literal>catalog_name</literal></entry>
4373       <entry><type>sql_identifier</type></entry>
4374       <entry>Name of the database that the schema is contained in (always the current database)</entry>
4375      </row>
4376
4377      <row>
4378       <entry><literal>schema_name</literal></entry>
4379       <entry><type>sql_identifier</type></entry>
4380       <entry>Name of the schema</entry>
4381      </row>
4382
4383      <row>
4384       <entry><literal>schema_owner</literal></entry>
4385       <entry><type>sql_identifier</type></entry>
4386       <entry>Name of the owner of the schema</entry>
4387      </row>
4388
4389      <row>
4390       <entry><literal>default_character_set_catalog</literal></entry>
4391       <entry><type>sql_identifier</type></entry>
4392       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4393      </row>
4394
4395      <row>
4396       <entry><literal>default_character_set_schema</literal></entry>
4397       <entry><type>sql_identifier</type></entry>
4398       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4399      </row>
4400
4401      <row>
4402       <entry><literal>default_character_set_name</literal></entry>
4403       <entry><type>sql_identifier</type></entry>
4404       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4405      </row>
4406
4407      <row>
4408       <entry><literal>sql_path</literal></entry>
4409       <entry><type>character_data</type></entry>
4410       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4411      </row>
4412     </tbody>
4413    </tgroup>
4414   </table>
4415  </sect1>
4416
4417  <sect1 id="infoschema-sequences">
4418   <title><literal>sequences</literal></title>
4419
4420   <para>
4421    The view <literal>sequences</literal> contains all sequences
4422    defined in the current database.  Only those sequences are shown
4423    that the current user has access to (by way of being the owner or
4424    having some privilege).
4425   </para>
4426
4427   <table>
4428    <title><literal>sequences</literal> Columns</title>
4429
4430    <tgroup cols="3">
4431     <thead>
4432      <row>
4433       <entry>Name</entry>
4434       <entry>Data Type</entry>
4435       <entry>Description</entry>
4436      </row>
4437     </thead>
4438
4439     <tbody>
4440      <row>
4441       <entry><literal>sequence_catalog</literal></entry>
4442       <entry><type>sql_identifier</type></entry>
4443       <entry>Name of the database that contains the sequence (always the current database)</entry>
4444      </row>
4445
4446      <row>
4447       <entry><literal>sequence_schema</literal></entry>
4448       <entry><type>sql_identifier</type></entry>
4449       <entry>Name of the schema that contains the sequence</entry>
4450      </row>
4451
4452      <row>
4453       <entry><literal>sequence_name</literal></entry>
4454       <entry><type>sql_identifier</type></entry>
4455       <entry>Name of the sequence</entry>
4456      </row>
4457
4458      <row>
4459       <entry><literal>data_type</literal></entry>
4460       <entry><type>character_data</type></entry>
4461       <entry>
4462        The data type of the sequence.  In
4463        <productname>PostgreSQL</productname>, this is currently always
4464        <literal>bigint</literal>.
4465       </entry>
4466      </row>
4467
4468      <row>
4469       <entry><literal>numeric_precision</literal></entry>
4470       <entry><type>cardinal_number</type></entry>
4471       <entry>
4472        This column contains the (declared or implicit) precision of
4473        the sequence data type (see above).  The precision indicates
4474        the number of significant digits.  It can be expressed in
4475        decimal (base 10) or binary (base 2) terms, as specified in the
4476        column <literal>numeric_precision_radix</literal>.
4477       </entry>
4478      </row>
4479
4480      <row>
4481       <entry><literal>numeric_precision_radix</literal></entry>
4482       <entry><type>cardinal_number</type></entry>
4483       <entry>
4484        This column indicates in which base the values in the columns
4485        <literal>numeric_precision</literal> and
4486        <literal>numeric_scale</literal> are expressed.  The value is
4487        either 2 or 10.
4488       </entry>
4489      </row>
4490
4491      <row>
4492       <entry><literal>numeric_scale</literal></entry>
4493       <entry><type>cardinal_number</type></entry>
4494       <entry>
4495        This column contains the (declared or implicit) scale of the
4496        sequence data type (see above).  The scale indicates the number
4497        of significant digits to the right of the decimal point.  It
4498        can be expressed in decimal (base 10) or binary (base 2) terms,
4499        as specified in the column
4500        <literal>numeric_precision_radix</literal>.
4501       </entry>
4502      </row>
4503
4504      <row>
4505       <entry><literal>start_value</literal></entry>
4506       <entry><type>character_data</type></entry>
4507       <entry>The start value of the sequence</entry>
4508      </row>
4509
4510      <row>
4511       <entry><literal>minimum_value</literal></entry>
4512       <entry><type>character_data</type></entry>
4513       <entry>The minimum value of the sequence</entry>
4514      </row>
4515
4516      <row>
4517       <entry><literal>maximum_value</literal></entry>
4518       <entry><type>character_data</type></entry>
4519       <entry>The maximum value of the sequence</entry>
4520      </row>
4521
4522      <row>
4523       <entry><literal>increment</literal></entry>
4524       <entry><type>character_data</type></entry>
4525       <entry>The increment of the sequence</entry>
4526      </row>
4527
4528      <row>
4529       <entry><literal>cycle_option</literal></entry>
4530       <entry><type>yes_or_no</type></entry>
4531       <entry><literal>YES</literal> if the sequence cycles, else <literal>NO</literal></entry>
4532      </row>
4533     </tbody>
4534    </tgroup>
4535   </table>
4536
4537   <para>
4538    Note that in accordance with the SQL standard, the start, minimum,
4539    maximum, and increment values are returned as character strings.
4540   </para>
4541  </sect1>
4542
4543  <sect1 id="infoschema-sql-features">
4544   <title><literal>sql_features</literal></title>
4545
4546   <para>
4547    The table <literal>sql_features</literal> contains information
4548    about which formal features defined in the SQL standard are
4549    supported by <productname>PostgreSQL</productname>.  This is the
4550    same information that is presented in <xref linkend="features">.
4551    There you can also find some additional background information.
4552   </para>
4553
4554   <table>
4555    <title><literal>sql_features</literal> Columns</title>
4556
4557    <tgroup cols="3">
4558     <thead>
4559      <row>
4560       <entry>Name</entry>
4561       <entry>Data Type</entry>
4562       <entry>Description</entry>
4563      </row>
4564     </thead>
4565
4566     <tbody>
4567      <row>
4568       <entry><literal>feature_id</literal></entry>
4569       <entry><type>character_data</type></entry>
4570       <entry>Identifier string of the feature</entry>
4571      </row>
4572
4573      <row>
4574       <entry><literal>feature_name</literal></entry>
4575       <entry><type>character_data</type></entry>
4576       <entry>Descriptive name of the feature</entry>
4577      </row>
4578
4579      <row>
4580       <entry><literal>sub_feature_id</literal></entry>
4581       <entry><type>character_data</type></entry>
4582       <entry>Identifier string of the subfeature, or a zero-length string if not a subfeature</entry>
4583      </row>
4584
4585      <row>
4586       <entry><literal>sub_feature_name</literal></entry>
4587       <entry><type>character_data</type></entry>
4588       <entry>Descriptive name of the subfeature, or a zero-length string if not a subfeature</entry>
4589      </row>
4590
4591      <row>
4592       <entry><literal>is_supported</literal></entry>
4593       <entry><type>yes_or_no</type></entry>
4594       <entry>
4595        <literal>YES</literal> if the feature is fully supported by the
4596        current version of <productname>PostgreSQL</>, <literal>NO</literal> if not
4597       </entry>
4598      </row>
4599
4600      <row>
4601       <entry><literal>is_verified_by</literal></entry>
4602       <entry><type>character_data</type></entry>
4603       <entry>
4604        Always null, since the <productname>PostgreSQL</> development group does not
4605        perform formal testing of feature conformance
4606       </entry>
4607      </row>
4608
4609      <row>
4610       <entry><literal>comments</literal></entry>
4611       <entry><type>character_data</type></entry>
4612       <entry>Possibly a comment about the supported status of the feature</entry>
4613      </row>
4614     </tbody>
4615    </tgroup>
4616   </table>
4617  </sect1>
4618
4619  <sect1 id="infoschema-sql-implementation-info">
4620   <title><literal>sql_implementation_info</literal></title>
4621
4622   <para>
4623    The table <literal>sql_implementation_info</literal> contains
4624    information about various aspects that are left
4625    implementation-defined by the SQL standard.  This information is
4626    primarily intended for use in the context of the ODBC interface;
4627    users of other interfaces will probably find this information to be
4628    of little use.  For this reason, the individual implementation
4629    information items are not described here; you will find them in the
4630    description of the ODBC interface.
4631   </para>
4632
4633   <table>
4634    <title><literal>sql_implementation_info</literal> Columns</title>
4635
4636    <tgroup cols="3">
4637     <thead>
4638      <row>
4639       <entry>Name</entry>
4640       <entry>Data Type</entry>
4641       <entry>Description</entry>
4642      </row>
4643     </thead>
4644
4645     <tbody>
4646      <row>
4647       <entry><literal>implementation_info_id</literal></entry>
4648       <entry><type>character_data</type></entry>
4649       <entry>Identifier string of the implementation information item</entry>
4650      </row>
4651
4652      <row>
4653       <entry><literal>implementation_info_name</literal></entry>
4654       <entry><type>character_data</type></entry>
4655       <entry>Descriptive name of the implementation information item</entry>
4656      </row>
4657
4658      <row>
4659       <entry><literal>integer_value</literal></entry>
4660       <entry><type>cardinal_number</type></entry>
4661       <entry>
4662        Value of the implementation information item, or null if the
4663        value is contained in the column
4664        <literal>character_value</literal>
4665       </entry>
4666      </row>
4667
4668      <row>
4669       <entry><literal>character_value</literal></entry>
4670       <entry><type>character_data</type></entry>
4671       <entry>
4672        Value of the implementation information item, or null if the
4673        value is contained in the column
4674        <literal>integer_value</literal>
4675       </entry>
4676      </row>
4677
4678      <row>
4679       <entry><literal>comments</literal></entry>
4680       <entry><type>character_data</type></entry>
4681       <entry>Possibly a comment pertaining to the implementation information item</entry>
4682      </row>
4683     </tbody>
4684    </tgroup>
4685   </table>
4686  </sect1>
4687
4688  <sect1 id="infoschema-sql-languages">
4689   <title><literal>sql_languages</literal></title>
4690
4691   <para>
4692    The table <literal>sql_languages</literal> contains one row for
4693    each SQL language binding that is supported by
4694    <productname>PostgreSQL</productname>.
4695    <productname>PostgreSQL</productname> supports direct SQL and
4696    embedded SQL in C; that is all you will learn from this table.
4697   </para>
4698
4699   <table>
4700    <title><literal>sql_languages</literal> Columns</title>
4701
4702    <tgroup cols="3">
4703     <thead>
4704      <row>
4705       <entry>Name</entry>
4706       <entry>Data Type</entry>
4707       <entry>Description</entry>
4708      </row>
4709     </thead>
4710
4711     <tbody>
4712      <row>
4713       <entry><literal>sql_language_source</literal></entry>
4714       <entry><type>character_data</type></entry>
4715       <entry>
4716        The name of the source of the language definition; always
4717        <literal>ISO 9075</literal>, that is, the SQL standard
4718       </entry>
4719      </row>
4720
4721      <row>
4722       <entry><literal>sql_language_year</literal></entry>
4723       <entry><type>character_data</type></entry>
4724       <entry>
4725        The year the standard referenced in
4726        <literal>sql_language_source</literal> was approved; currently
4727        <literal>2003</>
4728       </entry>
4729      </row>
4730
4731      <row>
4732       <entry><literal>sql_language_conformance</literal></entry>
4733       <entry><type>character_data</type></entry>
4734       <entry>
4735        The standard conformance level for the language binding.  For
4736        ISO 9075:2003 this is always <literal>CORE</literal>.
4737       </entry>
4738      </row>
4739
4740      <row>
4741       <entry><literal>sql_language_integrity</literal></entry>
4742       <entry><type>character_data</type></entry>
4743       <entry>Always null (This value is relevant to an earlier version of the SQL standard.)</entry>
4744      </row>
4745
4746      <row>
4747       <entry><literal>sql_language_implementation</literal></entry>
4748       <entry><type>character_data</type></entry>
4749       <entry>Always null</entry>
4750      </row>
4751
4752      <row>
4753       <entry><literal>sql_language_binding_style</literal></entry>
4754       <entry><type>character_data</type></entry>
4755       <entry>
4756        The language binding style, either <literal>DIRECT</literal> or
4757        <literal>EMBEDDED</literal>
4758       </entry>
4759      </row>
4760
4761      <row>
4762       <entry><literal>sql_language_programming_language</literal></entry>
4763       <entry><type>character_data</type></entry>
4764       <entry>
4765        The programming language, if the binding style is
4766        <literal>EMBEDDED</literal>, else null.  <productname>PostgreSQL</> only
4767        supports the language C.
4768       </entry>
4769      </row>
4770     </tbody>
4771    </tgroup>
4772   </table>
4773  </sect1>
4774
4775  <sect1 id="infoschema-sql-packages">
4776   <title><literal>sql_packages</literal></title>
4777
4778   <para>
4779    The table <literal>sql_packages</literal> contains information
4780    about which feature packages defined in the SQL standard are
4781    supported by <productname>PostgreSQL</productname>.  Refer to <xref
4782    linkend="features"> for background information on feature packages.
4783   </para>
4784
4785   <table>
4786    <title><literal>sql_packages</literal> Columns</title>
4787
4788    <tgroup cols="3">
4789     <thead>
4790      <row>
4791       <entry>Name</entry>
4792       <entry>Data Type</entry>
4793       <entry>Description</entry>
4794      </row>
4795     </thead>
4796
4797     <tbody>
4798      <row>
4799       <entry><literal>feature_id</literal></entry>
4800       <entry><type>character_data</type></entry>
4801       <entry>Identifier string of the package</entry>
4802      </row>
4803
4804      <row>
4805       <entry><literal>feature_name</literal></entry>
4806       <entry><type>character_data</type></entry>
4807       <entry>Descriptive name of the package</entry>
4808      </row>
4809
4810      <row>
4811       <entry><literal>is_supported</literal></entry>
4812       <entry><type>yes_or_no</type></entry>
4813       <entry>
4814        <literal>YES</literal> if the package is fully supported by the
4815        current version of <productname>PostgreSQL</>, <literal>NO</literal> if not
4816       </entry>
4817      </row>
4818
4819      <row>
4820       <entry><literal>is_verified_by</literal></entry>
4821       <entry><type>character_data</type></entry>
4822       <entry>
4823        Always null, since the <productname>PostgreSQL</> development group does not
4824        perform formal testing of feature conformance
4825       </entry>
4826      </row>
4827
4828      <row>
4829       <entry><literal>comments</literal></entry>
4830       <entry><type>character_data</type></entry>
4831       <entry>Possibly a comment about the supported status of the package</entry>
4832      </row>
4833     </tbody>
4834    </tgroup>
4835   </table>
4836  </sect1>
4837
4838  <sect1 id="infoschema-sql-parts">
4839   <title><literal>sql_parts</literal></title>
4840
4841   <para>
4842    The table <literal>sql_parts</literal> contains information about
4843    which of the several parts of the SQL standard are supported by
4844    <productname>PostgreSQL</productname>.
4845   </para>
4846
4847   <table>
4848    <title><literal>sql_parts</literal> Columns</title>
4849
4850    <tgroup cols="3">
4851     <thead>
4852      <row>
4853       <entry>Name</entry>
4854       <entry>Data Type</entry>
4855       <entry>Description</entry>
4856      </row>
4857     </thead>
4858
4859     <tbody>
4860      <row>
4861       <entry><literal>feature_id</literal></entry>
4862       <entry><type>character_data</type></entry>
4863       <entry>An identifier string containing the number of the part</entry>
4864      </row>
4865
4866      <row>
4867       <entry><literal>feature_name</literal></entry>
4868       <entry><type>character_data</type></entry>
4869       <entry>Descriptive name of the part</entry>
4870      </row>
4871
4872      <row>
4873       <entry><literal>is_supported</literal></entry>
4874       <entry><type>yes_or_no</type></entry>
4875       <entry>
4876        <literal>YES</literal> if the part is fully supported by the
4877        current version of <productname>PostgreSQL</>,
4878        <literal>NO</literal> if not
4879       </entry>
4880      </row>
4881
4882      <row>
4883       <entry><literal>is_verified_by</literal></entry>
4884       <entry><type>character_data</type></entry>
4885       <entry>
4886        Always null, since the <productname>PostgreSQL</> development group does not
4887        perform formal testing of feature conformance
4888       </entry>
4889      </row>
4890
4891      <row>
4892       <entry><literal>comments</literal></entry>
4893       <entry><type>character_data</type></entry>
4894       <entry>Possibly a comment about the supported status of the part</entry>
4895      </row>
4896     </tbody>
4897    </tgroup>
4898   </table>
4899  </sect1>
4900
4901  <sect1 id="infoschema-sql-sizing">
4902   <title><literal>sql_sizing</literal></title>
4903
4904   <para>
4905    The table <literal>sql_sizing</literal> contains information about
4906    various size limits and maximum values in
4907    <productname>PostgreSQL</productname>.  This information is
4908    primarily intended for use in the context of the ODBC interface;
4909    users of other interfaces will probably find this information to be
4910    of little use.  For this reason, the individual sizing items are
4911    not described here; you will find them in the description of the
4912    ODBC interface.
4913   </para>
4914
4915   <table>
4916    <title><literal>sql_sizing</literal> Columns</title>
4917
4918    <tgroup cols="3">
4919     <thead>
4920      <row>
4921       <entry>Name</entry>
4922       <entry>Data Type</entry>
4923       <entry>Description</entry>
4924      </row>
4925     </thead>
4926
4927     <tbody>
4928      <row>
4929       <entry><literal>sizing_id</literal></entry>
4930       <entry><type>cardinal_number</type></entry>
4931       <entry>Identifier of the sizing item</entry>
4932      </row>
4933
4934      <row>
4935       <entry><literal>sizing_name</literal></entry>
4936       <entry><type>character_data</type></entry>
4937       <entry>Descriptive name of the sizing item</entry>
4938      </row>
4939
4940      <row>
4941       <entry><literal>supported_value</literal></entry>
4942       <entry><type>cardinal_number</type></entry>
4943       <entry>
4944        Value of the sizing item, or 0 if the size is unlimited or
4945        cannot be determined, or null if the features for which the
4946        sizing item is applicable are not supported
4947       </entry>
4948      </row>
4949
4950      <row>
4951       <entry><literal>comments</literal></entry>
4952       <entry><type>character_data</type></entry>
4953       <entry>Possibly a comment pertaining to the sizing item</entry>
4954      </row>
4955     </tbody>
4956    </tgroup>
4957   </table>
4958  </sect1>
4959
4960  <sect1 id="infoschema-sql-sizing-profiles">
4961   <title><literal>sql_sizing_profiles</literal></title>
4962
4963   <para>
4964    The table <literal>sql_sizing_profiles</literal> contains
4965    information about the <literal>sql_sizing</literal> values that are
4966    required by various profiles of the SQL standard.  <productname>PostgreSQL</> does
4967    not track any SQL profiles, so this table is empty.
4968   </para>
4969
4970   <table>
4971    <title><literal>sql_sizing_profiles</literal> Columns</title>
4972
4973    <tgroup cols="3">
4974     <thead>
4975      <row>
4976       <entry>Name</entry>
4977       <entry>Data Type</entry>
4978       <entry>Description</entry>
4979      </row>
4980     </thead>
4981
4982     <tbody>
4983      <row>
4984       <entry><literal>sizing_id</literal></entry>
4985       <entry><type>cardinal_number</type></entry>
4986       <entry>Identifier of the sizing item</entry>
4987      </row>
4988
4989      <row>
4990       <entry><literal>sizing_name</literal></entry>
4991       <entry><type>character_data</type></entry>
4992       <entry>Descriptive name of the sizing item</entry>
4993      </row>
4994
4995      <row>
4996       <entry><literal>profile_id</literal></entry>
4997       <entry><type>character_data</type></entry>
4998       <entry>Identifier string of a profile</entry>
4999      </row>
5000
5001      <row>
5002       <entry><literal>required_value</literal></entry>
5003       <entry><type>cardinal_number</type></entry>
5004       <entry>
5005        The value required by the SQL profile for the sizing item, or 0
5006        if the profile places no limit on the sizing item, or null if
5007        the profile does not require any of the features for which the
5008        sizing item is applicable
5009       </entry>
5010      </row>
5011
5012      <row>
5013       <entry><literal>comments</literal></entry>
5014       <entry><type>character_data</type></entry>
5015       <entry>Possibly a comment pertaining to the sizing item within the profile</entry>
5016      </row>
5017     </tbody>
5018    </tgroup>
5019   </table>
5020  </sect1>
5021
5022  <sect1 id="infoschema-table-constraints">
5023   <title><literal>table_constraints</literal></title>
5024
5025   <para>
5026    The view <literal>table_constraints</literal> contains all
5027    constraints belonging to tables that the current user owns or has
5028    some non-SELECT privilege on.
5029   </para>
5030
5031   <table>
5032    <title><literal>table_constraints</literal> Columns</title>
5033
5034    <tgroup cols="3">
5035     <thead>
5036      <row>
5037       <entry>Name</entry>
5038       <entry>Data Type</entry>
5039       <entry>Description</entry>
5040      </row>
5041     </thead>
5042
5043     <tbody>
5044      <row>
5045       <entry><literal>constraint_catalog</literal></entry>
5046       <entry><type>sql_identifier</type></entry>
5047       <entry>Name of the database that contains the constraint (always the current database)</entry>
5048      </row>
5049
5050      <row>
5051       <entry><literal>constraint_schema</literal></entry>
5052       <entry><type>sql_identifier</type></entry>
5053       <entry>Name of the schema that contains the constraint</entry>
5054      </row>
5055
5056      <row>
5057       <entry><literal>constraint_name</literal></entry>
5058       <entry><type>sql_identifier</type></entry>
5059       <entry>Name of the constraint</entry>
5060      </row>
5061
5062      <row>
5063       <entry><literal>table_catalog</literal></entry>
5064       <entry><type>sql_identifier</type></entry>
5065       <entry>Name of the database that contains the table (always the current database)</entry>
5066      </row>
5067
5068      <row>
5069       <entry><literal>table_schema</literal></entry>
5070       <entry><type>sql_identifier</type></entry>
5071       <entry>Name of the schema that contains the table</entry>
5072      </row>
5073
5074      <row>
5075       <entry><literal>table_name</literal></entry>
5076       <entry><type>sql_identifier</type></entry>
5077       <entry>Name of the table</entry>
5078      </row>
5079
5080      <row>
5081       <entry><literal>constraint_type</literal></entry>
5082       <entry><type>character_data</type></entry>
5083       <entry>
5084        Type of the constraint: <literal>CHECK</literal>,
5085        <literal>FOREIGN KEY</literal>, <literal>PRIMARY KEY</literal>,
5086        or <literal>UNIQUE</literal>
5087       </entry>
5088      </row>
5089
5090      <row>
5091       <entry><literal>is_deferrable</literal></entry>
5092       <entry><type>yes_or_no</type></entry>
5093       <entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry>
5094      </row>
5095
5096      <row>
5097       <entry><literal>initially_deferred</literal></entry>
5098       <entry><type>yes_or_no</type></entry>
5099       <entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry>
5100      </row>
5101     </tbody>
5102    </tgroup>
5103   </table>
5104  </sect1>
5105
5106  <sect1 id="infoschema-table-privileges">
5107   <title><literal>table_privileges</literal></title>
5108
5109   <para>
5110    The view <literal>table_privileges</literal> identifies all
5111    privileges granted on tables or views to a currently enabled role
5112    or by a currently enabled role.  There is one row for each
5113    combination of table, grantor, and grantee.
5114   </para>
5115
5116   <table>
5117    <title><literal>table_privileges</literal> Columns</title>
5118
5119    <tgroup cols="3">
5120     <thead>
5121      <row>
5122       <entry>Name</entry>
5123       <entry>Data Type</entry>
5124       <entry>Description</entry>
5125      </row>
5126     </thead>
5127
5128     <tbody>
5129      <row>
5130       <entry><literal>grantor</literal></entry>
5131       <entry><type>sql_identifier</type></entry>
5132       <entry>Name of the role that granted the privilege</entry>
5133      </row>
5134
5135      <row>
5136       <entry><literal>grantee</literal></entry>
5137       <entry><type>sql_identifier</type></entry>
5138       <entry>Name of the role that the privilege was granted to</entry>
5139      </row>
5140
5141      <row>
5142       <entry><literal>table_catalog</literal></entry>
5143       <entry><type>sql_identifier</type></entry>
5144       <entry>Name of the database that contains the table (always the current database)</entry>
5145      </row>
5146
5147      <row>
5148       <entry><literal>table_schema</literal></entry>
5149       <entry><type>sql_identifier</type></entry>
5150       <entry>Name of the schema that contains the table</entry>
5151      </row>
5152
5153      <row>
5154       <entry><literal>table_name</literal></entry>
5155       <entry><type>sql_identifier</type></entry>
5156       <entry>Name of the table</entry>
5157      </row>
5158
5159      <row>
5160       <entry><literal>privilege_type</literal></entry>
5161       <entry><type>character_data</type></entry>
5162       <entry>
5163        Type of the privilege: <literal>SELECT</literal>,
5164        <literal>INSERT</literal>, <literal>UPDATE</literal>,
5165        <literal>DELETE</literal>, <literal>TRUNCATE</literal>,
5166        <literal>REFERENCES</literal>, or <literal>TRIGGER</literal>
5167       </entry>
5168      </row>
5169
5170      <row>
5171       <entry><literal>is_grantable</literal></entry>
5172       <entry><type>yes_or_no</type></entry>
5173       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
5174      </row>
5175
5176      <row>
5177       <entry><literal>with_hierarchy</literal></entry>
5178       <entry><type>yes_or_no</type></entry>
5179       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5180      </row>
5181     </tbody>
5182    </tgroup>
5183   </table>
5184  </sect1>
5185
5186  <sect1 id="infoschema-tables">
5187   <title><literal>tables</literal></title>
5188
5189   <para>
5190    The view <literal>tables</literal> contains all tables and views
5191    defined in the current database.  Only those tables and views are
5192    shown that the current user has access to (by way of being the
5193    owner or having some privilege).
5194   </para>
5195
5196   <table>
5197    <title><literal>tables</literal> Columns</title>
5198
5199    <tgroup cols="3">
5200     <thead>
5201      <row>
5202       <entry>Name</entry>
5203       <entry>Data Type</entry>
5204       <entry>Description</entry>
5205      </row>
5206     </thead>
5207
5208     <tbody>
5209      <row>
5210       <entry><literal>table_catalog</literal></entry>
5211       <entry><type>sql_identifier</type></entry>
5212       <entry>Name of the database that contains the table (always the current database)</entry>
5213      </row>
5214
5215      <row>
5216       <entry><literal>table_schema</literal></entry>
5217       <entry><type>sql_identifier</type></entry>
5218       <entry>Name of the schema that contains the table</entry>
5219      </row>
5220
5221      <row>
5222       <entry><literal>table_name</literal></entry>
5223       <entry><type>sql_identifier</type></entry>
5224       <entry>Name of the table</entry>
5225      </row>
5226
5227      <row>
5228       <entry><literal>table_type</literal></entry>
5229       <entry><type>character_data</type></entry>
5230       <entry>
5231        Type of the table: <literal>BASE TABLE</literal> for a
5232        persistent base table (the normal table type),
5233        <literal>VIEW</literal> for a view, <literal>FOREIGN TABLE</literal>
5234        for a foreign table, or
5235        <literal>LOCAL TEMPORARY</literal> for a temporary table
5236       </entry>
5237      </row>
5238
5239      <row>
5240       <entry><literal>self_referencing_column_name</literal></entry>
5241       <entry><type>sql_identifier</type></entry>
5242       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5243      </row>
5244
5245      <row>
5246       <entry><literal>reference_generation</literal></entry>
5247       <entry><type>character_data</type></entry>
5248       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5249      </row>
5250
5251      <row>
5252       <entry><literal>user_defined_type_catalog</literal></entry>
5253       <entry><type>sql_identifier</type></entry>
5254       <entry>
5255        If the table is a typed table, the name of the database that
5256        contains the underlying data type (always the current
5257        database), else null.
5258       </entry>
5259      </row>
5260
5261      <row>
5262       <entry><literal>user_defined_type_schema</literal></entry>
5263       <entry><type>sql_identifier</type></entry>
5264       <entry>
5265        If the table is a typed table, the name of the schema that
5266        contains the underlying data type, else null.
5267       </entry>
5268      </row>
5269
5270      <row>
5271       <entry><literal>user_defined_type_name</literal></entry>
5272       <entry><type>sql_identifier</type></entry>
5273       <entry>
5274        If the table is a typed table, the name of the underlying data
5275        type, else null.
5276       </entry>
5277      </row>
5278
5279      <row>
5280       <entry><literal>is_insertable_into</literal></entry>
5281       <entry><type>yes_or_no</type></entry>
5282       <entry>
5283        <literal>YES</literal> if the table is insertable into,
5284        <literal>NO</literal> if not (Base tables are always insertable
5285        into, views not necessarily.)
5286       </entry>
5287      </row>
5288
5289      <row>
5290       <entry><literal>is_typed</literal></entry>
5291       <entry><type>yes_or_no</type></entry>
5292       <entry><literal>YES</literal> if the table is a typed table, <literal>NO</literal> if not</entry>
5293      </row>
5294
5295      <row>
5296       <entry><literal>commit_action</literal></entry>
5297       <entry><type>character_data</type></entry>
5298       <entry>
5299        If the table is a temporary table, then
5300        <literal>PRESERVE</literal>, else null.  (The SQL standard
5301        defines other commit actions for temporary tables, which are
5302        not supported by <productname>PostgreSQL</>.)
5303       </entry>
5304      </row>
5305     </tbody>
5306    </tgroup>
5307   </table>
5308  </sect1>
5309
5310  <sect1 id="infoschema-triggered-update-columns">
5311   <title><literal>triggered_update_columns</literal></title>
5312
5313   <para>
5314    For triggers in the current database that specify a column list
5315    (like <literal>UPDATE OF column1, column2</literal>), the
5316    view <literal>triggered_update_columns</literal> identifies these
5317    columns.  Triggers that do not specify a column list are not
5318    included in this view.  Only those columns are shown that the
5319    current user owns or has some non-SELECT privilege on.
5320   </para>
5321
5322   <table>
5323    <title><literal>triggered_update_columns</literal> Columns</title>
5324
5325    <tgroup cols="3">
5326     <thead>
5327      <row>
5328       <entry>Name</entry>
5329       <entry>Data Type</entry>
5330       <entry>Description</entry>
5331      </row>
5332     </thead>
5333
5334     <tbody>
5335      <row>
5336       <entry><literal>trigger_catalog</literal></entry>
5337       <entry><type>sql_identifier</type></entry>
5338       <entry>Name of the database that contains the trigger (always the current database)</entry>
5339      </row>
5340
5341      <row>
5342       <entry><literal>trigger_schema</literal></entry>
5343       <entry><type>sql_identifier</type></entry>
5344       <entry>Name of the schema that contains the trigger</entry>
5345      </row>
5346
5347      <row>
5348       <entry><literal>trigger_name</literal></entry>
5349       <entry><type>sql_identifier</type></entry>
5350       <entry>Name of the trigger</entry>
5351      </row>
5352
5353      <row>
5354       <entry><literal>event_object_catalog</literal></entry>
5355       <entry><type>sql_identifier</type></entry>
5356       <entry>
5357        Name of the database that contains the table that the trigger
5358        is defined on (always the current database)
5359       </entry>
5360      </row>
5361
5362      <row>
5363       <entry><literal>event_object_schema</literal></entry>
5364       <entry><type>sql_identifier</type></entry>
5365       <entry>Name of the schema that contains the table that the trigger is defined on</entry>
5366      </row>
5367
5368      <row>
5369       <entry><literal>event_object_table</literal></entry>
5370       <entry><type>sql_identifier</type></entry>
5371       <entry>Name of the table that the trigger is defined on</entry>
5372      </row>
5373
5374      <row>
5375       <entry><literal>event_object_column</literal></entry>
5376       <entry><type>sql_identifier</type></entry>
5377       <entry>Name of the column that the trigger is defined on</entry>
5378      </row>
5379     </tbody>
5380    </tgroup>
5381   </table>
5382  </sect1>
5383
5384  <sect1 id="infoschema-triggers">
5385   <title><literal>triggers</literal></title>
5386
5387   <para>
5388    The view <literal>triggers</literal> contains all triggers defined
5389    in the current database on tables and views that the current user owns
5390    or has some non-SELECT privilege on.
5391   </para>
5392
5393   <table>
5394    <title><literal>triggers</literal> Columns</title>
5395
5396    <tgroup cols="3">
5397     <thead>
5398      <row>
5399       <entry>Name</entry>
5400       <entry>Data Type</entry>
5401       <entry>Description</entry>
5402      </row>
5403     </thead>
5404
5405     <tbody>
5406      <row>
5407       <entry><literal>trigger_catalog</literal></entry>
5408       <entry><type>sql_identifier</type></entry>
5409       <entry>Name of the database that contains the trigger (always the current database)</entry>
5410      </row>
5411
5412      <row>
5413       <entry><literal>trigger_schema</literal></entry>
5414       <entry><type>sql_identifier</type></entry>
5415       <entry>Name of the schema that contains the trigger</entry>
5416      </row>
5417
5418      <row>
5419       <entry><literal>trigger_name</literal></entry>
5420       <entry><type>sql_identifier</type></entry>
5421       <entry>Name of the trigger</entry>
5422      </row>
5423
5424      <row>
5425       <entry><literal>event_manipulation</literal></entry>
5426       <entry><type>character_data</type></entry>
5427       <entry>
5428        Event that fires the trigger (<literal>INSERT</literal>,
5429        <literal>UPDATE</literal>, or <literal>DELETE</literal>)
5430       </entry>
5431      </row>
5432
5433      <row>
5434       <entry><literal>event_object_catalog</literal></entry>
5435       <entry><type>sql_identifier</type></entry>
5436       <entry>
5437        Name of the database that contains the table that the trigger
5438        is defined on (always the current database)
5439       </entry>
5440      </row>
5441
5442      <row>
5443       <entry><literal>event_object_schema</literal></entry>
5444       <entry><type>sql_identifier</type></entry>
5445       <entry>Name of the schema that contains the table that the trigger is defined on</entry>
5446      </row>
5447
5448      <row>
5449       <entry><literal>event_object_table</literal></entry>
5450       <entry><type>sql_identifier</type></entry>
5451       <entry>Name of the table that the trigger is defined on</entry>
5452      </row>
5453
5454      <row>
5455       <entry><literal>action_order</literal></entry>
5456       <entry><type>cardinal_number</type></entry>
5457       <entry>Not yet implemented</entry>
5458      </row>
5459
5460      <row>
5461       <entry><literal>action_condition</literal></entry>
5462       <entry><type>character_data</type></entry>
5463       <entry>
5464        <literal>WHEN</literal> condition of the trigger, null if none
5465        (also null if the table is not owned by a currently enabled
5466        role)
5467       </entry>
5468      </row>
5469
5470      <row>
5471       <entry><literal>action_statement</literal></entry>
5472       <entry><type>character_data</type></entry>
5473       <entry>
5474        Statement that is executed by the trigger (currently always
5475        <literal>EXECUTE PROCEDURE
5476        <replaceable>function</replaceable>(...)</literal>)
5477       </entry>
5478      </row>
5479
5480      <row>
5481       <entry><literal>action_orientation</literal></entry>
5482       <entry><type>character_data</type></entry>
5483       <entry>
5484        Identifies whether the trigger fires once for each processed
5485        row or once for each statement (<literal>ROW</literal> or
5486        <literal>STATEMENT</literal>)
5487       </entry>
5488      </row>
5489
5490      <row>
5491       <entry><literal>action_timing</literal></entry>
5492       <entry><type>character_data</type></entry>
5493       <entry>
5494        Time at which the trigger fires (<literal>BEFORE</literal>,
5495        <literal>AFTER</literal>, or <literal>INSTEAD OF</literal>)
5496       </entry>
5497      </row>
5498
5499      <row>
5500       <entry><literal>action_reference_old_table</literal></entry>
5501       <entry><type>sql_identifier</type></entry>
5502       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5503      </row>
5504
5505      <row>
5506       <entry><literal>action_reference_new_table</literal></entry>
5507       <entry><type>sql_identifier</type></entry>
5508       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5509      </row>
5510
5511      <row>
5512       <entry><literal>action_reference_old_row</literal></entry>
5513       <entry><type>sql_identifier</type></entry>
5514       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5515      </row>
5516
5517      <row>
5518       <entry><literal>action_reference_new_row</literal></entry>
5519       <entry><type>sql_identifier</type></entry>
5520       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5521      </row>
5522
5523      <row>
5524       <entry><literal>created</literal></entry>
5525       <entry><type>time_stamp</type></entry>
5526       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5527      </row>
5528     </tbody>
5529    </tgroup>
5530   </table>
5531
5532   <para>
5533    Triggers in <productname>PostgreSQL</productname> have two
5534    incompatibilities with the SQL standard that affect the
5535    representation in the information schema.  First, trigger names are
5536    local to each table in <productname>PostgreSQL</productname>, rather
5537    than being independent schema objects.  Therefore there can be duplicate
5538    trigger names defined in one schema, so long as they belong to
5539    different tables.  (<literal>trigger_catalog</literal> and
5540    <literal>trigger_schema</literal> are really the values pertaining
5541    to the table that the trigger is defined on.)  Second, triggers can
5542    be defined to fire on multiple events in
5543    <productname>PostgreSQL</productname> (e.g., <literal>ON INSERT OR
5544    UPDATE</literal>), whereas the SQL standard only allows one.  If a
5545    trigger is defined to fire on multiple events, it is represented as
5546    multiple rows in the information schema, one for each type of
5547    event.  As a consequence of these two issues, the primary key of
5548    the view <literal>triggers</literal> is really
5549    <literal>(trigger_catalog, trigger_schema, event_object_table,
5550    trigger_name, event_manipulation)</literal> instead of
5551    <literal>(trigger_catalog, trigger_schema, trigger_name)</literal>,
5552    which is what the SQL standard specifies.  Nonetheless, if you
5553    define your triggers in a manner that conforms with the SQL
5554    standard (trigger names unique in the schema and only one event
5555    type per trigger), this will not affect you.
5556   </para>
5557
5558   <note>
5559    <para>
5560     Prior to <productname>PostgreSQL</> 9.1, this view's columns
5561     <structfield>action_timing</structfield>,
5562     <structfield>action_reference_old_table</structfield>,
5563     <structfield>action_reference_new_table</structfield>,
5564     <structfield>action_reference_old_row</structfield>, and
5565     <structfield>action_reference_new_row</structfield>
5566     were named
5567     <structfield>condition_timing</structfield>,
5568     <structfield>condition_reference_old_table</structfield>,
5569     <structfield>condition_reference_new_table</structfield>,
5570     <structfield>condition_reference_old_row</structfield>, and
5571     <structfield>condition_reference_new_row</structfield>
5572     respectively.
5573     That was how they were named in the SQL:1999 standard.
5574     The new naming conforms to SQL:2003 and later.
5575    </para>
5576   </note>
5577  </sect1>
5578
5579  <sect1 id="infoschema-udt-privileges">
5580   <title><literal>udt_privileges</literal></title>
5581
5582   <para>
5583    The view <literal>udt_privileges</literal> is intended to identify
5584    <literal>USAGE</literal> privileges granted on user-defined types
5585    to a currently enabled role or by a currently enabled role.  Since
5586    data types do not have real privileges
5587    in <productname>PostgreSQL</productname>, this view shows implicit
5588    non-grantable <literal>USAGE</literal> privileges granted by the
5589    owner to <literal>PUBLIC</literal> for all types, including
5590    built-in ones (except domains,
5591    see <xref linkend="infoschema-usage-privileges"> for that).
5592   </para>
5593
5594   <table>
5595    <title><literal>udt_privileges</literal> Columns</title>
5596
5597    <tgroup cols="3">
5598     <thead>
5599      <row>
5600       <entry>Name</entry>
5601       <entry>Data Type</entry>
5602       <entry>Description</entry>
5603      </row>
5604     </thead>
5605
5606     <tbody>
5607      <row>
5608       <entry><literal>grantor</literal></entry>
5609       <entry><type>sql_identifier</type></entry>
5610       <entry>Name of the role that granted the privilege</entry>
5611      </row>
5612
5613      <row>
5614       <entry><literal>grantee</literal></entry>
5615       <entry><type>sql_identifier</type></entry>
5616       <entry>Name of the role that the privilege was granted to</entry>
5617      </row>
5618
5619      <row>
5620       <entry><literal>udt_catalog</literal></entry>
5621       <entry><type>sql_identifier</type></entry>
5622       <entry>Name of the database containing the type (always the current database)</entry>
5623      </row>
5624
5625      <row>
5626       <entry><literal>udt_schema</literal></entry>
5627       <entry><type>sql_identifier</type></entry>
5628       <entry>Name of the schema containing the type</entry>
5629      </row>
5630
5631      <row>
5632       <entry><literal>udt_name</literal></entry>
5633       <entry><type>sql_identifier</type></entry>
5634       <entry>Name of the type</entry>
5635      </row>
5636
5637      <row>
5638       <entry><literal>privilege_type</literal></entry>
5639       <entry><type>character_data</type></entry>
5640       <entry>Always <literal>TYPE USAGE</literal></entry>
5641      </row>
5642
5643      <row>
5644       <entry><literal>is_grantable</literal></entry>
5645       <entry><type>yes_or_no</type></entry>
5646       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
5647      </row>
5648     </tbody>
5649    </tgroup>
5650   </table>
5651  </sect1>
5652
5653  <sect1 id="infoschema-usage-privileges">
5654   <title><literal>usage_privileges</literal></title>
5655
5656   <para>
5657    The view <literal>usage_privileges</literal> identifies
5658    <literal>USAGE</literal> privileges granted on various kinds of
5659    objects to a currently enabled role or by a currently enabled role.
5660    In <productname>PostgreSQL</productname>, this currently applies to
5661    collations, domains, foreign-data wrappers, and foreign servers.  There is one
5662    row for each combination of object, grantor, and grantee.
5663   </para>
5664
5665   <para>
5666    Since collations and domains do not have real privileges
5667    in <productname>PostgreSQL</productname>, this view shows implicit
5668    non-grantable <literal>USAGE</literal> privileges granted by the
5669    owner to <literal>PUBLIC</literal> for all collations and domains.  The other
5670    object types, however, show real privileges.
5671   </para>
5672
5673   <table>
5674    <title><literal>usage_privileges</literal> Columns</title>
5675
5676    <tgroup cols="3">
5677     <thead>
5678      <row>
5679       <entry>Name</entry>
5680       <entry>Data Type</entry>
5681       <entry>Description</entry>
5682      </row>
5683     </thead>
5684
5685     <tbody>
5686      <row>
5687       <entry><literal>grantor</literal></entry>
5688       <entry><type>sql_identifier</type></entry>
5689       <entry>Name of the role that granted the privilege</entry>
5690      </row>
5691
5692      <row>
5693       <entry><literal>grantee</literal></entry>
5694       <entry><type>sql_identifier</type></entry>
5695       <entry>Name of the role that the privilege was granted to</entry>
5696      </row>
5697
5698      <row>
5699       <entry><literal>object_catalog</literal></entry>
5700       <entry><type>sql_identifier</type></entry>
5701       <entry>Name of the database containing the object (always the current database)</entry>
5702      </row>
5703
5704      <row>
5705       <entry><literal>object_schema</literal></entry>
5706       <entry><type>sql_identifier</type></entry>
5707       <entry>Name of the schema containing the object, if applicable,
5708       else an empty string</entry>
5709      </row>
5710
5711      <row>
5712       <entry><literal>object_name</literal></entry>
5713       <entry><type>sql_identifier</type></entry>
5714       <entry>Name of the object</entry>
5715      </row>
5716
5717      <row>
5718       <entry><literal>object_type</literal></entry>
5719       <entry><type>character_data</type></entry>
5720       <entry><literal>COLLATION</literal> or <literal>DOMAIN</literal> or <literal>FOREIGN DATA WRAPPER</literal> or <literal>FOREIGN SERVER</literal></entry>
5721      </row>
5722
5723      <row>
5724       <entry><literal>privilege_type</literal></entry>
5725       <entry><type>character_data</type></entry>
5726       <entry>Always <literal>USAGE</literal></entry>
5727      </row>
5728
5729      <row>
5730       <entry><literal>is_grantable</literal></entry>
5731       <entry><type>yes_or_no</type></entry>
5732       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
5733      </row>
5734     </tbody>
5735    </tgroup>
5736   </table>
5737  </sect1>
5738
5739  <sect1 id="infoschema-user-defined-types">
5740   <title><literal>user_defined_types</literal></title>
5741
5742   <para>
5743    The view <literal>user_defined_types</literal> currently contains
5744    all composite types defined in the current database.
5745   </para>
5746
5747   <para>
5748    SQL knows about two kinds of user-defined types: structured types
5749    (also known as composite types
5750    in <productname>PostgreSQL</productname>) and distinct types (not
5751    implemented in <productname>PostgreSQL</productname>).  To be
5752    future-proof, use the
5753    column <literal>user_defined_type_category</literal> to
5754    differentiate between these.  Other user-defined types such as base
5755    types and enums, which are <productname>PostgreSQL</productname>
5756    extensions, are not shown here.  For domains,
5757    see <xref linkend="infoschema-domains"> instead.
5758   </para>
5759
5760   <table>
5761    <title><literal>user_defined_types</literal> Columns</title>
5762
5763    <tgroup cols="3">
5764     <thead>
5765      <row>
5766       <entry>Name</entry>
5767       <entry>Data Type</entry>
5768       <entry>Description</entry>
5769      </row>
5770     </thead>
5771
5772     <tbody>
5773      <row>
5774       <entry><literal>user_defined_type_catalog</literal></entry>
5775       <entry><type>sql_identifier</type></entry>
5776       <entry>Name of the database that contains the type (always the current database)</entry>
5777      </row>
5778
5779      <row>
5780       <entry><literal>user_defined_type_schema</literal></entry>
5781       <entry><type>sql_identifier</type></entry>
5782       <entry>Name of the schema that contains the type</entry>
5783      </row>
5784
5785      <row>
5786       <entry><literal>user_defined_type_name</literal></entry>
5787       <entry><type>sql_identifier</type></entry>
5788       <entry>Name of the type</entry>
5789      </row>
5790
5791      <row>
5792       <entry><literal>user_defined_type_category</literal></entry>
5793       <entry><type>character_data</type></entry>
5794       <entry>
5795        Currently always <literal>STRUCTURED</literal>
5796       </entry>
5797      </row>
5798
5799      <row>
5800       <entry><literal>is_instantiable</literal></entry>
5801       <entry><type>yes_or_no</type></entry>
5802       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5803      </row>
5804
5805      <row>
5806       <entry><literal>is_final</literal></entry>
5807       <entry><type>yes_or_no</type></entry>
5808       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5809      </row>
5810
5811      <row>
5812       <entry><literal>ordering_form</literal></entry>
5813       <entry><type>character_data</type></entry>
5814       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5815      </row>
5816
5817      <row>
5818       <entry><literal>ordering_category</literal></entry>
5819       <entry><type>character_data</type></entry>
5820       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5821      </row>
5822
5823      <row>
5824       <entry><literal>ordering_routine_catalog</literal></entry>
5825       <entry><type>sql_identifier</type></entry>
5826       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5827      </row>
5828
5829      <row>
5830       <entry><literal>ordering_routine_schema</literal></entry>
5831       <entry><type>sql_identifier</type></entry>
5832       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5833      </row>
5834
5835      <row>
5836       <entry><literal>ordering_routine_name</literal></entry>
5837       <entry><type>sql_identifier</type></entry>
5838       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5839      </row>
5840
5841      <row>
5842       <entry><literal>reference_type</literal></entry>
5843       <entry><type>character_data</type></entry>
5844       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5845      </row>
5846
5847      <row>
5848       <entry><literal>data_type</literal></entry>
5849       <entry><type>character_data</type></entry>
5850       <entry>
5851        Always <literal>USER-DEFINED TYPE</literal> (for joining
5852        against <literal>object_type</literal> columns in other
5853        views)
5854       </entry>
5855      </row>
5856
5857      <row>
5858       <entry><literal>character_maximum_length</literal></entry>
5859       <entry><type>cardinal_number</type></entry>
5860       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5861      </row>
5862
5863      <row>
5864       <entry><literal>character_octet_length</literal></entry>
5865       <entry><type>cardinal_number</type></entry>
5866       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5867      </row>
5868
5869      <row>
5870       <entry><literal>character_set_catalog</literal></entry>
5871       <entry><type>sql_identifier</type></entry>
5872       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5873      </row>
5874
5875      <row>
5876       <entry><literal>character_set_schema</literal></entry>
5877       <entry><type>sql_identifier</type></entry>
5878       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5879      </row>
5880
5881      <row>
5882       <entry><literal>character_set_name</literal></entry>
5883       <entry><type>sql_identifier</type></entry>
5884       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5885      </row>
5886
5887      <row>
5888       <entry><literal>collation_catalog</literal></entry>
5889       <entry><type>sql_identifier</type></entry>
5890       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5891      </row>
5892
5893      <row>
5894       <entry><literal>collation_schema</literal></entry>
5895       <entry><type>sql_identifier</type></entry>
5896       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5897      </row>
5898
5899      <row>
5900       <entry><literal>collation_name</literal></entry>
5901       <entry><type>sql_identifier</type></entry>
5902       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5903      </row>
5904
5905      <row>
5906       <entry><literal>numeric_precision</literal></entry>
5907       <entry><type>cardinal_number</type></entry>
5908       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5909      </row>
5910
5911      <row>
5912       <entry><literal>numeric_precision_radix</literal></entry>
5913       <entry><type>cardinal_number</type></entry>
5914       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5915      </row>
5916
5917      <row>
5918       <entry><literal>numeric_scale</literal></entry>
5919       <entry><type>cardinal_number</type></entry>
5920       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5921      </row>
5922
5923      <row>
5924       <entry><literal>datetime_precision</literal></entry>
5925       <entry><type>cardinal_number</type></entry>
5926       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5927      </row>
5928
5929      <row>
5930       <entry><literal>interval_type</literal></entry>
5931       <entry><type>character_data</type></entry>
5932       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5933      </row>
5934
5935      <row>
5936       <entry><literal>interval_precision</literal></entry>
5937       <entry><type>character_data</type></entry>
5938       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5939      </row>
5940
5941      <row>
5942       <entry><literal>source_dtd_identifier</literal></entry>
5943       <entry><type>sql_identifier</type></entry>
5944       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5945      </row>
5946
5947      <row>
5948       <entry><literal>ref_dtd_identifier</literal></entry>
5949       <entry><type>sql_identifier</type></entry>
5950       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5951      </row>
5952     </tbody>
5953    </tgroup>
5954   </table>
5955  </sect1>
5956
5957  <sect1 id="infoschema-user-mapping-options">
5958   <title><literal>user_mapping_options</literal></title>
5959
5960   <para>
5961    The view <literal>user_mapping_options</literal> contains all the
5962    options defined for user mappings in the current database.  Only
5963    those user mappings are shown where the current user has access to
5964    the corresponding foreign server (by way of being the owner or
5965    having some privilege).
5966   </para>
5967
5968   <table>
5969    <title><literal>user_mapping_options</literal> Columns</title>
5970
5971    <tgroup cols="3">
5972     <thead>
5973      <row>
5974       <entry>Name</entry>
5975       <entry>Data Type</entry>
5976       <entry>Description</entry>
5977      </row>
5978     </thead>
5979
5980     <tbody>
5981      <row>
5982       <entry><literal>authorization_identifier</literal></entry>
5983       <entry><type>sql_identifier</type></entry>
5984       <entry>Name of the user being mapped,
5985       or <literal>PUBLIC</literal> if the mapping is public</entry>
5986      </row>
5987
5988      <row>
5989       <entry><literal>foreign_server_catalog</literal></entry>
5990       <entry><type>sql_identifier</type></entry>
5991       <entry>Name of the database that the foreign server used by this
5992       mapping is defined in (always the current database)</entry>
5993      </row>
5994
5995      <row>
5996       <entry><literal>foreign_server_name</literal></entry>
5997       <entry><type>sql_identifier</type></entry>
5998       <entry>Name of the foreign server used by this mapping</entry>
5999      </row>
6000
6001      <row>
6002       <entry><literal>option_name</literal></entry>
6003       <entry><type>sql_identifier</type></entry>
6004       <entry>Name of an option</entry>
6005      </row>
6006
6007      <row>
6008       <entry><literal>option_value</literal></entry>
6009       <entry><type>character_data</type></entry>
6010       <entry>Value of the option.  This column will show as null
6011       unless the current user is the user being mapped, or the mapping
6012       is for <literal>PUBLIC</literal> and the current user is the
6013       server owner, or the current user is a superuser.  The intent is
6014       to protect password information stored as user mapping
6015       option.</entry>
6016      </row>
6017     </tbody>
6018    </tgroup>
6019   </table>
6020  </sect1>
6021
6022  <sect1 id="infoschema-user-mappings">
6023   <title><literal>user_mappings</literal></title>
6024
6025   <para>
6026    The view <literal>user_mappings</literal> contains all user
6027    mappings defined in the current database.  Only those user mappings
6028    are shown where the current user has access to the corresponding
6029    foreign server (by way of being the owner or having some
6030    privilege).
6031   </para>
6032
6033   <table>
6034    <title><literal>user_mappings</literal> Columns</title>
6035
6036    <tgroup cols="3">
6037     <thead>
6038      <row>
6039       <entry>Name</entry>
6040       <entry>Data Type</entry>
6041       <entry>Description</entry>
6042      </row>
6043     </thead>
6044
6045     <tbody>
6046      <row>
6047       <entry><literal>authorization_identifier</literal></entry>
6048       <entry><type>sql_identifier</type></entry>
6049       <entry>Name of the user being mapped,
6050       or <literal>PUBLIC</literal> if the mapping is public</entry>
6051      </row>
6052
6053      <row>
6054       <entry><literal>foreign_server_catalog</literal></entry>
6055       <entry><type>sql_identifier</type></entry>
6056       <entry>Name of the database that the foreign server used by this
6057       mapping is defined in (always the current database)</entry>
6058      </row>
6059
6060      <row>
6061       <entry><literal>foreign_server_name</literal></entry>
6062       <entry><type>sql_identifier</type></entry>
6063       <entry>Name of the foreign server used by this mapping</entry>
6064      </row>
6065     </tbody>
6066    </tgroup>
6067   </table>
6068  </sect1>
6069
6070  <sect1 id="infoschema-view-column-usage">
6071   <title><literal>view_column_usage</literal></title>
6072
6073   <para>
6074    The view <literal>view_column_usage</literal> identifies all
6075    columns that are used in the query expression of a view (the
6076    <command>SELECT</command> statement that defines the view).  A
6077    column is only included if the table that contains the column is
6078    owned by a currently enabled role.
6079   </para>
6080
6081   <note>
6082    <para>
6083     Columns of system tables are not included.  This should be fixed
6084     sometime.
6085    </para>
6086   </note>
6087
6088   <table>
6089    <title><literal>view_column_usage</literal> Columns</title>
6090
6091    <tgroup cols="3">
6092     <thead>
6093      <row>
6094       <entry>Name</entry>
6095       <entry>Data Type</entry>
6096       <entry>Description</entry>
6097      </row>
6098     </thead>
6099
6100     <tbody>
6101      <row>
6102       <entry><literal>view_catalog</literal></entry>
6103       <entry><type>sql_identifier</type></entry>
6104       <entry>Name of the database that contains the view (always the current database)</entry>
6105      </row>
6106
6107      <row>
6108       <entry><literal>view_schema</literal></entry>
6109       <entry><type>sql_identifier</type></entry>
6110       <entry>Name of the schema that contains the view</entry>
6111      </row>
6112
6113      <row>
6114       <entry><literal>view_name</literal></entry>
6115       <entry><type>sql_identifier</type></entry>
6116       <entry>Name of the view</entry>
6117      </row>
6118
6119      <row>
6120       <entry><literal>table_catalog</literal></entry>
6121       <entry><type>sql_identifier</type></entry>
6122       <entry>
6123        Name of the database that contains the table that contains the
6124        column that is used by the view (always the current database)
6125       </entry>
6126      </row>
6127
6128      <row>
6129       <entry><literal>table_schema</literal></entry>
6130       <entry><type>sql_identifier</type></entry>
6131       <entry>
6132        Name of the schema that contains the table that contains the
6133        column that is used by the view
6134       </entry>
6135      </row>
6136
6137      <row>
6138       <entry><literal>table_name</literal></entry>
6139       <entry><type>sql_identifier</type></entry>
6140       <entry>
6141        Name of the table that contains the column that is used by the
6142        view
6143       </entry>
6144      </row>
6145
6146      <row>
6147       <entry><literal>column_name</literal></entry>
6148       <entry><type>sql_identifier</type></entry>
6149       <entry>Name of the column that is used by the view</entry>
6150      </row>
6151     </tbody>
6152    </tgroup>
6153   </table>
6154  </sect1>
6155
6156  <sect1 id="infoschema-view-routine-usage">
6157   <title><literal>view_routine_usage</literal></title>
6158
6159   <para>
6160    The view <literal>view_routine_usage</literal> identifies all
6161    routines (functions and procedures) that are used in the query
6162    expression of a view (the <command>SELECT</command> statement that
6163    defines the view).  A routine is only included if that routine is
6164    owned by a currently enabled role.
6165   </para>
6166
6167   <table>
6168    <title><literal>view_routine_usage</literal> Columns</title>
6169
6170    <tgroup cols="3">
6171     <thead>
6172      <row>
6173       <entry>Name</entry>
6174       <entry>Data Type</entry>
6175       <entry>Description</entry>
6176      </row>
6177     </thead>
6178
6179     <tbody>
6180      <row>
6181       <entry><literal>table_catalog</literal></entry>
6182       <entry><literal>sql_identifier</literal></entry>
6183       <entry>Name of the database containing the view (always the current database)</entry>
6184      </row>
6185
6186      <row>
6187       <entry><literal>table_schema</literal></entry>
6188       <entry><literal>sql_identifier</literal></entry>
6189       <entry>Name of the schema containing the view</entry>
6190      </row>
6191
6192      <row>
6193       <entry><literal>table_name</literal></entry>
6194       <entry><literal>sql_identifier</literal></entry>
6195       <entry>Name of the view</entry>
6196      </row>
6197
6198      <row>
6199       <entry><literal>specific_catalog</literal></entry>
6200       <entry><literal>sql_identifier</literal></entry>
6201       <entry>Name of the database containing the function (always the current database)</entry>
6202      </row>
6203
6204      <row>
6205       <entry><literal>specific_schema</literal></entry>
6206       <entry><literal>sql_identifier</literal></entry>
6207       <entry>Name of the schema containing the function</entry>
6208      </row>
6209
6210      <row>
6211       <entry><literal>specific_name</literal></entry>
6212       <entry><literal>sql_identifier</literal></entry>
6213       <entry>
6214        The <quote>specific name</quote> of the function.  See <xref
6215        linkend="infoschema-routines"> for more information.
6216       </entry>
6217      </row>
6218     </tbody>
6219    </tgroup>
6220   </table>
6221  </sect1>
6222
6223  <sect1 id="infoschema-view-table-usage">
6224   <title><literal>view_table_usage</literal></title>
6225
6226   <para>
6227    The view <literal>view_table_usage</literal> identifies all tables
6228    that are used in the query expression of a view (the
6229    <command>SELECT</command> statement that defines the view).  A
6230    table is only included if that table is owned by a currently
6231    enabled role.
6232   </para>
6233
6234   <note>
6235    <para>
6236     System tables are not included.  This should be fixed sometime.
6237    </para>
6238   </note>
6239
6240   <table>
6241    <title><literal>view_table_usage</literal> Columns</title>
6242
6243    <tgroup cols="3">
6244     <thead>
6245      <row>
6246       <entry>Name</entry>
6247       <entry>Data Type</entry>
6248       <entry>Description</entry>
6249      </row>
6250     </thead>
6251
6252     <tbody>
6253      <row>
6254       <entry><literal>view_catalog</literal></entry>
6255       <entry><type>sql_identifier</type></entry>
6256       <entry>Name of the database that contains the view (always the current database)</entry>
6257      </row>
6258
6259      <row>
6260       <entry><literal>view_schema</literal></entry>
6261       <entry><type>sql_identifier</type></entry>
6262       <entry>Name of the schema that contains the view</entry>
6263      </row>
6264
6265      <row>
6266       <entry><literal>view_name</literal></entry>
6267       <entry><type>sql_identifier</type></entry>
6268       <entry>Name of the view</entry>
6269      </row>
6270
6271      <row>
6272       <entry><literal>table_catalog</literal></entry>
6273       <entry><type>sql_identifier</type></entry>
6274       <entry>
6275        Name of the database that contains the table that is
6276        used by the view (always the current database)
6277       </entry>
6278      </row>
6279
6280      <row>
6281       <entry><literal>table_schema</literal></entry>
6282       <entry><type>sql_identifier</type></entry>
6283       <entry>
6284        Name of the schema that contains the table that is used by the
6285        view
6286       </entry>
6287      </row>
6288
6289      <row>
6290       <entry><literal>table_name</literal></entry>
6291       <entry><type>sql_identifier</type></entry>
6292       <entry>
6293        Name of the table that is used by the view
6294       </entry>
6295      </row>
6296     </tbody>
6297    </tgroup>
6298   </table>
6299  </sect1>
6300
6301  <sect1 id="infoschema-views">
6302   <title><literal>views</literal></title>
6303
6304   <para>
6305    The view <literal>views</literal> contains all views defined in the
6306    current database.  Only those views are shown that the current user
6307    has access to (by way of being the owner or having some privilege).
6308   </para>
6309
6310   <table>
6311    <title><literal>views</literal> Columns</title>
6312
6313    <tgroup cols="3">
6314     <thead>
6315      <row>
6316       <entry>Name</entry>
6317       <entry>Data Type</entry>
6318       <entry>Description</entry>
6319      </row>
6320     </thead>
6321
6322     <tbody>
6323      <row>
6324       <entry><literal>table_catalog</literal></entry>
6325       <entry><type>sql_identifier</type></entry>
6326       <entry>Name of the database that contains the view (always the current database)</entry>
6327      </row>
6328
6329      <row>
6330       <entry><literal>table_schema</literal></entry>
6331       <entry><type>sql_identifier</type></entry>
6332       <entry>Name of the schema that contains the view</entry>
6333      </row>
6334
6335      <row>
6336       <entry><literal>table_name</literal></entry>
6337       <entry><type>sql_identifier</type></entry>
6338       <entry>Name of the view</entry>
6339      </row>
6340
6341      <row>
6342       <entry><literal>view_definition</literal></entry>
6343       <entry><type>character_data</type></entry>
6344       <entry>
6345        Query expression defining the view (null if the view is not
6346        owned by a currently enabled role)
6347       </entry>
6348      </row>
6349
6350      <row>
6351       <entry><literal>check_option</literal></entry>
6352       <entry><type>character_data</type></entry>
6353       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
6354      </row>
6355
6356      <row>
6357       <entry><literal>is_updatable</literal></entry>
6358       <entry><type>yes_or_no</type></entry>
6359       <entry>
6360        <literal>YES</literal> if the view is updatable (allows
6361        <command>UPDATE</command> and <command>DELETE</command>),
6362        <literal>NO</literal> if not
6363       </entry>
6364      </row>
6365
6366      <row>
6367       <entry><literal>is_insertable_into</literal></entry>
6368       <entry><type>yes_or_no</type></entry>
6369       <entry>
6370        <literal>YES</literal> if the view is insertable into (allows
6371        <command>INSERT</command>), <literal>NO</literal> if not
6372       </entry>
6373      </row>
6374
6375      <row>
6376       <entry><literal>is_trigger_updatable</literal></entry>
6377       <entry><type>yes_or_no</type></entry>
6378       <entry>
6379        <literal>YES</> if the view has an <literal>INSTEAD OF</>
6380        <command>UPDATE</> trigger defined on it, <literal>NO</> if not
6381       </entry>
6382      </row>
6383
6384      <row>
6385       <entry><literal>is_trigger_deletable</literal></entry>
6386       <entry><type>yes_or_no</type></entry>
6387       <entry>
6388        <literal>YES</> if the view has an <literal>INSTEAD OF</>
6389        <command>DELETE</> trigger defined on it, <literal>NO</> if not
6390       </entry>
6391      </row>
6392
6393      <row>
6394       <entry><literal>is_trigger_insertable_into</literal></entry>
6395       <entry><type>yes_or_no</type></entry>
6396       <entry>
6397        <literal>YES</> if the view has an <literal>INSTEAD OF</>
6398        <command>INSERT</> trigger defined on it, <literal>NO</> if not
6399       </entry>
6400      </row>
6401     </tbody>
6402    </tgroup>
6403   </table>
6404  </sect1>
6405
6406 </chapter>