]> granicus.if.org Git - postgresql/blob - doc/src/sgml/information_schema.sgml
ad945c2ea9f52ad083096500936825399624d9d6
[postgresql] / doc / src / sgml / information_schema.sgml
1 <!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.43 2009/12/30 22:48:10 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>.  The only effective
2847    difference between this view
2848    and <literal>column_privileges</literal> is that this view omits
2849    columns that have been made accessible to the current user by way
2850    of a grant to public.
2851   </para>
2852
2853   <table>
2854    <title><literal>role_column_grants</literal> Columns</title>
2855
2856    <tgroup cols="3">
2857     <thead>
2858      <row>
2859       <entry>Name</entry>
2860       <entry>Data Type</entry>
2861       <entry>Description</entry>
2862      </row>
2863     </thead>
2864
2865     <tbody>
2866      <row>
2867       <entry><literal>grantor</literal></entry>
2868       <entry><type>sql_identifier</type></entry>
2869       <entry>Name of the role that granted the privilege</entry>
2870      </row>
2871
2872      <row>
2873       <entry><literal>grantee</literal></entry>
2874       <entry><type>sql_identifier</type></entry>
2875       <entry>Name of the role that the privilege was granted to</entry>
2876      </row>
2877
2878      <row>
2879       <entry><literal>table_catalog</literal></entry>
2880       <entry><type>sql_identifier</type></entry>
2881       <entry>Name of the database that contains the table that contains the column (always the current database)</entry>
2882      </row>
2883
2884      <row>
2885       <entry><literal>table_schema</literal></entry>
2886       <entry><type>sql_identifier</type></entry>
2887       <entry>Name of the schema that contains the table that contains the column</entry>
2888      </row>
2889
2890      <row>
2891       <entry><literal>table_name</literal></entry>
2892       <entry><type>sql_identifier</type></entry>
2893       <entry>Name of the table that contains the column</entry>
2894      </row>
2895
2896      <row>
2897       <entry><literal>column_name</literal></entry>
2898       <entry><type>sql_identifier</type></entry>
2899       <entry>Name of the column</entry>
2900      </row>
2901
2902      <row>
2903       <entry><literal>privilege_type</literal></entry>
2904       <entry><type>character_data</type></entry>
2905       <entry>
2906        Type of the privilege: <literal>SELECT</literal>,
2907        <literal>INSERT</literal>, <literal>UPDATE</literal>, or
2908        <literal>REFERENCES</literal>
2909       </entry>
2910      </row>
2911
2912      <row>
2913       <entry><literal>is_grantable</literal></entry>
2914       <entry><type>yes_or_no</type></entry>
2915       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
2916      </row>
2917     </tbody>
2918    </tgroup>
2919   </table>
2920  </sect1>
2921
2922  <sect1 id="infoschema-role-routine-grants">
2923   <title><literal>role_routine_grants</literal></title>
2924
2925   <para>
2926    The view <literal>role_routine_grants</literal> identifies all
2927    privileges granted on functions where the grantor or grantee is a
2928    currently enabled role.  Further information can be found under
2929    <literal>routine_privileges</literal>.  The only effective
2930    difference between this view
2931    and <literal>routine_privileges</literal> is that this view omits
2932    functions that have been made accessible to the current user by way
2933    of a grant to public.
2934   </para>
2935
2936   <table>
2937    <title><literal>role_routine_grants</literal> Columns</title>
2938
2939    <tgroup cols="3">
2940     <thead>
2941      <row>
2942       <entry>Name</entry>
2943       <entry>Data Type</entry>
2944       <entry>Description</entry>
2945      </row>
2946     </thead>
2947
2948     <tbody>
2949      <row>
2950       <entry><literal>grantor</literal></entry>
2951       <entry><type>sql_identifier</type></entry>
2952       <entry>Name of the role that granted the privilege</entry>
2953      </row>
2954
2955      <row>
2956       <entry><literal>grantee</literal></entry>
2957       <entry><type>sql_identifier</type></entry>
2958       <entry>Name of the role that the privilege was granted to</entry>
2959      </row>
2960
2961      <row>
2962       <entry><literal>specific_catalog</literal></entry>
2963       <entry><type>sql_identifier</type></entry>
2964       <entry>Name of the database containing the function (always the current database)</entry>
2965      </row>
2966
2967      <row>
2968       <entry><literal>specific_schema</literal></entry>
2969       <entry><type>sql_identifier</type></entry>
2970       <entry>Name of the schema containing the function</entry>
2971      </row>
2972
2973      <row>
2974       <entry><literal>specific_name</literal></entry>
2975       <entry><type>sql_identifier</type></entry>
2976       <entry>
2977        The <quote>specific name</quote> of the function.  See <xref
2978        linkend="infoschema-routines"> for more information.
2979       </entry>
2980      </row>
2981
2982      <row>
2983       <entry><literal>routine_catalog</literal></entry>
2984       <entry><type>sql_identifier</type></entry>
2985       <entry>Name of the database containing the function (always the current database)</entry>
2986      </row>
2987
2988      <row>
2989       <entry><literal>routine_schema</literal></entry>
2990       <entry><type>sql_identifier</type></entry>
2991       <entry>Name of the schema containing the function</entry>
2992      </row>
2993
2994      <row>
2995       <entry><literal>routine_name</literal></entry>
2996       <entry><type>sql_identifier</type></entry>
2997       <entry>Name of the function (might be duplicated in case of overloading)</entry>
2998      </row>
2999
3000      <row>
3001       <entry><literal>privilege_type</literal></entry>
3002       <entry><type>character_data</type></entry>
3003       <entry>Always <literal>EXECUTE</literal> (the only privilege type for functions)</entry>
3004      </row>
3005
3006      <row>
3007       <entry><literal>is_grantable</literal></entry>
3008       <entry><type>yes_or_no</type></entry>
3009       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3010      </row>
3011     </tbody>
3012    </tgroup>
3013   </table>
3014  </sect1>
3015
3016  <sect1 id="infoschema-role-table-grants">
3017   <title><literal>role_table_grants</literal></title>
3018
3019   <para>
3020    The view <literal>role_table_grants</literal> identifies all
3021    privileges granted on tables or views where the grantor or grantee
3022    is a currently enabled role.  Further information can be found
3023    under <literal>table_privileges</literal>.  The only effective
3024    difference between this view
3025    and <literal>table_privileges</literal> is that this view omits
3026    tables that have been made accessible to the current user by way of
3027    a grant to public.
3028   </para>
3029
3030   <table>
3031    <title><literal>role_table_grants</literal> Columns</title>
3032
3033    <tgroup cols="3">
3034     <thead>
3035      <row>
3036       <entry>Name</entry>
3037       <entry>Data Type</entry>
3038       <entry>Description</entry>
3039      </row>
3040     </thead>
3041
3042     <tbody>
3043      <row>
3044       <entry><literal>grantor</literal></entry>
3045       <entry><type>sql_identifier</type></entry>
3046       <entry>Name of the role that granted the privilege</entry>
3047      </row>
3048
3049      <row>
3050       <entry><literal>grantee</literal></entry>
3051       <entry><type>sql_identifier</type></entry>
3052       <entry>Name of the role that the privilege was granted to</entry>
3053      </row>
3054
3055      <row>
3056       <entry><literal>table_catalog</literal></entry>
3057       <entry><type>sql_identifier</type></entry>
3058       <entry>Name of the database that contains the table (always the current database)</entry>
3059      </row>
3060
3061      <row>
3062       <entry><literal>table_schema</literal></entry>
3063       <entry><type>sql_identifier</type></entry>
3064       <entry>Name of the schema that contains the table</entry>
3065      </row>
3066
3067      <row>
3068       <entry><literal>table_name</literal></entry>
3069       <entry><type>sql_identifier</type></entry>
3070       <entry>Name of the table</entry>
3071      </row>
3072
3073      <row>
3074       <entry><literal>privilege_type</literal></entry>
3075       <entry><type>character_data</type></entry>
3076       <entry>
3077        Type of the privilege: <literal>SELECT</literal>,
3078        <literal>INSERT</literal>, <literal>UPDATE</literal>,
3079        <literal>DELETE</literal>, <literal>TRUNCATE</literal>,
3080        <literal>REFERENCES</literal>, or <literal>TRIGGER</literal>
3081       </entry>
3082      </row>
3083
3084      <row>
3085       <entry><literal>is_grantable</literal></entry>
3086       <entry><type>yes_or_no</type></entry>
3087       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3088      </row>
3089
3090      <row>
3091       <entry><literal>with_hierarchy</literal></entry>
3092       <entry><type>yes_or_no</type></entry>
3093       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3094      </row>
3095     </tbody>
3096    </tgroup>
3097   </table>
3098  </sect1>
3099
3100  <sect1 id="infoschema-role-usage-grants">
3101   <title><literal>role_usage_grants</literal></title>
3102
3103   <para>
3104    The view <literal>role_usage_grants</literal> identifies
3105    <literal>USAGE</literal> privileges granted on various kinds of
3106    objects where the grantor or grantee is a currently enabled role.
3107    Further information can be found under
3108    <literal>usage_privileges</literal>.  The only effective difference
3109    between this view and <literal>usage_privileges</literal> is that
3110    this view omits objects that have been made accessible to the
3111    current user by way of a grant to public.
3112   </para>
3113
3114   <table>
3115    <title><literal>role_usage_grants</literal> Columns</title>
3116
3117    <tgroup cols="3">
3118     <thead>
3119      <row>
3120       <entry>Name</entry>
3121       <entry>Data Type</entry>
3122       <entry>Description</entry>
3123      </row>
3124     </thead>
3125
3126     <tbody>
3127      <row>
3128       <entry><literal>grantor</literal></entry>
3129       <entry><type>sql_identifier</type></entry>
3130       <entry>The name of the role that granted the privilege</entry>
3131      </row>
3132
3133      <row>
3134       <entry><literal>grantee</literal></entry>
3135       <entry><type>sql_identifier</type></entry>
3136       <entry>The name of the role that the privilege was granted to</entry>
3137      </row>
3138
3139      <row>
3140       <entry><literal>object_catalog</literal></entry>
3141       <entry><type>sql_identifier</type></entry>
3142       <entry>Name of the database containing the object (always the current database)</entry>
3143      </row>
3144
3145      <row>
3146       <entry><literal>object_schema</literal></entry>
3147       <entry><type>sql_identifier</type></entry>
3148       <entry>Name of the schema containing the object, if applicable,
3149       else an empty string</entry>
3150      </row>
3151
3152      <row>
3153       <entry><literal>object_name</literal></entry>
3154       <entry><type>sql_identifier</type></entry>
3155       <entry>Name of the object</entry>
3156      </row>
3157
3158      <row>
3159       <entry><literal>object_type</literal></entry>
3160       <entry><type>character_data</type></entry>
3161       <entry><literal>DOMAIN</literal> or <literal>FOREIGN DATA WRAPPER</literal> or <literal>FOREIGN SERVER</literal></entry>
3162      </row>
3163
3164      <row>
3165       <entry><literal>privilege_type</literal></entry>
3166       <entry><type>character_data</type></entry>
3167       <entry>Always <literal>USAGE</literal></entry>
3168      </row>
3169
3170      <row>
3171       <entry><literal>is_grantable</literal></entry>
3172       <entry><type>yes_or_no</type></entry>
3173       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3174      </row>
3175     </tbody>
3176    </tgroup>
3177   </table>
3178  </sect1>
3179
3180  <sect1 id="infoschema-routine-privileges">
3181   <title><literal>routine_privileges</literal></title>
3182
3183   <para>
3184    The view <literal>routine_privileges</literal> identifies all
3185    privileges granted on functions to a currently enabled role or by a
3186    currently enabled role.  There is one row for each combination of function,
3187    grantor, and grantee.
3188   </para>
3189
3190   <table>
3191    <title><literal>routine_privileges</literal> Columns</title>
3192
3193    <tgroup cols="3">
3194     <thead>
3195      <row>
3196       <entry>Name</entry>
3197       <entry>Data Type</entry>
3198       <entry>Description</entry>
3199      </row>
3200     </thead>
3201
3202     <tbody>
3203      <row>
3204       <entry><literal>grantor</literal></entry>
3205       <entry><type>sql_identifier</type></entry>
3206       <entry>Name of the role that granted the privilege</entry>
3207      </row>
3208
3209      <row>
3210       <entry><literal>grantee</literal></entry>
3211       <entry><type>sql_identifier</type></entry>
3212       <entry>Name of the role that the privilege was granted to</entry>
3213      </row>
3214
3215      <row>
3216       <entry><literal>specific_catalog</literal></entry>
3217       <entry><type>sql_identifier</type></entry>
3218       <entry>Name of the database containing the function (always the current database)</entry>
3219      </row>
3220
3221      <row>
3222       <entry><literal>specific_schema</literal></entry>
3223       <entry><type>sql_identifier</type></entry>
3224       <entry>Name of the schema containing the function</entry>
3225      </row>
3226
3227      <row>
3228       <entry><literal>specific_name</literal></entry>
3229       <entry><type>sql_identifier</type></entry>
3230       <entry>
3231        The <quote>specific name</quote> of the function.  See <xref
3232        linkend="infoschema-routines"> for more information.
3233       </entry>
3234      </row>
3235
3236      <row>
3237       <entry><literal>routine_catalog</literal></entry>
3238       <entry><type>sql_identifier</type></entry>
3239       <entry>Name of the database containing the function (always the current database)</entry>
3240      </row>
3241
3242      <row>
3243       <entry><literal>routine_schema</literal></entry>
3244       <entry><type>sql_identifier</type></entry>
3245       <entry>Name of the schema containing the function</entry>
3246      </row>
3247
3248      <row>
3249       <entry><literal>routine_name</literal></entry>
3250       <entry><type>sql_identifier</type></entry>
3251       <entry>Name of the function (might be duplicated in case of overloading)</entry>
3252      </row>
3253
3254      <row>
3255       <entry><literal>privilege_type</literal></entry>
3256       <entry><type>character_data</type></entry>
3257       <entry>Always <literal>EXECUTE</literal> (the only privilege type for functions)</entry>
3258      </row>
3259
3260      <row>
3261       <entry><literal>is_grantable</literal></entry>
3262       <entry><type>yes_or_no</type></entry>
3263       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3264      </row>
3265     </tbody>
3266    </tgroup>
3267   </table>
3268  </sect1>
3269
3270  <sect1 id="infoschema-routines">
3271   <title><literal>routines</literal></title>
3272
3273   <para>
3274    The view <literal>routines</literal> contains all functions in the
3275    current database.  Only those functions are shown that the current
3276    user has access to (by way of being the owner or having some
3277    privilege).
3278   </para>
3279
3280   <table>
3281    <title><literal>routines</literal> Columns</title>
3282
3283    <tgroup cols="3">
3284     <thead>
3285      <row>
3286       <entry>Name</entry>
3287       <entry>Data Type</entry>
3288       <entry>Description</entry>
3289      </row>
3290     </thead>
3291
3292     <tbody>
3293      <row>
3294       <entry><literal>specific_catalog</literal></entry>
3295       <entry><type>sql_identifier</type></entry>
3296       <entry>Name of the database containing the function (always the current database)</entry>
3297      </row>
3298
3299      <row>
3300       <entry><literal>specific_schema</literal></entry>
3301       <entry><type>sql_identifier</type></entry>
3302       <entry>Name of the schema containing the function</entry>
3303      </row>
3304
3305      <row>
3306       <entry><literal>specific_name</literal></entry>
3307       <entry><type>sql_identifier</type></entry>
3308       <entry>
3309        The <quote>specific name</quote> of the function.  This is a
3310        name that uniquely identifies the function in the schema, even
3311        if the real name of the function is overloaded.  The format of
3312        the specific name is not defined, it should only be used to
3313        compare it to other instances of specific routine names.
3314       </entry>
3315      </row>
3316
3317      <row>
3318       <entry><literal>routine_catalog</literal></entry>
3319       <entry><type>sql_identifier</type></entry>
3320       <entry>Name of the database containing the function (always the current database)</entry>
3321      </row>
3322
3323      <row>
3324       <entry><literal>routine_schema</literal></entry>
3325       <entry><type>sql_identifier</type></entry>
3326       <entry>Name of the schema containing the function</entry>
3327      </row>
3328
3329      <row>
3330       <entry><literal>routine_name</literal></entry>
3331       <entry><type>sql_identifier</type></entry>
3332       <entry>Name of the function (might be duplicated in case of overloading)</entry>
3333      </row>
3334
3335      <row>
3336       <entry><literal>routine_type</literal></entry>
3337       <entry><type>character_data</type></entry>
3338       <entry>
3339        Always <literal>FUNCTION</literal> (In the future there might
3340        be other types of routines.)
3341       </entry>
3342      </row>
3343
3344      <row>
3345       <entry><literal>module_catalog</literal></entry>
3346       <entry><type>sql_identifier</type></entry>
3347       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3348      </row>
3349
3350      <row>
3351       <entry><literal>module_schema</literal></entry>
3352       <entry><type>sql_identifier</type></entry>
3353       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3354      </row>
3355
3356      <row>
3357       <entry><literal>module_name</literal></entry>
3358       <entry><type>sql_identifier</type></entry>
3359       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3360      </row>
3361
3362      <row>
3363       <entry><literal>udt_catalog</literal></entry>
3364       <entry><type>sql_identifier</type></entry>
3365       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3366      </row>
3367
3368      <row>
3369       <entry><literal>udt_schema</literal></entry>
3370       <entry><type>sql_identifier</type></entry>
3371       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3372      </row>
3373
3374      <row>
3375       <entry><literal>udt_name</literal></entry>
3376       <entry><type>sql_identifier</type></entry>
3377       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3378      </row>
3379
3380      <row>
3381       <entry><literal>data_type</literal></entry>
3382       <entry><type>character_data</type></entry>
3383       <entry>
3384        Return data type of the function, if it is a built-in type, or
3385        <literal>ARRAY</literal> if it is some array (in that case, see
3386        the view <literal>element_types</literal>), else
3387        <literal>USER-DEFINED</literal> (in that case, the type is
3388        identified in <literal>type_udt_name</literal> and associated
3389        columns).
3390       </entry>
3391      </row>
3392
3393      <row>
3394       <entry><literal>character_maximum_length</literal></entry>
3395       <entry><type>cardinal_number</type></entry>
3396       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3397      </row>
3398
3399      <row>
3400       <entry><literal>character_octet_length</literal></entry>
3401       <entry><type>cardinal_number</type></entry>
3402       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3403      </row>
3404
3405      <row>
3406       <entry><literal>character_set_catalog</literal></entry>
3407       <entry><type>sql_identifier</type></entry>
3408       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3409      </row>
3410
3411      <row>
3412       <entry><literal>character_set_schema</literal></entry>
3413       <entry><type>sql_identifier</type></entry>
3414       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3415      </row>
3416
3417      <row>
3418       <entry><literal>character_set_name</literal></entry>
3419       <entry><type>sql_identifier</type></entry>
3420       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3421      </row>
3422
3423      <row>
3424       <entry><literal>collation_catalog</literal></entry>
3425       <entry><type>sql_identifier</type></entry>
3426       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3427      </row>
3428
3429      <row>
3430       <entry><literal>collation_schema</literal></entry>
3431       <entry><type>sql_identifier</type></entry>
3432       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3433      </row>
3434
3435      <row>
3436       <entry><literal>collation_name</literal></entry>
3437       <entry><type>sql_identifier</type></entry>
3438       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3439      </row>
3440
3441      <row>
3442       <entry><literal>numeric_precision</literal></entry>
3443       <entry><type>cardinal_number</type></entry>
3444       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3445      </row>
3446
3447      <row>
3448       <entry><literal>numeric_precision_radix</literal></entry>
3449       <entry><type>cardinal_number</type></entry>
3450       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3451      </row>
3452
3453      <row>
3454       <entry><literal>numeric_scale</literal></entry>
3455       <entry><type>cardinal_number</type></entry>
3456       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3457      </row>
3458
3459      <row>
3460       <entry><literal>datetime_precision</literal></entry>
3461       <entry><type>cardinal_number</type></entry>
3462       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3463      </row>
3464
3465      <row>
3466       <entry><literal>interval_type</literal></entry>
3467       <entry><type>character_data</type></entry>
3468       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3469      </row>
3470
3471      <row>
3472       <entry><literal>interval_precision</literal></entry>
3473       <entry><type>character_data</type></entry>
3474       <entry>Always null, since this information is not applied to return data types in <productname>PostgreSQL</></entry>
3475      </row>
3476
3477      <row>
3478       <entry><literal>type_udt_catalog</literal></entry>
3479       <entry><type>sql_identifier</type></entry>
3480       <entry>
3481        Name of the database that the return data type of the function
3482        is defined in (always the current database)
3483       </entry>
3484      </row>
3485
3486      <row>
3487       <entry><literal>type_udt_schema</literal></entry>
3488       <entry><type>sql_identifier</type></entry>
3489       <entry>
3490        Name of the schema that the return data type of the function is
3491        defined in
3492       </entry>
3493      </row>
3494
3495      <row>
3496       <entry><literal>type_udt_name</literal></entry>
3497       <entry><type>sql_identifier</type></entry>
3498       <entry>
3499        Name of the return data type of the function
3500       </entry>
3501      </row>
3502
3503      <row>
3504       <entry><literal>scope_catalog</literal></entry>
3505       <entry><type>sql_identifier</type></entry>
3506       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3507      </row>
3508
3509      <row>
3510       <entry><literal>scope_schema</literal></entry>
3511       <entry><type>sql_identifier</type></entry>
3512       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3513      </row>
3514
3515      <row>
3516       <entry><literal>scope_name</literal></entry>
3517       <entry><type>sql_identifier</type></entry>
3518       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3519      </row>
3520
3521      <row>
3522       <entry><literal>maximum_cardinality</literal></entry>
3523       <entry><type>cardinal_number</type></entry>
3524       <entry>Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</></entry>
3525      </row>
3526
3527      <row>
3528       <entry><literal>dtd_identifier</literal></entry>
3529       <entry><type>sql_identifier</type></entry>
3530       <entry>
3531        An identifier of the data type descriptor of the return data
3532        type of this function, unique among the data type descriptors
3533        pertaining to the function.  This is mainly useful for joining
3534        with other instances of such identifiers.  (The specific format
3535        of the identifier is not defined and not guaranteed to remain
3536        the same in future versions.)
3537       </entry>
3538      </row>
3539
3540      <row>
3541       <entry><literal>routine_body</literal></entry>
3542       <entry><type>character_data</type></entry>
3543       <entry>
3544        If the function is an SQL function, then
3545        <literal>SQL</literal>, else <literal>EXTERNAL</literal>.
3546       </entry>
3547      </row>
3548
3549      <row>
3550       <entry><literal>routine_definition</literal></entry>
3551       <entry><type>character_data</type></entry>
3552       <entry>
3553        The source text of the function (null if the function is not
3554        owned by a currently enabled role).  (According to the SQL
3555        standard, this column is only applicable if
3556        <literal>routine_body</literal> is <literal>SQL</literal>, but
3557        in <productname>PostgreSQL</productname> it will contain
3558        whatever source text was specified when the function was
3559        created.)
3560       </entry>
3561      </row>
3562
3563      <row>
3564       <entry><literal>external_name</literal></entry>
3565       <entry><type>character_data</type></entry>
3566       <entry>
3567        If this function is a C function, then the external name (link
3568        symbol) of the function; else null.  (This works out to be the
3569        same value that is shown in
3570        <literal>routine_definition</literal>.)
3571       </entry>
3572      </row>
3573
3574      <row>
3575       <entry><literal>external_language</literal></entry>
3576       <entry><type>character_data</type></entry>
3577       <entry>The language the function is written in</entry>
3578      </row>
3579
3580      <row>
3581       <entry><literal>parameter_style</literal></entry>
3582       <entry><type>character_data</type></entry>
3583       <entry>
3584        Always <literal>GENERAL</literal> (The SQL standard defines
3585        other parameter styles, which are not available in <productname>PostgreSQL</>.)
3586       </entry>
3587      </row>
3588
3589      <row>
3590       <entry><literal>is_deterministic</literal></entry>
3591       <entry><type>yes_or_no</type></entry>
3592       <entry>
3593        If the function is declared immutable (called deterministic in
3594        the SQL standard), then <literal>YES</literal>, else
3595        <literal>NO</literal>.  (You cannot query the other volatility
3596        levels available in <productname>PostgreSQL</> through the information schema.)
3597       </entry>
3598      </row>
3599
3600      <row>
3601       <entry><literal>sql_data_access</literal></entry>
3602       <entry><type>character_data</type></entry>
3603       <entry>
3604        Always <literal>MODIFIES</literal>, meaning that the function
3605        possibly modifies SQL data.  This information is not useful for
3606        <productname>PostgreSQL</>.
3607       </entry>
3608      </row>
3609
3610      <row>
3611       <entry><literal>is_null_call</literal></entry>
3612       <entry><type>yes_or_no</type></entry>
3613       <entry>
3614        If the function automatically returns null if any of its
3615        arguments are null, then <literal>YES</literal>, else
3616        <literal>NO</literal>.
3617       </entry>
3618      </row>
3619
3620      <row>
3621       <entry><literal>sql_path</literal></entry>
3622       <entry><type>character_data</type></entry>
3623       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3624      </row>
3625
3626      <row>
3627       <entry><literal>schema_level_routine</literal></entry>
3628       <entry><type>yes_or_no</type></entry>
3629       <entry>
3630        Always <literal>YES</literal> (The opposite would be a method
3631        of a user-defined type, which is a feature not available in
3632        <productname>PostgreSQL</>.)
3633       </entry>
3634      </row>
3635
3636      <row>
3637       <entry><literal>max_dynamic_result_sets</literal></entry>
3638       <entry><type>cardinal_number</type></entry>
3639       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3640      </row>
3641
3642      <row>
3643       <entry><literal>is_user_defined_cast</literal></entry>
3644       <entry><type>yes_or_no</type></entry>
3645       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3646      </row>
3647
3648      <row>
3649       <entry><literal>is_implicitly_invocable</literal></entry>
3650       <entry><type>yes_or_no</type></entry>
3651       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3652      </row>
3653
3654      <row>
3655       <entry><literal>security_type</literal></entry>
3656       <entry><type>character_data</type></entry>
3657       <entry>
3658        If the function runs with the privileges of the current user,
3659        then <literal>INVOKER</literal>, if the function runs with the
3660        privileges of the user who defined it, then
3661        <literal>DEFINER</literal>.
3662       </entry>
3663      </row>
3664
3665      <row>
3666       <entry><literal>to_sql_specific_catalog</literal></entry>
3667       <entry><type>sql_identifier</type></entry>
3668       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3669      </row>
3670
3671      <row>
3672       <entry><literal>to_sql_specific_schema</literal></entry>
3673       <entry><type>sql_identifier</type></entry>
3674       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3675      </row>
3676
3677      <row>
3678       <entry><literal>to_sql_specific_name</literal></entry>
3679       <entry><type>sql_identifier</type></entry>
3680       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3681      </row>
3682
3683      <row>
3684       <entry><literal>as_locator</literal></entry>
3685       <entry><type>yes_or_no</type></entry>
3686       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3687      </row>
3688
3689      <row>
3690       <entry><literal>created</literal></entry>
3691       <entry><type>time_stamp</type></entry>
3692       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3693      </row>
3694
3695      <row>
3696       <entry><literal>last_altered</literal></entry>
3697       <entry><type>time_stamp</type></entry>
3698       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3699      </row>
3700
3701      <row>
3702       <entry><literal>new_savepoint_level</literal></entry>
3703       <entry><type>yes_or_no</type></entry>
3704       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3705      </row>
3706
3707      <row>
3708       <entry><literal>is_udt_dependent</literal></entry>
3709       <entry><type>yes_or_no</type></entry>
3710       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3711      </row>
3712
3713      <row>
3714       <entry><literal>result_cast_from_data_type</literal></entry>
3715       <entry><type>character_data</type></entry>
3716       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3717      </row>
3718
3719      <row>
3720       <entry><literal>result_cast_as_locator</literal></entry>
3721       <entry><type>yes_or_no</type></entry>
3722       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3723      </row>
3724
3725      <row>
3726       <entry><literal>result_cast_char_max_length</literal></entry>
3727       <entry><type>cardinal_number</type></entry>
3728       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3729      </row>
3730
3731      <row>
3732       <entry><literal>result_cast_char_octet_length</literal></entry>
3733       <entry><type>character_data</type></entry>
3734       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3735      </row>
3736
3737      <row>
3738       <entry><literal>result_cast_char_set_catalog</literal></entry>
3739       <entry><type>sql_identifier</type></entry>
3740       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3741      </row>
3742
3743      <row>
3744       <entry><literal>result_cast_char_set_schema</literal></entry>
3745       <entry><type>sql_identifier</type></entry>
3746       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3747      </row>
3748
3749      <row>
3750       <entry><literal>result_cast_char_set_name</literal></entry>
3751       <entry><type>sql_identifier</type></entry>
3752       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3753      </row>
3754
3755      <row>
3756       <entry><literal>result_cast_collation_catalog</literal></entry>
3757       <entry><type>sql_identifier</type></entry>
3758       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3759      </row>
3760
3761      <row>
3762       <entry><literal>result_cast_collation_schema</literal></entry>
3763       <entry><type>sql_identifier</type></entry>
3764       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3765      </row>
3766
3767      <row>
3768       <entry><literal>result_cast_collation_name</literal></entry>
3769       <entry><type>sql_identifier</type></entry>
3770       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3771      </row>
3772
3773      <row>
3774       <entry><literal>result_cast_numeric_precision</literal></entry>
3775       <entry><type>cardinal_number</type></entry>
3776       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3777      </row>
3778
3779      <row>
3780       <entry><literal>result_cast_numeric_precision_radix</literal></entry>
3781       <entry><type>cardinal_number</type></entry>
3782       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3783      </row>
3784
3785      <row>
3786       <entry><literal>result_cast_numeric_scale</literal></entry>
3787       <entry><type>cardinal_number</type></entry>
3788       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3789      </row>
3790
3791      <row>
3792       <entry><literal>result_cast_datetime_precision</literal></entry>
3793       <entry><type>character_data</type></entry>
3794       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3795      </row>
3796
3797      <row>
3798       <entry><literal>result_cast_interval_type</literal></entry>
3799       <entry><type>character_data</type></entry>
3800       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3801      </row>
3802
3803      <row>
3804       <entry><literal>result_cast_interval_precision</literal></entry>
3805       <entry><type>character_data</type></entry>
3806       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3807      </row>
3808
3809      <row>
3810       <entry><literal>result_cast_type_udt_catalog</literal></entry>
3811       <entry><type>sql_identifier</type></entry>
3812       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3813      </row>
3814
3815      <row>
3816       <entry><literal>result_cast_type_udt_schema</literal></entry>
3817       <entry><type>sql_identifier</type></entry>
3818       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3819      </row>
3820
3821      <row>
3822       <entry><literal>result_cast_type_udt_name</literal></entry>
3823       <entry><type>sql_identifier</type></entry>
3824       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3825      </row>
3826
3827      <row>
3828       <entry><literal>result_cast_scope_catalog</literal></entry>
3829       <entry><type>sql_identifier</type></entry>
3830       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3831      </row>
3832
3833      <row>
3834       <entry><literal>result_cast_scope_schema</literal></entry>
3835       <entry><type>sql_identifier</type></entry>
3836       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3837      </row>
3838
3839      <row>
3840       <entry><literal>result_cast_scope_name</literal></entry>
3841       <entry><type>sql_identifier</type></entry>
3842       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3843      </row>
3844
3845      <row>
3846       <entry><literal>result_cast_maximum_cardinality</literal></entry>
3847       <entry><type>cardinal_number</type></entry>
3848       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3849      </row>
3850
3851      <row>
3852       <entry><literal>result_cast_dtd_identifier</literal></entry>
3853       <entry><type>sql_identifier</type></entry>
3854       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3855      </row>
3856     </tbody>
3857    </tgroup>
3858   </table>
3859  </sect1>
3860
3861  <sect1 id="infoschema-schemata">
3862   <title><literal>schemata</literal></title>
3863
3864   <para>
3865    The view <literal>schemata</literal> contains all schemas in the
3866    current database that are owned by a currently enabled role.
3867   </para>
3868
3869   <table>
3870    <title><literal>schemata</literal> Columns</title>
3871
3872    <tgroup cols="3">
3873     <thead>
3874      <row>
3875       <entry>Name</entry>
3876       <entry>Data Type</entry>
3877       <entry>Description</entry>
3878      </row>
3879     </thead>
3880
3881     <tbody>
3882      <row>
3883       <entry><literal>catalog_name</literal></entry>
3884       <entry><type>sql_identifier</type></entry>
3885       <entry>Name of the database that the schema is contained in (always the current database)</entry>
3886      </row>
3887
3888      <row>
3889       <entry><literal>schema_name</literal></entry>
3890       <entry><type>sql_identifier</type></entry>
3891       <entry>Name of the schema</entry>
3892      </row>
3893
3894      <row>
3895       <entry><literal>schema_owner</literal></entry>
3896       <entry><type>sql_identifier</type></entry>
3897       <entry>Name of the owner of the schema</entry>
3898      </row>
3899
3900      <row>
3901       <entry><literal>default_character_set_catalog</literal></entry>
3902       <entry><type>sql_identifier</type></entry>
3903       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3904      </row>
3905
3906      <row>
3907       <entry><literal>default_character_set_schema</literal></entry>
3908       <entry><type>sql_identifier</type></entry>
3909       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3910      </row>
3911
3912      <row>
3913       <entry><literal>default_character_set_name</literal></entry>
3914       <entry><type>sql_identifier</type></entry>
3915       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3916      </row>
3917
3918      <row>
3919       <entry><literal>sql_path</literal></entry>
3920       <entry><type>character_data</type></entry>
3921       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3922      </row>
3923     </tbody>
3924    </tgroup>
3925   </table>
3926  </sect1>
3927
3928  <sect1 id="infoschema-sequences">
3929   <title><literal>sequences</literal></title>
3930
3931   <para>
3932    The view <literal>sequences</literal> contains all sequences
3933    defined in the current database.  Only those sequences are shown
3934    that the current user has access to (by way of being the owner or
3935    having some privilege).
3936   </para>
3937
3938   <table>
3939    <title><literal>sequences</literal> Columns</title>
3940
3941    <tgroup cols="3">
3942     <thead>
3943      <row>
3944       <entry>Name</entry>
3945       <entry>Data Type</entry>
3946       <entry>Description</entry>
3947      </row>
3948     </thead>
3949
3950     <tbody>
3951      <row>
3952       <entry><literal>sequence_catalog</literal></entry>
3953       <entry><type>sql_identifier</type></entry>
3954       <entry>Name of the database that contains the sequence (always the current database)</entry>
3955      </row>
3956
3957      <row>
3958       <entry><literal>sequence_schema</literal></entry>
3959       <entry><type>sql_identifier</type></entry>
3960       <entry>Name of the schema that contains the sequence</entry>
3961      </row>
3962
3963      <row>
3964       <entry><literal>sequence_name</literal></entry>
3965       <entry><type>sql_identifier</type></entry>
3966       <entry>Name of the sequence</entry>
3967      </row>
3968
3969      <row>
3970       <entry><literal>data_type</literal></entry>
3971       <entry><type>character_data</type></entry>
3972       <entry>
3973        The data type of the sequence.  In
3974        <productname>PostgreSQL</productname>, this is currently always
3975        <literal>bigint</literal>.
3976       </entry>
3977      </row>
3978
3979      <row>
3980       <entry><literal>numeric_precision</literal></entry>
3981       <entry><type>cardinal_number</type></entry>
3982       <entry>
3983        This column contains the (declared or implicit) precision of
3984        the sequence data type (see above).  The precision indicates
3985        the number of significant digits.  It can be expressed in
3986        decimal (base 10) or binary (base 2) terms, as specified in the
3987        column <literal>numeric_precision_radix</literal>.
3988       </entry>
3989      </row>
3990
3991      <row>
3992       <entry><literal>numeric_precision_radix</literal></entry>
3993       <entry><type>cardinal_number</type></entry>
3994       <entry>
3995        This column indicates in which base the values in the columns
3996        <literal>numeric_precision</literal> and
3997        <literal>numeric_scale</literal> are expressed.  The value is
3998        either 2 or 10.
3999       </entry>
4000      </row>
4001
4002      <row>
4003       <entry><literal>numeric_scale</literal></entry>
4004       <entry><type>cardinal_number</type></entry>
4005       <entry>
4006        This column contains the (declared or implicit) scale of the
4007        sequence data type (see above).  The scale indicates the number
4008        of significant digits to the right of the decimal point.  It
4009        can be expressed in decimal (base 10) or binary (base 2) terms,
4010        as specified in the column
4011        <literal>numeric_precision_radix</literal>.
4012       </entry>
4013      </row>
4014
4015      <row>
4016       <entry><literal>maximum_value</literal></entry>
4017       <entry><type>cardinal_number</type></entry>
4018       <entry>Not yet implemented</entry>
4019      </row>
4020
4021      <row>
4022       <entry><literal>minimum_value</literal></entry>
4023       <entry><type>cardinal_number</type></entry>
4024       <entry>Not yet implemented</entry>
4025      </row>
4026
4027      <row>
4028       <entry><literal>increment</literal></entry>
4029       <entry><type>cardinal_number</type></entry>
4030       <entry>Not yet implemented</entry>
4031      </row>
4032
4033      <row>
4034       <entry><literal>cycle_option</literal></entry>
4035       <entry><type>yes_or_no</type></entry>
4036       <entry>Not yet implemented</entry>
4037      </row>
4038     </tbody>
4039    </tgroup>
4040   </table>
4041  </sect1>
4042
4043  <sect1 id="infoschema-sql-features">
4044   <title><literal>sql_features</literal></title>
4045
4046   <para>
4047    The table <literal>sql_features</literal> contains information
4048    about which formal features defined in the SQL standard are
4049    supported by <productname>PostgreSQL</productname>.  This is the
4050    same information that is presented in <xref linkend="features">.
4051    There you can also find some additional background information.
4052   </para>
4053
4054   <table>
4055    <title><literal>sql_features</literal> Columns</title>
4056
4057    <tgroup cols="3">
4058     <thead>
4059      <row>
4060       <entry>Name</entry>
4061       <entry>Data Type</entry>
4062       <entry>Description</entry>
4063      </row>
4064     </thead>
4065
4066     <tbody>
4067      <row>
4068       <entry><literal>feature_id</literal></entry>
4069       <entry><type>character_data</type></entry>
4070       <entry>Identifier string of the feature</entry>
4071      </row>
4072
4073      <row>
4074       <entry><literal>feature_name</literal></entry>
4075       <entry><type>character_data</type></entry>
4076       <entry>Descriptive name of the feature</entry>
4077      </row>
4078
4079      <row>
4080       <entry><literal>sub_feature_id</literal></entry>
4081       <entry><type>character_data</type></entry>
4082       <entry>Identifier string of the subfeature, or a zero-length string if not a subfeature</entry>
4083      </row>
4084
4085      <row>
4086       <entry><literal>sub_feature_name</literal></entry>
4087       <entry><type>character_data</type></entry>
4088       <entry>Descriptive name of the subfeature, or a zero-length string if not a subfeature</entry>
4089      </row>
4090
4091      <row>
4092       <entry><literal>is_supported</literal></entry>
4093       <entry><type>yes_or_no</type></entry>
4094       <entry>
4095        <literal>YES</literal> if the feature is fully supported by the
4096        current version of <productname>PostgreSQL</>, <literal>NO</literal> if not
4097       </entry>
4098      </row>
4099
4100      <row>
4101       <entry><literal>is_verified_by</literal></entry>
4102       <entry><type>character_data</type></entry>
4103       <entry>
4104        Always null, since the <productname>PostgreSQL</> development group does not
4105        perform formal testing of feature conformance
4106       </entry>
4107      </row>
4108
4109      <row>
4110       <entry><literal>comments</literal></entry>
4111       <entry><type>character_data</type></entry>
4112       <entry>Possibly a comment about the supported status of the feature</entry>
4113      </row>
4114     </tbody>
4115    </tgroup>
4116   </table>
4117  </sect1>
4118
4119  <sect1 id="infoschema-sql-implementation-info">
4120   <title><literal>sql_implementation_info</literal></title>
4121
4122   <para>
4123    The table <literal>sql_implementation_info</literal> contains
4124    information about various aspects that are left
4125    implementation-defined by the SQL standard.  This information is
4126    primarily intended for use in the context of the ODBC interface;
4127    users of other interfaces will probably find this information to be
4128    of little use.  For this reason, the individual implementation
4129    information items are not described here; you will find them in the
4130    description of the ODBC interface.
4131   </para>
4132
4133   <table>
4134    <title><literal>sql_implementation_info</literal> Columns</title>
4135
4136    <tgroup cols="3">
4137     <thead>
4138      <row>
4139       <entry>Name</entry>
4140       <entry>Data Type</entry>
4141       <entry>Description</entry>
4142      </row>
4143     </thead>
4144
4145     <tbody>
4146      <row>
4147       <entry><literal>implementation_info_id</literal></entry>
4148       <entry><type>character_data</type></entry>
4149       <entry>Identifier string of the implementation information item</entry>
4150      </row>
4151
4152      <row>
4153       <entry><literal>implementation_info_name</literal></entry>
4154       <entry><type>character_data</type></entry>
4155       <entry>Descriptive name of the implementation information item</entry>
4156      </row>
4157
4158      <row>
4159       <entry><literal>integer_value</literal></entry>
4160       <entry><type>cardinal_number</type></entry>
4161       <entry>
4162        Value of the implementation information item, or null if the
4163        value is contained in the column
4164        <literal>character_value</literal>
4165       </entry>
4166      </row>
4167
4168      <row>
4169       <entry><literal>character_value</literal></entry>
4170       <entry><type>character_data</type></entry>
4171       <entry>
4172        Value of the implementation information item, or null if the
4173        value is contained in the column
4174        <literal>integer_value</literal>
4175       </entry>
4176      </row>
4177
4178      <row>
4179       <entry><literal>comments</literal></entry>
4180       <entry><type>character_data</type></entry>
4181       <entry>Possibly a comment pertaining to the implementation information item</entry>
4182      </row>
4183     </tbody>
4184    </tgroup>
4185   </table>
4186  </sect1>
4187
4188  <sect1 id="infoschema-sql-languages">
4189   <title><literal>sql_languages</literal></title>
4190
4191   <para>
4192    The table <literal>sql_languages</literal> contains one row for
4193    each SQL language binding that is supported by
4194    <productname>PostgreSQL</productname>.
4195    <productname>PostgreSQL</productname> supports direct SQL and
4196    embedded SQL in C; that is all you will learn from this table.
4197   </para>
4198
4199   <table>
4200    <title><literal>sql_languages</literal> Columns</title>
4201
4202    <tgroup cols="3">
4203     <thead>
4204      <row>
4205       <entry>Name</entry>
4206       <entry>Data Type</entry>
4207       <entry>Description</entry>
4208      </row>
4209     </thead>
4210
4211     <tbody>
4212      <row>
4213       <entry><literal>sql_language_source</literal></entry>
4214       <entry><type>character_data</type></entry>
4215       <entry>
4216        The name of the source of the language definition; always
4217        <literal>ISO 9075</literal>, that is, the SQL standard
4218       </entry>
4219      </row>
4220
4221      <row>
4222       <entry><literal>sql_language_year</literal></entry>
4223       <entry><type>character_data</type></entry>
4224       <entry>
4225        The year the standard referenced in
4226        <literal>sql_language_source</literal> was approved; currently
4227        <literal>2003</>
4228       </entry>
4229      </row>
4230
4231      <row>
4232       <entry><literal>sql_language_conformance</literal></entry>
4233       <entry><type>character_data</type></entry>
4234       <entry>
4235        The standard conformance level for the language binding.  For
4236        ISO 9075:2003 this is always <literal>CORE</literal>.
4237       </entry>
4238      </row>
4239
4240      <row>
4241       <entry><literal>sql_language_integrity</literal></entry>
4242       <entry><type>character_data</type></entry>
4243       <entry>Always null (This value is relevant to an earlier version of the SQL standard.)</entry>
4244      </row>
4245
4246      <row>
4247       <entry><literal>sql_language_implementation</literal></entry>
4248       <entry><type>character_data</type></entry>
4249       <entry>Always null</entry>
4250      </row>
4251
4252      <row>
4253       <entry><literal>sql_language_binding_style</literal></entry>
4254       <entry><type>character_data</type></entry>
4255       <entry>
4256        The language binding style, either <literal>DIRECT</literal> or
4257        <literal>EMBEDDED</literal>
4258       </entry>
4259      </row>
4260
4261      <row>
4262       <entry><literal>sql_language_programming_language</literal></entry>
4263       <entry><type>character_data</type></entry>
4264       <entry>
4265        The programming language, if the binding style is
4266        <literal>EMBEDDED</literal>, else null.  <productname>PostgreSQL</> only
4267        supports the language C.
4268       </entry>
4269      </row>
4270     </tbody>
4271    </tgroup>
4272   </table>
4273  </sect1>
4274
4275  <sect1 id="infoschema-sql-packages">
4276   <title><literal>sql_packages</literal></title>
4277
4278   <para>
4279    The table <literal>sql_packages</literal> contains information
4280    about which feature packages defined in the SQL standard are
4281    supported by <productname>PostgreSQL</productname>.  Refer to <xref
4282    linkend="features"> for background information on feature packages.
4283   </para>
4284
4285   <table>
4286    <title><literal>sql_packages</literal> Columns</title>
4287
4288    <tgroup cols="3">
4289     <thead>
4290      <row>
4291       <entry>Name</entry>
4292       <entry>Data Type</entry>
4293       <entry>Description</entry>
4294      </row>
4295     </thead>
4296
4297     <tbody>
4298      <row>
4299       <entry><literal>feature_id</literal></entry>
4300       <entry><type>character_data</type></entry>
4301       <entry>Identifier string of the package</entry>
4302      </row>
4303
4304      <row>
4305       <entry><literal>feature_name</literal></entry>
4306       <entry><type>character_data</type></entry>
4307       <entry>Descriptive name of the package</entry>
4308      </row>
4309
4310      <row>
4311       <entry><literal>is_supported</literal></entry>
4312       <entry><type>yes_or_no</type></entry>
4313       <entry>
4314        <literal>YES</literal> if the package is fully supported by the
4315        current version of <productname>PostgreSQL</>, <literal>NO</literal> if not
4316       </entry>
4317      </row>
4318
4319      <row>
4320       <entry><literal>is_verified_by</literal></entry>
4321       <entry><type>character_data</type></entry>
4322       <entry>
4323        Always null, since the <productname>PostgreSQL</> development group does not
4324        perform formal testing of feature conformance
4325       </entry>
4326      </row>
4327
4328      <row>
4329       <entry><literal>comments</literal></entry>
4330       <entry><type>character_data</type></entry>
4331       <entry>Possibly a comment about the supported status of the package</entry>
4332      </row>
4333     </tbody>
4334    </tgroup>
4335   </table>
4336  </sect1>
4337
4338  <sect1 id="infoschema-sql-parts">
4339   <title><literal>sql_parts</literal></title>
4340
4341   <para>
4342    The table <literal>sql_parts</literal> contains information about
4343    which of the several parts of the SQL standard are supported by
4344    <productname>PostgreSQL</productname>.
4345   </para>
4346
4347   <table>
4348    <title><literal>sql_parts</literal> Columns</title>
4349
4350    <tgroup cols="3">
4351     <thead>
4352      <row>
4353       <entry>Name</entry>
4354       <entry>Data Type</entry>
4355       <entry>Description</entry>
4356      </row>
4357     </thead>
4358
4359     <tbody>
4360      <row>
4361       <entry><literal>feature_id</literal></entry>
4362       <entry><type>character_data</type></entry>
4363       <entry>An identifier string containing the number of the part</entry>
4364      </row>
4365
4366      <row>
4367       <entry><literal>feature_name</literal></entry>
4368       <entry><type>character_data</type></entry>
4369       <entry>Descriptive name of the part</entry>
4370      </row>
4371
4372      <row>
4373       <entry><literal>is_supported</literal></entry>
4374       <entry><type>yes_or_no</type></entry>
4375       <entry>
4376        <literal>YES</literal> if the part is fully supported by the
4377        current version of <productname>PostgreSQL</>,
4378        <literal>NO</literal> if not
4379       </entry>
4380      </row>
4381
4382      <row>
4383       <entry><literal>is_verified_by</literal></entry>
4384       <entry><type>character_data</type></entry>
4385       <entry>
4386        Always null, since the <productname>PostgreSQL</> development group does not
4387        perform formal testing of feature conformance
4388       </entry>
4389      </row>
4390
4391      <row>
4392       <entry><literal>comments</literal></entry>
4393       <entry><type>character_data</type></entry>
4394       <entry>Possibly a comment about the supported status of the part</entry>
4395      </row>
4396     </tbody>
4397    </tgroup>
4398   </table>
4399  </sect1>
4400
4401  <sect1 id="infoschema-sql-sizing">
4402   <title><literal>sql_sizing</literal></title>
4403
4404   <para>
4405    The table <literal>sql_sizing</literal> contains information about
4406    various size limits and maximum values in
4407    <productname>PostgreSQL</productname>.  This information is
4408    primarily intended for use in the context of the ODBC interface;
4409    users of other interfaces will probably find this information to be
4410    of little use.  For this reason, the individual sizing items are
4411    not described here; you will find them in the description of the
4412    ODBC interface.
4413   </para>
4414
4415   <table>
4416    <title><literal>sql_sizing</literal> Columns</title>
4417
4418    <tgroup cols="3">
4419     <thead>
4420      <row>
4421       <entry>Name</entry>
4422       <entry>Data Type</entry>
4423       <entry>Description</entry>
4424      </row>
4425     </thead>
4426
4427     <tbody>
4428      <row>
4429       <entry><literal>sizing_id</literal></entry>
4430       <entry><type>cardinal_number</type></entry>
4431       <entry>Identifier of the sizing item</entry>
4432      </row>
4433
4434      <row>
4435       <entry><literal>sizing_name</literal></entry>
4436       <entry><type>character_data</type></entry>
4437       <entry>Descriptive name of the sizing item</entry>
4438      </row>
4439
4440      <row>
4441       <entry><literal>supported_value</literal></entry>
4442       <entry><type>cardinal_number</type></entry>
4443       <entry>
4444        Value of the sizing item, or 0 if the size is unlimited or
4445        cannot be determined, or null if the features for which the
4446        sizing item is applicable are not supported
4447       </entry>
4448      </row>
4449
4450      <row>
4451       <entry><literal>comments</literal></entry>
4452       <entry><type>character_data</type></entry>
4453       <entry>Possibly a comment pertaining to the sizing item</entry>
4454      </row>
4455     </tbody>
4456    </tgroup>
4457   </table>
4458  </sect1>
4459
4460  <sect1 id="infoschema-sql-sizing-profiles">
4461   <title><literal>sql_sizing_profiles</literal></title>
4462
4463   <para>
4464    The table <literal>sql_sizing_profiles</literal> contains
4465    information about the <literal>sql_sizing</literal> values that are
4466    required by various profiles of the SQL standard.  <productname>PostgreSQL</> does
4467    not track any SQL profiles, so this table is empty.
4468   </para>
4469
4470   <table>
4471    <title><literal>sql_sizing_profiles</literal> Columns</title>
4472
4473    <tgroup cols="3">
4474     <thead>
4475      <row>
4476       <entry>Name</entry>
4477       <entry>Data Type</entry>
4478       <entry>Description</entry>
4479      </row>
4480     </thead>
4481
4482     <tbody>
4483      <row>
4484       <entry><literal>sizing_id</literal></entry>
4485       <entry><type>cardinal_number</type></entry>
4486       <entry>Identifier of the sizing item</entry>
4487      </row>
4488
4489      <row>
4490       <entry><literal>sizing_name</literal></entry>
4491       <entry><type>character_data</type></entry>
4492       <entry>Descriptive name of the sizing item</entry>
4493      </row>
4494
4495      <row>
4496       <entry><literal>profile_id</literal></entry>
4497       <entry><type>character_data</type></entry>
4498       <entry>Identifier string of a profile</entry>
4499      </row>
4500
4501      <row>
4502       <entry><literal>required_value</literal></entry>
4503       <entry><type>cardinal_number</type></entry>
4504       <entry>
4505        The value required by the SQL profile for the sizing item, or 0
4506        if the profile places no limit on the sizing item, or null if
4507        the profile does not require any of the features for which the
4508        sizing item is applicable
4509       </entry>
4510      </row>
4511
4512      <row>
4513       <entry><literal>comments</literal></entry>
4514       <entry><type>character_data</type></entry>
4515       <entry>Possibly a comment pertaining to the sizing item within the profile</entry>
4516      </row>
4517     </tbody>
4518    </tgroup>
4519   </table>
4520  </sect1>
4521
4522  <sect1 id="infoschema-table-constraints">
4523   <title><literal>table_constraints</literal></title>
4524
4525   <para>
4526    The view <literal>table_constraints</literal> contains all
4527    constraints belonging to tables that the current user owns or has
4528    some non-SELECT privilege on.
4529   </para>
4530
4531   <table>
4532    <title><literal>table_constraints</literal> Columns</title>
4533
4534    <tgroup cols="3">
4535     <thead>
4536      <row>
4537       <entry>Name</entry>
4538       <entry>Data Type</entry>
4539       <entry>Description</entry>
4540      </row>
4541     </thead>
4542
4543     <tbody>
4544      <row>
4545       <entry><literal>constraint_catalog</literal></entry>
4546       <entry><type>sql_identifier</type></entry>
4547       <entry>Name of the database that contains the constraint (always the current database)</entry>
4548      </row>
4549
4550      <row>
4551       <entry><literal>constraint_schema</literal></entry>
4552       <entry><type>sql_identifier</type></entry>
4553       <entry>Name of the schema that contains the constraint</entry>
4554      </row>
4555
4556      <row>
4557       <entry><literal>constraint_name</literal></entry>
4558       <entry><type>sql_identifier</type></entry>
4559       <entry>Name of the constraint</entry>
4560      </row>
4561
4562      <row>
4563       <entry><literal>table_catalog</literal></entry>
4564       <entry><type>sql_identifier</type></entry>
4565       <entry>Name of the database that contains the table (always the current database)</entry>
4566      </row>
4567
4568      <row>
4569       <entry><literal>table_schema</literal></entry>
4570       <entry><type>sql_identifier</type></entry>
4571       <entry>Name of the schema that contains the table</entry>
4572      </row>
4573
4574      <row>
4575       <entry><literal>table_name</literal></entry>
4576       <entry><type>sql_identifier</type></entry>
4577       <entry>Name of the table</entry>
4578      </row>
4579
4580      <row>
4581       <entry><literal>constraint_type</literal></entry>
4582       <entry><type>character_data</type></entry>
4583       <entry>
4584        Type of the constraint: <literal>CHECK</literal>,
4585        <literal>FOREIGN KEY</literal>, <literal>PRIMARY KEY</literal>,
4586        or <literal>UNIQUE</literal>
4587       </entry>
4588      </row>
4589
4590      <row>
4591       <entry><literal>is_deferrable</literal></entry>
4592       <entry><type>yes_or_no</type></entry>
4593       <entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry>
4594      </row>
4595
4596      <row>
4597       <entry><literal>initially_deferred</literal></entry>
4598       <entry><type>yes_or_no</type></entry>
4599       <entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry>
4600      </row>
4601     </tbody>
4602    </tgroup>
4603   </table>
4604  </sect1>
4605
4606  <sect1 id="infoschema-table-privileges">
4607   <title><literal>table_privileges</literal></title>
4608
4609   <para>
4610    The view <literal>table_privileges</literal> identifies all
4611    privileges granted on tables or views to a currently enabled role
4612    or by a currently enabled role.  There is one row for each
4613    combination of table, grantor, and grantee.
4614   </para>
4615
4616   <table>
4617    <title><literal>table_privileges</literal> Columns</title>
4618
4619    <tgroup cols="3">
4620     <thead>
4621      <row>
4622       <entry>Name</entry>
4623       <entry>Data Type</entry>
4624       <entry>Description</entry>
4625      </row>
4626     </thead>
4627
4628     <tbody>
4629      <row>
4630       <entry><literal>grantor</literal></entry>
4631       <entry><type>sql_identifier</type></entry>
4632       <entry>Name of the role that granted the privilege</entry>
4633      </row>
4634
4635      <row>
4636       <entry><literal>grantee</literal></entry>
4637       <entry><type>sql_identifier</type></entry>
4638       <entry>Name of the role that the privilege was granted to</entry>
4639      </row>
4640
4641      <row>
4642       <entry><literal>table_catalog</literal></entry>
4643       <entry><type>sql_identifier</type></entry>
4644       <entry>Name of the database that contains the table (always the current database)</entry>
4645      </row>
4646
4647      <row>
4648       <entry><literal>table_schema</literal></entry>
4649       <entry><type>sql_identifier</type></entry>
4650       <entry>Name of the schema that contains the table</entry>
4651      </row>
4652
4653      <row>
4654       <entry><literal>table_name</literal></entry>
4655       <entry><type>sql_identifier</type></entry>
4656       <entry>Name of the table</entry>
4657      </row>
4658
4659      <row>
4660       <entry><literal>privilege_type</literal></entry>
4661       <entry><type>character_data</type></entry>
4662       <entry>
4663        Type of the privilege: <literal>SELECT</literal>,
4664        <literal>INSERT</literal>, <literal>UPDATE</literal>,
4665        <literal>DELETE</literal>, <literal>TRUNCATE</literal>,
4666        <literal>REFERENCES</literal>, or <literal>TRIGGER</literal>
4667       </entry>
4668      </row>
4669
4670      <row>
4671       <entry><literal>is_grantable</literal></entry>
4672       <entry><type>yes_or_no</type></entry>
4673       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
4674      </row>
4675
4676      <row>
4677       <entry><literal>with_hierarchy</literal></entry>
4678       <entry><type>yes_or_no</type></entry>
4679       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4680      </row>
4681     </tbody>
4682    </tgroup>
4683   </table>
4684  </sect1>
4685
4686  <sect1 id="infoschema-tables">
4687   <title><literal>tables</literal></title>
4688
4689   <para>
4690    The view <literal>tables</literal> contains all tables and views
4691    defined in the current database.  Only those tables and views are
4692    shown that the current user has access to (by way of being the
4693    owner or having some privilege).
4694   </para>
4695
4696   <table>
4697    <title><literal>tables</literal> Columns</title>
4698
4699    <tgroup cols="3">
4700     <thead>
4701      <row>
4702       <entry>Name</entry>
4703       <entry>Data Type</entry>
4704       <entry>Description</entry>
4705      </row>
4706     </thead>
4707
4708     <tbody>
4709      <row>
4710       <entry><literal>table_catalog</literal></entry>
4711       <entry><type>sql_identifier</type></entry>
4712       <entry>Name of the database that contains the table (always the current database)</entry>
4713      </row>
4714
4715      <row>
4716       <entry><literal>table_schema</literal></entry>
4717       <entry><type>sql_identifier</type></entry>
4718       <entry>Name of the schema that contains the table</entry>
4719      </row>
4720
4721      <row>
4722       <entry><literal>table_name</literal></entry>
4723       <entry><type>sql_identifier</type></entry>
4724       <entry>Name of the table</entry>
4725      </row>
4726
4727      <row>
4728       <entry><literal>table_type</literal></entry>
4729       <entry><type>character_data</type></entry>
4730       <entry>
4731        Type of the table: <literal>BASE TABLE</literal> for a
4732        persistent base table (the normal table type),
4733        <literal>VIEW</literal> for a view, or <literal>LOCAL
4734        TEMPORARY</literal> for a temporary table
4735       </entry>
4736      </row>
4737
4738      <row>
4739       <entry><literal>self_referencing_column_name</literal></entry>
4740       <entry><type>sql_identifier</type></entry>
4741       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4742      </row>
4743
4744      <row>
4745       <entry><literal>reference_generation</literal></entry>
4746       <entry><type>character_data</type></entry>
4747       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4748      </row>
4749
4750      <row>
4751       <entry><literal>user_defined_type_catalog</literal></entry>
4752       <entry><type>sql_identifier</type></entry>
4753       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4754      </row>
4755
4756      <row>
4757       <entry><literal>user_defined_type_schema</literal></entry>
4758       <entry><type>sql_identifier</type></entry>
4759       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4760      </row>
4761
4762      <row>
4763       <entry><literal>user_defined_type_name</literal></entry>
4764       <entry><type>sql_identifier</type></entry>
4765       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4766      </row>
4767
4768      <row>
4769       <entry><literal>is_insertable_into</literal></entry>
4770       <entry><type>yes_or_no</type></entry>
4771       <entry>
4772        <literal>YES</literal> if the table is insertable into,
4773        <literal>NO</literal> if not (Base tables are always insertable
4774        into, views not necessarily.)
4775       </entry>
4776      </row>
4777
4778      <row>
4779       <entry><literal>is_typed</literal></entry>
4780       <entry><type>yes_or_no</type></entry>
4781       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4782      </row>
4783
4784      <row>
4785       <entry><literal>commit_action</literal></entry>
4786       <entry><type>character_data</type></entry>
4787       <entry>
4788        If the table is a temporary table, then
4789        <literal>PRESERVE</literal>, else null.  (The SQL standard
4790        defines other commit actions for temporary tables, which are
4791        not supported by <productname>PostgreSQL</>.)
4792       </entry>
4793      </row>
4794     </tbody>
4795    </tgroup>
4796   </table>
4797  </sect1>
4798
4799  <sect1 id="infoschema-triggers">
4800   <title><literal>triggers</literal></title>
4801
4802   <para>
4803    The view <literal>triggers</literal> contains all triggers defined
4804    in the current database on tables that the current user owns or has
4805    some non-SELECT privilege on.
4806   </para>
4807
4808   <table>
4809    <title><literal>triggers</literal> Columns</title>
4810
4811    <tgroup cols="3">
4812     <thead>
4813      <row>
4814       <entry>Name</entry>
4815       <entry>Data Type</entry>
4816       <entry>Description</entry>
4817      </row>
4818     </thead>
4819
4820     <tbody>
4821      <row>
4822       <entry><literal>trigger_catalog</literal></entry>
4823       <entry><type>sql_identifier</type></entry>
4824       <entry>Name of the database that contains the trigger (always the current database)</entry>
4825      </row>
4826
4827      <row>
4828       <entry><literal>trigger_schema</literal></entry>
4829       <entry><type>sql_identifier</type></entry>
4830       <entry>Name of the schema that contains the trigger</entry>
4831      </row>
4832
4833      <row>
4834       <entry><literal>trigger_name</literal></entry>
4835       <entry><type>sql_identifier</type></entry>
4836       <entry>Name of the trigger</entry>
4837      </row>
4838
4839      <row>
4840       <entry><literal>event_manipulation</literal></entry>
4841       <entry><type>character_data</type></entry>
4842       <entry>
4843        Event that fires the trigger (<literal>INSERT</literal>,
4844        <literal>UPDATE</literal>, or <literal>DELETE</literal>)
4845       </entry>
4846      </row>
4847
4848      <row>
4849       <entry><literal>event_object_catalog</literal></entry>
4850       <entry><type>sql_identifier</type></entry>
4851       <entry>
4852        Name of the database that contains the table that the trigger
4853        is defined on (always the current database)
4854       </entry>
4855      </row>
4856
4857      <row>
4858       <entry><literal>event_object_schema</literal></entry>
4859       <entry><type>sql_identifier</type></entry>
4860       <entry>Name of the schema that contains the table that the trigger is defined on</entry>
4861      </row>
4862
4863      <row>
4864       <entry><literal>event_object_table</literal></entry>
4865       <entry><type>sql_identifier</type></entry>
4866       <entry>Name of the table that the trigger is defined on</entry>
4867      </row>
4868
4869      <row>
4870       <entry><literal>action_order</literal></entry>
4871       <entry><type>cardinal_number</type></entry>
4872       <entry>Not yet implemented</entry>
4873      </row>
4874
4875      <row>
4876       <entry><literal>action_condition</literal></entry>
4877       <entry><type>character_data</type></entry>
4878       <entry>
4879        <literal>WHEN</literal> condition of the trigger, null if none
4880        (also null if the table is not owned by a currently enabled
4881        role)
4882       </entry>
4883      </row>
4884
4885      <row>
4886       <entry><literal>action_statement</literal></entry>
4887       <entry><type>character_data</type></entry>
4888       <entry>
4889        Statement that is executed by the trigger (currently always
4890        <literal>EXECUTE PROCEDURE
4891        <replaceable>function</replaceable>(...)</literal>)
4892       </entry>
4893      </row>
4894
4895      <row>
4896       <entry><literal>action_orientation</literal></entry>
4897       <entry><type>character_data</type></entry>
4898       <entry>
4899        Identifies whether the trigger fires once for each processed
4900        row or once for each statement (<literal>ROW</literal> or
4901        <literal>STATEMENT</literal>)
4902       </entry>
4903      </row>
4904
4905      <row>
4906       <entry><literal>condition_timing</literal></entry>
4907       <entry><type>character_data</type></entry>
4908       <entry>
4909        Time at which the trigger fires (<literal>BEFORE</literal> or
4910        <literal>AFTER</literal>)
4911       </entry>
4912      </row>
4913
4914      <row>
4915       <entry><literal>condition_reference_old_table</literal></entry>
4916       <entry><type>sql_identifier</type></entry>
4917       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4918      </row>
4919
4920      <row>
4921       <entry><literal>condition_reference_new_table</literal></entry>
4922       <entry><type>sql_identifier</type></entry>
4923       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4924      </row>
4925
4926      <row>
4927       <entry><literal>condition_reference_old_row</literal></entry>
4928       <entry><type>sql_identifier</type></entry>
4929       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4930      </row>
4931
4932      <row>
4933       <entry><literal>condition_reference_new_row</literal></entry>
4934       <entry><type>sql_identifier</type></entry>
4935       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4936      </row>
4937
4938      <row>
4939       <entry><literal>created</literal></entry>
4940       <entry><type>time_stamp</type></entry>
4941       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
4942      </row>
4943     </tbody>
4944    </tgroup>
4945   </table>
4946
4947   <para>
4948    Triggers in <productname>PostgreSQL</productname> have two
4949    incompatibilities with the SQL standard that affect the
4950    representation in the information schema.  First, trigger names are
4951    local to the table in <productname>PostgreSQL</productname>, rather
4952    than being independent schema objects.  Therefore there can be duplicate
4953    trigger names defined in one schema, as long as they belong to
4954    different tables.  (<literal>trigger_catalog</literal> and
4955    <literal>trigger_schema</literal> are really the values pertaining
4956    to the table that the trigger is defined on.)  Second, triggers can
4957    be defined to fire on multiple events in
4958    <productname>PostgreSQL</productname> (e.g., <literal>ON INSERT OR
4959    UPDATE</literal>), whereas the SQL standard only allows one.  If a
4960    trigger is defined to fire on multiple events, it is represented as
4961    multiple rows in the information schema, one for each type of
4962    event.  As a consequence of these two issues, the primary key of
4963    the view <literal>triggers</literal> is really
4964    <literal>(trigger_catalog, trigger_schema, trigger_name,
4965    event_object_table, event_manipulation)</literal> instead of
4966    <literal>(trigger_catalog, trigger_schema, trigger_name)</literal>,
4967    which is what the SQL standard specifies.  Nonetheless, if you
4968    define your triggers in a manner that conforms with the SQL
4969    standard (trigger names unique in the schema and only one event
4970    type per trigger), this will not affect you.
4971   </para>
4972  </sect1>
4973
4974  <sect1 id="infoschema-usage-privileges">
4975   <title><literal>usage_privileges</literal></title>
4976
4977   <para>
4978    The view <literal>usage_privileges</literal> identifies
4979    <literal>USAGE</literal> privileges granted on various kinds of
4980    objects to a currently enabled role or by a currently enabled role.
4981    In <productname>PostgreSQL</productname>, this currently applies to
4982    domains, foreign-data wrappers, and foreign servers.  There is one
4983    row for each combination of object, grantor, and grantee.
4984   </para>
4985
4986   <para>
4987    Since domains do not have real privileges
4988    in <productname>PostgreSQL</productname>, this view shows implicit
4989    non-grantable <literal>USAGE</literal> privileges granted by the
4990    owner to <literal>PUBLIC</literal> for all domains.  The other
4991    object types, however, show real privileges.
4992   </para>
4993
4994   <table>
4995    <title><literal>usage_privileges</literal> Columns</title>
4996
4997    <tgroup cols="3">
4998     <thead>
4999      <row>
5000       <entry>Name</entry>
5001       <entry>Data Type</entry>
5002       <entry>Description</entry>
5003      </row>
5004     </thead>
5005
5006     <tbody>
5007      <row>
5008       <entry><literal>grantor</literal></entry>
5009       <entry><type>sql_identifier</type></entry>
5010       <entry>Name of the role that granted the privilege</entry>
5011      </row>
5012
5013      <row>
5014       <entry><literal>grantee</literal></entry>
5015       <entry><type>sql_identifier</type></entry>
5016       <entry>Name of the role that the privilege was granted to</entry>
5017      </row>
5018
5019      <row>
5020       <entry><literal>object_catalog</literal></entry>
5021       <entry><type>sql_identifier</type></entry>
5022       <entry>Name of the database containing the object (always the current database)</entry>
5023      </row>
5024
5025      <row>
5026       <entry><literal>object_schema</literal></entry>
5027       <entry><type>sql_identifier</type></entry>
5028       <entry>Name of the schema containing the object, if applicable,
5029       else an empty string</entry>
5030      </row>
5031
5032      <row>
5033       <entry><literal>object_name</literal></entry>
5034       <entry><type>sql_identifier</type></entry>
5035       <entry>Name of the object</entry>
5036      </row>
5037
5038      <row>
5039       <entry><literal>object_type</literal></entry>
5040       <entry><type>character_data</type></entry>
5041       <entry><literal>DOMAIN</literal> or <literal>FOREIGN DATA WRAPPER</literal> or <literal>FOREIGN SERVER</literal></entry>
5042      </row>
5043
5044      <row>
5045       <entry><literal>privilege_type</literal></entry>
5046       <entry><type>character_data</type></entry>
5047       <entry>Always <literal>USAGE</literal></entry>
5048      </row>
5049
5050      <row>
5051       <entry><literal>is_grantable</literal></entry>
5052       <entry><type>yes_or_no</type></entry>
5053       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
5054      </row>
5055     </tbody>
5056    </tgroup>
5057   </table>
5058  </sect1>
5059
5060  <sect1 id="infoschema-user-mapping-options">
5061   <title><literal>user_mapping_options</literal></title>
5062
5063   <para>
5064    The view <literal>user_mapping_options</literal> contains all the
5065    options defined for user mappings in the current database.  Only
5066    those user mappings are shown where the current user has access to
5067    the corresponding foreign server (by way of being the owner or
5068    having some privilege).
5069   </para>
5070
5071   <table>
5072    <title><literal>user_mapping_options</literal> Columns</title>
5073
5074    <tgroup cols="3">
5075     <thead>
5076      <row>
5077       <entry>Name</entry>
5078       <entry>Data Type</entry>
5079       <entry>Description</entry>
5080      </row>
5081     </thead>
5082
5083     <tbody>
5084      <row>
5085       <entry><literal>authorization_identifier</literal></entry>
5086       <entry><type>sql_identifier</type></entry>
5087       <entry>Name of the user being mapped,
5088       or <literal>PUBLIC</literal> if the mapping is public</entry>
5089      </row>
5090
5091      <row>
5092       <entry><literal>foreign_server_catalog</literal></entry>
5093       <entry><type>sql_identifier</type></entry>
5094       <entry>Name of the database that the foreign server used by this
5095       mapping is defined in (always the current database)</entry>
5096      </row>
5097
5098      <row>
5099       <entry><literal>foreign_server_name</literal></entry>
5100       <entry><type>sql_identifier</type></entry>
5101       <entry>Name of the foreign server used by this mapping</entry>
5102      </row>
5103
5104      <row>
5105       <entry><literal>option_name</literal></entry>
5106       <entry><type>sql_identifier</type></entry>
5107       <entry>Name of an option</entry>
5108      </row>
5109
5110      <row>
5111       <entry><literal>option_value</literal></entry>
5112       <entry><type>character_data</type></entry>
5113       <entry>Value of the option.  This column will show as null
5114       unless the current user is the user being mapped, or the mapping
5115       is for <literal>PUBLIC</literal> and the current user is the
5116       server owner, or the current user is a superuser.  The intent is
5117       to protect password information stored as user mapping
5118       option.</entry>
5119      </row>
5120     </tbody>
5121    </tgroup>
5122   </table>
5123  </sect1>
5124
5125  <sect1 id="infoschema-user-mappings">
5126   <title><literal>user_mappings</literal></title>
5127
5128   <para>
5129    The view <literal>user_mappings</literal> contains all user
5130    mappings defined in the current database.  Only those user mappings
5131    are shown where the current user has access to the corresponding
5132    foreign server (by way of being the owner or having some
5133    privilege).
5134   </para>
5135
5136   <table>
5137    <title><literal>user_mappings</literal> Columns</title>
5138
5139    <tgroup cols="3">
5140     <thead>
5141      <row>
5142       <entry>Name</entry>
5143       <entry>Data Type</entry>
5144       <entry>Description</entry>
5145      </row>
5146     </thead>
5147
5148     <tbody>
5149      <row>
5150       <entry><literal>authorization_identifier</literal></entry>
5151       <entry><type>sql_identifier</type></entry>
5152       <entry>Name of the user being mapped,
5153       or <literal>PUBLIC</literal> if the mapping is public</entry>
5154      </row>
5155
5156      <row>
5157       <entry><literal>foreign_server_catalog</literal></entry>
5158       <entry><type>sql_identifier</type></entry>
5159       <entry>Name of the database that the foreign server used by this
5160       mapping is defined in (always the current database)</entry>
5161      </row>
5162
5163      <row>
5164       <entry><literal>foreign_server_name</literal></entry>
5165       <entry><type>sql_identifier</type></entry>
5166       <entry>Name of the foreign server used by this mapping</entry>
5167      </row>
5168     </tbody>
5169    </tgroup>
5170   </table>
5171  </sect1>
5172
5173  <sect1 id="infoschema-view-column-usage">
5174   <title><literal>view_column_usage</literal></title>
5175
5176   <para>
5177    The view <literal>view_column_usage</literal> identifies all
5178    columns that are used in the query expression of a view (the
5179    <command>SELECT</command> statement that defines the view).  A
5180    column is only included if the table that contains the column is
5181    owned by a currently enabled role.
5182   </para>
5183
5184   <note>
5185    <para>
5186     Columns of system tables are not included.  This should be fixed
5187     sometime.
5188    </para>
5189   </note>
5190
5191   <table>
5192    <title><literal>view_column_usage</literal> Columns</title>
5193
5194    <tgroup cols="3">
5195     <thead>
5196      <row>
5197       <entry>Name</entry>
5198       <entry>Data Type</entry>
5199       <entry>Description</entry>
5200      </row>
5201     </thead>
5202
5203     <tbody>
5204      <row>
5205       <entry><literal>view_catalog</literal></entry>
5206       <entry><type>sql_identifier</type></entry>
5207       <entry>Name of the database that contains the view (always the current database)</entry>
5208      </row>
5209
5210      <row>
5211       <entry><literal>view_schema</literal></entry>
5212       <entry><type>sql_identifier</type></entry>
5213       <entry>Name of the schema that contains the view</entry>
5214      </row>
5215
5216      <row>
5217       <entry><literal>view_name</literal></entry>
5218       <entry><type>sql_identifier</type></entry>
5219       <entry>Name of the view</entry>
5220      </row>
5221
5222      <row>
5223       <entry><literal>table_catalog</literal></entry>
5224       <entry><type>sql_identifier</type></entry>
5225       <entry>
5226        Name of the database that contains the table that contains the
5227        column that is used by the view (always the current database)
5228       </entry>
5229      </row>
5230
5231      <row>
5232       <entry><literal>table_schema</literal></entry>
5233       <entry><type>sql_identifier</type></entry>
5234       <entry>
5235        Name of the schema that contains the table that contains the
5236        column that is used by the view
5237       </entry>
5238      </row>
5239
5240      <row>
5241       <entry><literal>table_name</literal></entry>
5242       <entry><type>sql_identifier</type></entry>
5243       <entry>
5244        Name of the table that contains the column that is used by the
5245        view
5246       </entry>
5247      </row>
5248
5249      <row>
5250       <entry><literal>column_name</literal></entry>
5251       <entry><type>sql_identifier</type></entry>
5252       <entry>Name of the column that is used by the view</entry>
5253      </row>
5254     </tbody>
5255    </tgroup>
5256   </table>
5257  </sect1>
5258
5259  <sect1 id="infoschema-view-routine-usage">
5260   <title><literal>view_routine_usage</literal></title>
5261
5262   <para>
5263    The view <literal>view_routine_usage</literal> identifies all
5264    routines (functions and procedures) that are used in the query
5265    expression of a view (the <command>SELECT</command> statement that
5266    defines the view).  A routine is only included if that routine is
5267    owned by a currently enabled role.
5268   </para>
5269
5270   <table>
5271    <title><literal>view_routine_usage</literal> Columns</title>
5272
5273    <tgroup cols="3">
5274     <thead>
5275      <row>
5276       <entry>Name</entry>
5277       <entry>Data Type</entry>
5278       <entry>Description</entry>
5279      </row>
5280     </thead>
5281
5282     <tbody>
5283      <row>
5284       <entry><literal>table_catalog</literal></entry>
5285       <entry><literal>sql_identifier</literal></entry>
5286       <entry>Name of the database containing the view (always the current database)</entry>
5287      </row>
5288
5289      <row>
5290       <entry><literal>table_schema</literal></entry>
5291       <entry><literal>sql_identifier</literal></entry>
5292       <entry>Name of the schema containing the view</entry>
5293      </row>
5294
5295      <row>
5296       <entry><literal>table_name</literal></entry>
5297       <entry><literal>sql_identifier</literal></entry>
5298       <entry>Name of the view</entry>
5299      </row>
5300
5301      <row>
5302       <entry><literal>specific_catalog</literal></entry>
5303       <entry><literal>sql_identifier</literal></entry>
5304       <entry>Name of the database containing the function (always the current database)</entry>
5305      </row>
5306
5307      <row>
5308       <entry><literal>specific_schema</literal></entry>
5309       <entry><literal>sql_identifier</literal></entry>
5310       <entry>Name of the schema containing the function</entry>
5311      </row>
5312
5313      <row>
5314       <entry><literal>specific_name</literal></entry>
5315       <entry><literal>sql_identifier</literal></entry>
5316       <entry>
5317        The <quote>specific name</quote> of the function.  See <xref
5318        linkend="infoschema-routines"> for more information.
5319       </entry>
5320      </row>
5321     </tbody>
5322    </tgroup>
5323   </table>
5324  </sect1>
5325
5326  <sect1 id="infoschema-view-table-usage">
5327   <title><literal>view_table_usage</literal></title>
5328
5329   <para>
5330    The view <literal>view_table_usage</literal> identifies all tables
5331    that are used in the query expression of a view (the
5332    <command>SELECT</command> statement that defines the view).  A
5333    table is only included if that table is owned by a currently
5334    enabled role.
5335   </para>
5336
5337   <note>
5338    <para>
5339     System tables are not included.  This should be fixed sometime.
5340    </para>
5341   </note>
5342
5343   <table>
5344    <title><literal>view_table_usage</literal> Columns</title>
5345
5346    <tgroup cols="3">
5347     <thead>
5348      <row>
5349       <entry>Name</entry>
5350       <entry>Data Type</entry>
5351       <entry>Description</entry>
5352      </row>
5353     </thead>
5354
5355     <tbody>
5356      <row>
5357       <entry><literal>view_catalog</literal></entry>
5358       <entry><type>sql_identifier</type></entry>
5359       <entry>Name of the database that contains the view (always the current database)</entry>
5360      </row>
5361
5362      <row>
5363       <entry><literal>view_schema</literal></entry>
5364       <entry><type>sql_identifier</type></entry>
5365       <entry>Name of the schema that contains the view</entry>
5366      </row>
5367
5368      <row>
5369       <entry><literal>view_name</literal></entry>
5370       <entry><type>sql_identifier</type></entry>
5371       <entry>Name of the view</entry>
5372      </row>
5373
5374      <row>
5375       <entry><literal>table_catalog</literal></entry>
5376       <entry><type>sql_identifier</type></entry>
5377       <entry>
5378        Name of the database that contains the table that is
5379        used by the view (always the current database)
5380       </entry>
5381      </row>
5382
5383      <row>
5384       <entry><literal>table_schema</literal></entry>
5385       <entry><type>sql_identifier</type></entry>
5386       <entry>
5387        Name of the schema that contains the table that is used by the
5388        view
5389       </entry>
5390      </row>
5391
5392      <row>
5393       <entry><literal>table_name</literal></entry>
5394       <entry><type>sql_identifier</type></entry>
5395       <entry>
5396        Name of the table that is used by the view
5397       </entry>
5398      </row>
5399     </tbody>
5400    </tgroup>
5401   </table>
5402  </sect1>
5403
5404  <sect1 id="infoschema-views">
5405   <title><literal>views</literal></title>
5406
5407   <para>
5408    The view <literal>views</literal> contains all views defined in the
5409    current database.  Only those views are shown that the current user
5410    has access to (by way of being the owner or having some privilege).
5411   </para>
5412
5413   <table>
5414    <title><literal>views</literal> Columns</title>
5415
5416    <tgroup cols="3">
5417     <thead>
5418      <row>
5419       <entry>Name</entry>
5420       <entry>Data Type</entry>
5421       <entry>Description</entry>
5422      </row>
5423     </thead>
5424
5425     <tbody>
5426      <row>
5427       <entry><literal>table_catalog</literal></entry>
5428       <entry><type>sql_identifier</type></entry>
5429       <entry>Name of the database that contains the view (always the current database)</entry>
5430      </row>
5431
5432      <row>
5433       <entry><literal>table_schema</literal></entry>
5434       <entry><type>sql_identifier</type></entry>
5435       <entry>Name of the schema that contains the view</entry>
5436      </row>
5437
5438      <row>
5439       <entry><literal>table_name</literal></entry>
5440       <entry><type>sql_identifier</type></entry>
5441       <entry>Name of the view</entry>
5442      </row>
5443
5444      <row>
5445       <entry><literal>view_definition</literal></entry>
5446       <entry><type>character_data</type></entry>
5447       <entry>
5448        Query expression defining the view (null if the view is not
5449        owned by a currently enabled role)
5450       </entry>
5451      </row>
5452
5453      <row>
5454       <entry><literal>check_option</literal></entry>
5455       <entry><type>character_data</type></entry>
5456       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5457      </row>
5458
5459      <row>
5460       <entry><literal>is_updatable</literal></entry>
5461       <entry><type>yes_or_no</type></entry>
5462       <entry>
5463        <literal>YES</literal> if the view is updatable (allows
5464        <command>UPDATE</command> and <command>DELETE</command>),
5465        <literal>NO</literal> if not
5466       </entry>
5467      </row>
5468
5469      <row>
5470       <entry><literal>is_insertable_into</literal></entry>
5471       <entry><type>yes_or_no</type></entry>
5472       <entry>
5473        <literal>YES</literal> if the view is insertable into (allows
5474        <command>INSERT</command>), <literal>NO</literal> if not
5475       </entry>
5476      </row>
5477
5478      <row>
5479       <entry><literal>is_trigger_updatable</literal></entry>
5480       <entry><type>yes_or_no</type></entry>
5481       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5482      </row>
5483
5484      <row>
5485       <entry><literal>is_trigger_deletable</literal></entry>
5486       <entry><type>yes_or_no</type></entry>
5487       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5488      </row>
5489
5490      <row>
5491       <entry><literal>is_trigger_insertable_into</literal></entry>
5492       <entry><type>yes_or_no</type></entry>
5493       <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5494      </row>
5495     </tbody>
5496    </tgroup>
5497   </table>
5498  </sect1>
5499
5500 </chapter>