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