OSDN Git Service

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