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