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