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