]> granicus.if.org Git - postgresql/blob - doc/src/sgml/information_schema.sgml
3936cdec490e18a6195f9997050e80aeef28e2e2
[postgresql] / doc / src / sgml / information_schema.sgml
1 <!-- $Header: /cvsroot/pgsql/doc/src/sgml/information_schema.sgml,v 1.5 2003/06/28 20:50:07 petere Exp $ -->
2
3 <chapter id="information-schema">
4  <title>The Information Schema</title>
5
6  <indexterm zone="information-schema">
7   <primary>information schema</primary>
8  </indexterm>
9
10  <para>
11   The information schema consists of a set of views that contain
12   information about the objects defined in the current database.  The
13   information schema is defined in the SQL standard and can therefore
14   be expected to be portable and remain stable --- unlike the system
15   catalogs, which are specific to PostgreSQL and are modelled after
16   implementation concerns.  The information schema views do not,
17   however, contain information about PostgreSQL-specific features; to
18   inquire about those you need to query the system catalogs or other
19   PostgreSQL-specific views.
20  </para>
21
22  <sect1 id="infoschema-schema">
23   <title>The Schema</title>
24
25   <para>
26    The information schema itself is a schema named
27    <literal>information_schema</literal>.  This schema automatically
28    exists in all databases.  The owner of this schema is the initial
29    database user in the cluster, and that user naturally has all the
30    privileges on this schema, including the ability to drop it (but
31    the space savings achieved by this are minuscule).
32   </para>
33
34   <para>
35    By default, the information schema is not in the schema search
36    path, so you need to access all objects in it through qualified
37    names.  Since the names of some of the objects in the information
38    schema are generic names that might occur in user applications, you
39    should be careful if you want to put the information schema in the
40    path.
41   </para>
42  </sect1>
43
44  <sect1 id="infoschema-datatypes">
45   <title>Data Types</title>
46
47   <para>
48    The columns of the information schema views use special data types
49    that are defined in the information schema.  These are defined as
50    simple domains over ordinary built-in types.  You should not use
51    these types for work outside the information schema, but your
52    applications must be prepared for them if they select from the
53    information schema.
54   </para>
55
56   <para>
57    These types are:
58
59    <variablelist>
60     <varlistentry>
61      <term><type>cardinal_number</type></term>
62      <listitem>
63       <para>
64        A nonnegative integer.
65       </para>
66      </listitem>
67     </varlistentry>
68
69     <varlistentry>
70      <term><type>character_data</type></term>
71      <listitem>
72       <para>
73        A character string (without specific maximum length).
74       </para>
75      </listitem>
76     </varlistentry>
77
78     <varlistentry>
79      <term><type>sql_identifier</type></term>
80      <listitem>
81       <para>
82        A character string.  This type is used for SQL identifiers, the
83        type <type>character_data</type> is used for any other kind of
84        text data.
85       </para>
86      </listitem>
87     </varlistentry>
88
89     <varlistentry>
90      <term><type>time_stamp</type></term>
91      <listitem>
92       <para>
93        A domain over the type <type>timestamp</type>
94       </para>
95      </listitem>
96     </varlistentry>
97    </variablelist>
98
99    Every column in the information schema has one of these four types.
100   </para>
101
102   <para>
103    Boolean (true/false) data is represented in the information schema
104    by a column of type <type>character_data</type> that contains
105    either <literal>YES</literal> or <literal>NO</literal>.  (The
106    information schema was invented before the type
107    <type>boolean</type> was added to the SQL standard, so this
108    convention is necessary to keep the information schema backward
109    compatible.)
110   </para>
111  </sect1>
112
113  <sect1 id="infoschema-information-schema-catalog-name">
114   <title><literal>information_schema_catalog_name</literal></title>
115
116   <para>
117    <literal>information_schema_catalog_name</literal> is a table that
118    always contains one row and one column containing the name of the
119    current database (current catalog, in SQL terminology).
120   </para>
121
122   <table>
123    <title><literal>information_schema_catalog_name</literal> Columns</title>
124
125    <tgroup cols="3">
126     <thead>
127      <row>
128       <entry>Name</entry>
129       <entry>Data Type</entry>
130       <entry>Description</entry>
131      </row>
132     </thead>
133
134     <tbody>
135      <row>
136       <entry><literal>catalog_name</literal></entry>
137       <entry><type>sql_identifier</type></entry>
138       <entry>Name of the database that contains this information schema</entry>
139      </row>
140     </tbody>
141    </tgroup>
142   </table>
143  </sect1>
144
145  <sect1 id="infoschema-check-constraints">
146   <title><literal>check_constraints</literal></title>
147
148   <para>
149    The view <literal>check_constraints</literal> contains all check
150    constraints, either defined on a table or on a domain, that are
151    owned by the current user.  (The owner of the table or domain is
152    the owner of the constraint.)
153   </para>
154
155   <table>
156    <title><literal>check_constraints</literal> Columns</title>
157
158    <tgroup cols="3">
159     <thead>
160      <row>
161       <entry>Name</entry>
162       <entry>Data Type</entry>
163       <entry>Description</entry>
164      </row>
165     </thead>
166
167     <tbody>
168      <row>
169       <entry><literal>constraint_catalog</literal></entry>
170       <entry><literal>sql_identifier</literal></entry>
171       <entry>Name of the database containing the constraint (always the current database)</entry>
172      </row>
173
174      <row>
175       <entry><literal>constraint_schema</literal></entry>
176       <entry><literal>sql_identifier</literal></entry>
177       <entry>Name of the schema containing the constraint</entry>
178      </row>
179
180      <row>
181       <entry><literal>constraint_name</literal></entry>
182       <entry><literal>sql_identifier</literal></entry>
183       <entry>Name of the constraint</entry>
184      </row>
185
186      <row>
187       <entry><literal>check_clause</literal></entry>
188       <entry><literal>character_data</literal></entry>
189       <entry>The check expression of the check constraint</entry>
190      </row>
191     </tbody>
192    </tgroup>
193   </table>
194  </sect1>
195
196  <sect1 id="infoschema-column-domain-usage">
197   <title><literal>column_domain_usage</literal></title>
198
199   <para>
200    The view <literal>column_domain_usage</literal> identifies all
201    columns (of a table or a view) that make use of some domain defined
202    in the current database and owned by the current user.
203   </para>
204
205   <table>
206    <title><literal>column_domain_usage</literal> Columns</title>
207
208    <tgroup cols="3">
209     <thead>
210      <row>
211       <entry>Name</entry>
212       <entry>Data Type</entry>
213       <entry>Description</entry>
214      </row>
215     </thead>
216
217     <tbody>
218      <row>
219       <entry><literal>domain_catalog</literal></entry>
220       <entry><type>sql_identifier</type></entry>
221       <entry>Name of the database containing the domain (always the current database)</entry>
222      </row>
223
224      <row>
225       <entry><literal>domain_schema</literal></entry>
226       <entry><type>sql_identifier</type></entry>
227       <entry>Name of the schema containing the domain</entry>
228      </row>
229
230      <row>
231       <entry><literal>domain_name</literal></entry>
232       <entry><type>sql_identifier</type></entry>
233       <entry>Name of the domain</entry>
234      </row>
235
236      <row>
237       <entry><literal>table_catalog</literal></entry>
238       <entry><type>sql_identifier</type></entry>
239       <entry>Name of the database containing the table (always the current database)</entry>
240      </row>
241
242      <row>
243       <entry><literal>table_schema</literal></entry>
244       <entry><type>sql_identifier</type></entry>
245       <entry>Name of the schema containing the table</entry>
246      </row>
247
248      <row>
249       <entry><literal>table_name</literal></entry>
250       <entry><type>sql_identifier</type></entry>
251       <entry>Name of the table</entry>
252      </row>
253
254      <row>
255       <entry><literal>column_name</literal></entry>
256       <entry><type>sql_identifier</type></entry>
257       <entry>Name of the column</entry>
258      </row>
259     </tbody>
260    </tgroup>
261   </table>
262  </sect1>
263
264  <sect1 id="infoschema-column-privileges">
265   <title><literal>column_privileges</literal></title>
266
267   <para>
268    The view <literal>column_privileges</literal> identifies all
269    privileges granted on columns to the current user or by the current
270    user.  There is one row for each combination of column, grantor,
271    and grantee.
272   </para>
273
274   <para>
275    In PostgreSQL, you can only grant privileges on entire tables, not
276    individual columns.  Therefore, this view contains the same
277    information as <literal>table_privileges</literal>, just
278    represented through one row for each column in each appropriate
279    table.  But if you want to make your applications fit for possible
280    future developements, it is generally the right choice to use this
281    view instead of <literal>table_privileges</literal>.
282   </para>
283
284   <table>
285    <title><literal>column_privileges</literal> Columns</title>
286
287    <tgroup cols="3">
288     <thead>
289      <row>
290       <entry>Name</entry>
291       <entry>Data Type</entry>
292       <entry>Description</entry>
293      </row>
294     </thead>
295
296     <tbody>
297      <row>
298       <entry><literal>grantor</literal></entry>
299       <entry><type>sql_identifier</type></entry>
300       <entry>Name of the user that granted the privilege</entry>
301      </row>
302
303      <row>
304       <entry><literal>grantee</literal</entry>
305       <entry><type>sql_identifier</type></entry>
306       <entry>Name of the user that the privilege was granted to</entry>
307      </row>
308
309      <row>
310       <entry><literal>table_catalog</literal></entry>
311       <entry><type>sql_identifier</type></entry>
312       <entry>Name of the database that contains the table that contains the column (always the current database)</entry>
313      </row>
314
315      <row>
316       <entry><literal>table_schema</literal</entry>
317       <entry><type>sql_identifier</type></entry>
318       <entry>Name of the schema that contains the table that contains the column</entry>
319      </row>
320
321      <row>
322       <entry><literal>table_name</literal</entry>
323       <entry><type>sql_identifier</type></entry>
324       <entry>Name of the table that contains the column</entry>
325      </row>
326
327      <row>
328       <entry><literal>column_name</literal</entry>
329       <entry><type>sql_identifier</type></entry>
330       <entry>Name of the column</entry>
331      </row>
332
333      <row>
334       <entry><literal>privilege_type</literal</entry>
335       <entry><type>character_data</type></entry>
336       <entry>
337        Type of the privilege: <literal>SELECT</literal>,
338        <literal>DELETE</literal>, <literal>INSERT</literal>,
339        <literal>UPDATE</literal>, <literal>REFERENCES</literal>, or
340        <literal>TRIGGER</literal>
341       </entry>
342      </row>
343
344      <row>
345       <entry><literal>is_grantable</literal></entry>
346       <entry><type>character_data</type></entry>
347       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
348      </row>
349     </tbody>
350    </tgroup>
351   </table>
352  </sect1>
353
354  <sect1 id="infoschema-column-udt-usage">
355   <title><literal>column_udt_usage</literal></title>
356
357   <para>
358    The view <literal>column_udt_usage</literal> identifies all columns
359    that use data types owned by the current user.  Note that in
360    PostgreSQL, built-in data types behave like user-defined types, so
361    they are included here as well.  See also <xref
362    linkend="infoschema-columns"> for details.
363   </para>
364
365   <table>
366    <title><literal>column_udt_usage</literal> Columns</title>
367
368    <tgroup cols="3">
369     <thead>
370      <row>
371       <entry>Name</entry>
372       <entry>Data Type</entry>
373       <entry>Description</entry>
374      </row>
375     </thead>
376
377     <tbody>
378      <row>
379       <entry><literal>udt_catalog</literal></entry>
380       <entry><type>sql_identifier</type></entry>
381       <entry>
382        Name of the database that the column data type (the underlying
383        type of the domain, if applicable) is defined in (always the
384        current database)
385       </entry>
386      </row>
387
388      <row>
389       <entry><literal>udt_schema</literal></entry>
390       <entry><type>sql_identifier</type></entry>
391       <entry>
392        Name of the schema that the column data type (the underlying
393        type of the domain, if applicable) is defined in
394       </entry>
395      </row>
396
397      <row>
398       <entry><literal>udt_name</literal></entry>
399       <entry><type>sql_identifier</type></entry>
400       <entry>
401        Name of the column data type (the underlying type of the
402        domain, if applicable)
403       </entry>
404      </row>
405
406      <row>
407       <entry><literal>table_catalog</literal></entry>
408       <entry><type>sql_identifier</type></entry>
409       <entry>Name of the database containing the table (always the current database)</entry>
410      </row>
411
412      <row>
413       <entry><literal>table_schema</literal></entry>
414       <entry><type>sql_identifier</type></entry>
415       <entry>Name of the schema containing the table</entry>
416      </row>
417
418      <row>
419       <entry><literal>table_name</literal></entry>
420       <entry><type>sql_identifier</type></entry>
421       <entry>Name of the table</entry>
422      </row>
423
424      <row>
425       <entry><literal>column_name</literal></entry>
426       <entry><type>sql_identifier</type></entry>
427       <entry>Name of the column</entry>
428      </row>
429     </tbody>
430    </tgroup>
431   </table>
432  </sect1>
433
434  <sect1 id="infoschema-columns">
435   <title><literal>columns</literal></title>
436
437   <para>
438    The view <literal>columns</literal> contains information about all
439    table columns (or view columns) in the database.  System columns
440    (<literal>oid</>, etc.) are not included.  Only those columns are
441    shown that the current user has access to (by way of being the
442    owner or having some privilege).
443   </para>
444
445   <table>
446    <title><literal>columns</literal> Columns</title>
447
448    <tgroup cols="3">
449     <thead>
450      <row>
451       <entry>Name</entry>
452       <entry>Data Type</entry>
453       <entry>Description</entry>
454      </row>
455     </thead>
456
457     <tbody>
458      <row>
459       <entry><literal>table_catalog</literal></entry>
460       <entry><type>sql_identifier</type></entry>
461       <entry>Name of the database containing the table (always the current database)</entry>
462      </row>
463
464      <row>
465       <entry><literal>table_schema</literal></entry>
466       <entry><type>sql_identifier</type></entry>
467       <entry>Name of the schema containing the table</entry>
468      </row>
469
470      <row>
471       <entry><literal>table_name</literal></entry>
472       <entry><type>sql_identifier</type></entry>
473       <entry>Name of the table</entry>
474      </row>
475
476      <row>
477       <entry><literal>column_name</literal></entry>
478       <entry><type>sql_identifier</type></entry>
479       <entry>Name of the column</entry>
480      </row>
481
482      <row>
483       <entry><literal>ordinal_position</literal></entry>
484       <entry><type>cardinal_number</type></entry>
485       <entry>Ordinal position of the column within the table (count starts at 1)</entry>
486      </row>
487
488      <row>
489       <entry><literal>column_default</literal></entry>
490       <entry><type>character_data</type></entry>
491       <entry>
492        Default expression of the column (null if the current user is
493        not the owner of the table containing the column)
494       </entry>
495      </row>
496
497      <row>
498       <entry><literal>is_nullable</literal></entry>
499       <entry><type>character_data</type></entry>
500       <entry>
501        <literal>YES</literal> if the column is possibly nullable,
502        <literal>NO</literal> if it is known not nullable.  A not-null
503        constraint is one way a column can be known not nullable, but
504        there may be others.
505       </entry>
506      </row>
507
508      <row>
509       <entry><literal>data_type</literal></entry>
510       <entry><type>character_data</type></entry>
511       <entry>
512        Data type of the column, if it is a built-in type, or
513        <literal>ARRAY</literal> if it is some array (in that case, see
514        the view <literal>element_types</literal>), else
515        <literal>USER-DEFINED</literal> (in that case, the type is
516        identified in <literal>udt_name</literal> and associated
517        columns).  If the column is based on a domain, this column
518        refers to the type underlying the domain (and the domain is
519        identified in <literal>domain_name</literal> and associated
520        columns).
521       </entry>
522      </row>
523
524      <row>
525       <entry><literal>character_maximum_length</literal></entry>
526       <entry><type>cardinal_number</type></entry>
527       <entry>
528        If <literal>data_type</literal> identifies a character or bit
529        string type, the declared maximum length; null for all other
530        data types or if no maximum length was declared.
531       </entry>
532      </row>
533
534      <row>
535       <entry><literal>character_octet_length</literal></entry>
536       <entry><type>cardinal_number</type></entry>
537       <entry>
538        If <literal>data_type</literal> identifies a character type,
539        the maximum possible length in octets (bytes) of a datum (this
540        should not be of concern to PostgreSQL users); null for all
541        other data types.
542       </entry>
543      </row>
544
545      <row>
546       <entry><literal>numeric_precision</literal></entry>
547       <entry><type>cardinal_number</type></entry>
548       <entry>
549        If <literal>data_type</literal> identifies a numeric type, this
550        column contains the (declared or implicit) precision of the
551        type for this column.  The precision indicates the number of
552        significant digits.  It may be expressed in decimal (base 10)
553        or binary (base 2) terms, as specified in the column
554        <literal>numeric_precision_radix</literal>.  For all other data
555        types, this column is null.
556       </entry>
557      </row>
558
559      <row>
560       <entry><literal>numeric_precision_radix</literal></entry>
561       <entry><type>cardinal_number</type></entry>
562       <entry>
563        If <literal>data_type</literal> identifies a numeric type, this
564        column indicates in which base the values in the columns
565        <literal>numeric_precision</literal> and
566        <literal>numeric_scale</literal> are expressed.  The value is
567        either 2 or 10.  For all other data types, this column is null.
568       </entry>
569      </row>
570
571      <row>
572       <entry><literal>numeric_scale</literal></entry>
573       <entry><type>cardinal_number</type></entry>
574       <entry>
575        If <literal>data_type</literal> identifies an exact numeric
576        type, this column contains the (declared or implicit) scale of
577        the type for this column.  The scale indicates the number of
578        significant digits to the right of the decimal point.  It may
579        be expressed in decimal (base 10) or binary (base 2) terms, as
580        specified in the column
581        <literal>numeric_precision_radix</literal>.  For all other data
582        types, this column is null.
583       </entry>
584      </row>
585
586      <row>
587       <entry><literal>datetime_precision</literal></entry>
588       <entry><type>cardinal_number</type></entry>
589       <entry>
590        If <literal>data_type</literal> identifies a date, time, or
591        interval type, the declared precision; null for all other data
592        types or if no precision was declared.
593       </entry>
594      </row>
595
596      <row>
597       <entry><literal>interval_type</literal></entry>
598       <entry><type>character_data</type></entry>
599       <entry>Not yet implemented</entry>
600      </row>
601
602      <row>
603       <entry><literal>interval_precision</literal></entry>
604       <entry><type>character_data</type></entry>
605       <entry>Not yet implemented</entry>
606      </row>
607
608      <row>
609       <entry><literal>character_set_catalog</literal></entry>
610       <entry><type>sql_identifier</type></entry>
611       <entry>Applies to a feature not available in PostgreSQL</entry>
612      </row>
613
614      <row>
615       <entry><literal>character_set_schema</literal></entry>
616       <entry><type>sql_identifier</type></entry>
617       <entry>Applies to a feature not available in PostgreSQL</entry>
618      </row>
619
620      <row>
621       <entry><literal>character_set_name</literal></entry>
622       <entry><type>sql_identifier</type></entry>
623       <entry>Applies to a feature not available in PostgreSQL</entry>
624      </row>
625
626      <row>
627       <entry><literal>collation_catalog</literal></entry>
628       <entry><type>sql_identifier</type></entry>
629       <entry>Applies to a feature not available in PostgreSQL</entry>
630      </row>
631
632      <row>
633       <entry><literal>collation_schema</literal></entry>
634       <entry><type>sql_identifier</type></entry>
635       <entry>Applies to a feature not available in PostgreSQL</entry>
636      </row>
637
638      <row>
639       <entry><literal>collation_name</literal></entry>
640       <entry><type>sql_identifier</type></entry>
641       <entry>Applies to a feature not available in PostgreSQL</entry>
642      </row>
643
644      <row>
645       <entry><literal>domain_catalog</literal></entry>
646       <entry><type>sql_identifier</type></entry>
647       <entry>
648        If the column has a domain type, the name of the database that
649        the domain is defined in (always the current database), else
650        null.
651       </entry>
652      </row>
653
654      <row>
655       <entry><literal>domain_schema</literal></entry>
656       <entry><type>sql_identifier</type></entry>
657       <entry>
658        If the column has a domain type, the name of the schema that
659        the domain is defined in, else null.
660       </entry>
661      </row>
662
663      <row>
664       <entry><literal>domain_name</literal></entry>
665       <entry><type>sql_identifier</type></entry>
666       <entry>If the column has a domain type, the name of the domain, else null.</entry>
667      </row>
668
669      <row>
670       <entry><literal>udt_catalog</literal></entry>
671       <entry><type>sql_identifier</type></entry>
672       <entry>
673        Name of the database that the column data type (the underlying
674        type of the domain, if applicable) is defined in (always the
675        current database)
676       </entry>
677      </row>
678
679      <row>
680       <entry><literal>udt_schema</literal></entry>
681       <entry><type>sql_identifier</type></entry>
682       <entry>
683        Name of the schema that the column data type (the underlying
684        type of the domain, if applicable) is defined in
685       </entry>
686      </row>
687
688      <row>
689       <entry><literal>udt_name</literal></entry>
690       <entry><type>sql_identifier</type></entry>
691       <entry>
692        Name of the column data type (the underlying type of the
693        domain, if applicable)
694       </entry>
695      </row>
696
697      <row>
698       <entry><literal>scope_catalog</literal></entry>
699       <entry><type>sql_identifier</type></entry>
700       <entry>Applies to a feature not available in PostgreSQL</entry>
701      </row>
702
703      <row>
704       <entry><literal>scope_schema</literal></entry>
705       <entry><type>sql_identifier</type></entry>
706       <entry>Applies to a feature not available in PostgreSQL</entry>
707      </row>
708
709      <row>
710       <entry><literal>scope_name</literal></entry>
711       <entry><type>sql_identifier</type></entry>
712       <entry>Applies to a feature not available in PostgreSQL</entry>
713      </row>
714
715      <row>
716       <entry><literal>maximum_cardinality</literal></entry>
717       <entry><type>cardinal_number</type></entry>
718       <entry>Always null, because arrays always have unlimited maximum cardinality in PostgreSQL</entry>
719      </row>
720
721      <row>
722       <entry><literal>dtd_identifier</literal></entry>
723       <entry><type>sql_identifier</type></entry>
724       <entry>
725        An identifier of the data type descriptor of the column, unique
726        among the data type descriptors pertaining to the table.  This
727        is mainly useful for joining with other instances of such
728        identifiers.  (The specific format of the identifier is not
729        defined and not guaranteed to remain the same in future
730        versions.)
731       </entry>
732      </row>
733
734      <row>
735       <entry><literal>is_self_referencing</literal></entry>
736       <entry><type>character_data</type></entry>
737       <entry>Applies to a feature not available in PostgreSQL</entry>
738      </row>
739     </tbody>
740    </tgroup>
741   </table>
742
743   <para>
744    Since data types can be defined in a variety of ways in SQL, and
745    PostgreSQL contains additional ways to define data types, their
746    representation in the information schema can be somewhat difficult.
747    The column <literal>data_type</literal> is supposed to identify the
748    underlying built-in type of the column.  In PostgreSQL, this means
749    that the type is defined in the system catalog schema
750    <literal>pg_catalog</literal>.  This column may be useful if the
751    application can handle the well-known built-in types specially (for
752    example, format the numeric types differently or use the data in
753    the precision columns).  The columns <literal>udt_name</literal>,
754    <literal>udt_schema</literal>, and <literal>udt_catalog</literal>
755    always identify the underlying data type of the column, even if the
756    column is based on a domain.  (Since PostgreSQL treats built-in
757    types like user-defined types, built-in types appear here as well.
758    This is an extension of the SQL standard.)  These columns should be
759    used if an application wants to process data differently according
760    to the type, because in that case it wouldn't matter if the column
761    is really based on a domain.  If the column is based on a domain,
762    the identity of the domain is stored in the columns
763    <literal>domain_name</literal>, <literal>domain_schema</literal>,
764    and <literal>domain_catalog</literal>.  If you want to pair up
765    columns with their associated data types and treat domains as
766    separate types, you could write <literal>coalesce(domain_name,
767    udt_name)</literal>, etc.
768   </para>
769  </sect1>
770
771  <sect1 id="infoschema-constraint-column-usage">
772   <title><literal>constraint_column_usage</literal></title>
773
774   <para>
775    The view <literal>constraint_column_usage</literal> identifies all
776    columns in the current database that are used by some constraint.
777    Only those columns are shown that are contained in a table owned
778    the current user.  For a check constraint, this view identifies the
779    columns that are used in the check expression.  For a foreign key
780    constraint, this view identifies the columns that the foreign key
781    references.  For a unique or primary key constraint, this view
782    identifies the constrained columns.
783   </para>
784
785   <table>
786    <title><literal>constraint_column_usage</literal> Columns</title>
787
788    <tgroup cols="3">
789     <thead>
790      <row>
791       <entry>Name</entry>
792       <entry>Data Type</entry>
793       <entry>Description</entry>
794      </row>
795     </thead>
796
797     <tbody>
798      <row>
799       <entry><literal>table_catalog</literal></entry>
800       <entry><type>sql_identifier</type></entry>
801       <entry>
802        Name of the database that contains the table that contains the
803        column that is used by some constraint (always the current
804        database)
805       </entry>
806      </row>
807
808      <row>
809       <entry><literal>table_schema</literal</entry>
810       <entry><type>sql_identifier</type></entry>
811       <entry>
812        Name of the schema that contains the table that contains the
813        column that is used by some constraint
814       </entry>
815      </row>
816
817      <row>
818       <entry><literal>table_name</literal</entry>
819       <entry><type>sql_identifier</type></entry>
820       <entry>
821        Name of the table that contains the column that is used by some
822        constraint
823       </entry>
824      </row>
825
826      <row>
827       <entry><literal>column_name</literal</entry>
828       <entry><type>sql_identifier</type></entry>
829       <entry>
830        Name of the column that is used by some constraint
831       </entry>
832      </row>
833
834      <row>
835       <entry><literal>constraint_catalog</literal></entry>
836       <entry><type>sql_identifier</type></entry>
837       <entry>Name of the database that contains the constraint (always the current database)</entry>
838      </row>
839
840      <row>
841       <entry><literal>constraint_schema</literal</entry>
842       <entry><type>sql_identifier</type></entry>
843       <entry>Name of the schema that contains the constraint</entry>
844      </row>
845
846      <row>
847       <entry><literal>constraint_name</literal</entry>
848       <entry><type>sql_identifier</type></entry>
849       <entry>Name of the constraint</entry>
850      </row>
851     </tbody>
852    </tgroup>
853   </table>
854  </sect1>
855
856  <sect1 id="infoschema-constraint-table-usage">
857   <title><literal>constraint_table_usage</literal></title>
858
859   <para>
860    The view <literal>constraint_table_usage</literal> identifies all
861    tables in the current database that are used by some constraint and
862    are owned by the current user.  (This is different from the view
863    <literal>table_constraints</literal>, which identifies all table
864    constraints along with the table they are defined on.)  For a
865    foreign key constraint, this view identifies the table that the
866    foreign key references.  For a unique or primary key constraint,
867    this view simply identifies the table the constraint belongs to.
868    Check constraints and not-null constraints are not included in this
869    view.
870   </para>
871
872   <table>
873    <title><literal>constraint_table_usage</literal> Columns</title>
874
875    <tgroup cols="3">
876     <thead>
877      <row>
878       <entry>Name</entry>
879       <entry>Data Type</entry>
880       <entry>Description</entry>
881      </row>
882     </thead>
883
884     <tbody>
885      <row>
886       <entry><literal>table_catalog</literal></entry>
887       <entry><type>sql_identifier</type></entry>
888       <entry>
889        Name of the database that contains the table that is used by
890        some constraint (always the current database)
891       </entry>
892      </row>
893
894      <row>
895       <entry><literal>table_schema</literal</entry>
896       <entry><type>sql_identifier</type></entry>
897       <entry>
898        Name of the schema that contains the table that is used by some
899        constraint
900       </entry>
901      </row>
902
903      <row>
904       <entry><literal>table_name</literal</entry>
905       <entry><type>sql_identifier</type></entry>
906       <entry>Name of the table that is used by some constraint</entry>
907      </row>
908
909      <row>
910       <entry><literal>constraint_catalog</literal></entry>
911       <entry><type>sql_identifier</type></entry>
912       <entry>Name of the database that contains the constraint (always the current database)</entry>
913      </row>
914
915      <row>
916       <entry><literal>constraint_schema</literal</entry>
917       <entry><type>sql_identifier</type></entry>
918       <entry>Name of the schema that contains the constraint</entry>
919      </row>
920
921      <row>
922       <entry><literal>constraint_name</literal</entry>
923       <entry><type>sql_identifier</type></entry>
924       <entry>Name of the constraint</entry>
925      </row>
926     </tbody>
927    </tgroup>
928   </table>
929  </sect1>
930
931  <sect1 id="infoschema-data-type-privileges">
932   <title><literal>data_type_privileges</literal></title>
933
934   <para>
935    The view <literal>data_type_privileges</literal> identifies all
936    data type descriptors that the current user has access to, by way
937    of being the owner of the described object or having some privilege
938    for it.  A data type descriptor is generated whenever a data type
939    is used in the definition of a table column, a domain, or a
940    function (as parameter or return type) and stores some information
941    about how the data type is used in that instance (for example, the
942    declared maximum length, if applicable).  Each data type
943    descriptors is assigned an arbitrary identifier that is unique
944    among the data type descriptor identifiers assigned for one object
945    (table, domain, function).  This view is probably not useful for
946    applications, but it is used to define some other views in the
947    information schema.
948   </para>
949
950   <table>
951    <title><literal>domain_constraints</literal> Columns</title>
952
953    <tgroup cols="3">
954     <thead>
955      <row>
956       <entry>Name</entry>
957       <entry>Data Type</entry>
958       <entry>Description</entry>
959      </row>
960     </thead>
961
962     <tbody>
963      <row>
964       <entry><literal>object_catalog</literal></entry>
965       <entry><type>sql_identifier</type></entry>
966       <entry>Name of the database that contains the described object (always the current database)</entry>
967      </row>
968
969      <row>
970       <entry><literal>object_schema</literal</entry>
971       <entry><type>sql_identifier</type></entry>
972       <entry>Name of the schema that contains the described object</entry>
973      </row>
974
975      <row>
976       <entry><literal>object_name</literal</entry>
977       <entry><type>sql_identifier</type></entry>
978       <entry>Name of the described object</entry>
979      </row>
980
981      <row>
982       <entry><literal>object_type</literal</entry>
983       <entry><type>character_data</type></entry>
984       <entry>
985        The type of the described object: one of
986        <literal>TABLE</literal> (the data type descriptor pertains to
987        a column of that table), <literal>DOMAIN</literal> (the data
988        type descriptors pertains to that domain),
989        <literal>ROUTINE</literal> (the data type descriptor pertains
990        to a parameter or the return data type of that function).
991       </entry>
992      </row>
993
994      <row>
995       <entry><literal>dtd_identifier</literal</entry>
996       <entry><type>sql_identifier</type></entry>
997       <entry>
998        The identifier of the data type descriptor, which is unique
999        among the data type descriptors for that same object.
1000       </entry>
1001      </row>
1002     </tbody>
1003    </tgroup>
1004   </table>
1005  </sect1>
1006
1007  <sect1 id="infoschema-domain-constraints">
1008   <title><literal>domain_constraints</literal></title>
1009
1010   <para>
1011    The view <literal>domain_constraints</literal> contains all
1012    constraints belonging to domains owned by the current user.
1013   </para>
1014
1015   <table>
1016    <title><literal>domain_constraints</literal> Columns</title>
1017
1018    <tgroup cols="3">
1019     <thead>
1020      <row>
1021       <entry>Name</entry>
1022       <entry>Data Type</entry>
1023       <entry>Description</entry>
1024      </row>
1025     </thead>
1026
1027     <tbody>
1028      <row>
1029       <entry><literal>constraint_catalog</literal></entry>
1030       <entry><type>sql_identifier</type></entry>
1031       <entry>Name of the database that contains the constraint (always the current database)</entry>
1032      </row>
1033
1034      <row>
1035       <entry><literal>constraint_schema</literal</entry>
1036       <entry><type>sql_identifier</type></entry>
1037       <entry>Name of the schema that contains the constraint</entry>
1038      </row>
1039
1040      <row>
1041       <entry><literal>constraint_name</literal</entry>
1042       <entry><type>sql_identifier</type></entry>
1043       <entry>Name of the constraint</entry>
1044      </row>
1045
1046      <row>
1047       <entry><literal>domain_catalog</literal></entry>
1048       <entry><type>sql_identifier</type></entry>
1049       <entry>Name of the database that contains the domain (always the current database)</entry>
1050      </row>
1051
1052      <row>
1053       <entry><literal>domain_schema</literal</entry>
1054       <entry><type>sql_identifier</type></entry>
1055       <entry>Name of the schema that contains the domain</entry>
1056      </row>
1057
1058      <row>
1059       <entry><literal>domain_name</literal</entry>
1060       <entry><type>sql_identifier</type></entry>
1061       <entry>Name of the domain</entry>
1062      </row>
1063
1064      <row>
1065       <entry><literal>is_deferrable</literal></entry>
1066       <entry><type>character_data</type></entry>
1067       <entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry>
1068      </row>
1069
1070      <row>
1071       <entry><literal>initially_deferred</literal></entry>
1072       <entry><type>character_data</type></entry>
1073       <entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry>
1074      </row>
1075     </tbody>
1076    </tgroup>
1077   </table>
1078  </sect1>
1079
1080  <sect1 id="infoschema-domain-udt-usage">
1081   <title><literal>domain_udt_usage</literal></title>
1082
1083   <para>
1084    The view <literal>domain_udt_usage</literal> identifies all columns
1085    that use data types owned by the current user. Note that in
1086    PostgreSQL, built-in data types behave like user-defined types, so
1087    they are included here as well.
1088   </para>
1089
1090   <table>
1091    <title><literal>domain_udt_usage</literal> Columns</title>
1092
1093    <tgroup cols="3">
1094     <thead>
1095      <row>
1096       <entry>Name</entry>
1097       <entry>Data Type</entry>
1098       <entry>Description</entry>
1099      </row>
1100     </thead>
1101
1102     <tbody>
1103      <row>
1104       <entry><literal>udt_catalog</literal></entry>
1105       <entry><type>sql_identifier</type></entry>
1106       <entry>Name of the database that the domain data type is defined in (always the current database)</entry>
1107      </row>
1108
1109      <row>
1110       <entry><literal>udt_schema</literal></entry>
1111       <entry><type>sql_identifier</type></entry>
1112       <entry>Name of the schema that the domain data type is defined in</entry>
1113      </row>
1114
1115      <row>
1116       <entry><literal>udt_name</literal></entry>
1117       <entry><type>sql_identifier</type></entry>
1118       <entry>Name of the domain data type</entry>
1119      </row>
1120
1121      <row>
1122       <entry><literal>domain_catalog</literal></entry>
1123       <entry><type>sql_identifier</type></entry>
1124       <entry>Name of the database that contains the domain (always the current database)</entry>
1125      </row>
1126
1127      <row>
1128       <entry><literal>domain_schema</literal</entry>
1129       <entry><type>sql_identifier</type></entry>
1130       <entry>Name of the schema that contains the domain</entry>
1131      </row>
1132
1133      <row>
1134       <entry><literal>domain_name</literal</entry>
1135       <entry><type>sql_identifier</type></entry>
1136       <entry>Name of the domain</entry>
1137      </row>
1138     </tbody>
1139    </tgroup>
1140   </table>
1141  </sect1>
1142
1143  <sect1 id="infoschema-domains">
1144   <title><literal>domains</literal></title>
1145
1146   <para>
1147    The view <literal>domains</literal> contains all domains defined in
1148    the current database.
1149   </para>
1150
1151   <table>
1152    <title><literal>domains</literal> Columns</title>
1153
1154    <tgroup cols="3">
1155     <thead>
1156      <row>
1157       <entry>Name</entry>
1158       <entry>Data Type</entry>
1159       <entry>Description</entry>
1160      </row>
1161     </thead>
1162
1163     <tbody>
1164      <row>
1165       <entry><literal>domain_catalog</literal></entry>
1166       <entry><type>sql_identifier</type></entry>
1167       <entry>Name of the database that contains the domain (always the current database)</entry>
1168      </row>
1169
1170      <row>
1171       <entry><literal>domain_schema</literal</entry>
1172       <entry><type>sql_identifier</type></entry>
1173       <entry>Name of the schema that contains the domain</entry>
1174      </row>
1175
1176      <row>
1177       <entry><literal>domain_name</literal</entry>
1178       <entry><type>sql_identifier</type></entry>
1179       <entry>Name of the domain</entry>
1180      </row>
1181
1182      <row>
1183       <entry><literal>data_type</literal></entry>
1184       <entry><type>character_data</type></entry>
1185       <entry>
1186        Data type of the domain, if it is a built-in type, or
1187        <literal>ARRAY</literal> if it is some array (in that case, see
1188        the view <literal>element_types</literal>), else
1189        <literal>USER-DEFINED</literal> (in that case, the type is
1190        identified in <literal>udt_name</literal> and associated
1191        columns).
1192       </entry>
1193      </row>
1194
1195      <row>
1196       <entry><literal>character_maximum_length</literal></entry>
1197       <entry><type>cardinal_number</type></entry>
1198       <entry>
1199        If the domain has a character or bit string type, the declared
1200        maximum length; null for all other data types or if no maximum
1201        length was declared.
1202       </entry>
1203      </row>
1204
1205      <row>
1206       <entry><literal>character_octet_length</literal></entry>
1207       <entry><type>cardinal_number</type></entry>
1208       <entry>
1209        If the domain has a character type, the maximum possible length
1210        in octets (bytes) of a datum (this should not be of concern to
1211        PostgreSQL users); null for all other data types.
1212       </entry>
1213      </row>
1214
1215      <row>
1216       <entry><literal>character_set_catalog</literal></entry>
1217       <entry><type>sql_identifier</type></entry>
1218       <entry>Applies to a feature not available in PostgreSQL</entry>
1219      </row>
1220
1221      <row>
1222       <entry><literal>character_set_schema</literal></entry>
1223       <entry><type>sql_identifier</type></entry>
1224       <entry>Applies to a feature not available in PostgreSQL</entry>
1225      </row>
1226
1227      <row>
1228       <entry><literal>character_set_name</literal></entry>
1229       <entry><type>sql_identifier</type></entry>
1230       <entry>Applies to a feature not available in PostgreSQL</entry>
1231      </row>
1232
1233      <row>
1234       <entry><literal>collation_catalog</literal></entry>
1235       <entry><type>sql_identifier</type></entry>
1236       <entry>Applies to a feature not available in PostgreSQL</entry>
1237      </row>
1238
1239      <row>
1240       <entry><literal>collation_schema</literal></entry>
1241       <entry><type>sql_identifier</type></entry>
1242       <entry>Applies to a feature not available in PostgreSQL</entry>
1243      </row>
1244
1245      <row>
1246       <entry><literal>collation_name</literal></entry>
1247       <entry><type>sql_identifier</type></entry>
1248       <entry>Applies to a feature not available in PostgreSQL</entry>
1249      </row>
1250
1251      <row>
1252       <entry><literal>numeric_precision</literal></entry>
1253       <entry><type>cardinal_number</type></entry>
1254       <entry>
1255        If the domain has a numeric type, this column contains the
1256        (declared or implicit) precision of the type for this column.
1257        The precision indicates the number of significant digits.  It
1258        may be expressed in decimal (base 10) or binary (base 2) terms,
1259        as specified in the column
1260        <literal>numeric_precision_radix</literal>.  For all other data
1261        types, this column is null.
1262       </entry>
1263      </row>
1264
1265      <row>
1266       <entry><literal>numeric_precision_radix</literal></entry>
1267       <entry><type>cardinal_number</type></entry>
1268       <entry>
1269        If the domain has a numeric type, this column indicates in
1270        which base the values in the columns
1271        <literal>numeric_precision</literal> and
1272        <literal>numeric_scale</literal> are expressed.  The value is
1273        either 2 or 10.  For all other data types, this column is null.
1274       </entry>
1275      </row>
1276
1277      <row>
1278       <entry><literal>numeric_scale</literal></entry>
1279       <entry><type>cardinal_number</type></entry>
1280       <entry>
1281        If the domain has an exact numeric type, this column contains
1282        the (declared or implicit) scale of the type for this column.
1283        The scale indicates the number of significant digits to the
1284        right of the decimal point.  It may be expressed in decimal
1285        (base 10) or binary (base 2) terms, as specified in the column
1286        <literal>numeric_precision_radix</literal>.  For all other data
1287        types, this column is null.
1288       </entry>
1289      </row>
1290
1291      <row>
1292       <entry><literal>datetime_precision</literal></entry>
1293       <entry><type>cardinal_number</type></entry>
1294       <entry>
1295        If the domain has a date, time, or interval type, the declared
1296        precision; null for all other data types or if no precision was
1297        declared.
1298       </entry>
1299      </row>
1300
1301      <row>
1302       <entry><literal>interval_type</literal></entry>
1303       <entry><type>character_data</type></entry>
1304       <entry>Not yet implemented</entry>
1305      </row>
1306
1307      <row>
1308       <entry><literal>interval_precision</literal></entry>
1309       <entry><type>character_data</type></entry>
1310       <entry>Not yet implemented</entry>
1311      </row>
1312
1313      <row>
1314       <entry><literal>domain_default</literal></entry>
1315       <entry><type>character_data</type></entry>
1316       <entry>Default expression of the domain</entry>
1317      </row>
1318
1319      <row>
1320       <entry><literal>udt_catalog</literal></entry>
1321       <entry><type>sql_identifier</type></entry>
1322       <entry>Name of the database that the domain data type is defined in (always the current database)</entry>
1323      </row>
1324
1325      <row>
1326       <entry><literal>udt_schema</literal></entry>
1327       <entry><type>sql_identifier</type></entry>
1328       <entry>Name of the schema that the domain data type is defined in</entry>
1329      </row>
1330
1331      <row>
1332       <entry><literal>udt_name</literal></entry>
1333       <entry><type>sql_identifier</type></entry>
1334       <entry>Name of the domain data type</entry>
1335      </row>
1336
1337      <row>
1338       <entry><literal>scope_catalog</literal></entry>
1339       <entry><type>sql_identifier</type></entry>
1340       <entry>Applies to a feature not available in PostgreSQL</entry>
1341      </row>
1342
1343      <row>
1344       <entry><literal>scope_schema</literal></entry>
1345       <entry><type>sql_identifier</type></entry>
1346       <entry>Applies to a feature not available in PostgreSQL</entry>
1347      </row>
1348
1349      <row>
1350       <entry><literal>scope_name</literal></entry>
1351       <entry><type>sql_identifier</type></entry>
1352       <entry>Applies to a feature not available in PostgreSQL</entry>
1353      </row>
1354
1355      <row>
1356       <entry><literal>maximum_cardinality</literal></entry>
1357       <entry><type>cardinal_number</type></entry>
1358       <entry>Always null, because arrays always have unlimited maximum cardinality in PostgreSQL</entry>
1359      </row>
1360
1361      <row>
1362       <entry><literal>dtd_identifier</literal></entry>
1363       <entry><type>sql_identifier</type></entry>
1364       <entry>
1365        An identifier of the data type descriptor of the domain, unique
1366        among the data type descriptors pertaining to the domain (which
1367        is trivial, because a domain only contains one data type
1368        descriptor).  This is mainly useful for joining with other
1369        instances of such identifiers.  (The specific format of the
1370        identifier is not defined and not guaranteed to remain the same
1371        in future versions.)
1372       </entry>
1373      </row>
1374     </tbody>
1375    </tgroup>
1376   </table>
1377  </sect1>
1378
1379  <sect1 id="infoschema-element-types">
1380   <title><literal>element_types</literal></title>
1381
1382   <para>
1383    The view <literal>element_types</literal> contains the data type
1384    descriptors of the elements of arrays.  When a table column,
1385    domain, function parameter, or function return value is defined to
1386    be of an array type, the respective information schema view only
1387    contains <literal>ARRAY</literal> in the column
1388    <literal>data_type</literal>.  To obtain information on the element
1389    type of the array, you can join the respective view with this view.
1390    For example, to show the columns of a table with data types and
1391    array element types, if applicable, you could do
1392 <programlisting>
1393 SELECT c.column_name, c.data_type, e.data_type AS element_type
1394 FROM information_schema.columns c LEFT JOIN information_schema.element_types e
1395      ON ((c.table_catalog, c.table_schema, c.table_name, 'TABLE', c.dtd_identifier)
1396        = (e.object_catalog, e.object_schema, e.object_name, e.object_type, e.array_type_identifier))
1397 WHERE c.table_schema = '...' AND c.table_name = '...'
1398 ORDER BY c.ordinal_position;
1399 </programlisting>
1400    This view only includes objects that the current user has access
1401    to, by way of being the owner or having some privilege.
1402   </para>
1403
1404   <table>
1405    <title><literal>element_types</literal> Columns</title>
1406
1407    <tgroup cols="3">
1408     <thead>
1409      <row>
1410       <entry>Name</entry>
1411       <entry>Data Type</entry>
1412       <entry>Description</entry>
1413      </row>
1414     </thead>
1415
1416     <tbody>
1417      <row>
1418       <entry><literal>object_catalog</literal></entry>
1419       <entry><type>sql_identifier</type></entry>
1420       <entry>
1421        Name of the database that contains the object that uses the
1422        array being described (always the current database)
1423       </entry>
1424      </row>
1425
1426      <row>
1427       <entry><literal>object_schema</literal</entry>
1428       <entry><type>sql_identifier</type></entry>
1429       <entry>
1430        Name of the schema that contains the object that uses the array
1431        being described
1432       </entry>
1433      </row>
1434
1435      <row>
1436       <entry><literal>object_name</literal</entry>
1437       <entry><type>sql_identifier</type></entry>
1438       <entry>
1439        Name of the object that uses the array being described
1440       </entry>
1441      </row>
1442
1443      <row>
1444       <entry><literal>object_type</literal</entry>
1445       <entry><type>character_data</type></entry>
1446       <entry>
1447        The type of the object that uses the array being descibed: one
1448        of <literal>TABLE</literal> (the array is used by a column of
1449        that table), <literal>DOMAIN</literal> (the array is used by
1450        that domain), <literal>ROUTINE</literal> (the array is used by
1451        a parameter or the return data type of that function).
1452       </entry>
1453      </row>
1454
1455      <row>
1456       <entry><literal>array_type_identifier</literal</entry>
1457       <entry><type>sql_identifier</type></entry>
1458       <entry>
1459        The identifier of the data type descriptor of the array being
1460        described.  Use this to join with the
1461        <literal>dtd_identifier</literal> columns of other information
1462        schema views.
1463       </entry>
1464      </row>
1465
1466      <row>
1467       <entry><literal>data_type</literal></entry>
1468       <entry><type>character_data</type></entry>
1469       <entry>
1470        Data type of the array elements, if it is a built-in type, else
1471        <literal>USER-DEFINED</literal> (in that case, the type is
1472        identified in <literal>udt_name</literal> and associated
1473        columns).
1474       </entry>
1475      </row>
1476
1477      <row>
1478       <entry><literal>character_maximum_length</literal></entry>
1479       <entry><type>cardinal_number</type></entry>
1480       <entry>Always null, since this information is not applied to array element data types in PostgreSQL</entry>
1481      </row>
1482
1483      <row>
1484       <entry><literal>character_octet_length</literal></entry>
1485       <entry><type>cardinal_number</type></entry>
1486       <entry>Always null, since this information is not applied to array element data types in PostgreSQL</entry>
1487      </row>
1488
1489      <row>
1490       <entry><literal>character_set_catalog</literal></entry>
1491       <entry><type>sql_identifier</type></entry>
1492       <entry>Applies to a feature not available in PostgreSQL</entry>
1493      </row>
1494
1495      <row>
1496       <entry><literal>character_set_schema</literal></entry>
1497       <entry><type>sql_identifier</type></entry>
1498       <entry>Applies to a feature not available in PostgreSQL</entry>
1499      </row>
1500
1501      <row>
1502       <entry><literal>character_set_name</literal></entry>
1503       <entry><type>sql_identifier</type></entry>
1504       <entry>Applies to a feature not available in PostgreSQL</entry>
1505      </row>
1506
1507      <row>
1508       <entry><literal>collation_catalog</literal></entry>
1509       <entry><type>sql_identifier</type></entry>
1510       <entry>Applies to a feature not available in PostgreSQL</entry>
1511      </row>
1512
1513      <row>
1514       <entry><literal>collation_schema</literal></entry>
1515       <entry><type>sql_identifier</type></entry>
1516       <entry>Applies to a feature not available in PostgreSQL</entry>
1517      </row>
1518
1519      <row>
1520       <entry><literal>collation_name</literal></entry>
1521       <entry><type>sql_identifier</type></entry>
1522       <entry>Applies to a feature not available in PostgreSQL</entry>
1523      </row>
1524
1525      <row>
1526       <entry><literal>numeric_precision</literal></entry>
1527       <entry><type>cardinal_number</type></entry>
1528       <entry>Always null, since this information is not applied to array element data types in PostgreSQL</entry>
1529      </row>
1530
1531      <row>
1532       <entry><literal>numeric_precision_radix</literal></entry>
1533       <entry><type>cardinal_number</type></entry>
1534       <entry>Always null, since this information is not applied to array element data types in PostgreSQL</entry>
1535      </row>
1536
1537      <row>
1538       <entry><literal>numeric_scale</literal></entry>
1539       <entry><type>cardinal_number</type></entry>
1540       <entry>Always null, since this information is not applied to array element data types in PostgreSQL</entry>
1541      </row>
1542
1543      <row>
1544       <entry><literal>datetime_precision</literal></entry>
1545       <entry><type>cardinal_number</type></entry>
1546       <entry>Always null, since this information is not applied to array element data types in PostgreSQL</entry>
1547      </row>
1548
1549      <row>
1550       <entry><literal>interval_type</literal></entry>
1551       <entry><type>character_data</type></entry>
1552       <entry>Always null, since this information is not applied to array element data types in PostgreSQL</entry>
1553      </row>
1554
1555      <row>
1556       <entry><literal>interval_precision</literal></entry>
1557       <entry><type>character_data</type></entry>
1558       <entry>Always null, since this information is not applied to array element data types in PostgreSQL</entry>
1559      </row>
1560
1561      <row>
1562       <entry><literal>domain_default</literal></entry>
1563       <entry><type>character_data</type></entry>
1564       <entry>Not yet implemented</entry>
1565      </row>
1566
1567      <row>
1568       <entry><literal>udt_catalog</literal></entry>
1569       <entry><type>sql_identifier</type></entry>
1570       <entry>
1571        Name of the database that the data type of the elements is
1572        defined in (always the current database)
1573       </entry>
1574      </row>
1575
1576      <row>
1577       <entry><literal>udt_schema</literal></entry>
1578       <entry><type>sql_identifier</type></entry>
1579       <entry>
1580        Name of the schema that the data type of the elements is
1581        defined in
1582       </entry>
1583      </row>
1584
1585      <row>
1586       <entry><literal>udt_name</literal></entry>
1587       <entry><type>sql_identifier</type></entry>
1588       <entry>
1589        Name of the data type of the elements
1590       </entry>
1591      </row>
1592
1593      <row>
1594       <entry><literal>scope_catalog</literal></entry>
1595       <entry><type>sql_identifier</type></entry>
1596       <entry>Applies to a feature not available in PostgreSQL</entry>
1597      </row>
1598
1599      <row>
1600       <entry><literal>scope_schema</literal></entry>
1601       <entry><type>sql_identifier</type></entry>
1602       <entry>Applies to a feature not available in PostgreSQL</entry>
1603      </row>
1604
1605      <row>
1606       <entry><literal>scope_name</literal></entry>
1607       <entry><type>sql_identifier</type></entry>
1608       <entry>Applies to a feature not available in PostgreSQL</entry>
1609      </row>
1610
1611      <row>
1612       <entry><literal>maximum_cardinality</literal></entry>
1613       <entry><type>cardinal_number</type></entry>
1614       <entry>Always null, because arrays always have unlimited maximum cardinality in PostgreSQL</entry>
1615      </row>
1616
1617      <row>
1618       <entry><literal>dtd_identifier</literal></entry>
1619       <entry><type>sql_identifier</type></entry>
1620       <entry>
1621        An identifier of the data type descriptor of the element.  This
1622        is currently not useful.
1623       </entry>
1624      </row>
1625     </tbody>
1626    </tgroup>
1627   </table>
1628  </sect1>
1629
1630  <sect1 id="infoschema-key-column-usage">
1631   <title><literal>key_column_usage</literal></title>
1632
1633   <para>
1634    The view <literal>key_column_usage</literal> identifies all columns
1635    in the current database that are restricted by some unique, primary
1636    key, or foreign key constraint.  Check constraints are not included
1637    in this view.  Only those columns are shown that are contained in a
1638    table owned the current user.
1639   </para>
1640
1641   <table>
1642    <title><literal>key_column_usage</literal> Columns</title>
1643
1644    <tgroup cols="3">
1645     <thead>
1646      <row>
1647       <entry>Name</entry>
1648       <entry>Data Type</entry>
1649       <entry>Description</entry>
1650      </row>
1651     </thead>
1652
1653     <tbody>
1654      <row>
1655       <entry><literal>constraint_catalog</literal></entry>
1656       <entry><type>sql_identifier</type></entry>
1657       <entry>Name of the database that contains the constraint (always the current database)</entry>
1658      </row>
1659
1660      <row>
1661       <entry><literal>constraint_schema</literal</entry>
1662       <entry><type>sql_identifier</type></entry>
1663       <entry>Name of the schema that contains the constraint</entry>
1664      </row>
1665
1666      <row>
1667       <entry><literal>constraint_name</literal</entry>
1668       <entry><type>sql_identifier</type></entry>
1669       <entry>Name of the constraint</entry>
1670      </row>
1671
1672      <row>
1673       <entry><literal>table_catalog</literal></entry>
1674       <entry><type>sql_identifier</type></entry>
1675       <entry>
1676        Name of the database that contains the table that contains the
1677        column that is restricted by some constraint (always the
1678        current database)
1679       </entry>
1680      </row>
1681
1682      <row>
1683       <entry><literal>table_schema</literal</entry>
1684       <entry><type>sql_identifier</type></entry>
1685       <entry>
1686        Name of the schema that contains the table that contains the
1687        column that is restricted by some constraint
1688       </entry>
1689      </row>
1690
1691      <row>
1692       <entry><literal>table_name</literal</entry>
1693       <entry><type>sql_identifier</type></entry>
1694       <entry>
1695        Name of the table that contains the column that is restricted
1696        by some constraint
1697       </entry>
1698      </row>
1699
1700      <row>
1701       <entry><literal>column_name</literal</entry>
1702       <entry><type>sql_identifier</type></entry>
1703       <entry>
1704        Name of the column that is restricted by some constraint
1705       </entry>
1706      </row>
1707
1708      <row>
1709       <entry><literal>ordinal_position</literal</entry>
1710       <entry><type>cardinal_number</type></entry>
1711       <entry>
1712        Ordinal position of the column within the constraint key (count
1713        starts at 1)
1714       </entry>
1715      </row>
1716     </tbody>
1717    </tgroup>
1718   </table>
1719  </sect1>
1720
1721  <sect1 id="infoschema-parameters">
1722   <title><literal>parameters</literal></title>
1723
1724   <para>
1725    The view <literal>parameters</literal> contains information about
1726    the parameters (arguments) all functions in the current database.
1727    Only those functions are shown that the current user has access to
1728    (by way of being the owner or having some privilege).
1729   </para>
1730
1731   <table>
1732    <title><literal>parameters</literal> Columns</title>
1733
1734    <tgroup cols="3">
1735     <thead>
1736      <row>
1737       <entry>Name</entry>
1738       <entry>Data Type</entry>
1739       <entry>Description</entry>
1740      </row>
1741     </thead>
1742
1743     <tbody>
1744      <row>
1745       <entry><literal>specific_catalog</literal></entry>
1746       <entry><type>sql_identifier</type></entry>
1747       <entry>Name of the database containing the function (always the current database)</entry>
1748      </row>
1749
1750      <row>
1751       <entry><literal>specific_schema</literal></entry>
1752       <entry><type>sql_identifier</type></entry>
1753       <entry>Name of the schema containing the function</entry>
1754      </row>
1755
1756      <row>
1757       <entry><literal>specific_name</literal></entry>
1758       <entry><type>sql_identifier</type></entry>
1759       <entry>
1760        The <quote>specific name</quote> of the function.  See <xref
1761        linkend="infoschema-routines"> for more information.
1762       </entry>
1763      </row>
1764
1765      <row>
1766       <entry><literal>ordinal_position</literal></entry>
1767       <entry><type>cardinal_number</type></entry>
1768       <entry>
1769        Ordinal position of the parameter in the argument list of the
1770        function (count starts at 1)
1771       </entry>
1772      </row>
1773
1774      <row>
1775       <entry><literal>parameter_mode</literal></entry>
1776       <entry><type>character_data</type></entry>
1777       <entry>
1778        Always <literal>IN</literal>, meaning input parameter (In the
1779        future there might be other parameter modes.)
1780       </entry>
1781      </row>
1782
1783      <row>
1784       <entry><literal>is_result</literal></entry>
1785       <entry><type>character_data</type></entry>
1786       <entry>Applies to a feature not available in PostgreSQL</entry>
1787      </row>
1788
1789      <row>
1790       <entry><literal>as_locator</literal></entry>
1791       <entry><type>character_data</type></entry>
1792       <entry>Applies to a feature not available in PostgreSQL</entry>
1793      </row>
1794
1795      <row>
1796       <entry><literal>parameter_name</literal></entry>
1797       <entry><type>sql_identifier</type></entry>
1798       <entry>Always null, since PostgreSQL does not support named parameters</entry>
1799      </row>
1800
1801      <row>
1802       <entry><literal>data_type</literal></entry>
1803       <entry><type>character_data</type></entry>
1804       <entry>
1805        Data type of the parameter, if it is a built-in type, or
1806        <literal>ARRAY</literal> if it is some array (in that case, see
1807        the view <literal>element_types</literal>), else
1808        <literal>USER-DEFINED</literal> (in that case, the type is
1809        identified in <literal>udt_name</literal> and associated
1810        columns).
1811       </entry>
1812      </row>
1813
1814      <row>
1815       <entry><literal>character_maximum_length</literal></entry>
1816       <entry><type>cardinal_number</type></entry>
1817       <entry>Always null, since this information is not applied to parameter data types in PostgreSQL</entry>
1818      </row>
1819
1820      <row>
1821       <entry><literal>character_octet_length</literal></entry>
1822       <entry><type>cardinal_number</type></entry>
1823       <entry>Always null, since this information is not applied to parameter data types in PostgreSQL</entry>
1824      </row>
1825
1826      <row>
1827       <entry><literal>character_set_catalog</literal></entry>
1828       <entry><type>sql_identifier</type></entry>
1829       <entry>Applies to a feature not available in PostgreSQL</entry>
1830      </row>
1831
1832      <row>
1833       <entry><literal>character_set_schema</literal></entry>
1834       <entry><type>sql_identifier</type></entry>
1835       <entry>Applies to a feature not available in PostgreSQL</entry>
1836      </row>
1837
1838      <row>
1839       <entry><literal>character_set_name</literal></entry>
1840       <entry><type>sql_identifier</type></entry>
1841       <entry>Applies to a feature not available in PostgreSQL</entry>
1842      </row>
1843
1844      <row>
1845       <entry><literal>collation_catalog</literal></entry>
1846       <entry><type>sql_identifier</type></entry>
1847       <entry>Applies to a feature not available in PostgreSQL</entry>
1848      </row>
1849
1850      <row>
1851       <entry><literal>collation_schema</literal></entry>
1852       <entry><type>sql_identifier</type></entry>
1853       <entry>Applies to a feature not available in PostgreSQL</entry>
1854      </row>
1855
1856      <row>
1857       <entry><literal>collation_name</literal></entry>
1858       <entry><type>sql_identifier</type></entry>
1859       <entry>Applies to a feature not available in PostgreSQL</entry>
1860      </row>
1861
1862      <row>
1863       <entry><literal>numeric_precision</literal></entry>
1864       <entry><type>cardinal_number</type></entry>
1865       <entry>Always null, since this information is not applied to parameter data types in PostgreSQL</entry>
1866      </row>
1867
1868      <row>
1869       <entry><literal>numeric_precision_radix</literal></entry>
1870       <entry><type>cardinal_number</type></entry>
1871       <entry>Always null, since this information is not applied to parameter data types in PostgreSQL</entry>
1872      </row>
1873
1874      <row>
1875       <entry><literal>numeric_scale</literal></entry>
1876       <entry><type>cardinal_number</type></entry>
1877       <entry>Always null, since this information is not applied to parameter data types in PostgreSQL</entry>
1878      </row>
1879
1880      <row>
1881       <entry><literal>datetime_precision</literal></entry>
1882       <entry><type>cardinal_number</type></entry>
1883       <entry>Always null, since this information is not applied to parameter data types in PostgreSQL</entry>
1884      </row>
1885
1886      <row>
1887       <entry><literal>interval_type</literal></entry>
1888       <entry><type>character_data</type></entry>
1889       <entry>Always null, since this information is not applied to parameter data types in PostgreSQL</entry>
1890      </row>
1891
1892      <row>
1893       <entry><literal>interval_precision</literal></entry>
1894       <entry><type>character_data</type></entry>
1895       <entry>Always null, since this information is not applied to parameter data types in PostgreSQL</entry>
1896      </row>
1897
1898      <row>
1899       <entry><literal>udt_catalog</literal></entry>
1900       <entry><type>sql_identifier</type></entry>
1901       <entry>
1902        Name of the database that the data type of the parameter is
1903        defined in (always the current database)
1904       </entry>
1905      </row>
1906
1907      <row>
1908       <entry><literal>udt_schema</literal></entry>
1909       <entry><type>sql_identifier</type></entry>
1910       <entry>
1911        Name of the schema that the data type of the parameter is
1912        defined in
1913       </entry>
1914      </row>
1915
1916      <row>
1917       <entry><literal>udt_name</literal></entry>
1918       <entry><type>sql_identifier</type></entry>
1919       <entry>
1920        Name of the data type of the parameter
1921       </entry>
1922      </row>
1923
1924      <row>
1925       <entry><literal>scope_catalog</literal></entry>
1926       <entry><type>sql_identifier</type></entry>
1927       <entry>Applies to a feature not available in PostgreSQL</entry>
1928      </row>
1929
1930      <row>
1931       <entry><literal>scope_schema</literal></entry>
1932       <entry><type>sql_identifier</type></entry>
1933       <entry>Applies to a feature not available in PostgreSQL</entry>
1934      </row>
1935
1936      <row>
1937       <entry><literal>scope_name</literal></entry>
1938       <entry><type>sql_identifier</type></entry>
1939       <entry>Applies to a feature not available in PostgreSQL</entry>
1940      </row>
1941
1942      <row>
1943       <entry><literal>maximum_cardinality</literal></entry>
1944       <entry><type>cardinal_number</type></entry>
1945       <entry>Always null, because arrays always have unlimited maximum cardinality in PostgreSQL</entry>
1946      </row>
1947
1948      <row>
1949       <entry><literal>dtd_identifier</literal></entry>
1950       <entry><type>sql_identifier</type></entry>
1951       <entry>
1952        An identifier of the data type descriptor of the parameter,
1953        unique among the data type descriptors pertaining to the
1954        function.  This is mainly useful for joining with other
1955        instances of such identifiers.  (The specific format of the
1956        identifier is not defined and not guaranteed to remain the same
1957        in future versions.)
1958       </entry>
1959      </row>
1960     </tbody>
1961    </tgroup>
1962   </table>
1963  </sect1>
1964
1965  <sect1 id="infoschema-referential-constraints">
1966   <title><literal>referential_constraints</literal></title>
1967
1968   <para>
1969    The view <literal>referential_constraints</literal> contains all
1970    referential (foreign key) constraints in the current database that
1971    belong to a table owned by the current user.
1972   </para>
1973
1974   <table>
1975    <title><literal>referential_constraints</literal> Columns</title>
1976
1977    <tgroup cols="3">
1978     <thead>
1979      <row>
1980       <entry>Name</entry>
1981       <entry>Data Type</entry>
1982       <entry>Description</entry>
1983      </row>
1984     </thead>
1985
1986     <tbody>
1987      <row>
1988       <entry><literal>constraint_catalog</literal></entry>
1989       <entry><literal>sql_identifier</literal></entry>
1990       <entry>Name of the database containing the constraint (always the current database)</entry>
1991      </row>
1992
1993      <row>
1994       <entry><literal>constraint_schema</literal></entry>
1995       <entry><literal>sql_identifier</literal></entry>
1996       <entry>Name of the schema containing the constraint</entry>
1997      </row>
1998
1999      <row>
2000       <entry><literal>constraint_name</literal></entry>
2001       <entry><literal>sql_identifier</literal></entry>
2002       <entry>Name of the constraint</entry>
2003      </row>
2004
2005      <row>
2006       <entry><literal>unique_constraint_catalog</literal></entry>
2007       <entry><literal>sql_identifier</literal></entry>
2008       <entry>
2009        Name of the database that contains the unique or primary key
2010        constraint that the foreign key constraint references (always
2011        the current database)
2012       </entry>
2013      </row>
2014
2015      <row>
2016       <entry><literal>unique_constraint_schema</literal></entry>
2017       <entry><literal>sql_identifier</literal></entry>
2018       <entry>
2019        Name of the schema that contains the unique or primary key
2020        constraint that the foreign key constraint references
2021       </entry>
2022      </row>
2023
2024      <row>
2025       <entry><literal>unique_constraint_name</literal></entry>
2026       <entry><literal>sql_identifier</literal></entry>
2027       <entry>
2028        Name of the unique or primary key constraint that the foreign
2029        key constraint references
2030       </entry>
2031      </row>
2032
2033      <row>
2034       <entry><literal>match_option</literal></entry>
2035       <entry><literal>character_data</literal></entry>
2036       <entry>
2037        Match option of the foreign key constraint:
2038        <literal>FULL</literal>, <literal>PARTIAL</literal>, or
2039        <literal>NONE</literal>.
2040       </entry>
2041      </row>
2042
2043      <row>
2044       <entry><literal>update_rule</literal></entry>
2045       <entry><literal>character_data</literal></entry>
2046       <entry>
2047        Update rule of the foreign key constraint:
2048        <literal>CASCADE</literal>, <literal>SET NULL</literal>,
2049        <literal>SET DEFAULT</literal>, <literal>RESTRICT</literal>,or
2050        <literal>NO ACTION</literal>.
2051       </entry>
2052      </row>
2053
2054      <row>
2055       <entry><literal>delete_rule</literal></entry>
2056       <entry><literal>character_data</literal></entry>
2057       <entry>
2058        Delete rule of the foreign key constraint:
2059        <literal>CASCADE</literal>, <literal>SET NULL</literal>,
2060        <literal>SET DEFAULT</literal>, <literal>RESTRICT</literal>,or
2061        <literal>NO ACTION</literal>.
2062       </entry>
2063      </row>
2064     </tbody>
2065    </tgroup>
2066   </table>
2067  </sect1>
2068
2069  <sect1 id="infoschema-routine-privileges">
2070   <title><literal>routine_privileges</literal></title>
2071
2072   <para>
2073    The view <literal>routine_privileges</literal> identifies all
2074    privileges granted on functions to the current user or by the
2075    current user.  There is one row for each combination of function,
2076    grantor, and grantee.
2077   </para>
2078
2079   <table>
2080    <title><literal>routine_privileges</literal> Columns</title>
2081
2082    <tgroup cols="3">
2083     <thead>
2084      <row>
2085       <entry>Name</entry>
2086       <entry>Data Type</entry>
2087       <entry>Description</entry>
2088      </row>
2089     </thead>
2090
2091     <tbody>
2092      <row>
2093       <entry><literal>grantor</literal></entry>
2094       <entry><type>sql_identifier</type></entry>
2095       <entry>Name of the user that granted the privilege</entry>
2096      </row>
2097
2098      <row>
2099       <entry><literal>grantee</literal</entry>
2100       <entry><type>sql_identifier</type></entry>
2101       <entry>Name of the user that the privilege was granted to</entry>
2102      </row>
2103
2104      <row>
2105       <entry><literal>specific_catalog</literal></entry>
2106       <entry><type>sql_identifier</type></entry>
2107       <entry>Name of the database containing the function (always the current database)</entry>
2108      </row>
2109
2110      <row>
2111       <entry><literal>specific_schema</literal></entry>
2112       <entry><type>sql_identifier</type></entry>
2113       <entry>Name of the schema containing the function</entry>
2114      </row>
2115
2116      <row>
2117       <entry><literal>specific_name</literal></entry>
2118       <entry><type>sql_identifier</type></entry>
2119       <entry>
2120        The <quote>specific name</quote> of the function.  See <xref
2121        linkend="infoschema-routines"> for more information.
2122       </entry>
2123      </row>
2124
2125      <row>
2126       <entry><literal>routine_catalog</literal></entry>
2127       <entry><type>sql_identifier</type></entry>
2128       <entry>Name of the database containing the function (always the current database)</entry>
2129      </row>
2130
2131      <row>
2132       <entry><literal>routine_schema</literal></entry>
2133       <entry><type>sql_identifier</type></entry>
2134       <entry>Name of the schema containing the function</entry>
2135      </row>
2136
2137      <row>
2138       <entry><literal>routine_name</literal></entry>
2139       <entry><type>sql_identifier</type></entry>
2140       <entry>Name of the function (may be duplicated in case of overloading)</entry>
2141      </row>
2142
2143      <row>
2144       <entry><literal>privilege_type</literal</entry>
2145       <entry><type>character_data</type></entry>
2146       <entry>Always <literal>EXECUTE</literal> (the only privilege type for functions)</entry>
2147      </row>
2148
2149      <row>
2150       <entry><literal>is_grantable</literal></entry>
2151       <entry><type>character_data</type></entry>
2152       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
2153      </row>
2154     </tbody>
2155    </tgroup>
2156   </table>
2157  </sect1>
2158
2159  <sect1 id="infoschema-routines">
2160   <title><literal>routines</literal></title>
2161
2162   <para>
2163    The view <literal>routines</literal> contains all functions in the
2164    current database.  Only those functions are shown that the current
2165    user has access to (by way of being the owner or having some
2166    privilege).
2167   </para>
2168
2169   <table>
2170    <title><literal>routines</literal> Columns</title>
2171
2172    <tgroup cols="3">
2173     <thead>
2174      <row>
2175       <entry>Name</entry>
2176       <entry>Data Type</entry>
2177       <entry>Description</entry>
2178      </row>
2179     </thead>
2180
2181     <tbody>
2182      <row>
2183       <entry><literal>specific_catalog</literal></entry>
2184       <entry><type>sql_identifier</type></entry>
2185       <entry>Name of the database containing the function (always the current database)</entry>
2186      </row>
2187
2188      <row>
2189       <entry><literal>specific_schema</literal></entry>
2190       <entry><type>sql_identifier</type></entry>
2191       <entry>Name of the schema containing the function</entry>
2192      </row>
2193
2194      <row>
2195       <entry><literal>specific_name</literal></entry>
2196       <entry><type>sql_identifier</type></entry>
2197       <entry>
2198        The <quote>specific name</quote> of the function.  This is a
2199        name that uniquely identifies the function in the schema, even
2200        if the real name of the function is overloaded.  The format of
2201        the specific name is not defined, it should only be used to
2202        compare it to other instances of specific routine names.
2203       </entry>
2204      </row>
2205
2206      <row>
2207       <entry><literal>routine_catalog</literal></entry>
2208       <entry><type>sql_identifier</type></entry>
2209       <entry>Name of the database containing the function (always the current database)</entry>
2210      </row>
2211
2212      <row>
2213       <entry><literal>routine_schema</literal></entry>
2214       <entry><type>sql_identifier</type></entry>
2215       <entry>Name of the schema containing the function</entry>
2216      </row>
2217
2218      <row>
2219       <entry><literal>routine_name</literal></entry>
2220       <entry><type>sql_identifier</type></entry>
2221       <entry>Name of the function (may be duplicated in case of overloading)</entry>
2222      </row>
2223
2224      <row>
2225       <entry><literal>routine_type</literal></entry>
2226       <entry><type>character_data</type></entry>
2227       <entry>
2228        Always <literal>FUNCTION</literal> (In the future there might
2229        be other types of routines.)
2230       </entry>
2231      </row>
2232
2233      <row>
2234       <entry><literal>module_catalog</literal></entry>
2235       <entry><type>sql_identifier</type></entry>
2236       <entry>Applies to a feature not available in PostgreSQL</entry>
2237      </row>
2238
2239      <row>
2240       <entry><literal>module_schema</literal></entry>
2241       <entry><type>sql_identifier</type></entry>
2242       <entry>Applies to a feature not available in PostgreSQL</entry>
2243      </row>
2244
2245      <row>
2246       <entry><literal>module_name</literal></entry>
2247       <entry><type>sql_identifier</type></entry>
2248       <entry>Applies to a feature not available in PostgreSQL</entry>
2249      </row>
2250
2251      <row>
2252       <entry><literal>udt_catalog</literal></entry>
2253       <entry><type>sql_identifier</type></entry>
2254       <entry>Applies to a feature not available in PostgreSQL</entry>
2255      </row>
2256
2257      <row>
2258       <entry><literal>udt_schema</literal></entry>
2259       <entry><type>sql_identifier</type></entry>
2260       <entry>Applies to a feature not available in PostgreSQL</entry>
2261      </row>
2262
2263      <row>
2264       <entry><literal>udt_name</literal></entry>
2265       <entry><type>sql_identifier</type></entry>
2266       <entry>Applies to a feature not available in PostgreSQL</entry>
2267      </row>
2268
2269      <row>
2270       <entry><literal>data_type</literal></entry>
2271       <entry><type>character_data</type></entry>
2272       <entry>
2273        Return data type of the function, if it is a built-in type, or
2274        <literal>ARRAY</literal> if it is some array (in that case, see
2275        the view <literal>element_types</literal>), else
2276        <literal>USER-DEFINED</literal> (in that case, the type is
2277        identified in <literal>type_udt_name</literal> and associated
2278        columns).
2279       </entry>
2280      </row>
2281
2282      <row>
2283       <entry><literal>character_maximum_length</literal></entry>
2284       <entry><type>cardinal_number</type></entry>
2285       <entry>Always null, since this information is not applied to return data types in PostgreSQL</entry>
2286      </row>
2287
2288      <row>
2289       <entry><literal>character_octet_length</literal></entry>
2290       <entry><type>cardinal_number</type></entry>
2291       <entry>Always null, since this information is not applied to return data types in PostgreSQL</entry>
2292      </row>
2293
2294      <row>
2295       <entry><literal>character_set_catalog</literal></entry>
2296       <entry><type>sql_identifier</type></entry>
2297       <entry>Applies to a feature not available in PostgreSQL</entry>
2298      </row>
2299
2300      <row>
2301       <entry><literal>character_set_schema</literal></entry>
2302       <entry><type>sql_identifier</type></entry>
2303       <entry>Applies to a feature not available in PostgreSQL</entry>
2304      </row>
2305
2306      <row>
2307       <entry><literal>character_set_name</literal></entry>
2308       <entry><type>sql_identifier</type></entry>
2309       <entry>Applies to a feature not available in PostgreSQL</entry>
2310      </row>
2311
2312      <row>
2313       <entry><literal>collation_catalog</literal></entry>
2314       <entry><type>sql_identifier</type></entry>
2315       <entry>Applies to a feature not available in PostgreSQL</entry>
2316      </row>
2317
2318      <row>
2319       <entry><literal>collation_schema</literal></entry>
2320       <entry><type>sql_identifier</type></entry>
2321       <entry>Applies to a feature not available in PostgreSQL</entry>
2322      </row>
2323
2324      <row>
2325       <entry><literal>collation_name</literal></entry>
2326       <entry><type>sql_identifier</type></entry>
2327       <entry>Applies to a feature not available in PostgreSQL</entry>
2328      </row>
2329
2330      <row>
2331       <entry><literal>numeric_precision</literal></entry>
2332       <entry><type>cardinal_number</type></entry>
2333       <entry>Always null, since this information is not applied to return data types in PostgreSQL</entry>
2334      </row>
2335
2336      <row>
2337       <entry><literal>numeric_precision_radix</literal></entry>
2338       <entry><type>cardinal_number</type></entry>
2339       <entry>Always null, since this information is not applied to return data types in PostgreSQL</entry>
2340      </row>
2341
2342      <row>
2343       <entry><literal>numeric_scale</literal></entry>
2344       <entry><type>cardinal_number</type></entry>
2345       <entry>Always null, since this information is not applied to return data types in PostgreSQL</entry>
2346      </row>
2347
2348      <row>
2349       <entry><literal>datetime_precision</literal></entry>
2350       <entry><type>cardinal_number</type></entry>
2351       <entry>Always null, since this information is not applied to return data types in PostgreSQL</entry>
2352      </row>
2353
2354      <row>
2355       <entry><literal>interval_type</literal></entry>
2356       <entry><type>character_data</type></entry>
2357       <entry>Always null, since this information is not applied to return data types in PostgreSQL</entry>
2358      </row>
2359
2360      <row>
2361       <entry><literal>interval_precision</literal></entry>
2362       <entry><type>character_data</type></entry>
2363       <entry>Always null, since this information is not applied to return data types in PostgreSQL</entry>
2364      </row>
2365
2366      <row>
2367       <entry><literal>type_udt_catalog</literal></entry>
2368       <entry><type>sql_identifier</type></entry>
2369       <entry>
2370        Name of the database that the return data type of the function
2371        is defined in (always the current database)
2372       </entry>
2373      </row>
2374
2375      <row>
2376       <entry><literal>type_udt_schema</literal></entry>
2377       <entry><type>sql_identifier</type></entry>
2378       <entry>
2379        Name of the schema that the return data type of the function is
2380        defined in
2381       </entry>
2382      </row>
2383
2384      <row>
2385       <entry><literal>type_udt_name</literal></entry>
2386       <entry><type>sql_identifier</type></entry>
2387       <entry>
2388        Name of the return data type of the function
2389       </entry>
2390      </row>
2391
2392      <row>
2393       <entry><literal>scope_catalog</literal></entry>
2394       <entry><type>sql_identifier</type></entry>
2395       <entry>Applies to a feature not available in PostgreSQL</entry>
2396      </row>
2397
2398      <row>
2399       <entry><literal>scope_schema</literal></entry>
2400       <entry><type>sql_identifier</type></entry>
2401       <entry>Applies to a feature not available in PostgreSQL</entry>
2402      </row>
2403
2404      <row>
2405       <entry><literal>scope_name</literal></entry>
2406       <entry><type>sql_identifier</type></entry>
2407       <entry>Applies to a feature not available in PostgreSQL</entry>
2408      </row>
2409
2410      <row>
2411       <entry><literal>maximum_cardinality</literal></entry>
2412       <entry><type>cardinal_number</type></entry>
2413       <entry>Always null, because arrays always have unlimited maximum cardinality in PostgreSQL</entry>
2414      </row>
2415
2416      <row>
2417       <entry><literal>dtd_identifier</literal></entry>
2418       <entry><type>sql_identifier</type></entry>
2419       <entry>
2420        An identifier of the data type descriptor of the return data
2421        type of this function, unique among the data type descriptors
2422        pertaining to the function.  This is mainly useful for joining
2423        with other instances of such identifiers.  (The specific format
2424        of the identifier is not defined and not guaranteed to remain
2425        the same in future versions.)
2426       </entry>
2427      </row>
2428
2429      <row>
2430       <entry><literal>routine_body</literal></entry>
2431       <entry><type>character_data</type></entry>
2432       <entry>
2433        If the function is an SQL function, then
2434        <literal>SQL</literal>, else <literal>EXTERNAL</literal>.
2435       </entry>
2436      </row>
2437
2438      <row>
2439       <entry><literal>routine_definition</literal></entry>
2440       <entry><type>character_data</type></entry>
2441       <entry>
2442        The source text of the function (null if the current user is
2443        not the owner of the function).  (According to the SQL
2444        standard, this column is only applicable if
2445        <literal>routine_body</literal> is <literal>SQL</literal>, but
2446        in PostgreSQL it will contain whatever source text was
2447        specified when the function was created.)
2448       </entry>
2449      </row>
2450
2451      <row>
2452       <entry><literal>external_name</literal></entry>
2453       <entry><type>character_data</type></entry>
2454       <entry>
2455        If this function is a C function, then the external name (link
2456        symbol) of the function; else null.  (This works out to be the
2457        same value that is shown in
2458        <literal>routine_definition</literal>.)
2459       </entry>
2460      </row>
2461
2462      <row>
2463       <entry><literal>external_language</literal></entry>
2464       <entry><type>character_data</type></entry>
2465       <entry>The language the function is written in</entry>
2466      </row>
2467
2468      <row>
2469       <entry><literal>parameter_style</literal></entry>
2470       <entry><type>character_data</type></entry>
2471       <entry>
2472        Always <literal>GENERAL</literal> (The SQL standard defines
2473        other parameter styles, which are not available in PostgreSQL.)
2474       </entry>
2475      </row>
2476
2477      <row>
2478       <entry><literal>is_deterministic</literal></entry>
2479       <entry><type>character_data</type></entry>
2480       <entry>
2481        If the function is declared immutable (called deterministic in
2482        the SQL standard), then <literal>YES</literal>, else
2483        <literal>NO</literal>.  (You cannot query the other volatility
2484        levels available in PostgreSQL through the information schema.)
2485       </entry>
2486      </row>
2487
2488      <row>
2489       <entry><literal>sql_data_access</literal></entry>
2490       <entry><type>character_data</type></entry>
2491       <entry>
2492        Always <literal>MODIFIES</literal>, meaning that the function
2493        possibly modifies SQL data.  This information is not useful for
2494        PostgreSQL.
2495       </entry>
2496      </row>
2497
2498      <row>
2499       <entry><literal>is_null_call</literal></entry>
2500       <entry><type>character_data</type></entry>
2501       <entry>
2502        If the function automatically returns null if any of its
2503        arguments are null, then <literal>YES</literal>, else
2504        <literal>NO</literal>.
2505       </entry>
2506      </row>
2507
2508      <row>
2509       <entry><literal>sql_path</literal></entry>
2510       <entry><type>character_data</type></entry>
2511       <entry>Applies to a feature not available in PostgreSQL</entry>
2512      </row>
2513
2514      <row>
2515       <entry><literal>schema_level_routine</literal></entry>
2516       <entry><type>character_data</type></entry>
2517       <entry>
2518        Always <literal>YES</literal> (The opposite would be a method
2519        of a user-defined type, which is a feature not available in
2520        PostgreSQL.)
2521       </entry>
2522      </row>
2523
2524      <row>
2525       <entry><literal>max_dynamic_result_sets</literal></entry>
2526       <entry><type>cardinal_number</type></entry>
2527       <entry>Applies to a feature not available in PostgreSQL</entry>
2528      </row>
2529
2530      <row>
2531       <entry><literal>is_user_defined_cast</literal></entry>
2532       <entry><type>character_data</type></entry>
2533       <entry>Applies to a feature not available in PostgreSQL</entry>
2534      </row>
2535
2536      <row>
2537       <entry><literal>is_implicitly_invocable</literal></entry>
2538       <entry><type>character_data</type></entry>
2539       <entry>Applies to a feature not available in PostgreSQL</entry>
2540      </row>
2541
2542      <row>
2543       <entry><literal>security_type</literal></entry>
2544       <entry><type>character_data</type></entry>
2545       <entry>
2546        If the function runs with the privileges of the current user,
2547        then <literal>INVOKER</literal>, if the function runs with the
2548        privileges of the user who defined it, then
2549        <literal>DEFINER</literal>.
2550       </entry>
2551      </row>
2552
2553      <row>
2554       <entry><literal>to_sql_specific_catalog</literal></entry>
2555       <entry><type>sql_identifier</type></entry>
2556       <entry>Applies to a feature not available in PostgreSQL</entry>
2557      </row>
2558
2559      <row>
2560       <entry><literal>to_sql_specific_schema</literal></entry>
2561       <entry><type>sql_identifier</type></entry>
2562       <entry>Applies to a feature not available in PostgreSQL</entry>
2563      </row>
2564
2565      <row>
2566       <entry><literal>to_sql_specific_name</literal></entry>
2567       <entry><type>sql_identifier</type></entry>
2568       <entry>Applies to a feature not available in PostgreSQL</entry>
2569      </row>
2570
2571      <row>
2572       <entry><literal>as_locator</literal></entry>
2573       <entry><type>character_data</type></entry>
2574       <entry>Applies to a feature not available in PostgreSQL</entry>
2575      </row>
2576     </tbody>
2577    </tgroup>
2578   </table>
2579  </sect1>
2580
2581  <sect1 id="infoschema-schemata">
2582   <title><literal>schemata</literal></title>
2583
2584   <para>
2585    The view <literal>schemata</literal> contains all schemas in the
2586    current database that are owned by the current user.
2587   </para>
2588
2589   <table>
2590    <title><literal>schemata</literal> Columns</title>
2591
2592    <tgroup cols="3">
2593     <thead>
2594      <row>
2595       <entry>Name</entry>
2596       <entry>Data Type</entry>
2597       <entry>Description</entry>
2598      </row>
2599     </thead>
2600
2601     <tbody>
2602      <row>
2603       <entry><literal>catalog_name</literal></entry>
2604       <entry><type>sql_identifier</type></entry>
2605       <entry>Name of the database that the schema is contained in (always the current database)</entry>
2606      </row>
2607
2608      <row>
2609       <entry><literal>schema_name</literal></entry>
2610       <entry><type>sql_identifier</type></entry>
2611       <entry>Name of the schema</entry>
2612      </row>
2613
2614      <row>
2615       <entry><literal>schema_owner</literal></entry>
2616       <entry><type>sql_identifier</type></entry>
2617       <entry>Name of the owner of the schema</entry>
2618      </row>
2619
2620      <row>
2621       <entry><literal>default_character_set_catalog</literal></entry>
2622       <entry><type>sql_identifier</type></entry>
2623       <entry>Applies to a feature not available in PostgreSQL</entry>
2624      </row>
2625
2626      <row>
2627       <entry><literal>default_character_set_schema</literal></entry>
2628       <entry><type>sql_identifier</type></entry>
2629       <entry>Applies to a feature not available in PostgreSQL</entry>
2630      </row>
2631
2632      <row>
2633       <entry><literal>default_character_set_name</literal></entry>
2634       <entry><type>sql_identifier</type></entry>
2635       <entry>Applies to a feature not available in PostgreSQL</entry>
2636      </row>
2637
2638      <row>
2639       <entry><literal>sql_path</literal></entry>
2640       <entry><type>character_data</type></entry>
2641       <entry>Applies to a feature not available in PostgreSQL</entry>
2642      </row>
2643     </tbody>
2644    </tgroup>
2645   </table>
2646  </sect1>
2647
2648  <sect1 id="infoschema-sql-features">
2649   <title><literal>sql_features</literal></title>
2650
2651   <para>
2652    The table <literal>sql_features</literal> contains information
2653    about which formal features defined in the SQL standard are
2654    supported by PostgreSQL.  This is the same information that is
2655    presented in <xref linkend="features">.  There you can also find
2656    some additional background information.
2657   </para>
2658
2659   <table>
2660    <title><literal>sql_features</literal> Columns</title>
2661
2662    <tgroup cols="3">
2663     <thead>
2664      <row>
2665       <entry>Name</entry>
2666       <entry>Data Type</entry>
2667       <entry>Description</entry>
2668      </row>
2669     </thead>
2670
2671     <tbody>
2672      <row>
2673       <entry><literal>feature_id</literal></entry>
2674       <entry><type>character_data</type></entry>
2675       <entry>Identifier string of the feature</entry>
2676      </row>
2677
2678      <row>
2679       <entry><literal>feature_name</literal></entry>
2680       <entry><type>character_data</type></entry>
2681       <entry>Descriptive name of the feature</entry>
2682      </row>
2683
2684      <row>
2685       <entry><literal>sub_feature_id</literal></entry>
2686       <entry><type>character_data</type></entry>
2687       <entry>Identifier string of the subfeature, or a zero-length string if not a subfeature</entry>
2688      </row>
2689
2690      <row>
2691       <entry><literal>sub_feature_name</literal></entry>
2692       <entry><type>character_data</type></entry>
2693       <entry>Descriptive name of the subfeature, or a zero-length string if not a subfeature</entry>
2694      </row>
2695
2696      <row>
2697       <entry><literal>is_supported</literal></entry>
2698       <entry><type>character_data</type></entry>
2699       <entry>
2700        <literal>YES</literal> if the feature is fully supported by the
2701        current version of PostgreSQL, <literal>NO</literal> if not
2702       </entry>
2703      </row>
2704
2705      <row>
2706       <entry><literal>is_verified_by</literal></entry>
2707       <entry><type>character_data</type></entry>
2708       <entry>
2709        Always null, since the PostgreSQL development group does not
2710        perform formal testing of feature conformance
2711       </entry>
2712      </row>
2713
2714      <row>
2715       <entry><literal>comments</literal></entry>
2716       <entry><type>character_data</type></entry>
2717       <entry>Possibly a comment about the supported status of the feature</entry>
2718      </row>
2719     </tbody>
2720    </tgroup>
2721   </table>
2722  </sect1>
2723
2724  <sect1 id="infoschema-sql-implementation-info">
2725   <title><literal>sql_implementation_info</literal></title>
2726
2727   <para>
2728    The table <literal>sql_information_info</literal> contains
2729    information about various aspects that are left
2730    implementation-defined by the SQL standard.  This information is
2731    primarily intended for use in the context of the ODBC interface;
2732    users of other interfaces will probably find this information to be
2733    of little use.  For this reason, the individual implementation
2734    information items are not described here; you will find them in the
2735    description of the ODBC interface.
2736   </para>
2737
2738   <table>
2739    <title><literal>sql_implementation_info</literal> Columns</title>
2740
2741    <tgroup cols="3">
2742     <thead>
2743      <row>
2744       <entry>Name</entry>
2745       <entry>Data Type</entry>
2746       <entry>Description</entry>
2747      </row>
2748     </thead>
2749
2750     <tbody>
2751      <row>
2752       <entry><literal>implementation_info_id</literal></entry>
2753       <entry><type>character_data</type></entry>
2754       <entry>Identifier string of the implementation information item</entry>
2755      </row>
2756
2757      <row>
2758       <entry><literal>implementation_info_name</literal></entry>
2759       <entry><type>character_data</type></entry>
2760       <entry>Descriptive name of the implementation information item</entry>
2761      </row>
2762
2763      <row>
2764       <entry><literal>integer_value</literal></entry>
2765       <entry><type>cardinal_number</type></entry>
2766       <entry>
2767        Value of the implementation information item, or null if the
2768        value is contained in the column
2769        <literal>character_value</literal>
2770       </entry>
2771      </row>
2772
2773      <row>
2774       <entry><literal>character_value</literal></entry>
2775       <entry><type>character_data</type></entry>
2776       <entry>
2777        Value of the implementation information item, or null if the
2778        value is contained in the column
2779        <literal>integer_value</literal>
2780       </entry>
2781      </row>
2782
2783      <row>
2784       <entry><literal>comments</literal></entry>
2785       <entry><type>character_data</type></entry>
2786       <entry>Possibly a comment pertaining to the implementation information item</entry>
2787      </row>
2788     </tbody>
2789    </tgroup>
2790   </table>
2791  </sect1>
2792
2793  <sect1 id="infoschema-sql-languages">
2794   <title><literal>sql_languages</literal></title>
2795
2796   <para>
2797    The table <literal>sql_languages</literal> contains one row for
2798    each SQL language binding that is supported by PostgreSQL.
2799    PostgreSQL supports direct SQL and embedded SQL in C; that is all
2800    you will learn from this table.
2801   </para>
2802
2803   <table>
2804    <title><literal>sql_languages</literal> Columns</title>
2805
2806    <tgroup cols="3">
2807     <thead>
2808      <row>
2809       <entry>Name</entry>
2810       <entry>Data Type</entry>
2811       <entry>Description</entry>
2812      </row>
2813     </thead>
2814
2815     <tbody>
2816      <row>
2817       <entry><literal>sql_language_source</literal></entry>
2818       <entry><type>character_data</type></entry>
2819       <entry>
2820        The name of the source of the language definition; always
2821        <literal>ISO 9075</literal>, that is, the SQL standard
2822       </entry>
2823      </row>
2824
2825      <row>
2826       <entry><literal>sql_language_year</literal></entry>
2827       <entry><type>character_data</type></entry>
2828       <entry>
2829        The year the standard referenced in
2830        <literal>sql_language_source</literal> was approved; currently
2831        <literal>1999</>
2832       </entry>
2833      </row>
2834
2835      <row>
2836       <entry><literal>sql_language_comformance</literal></entry>
2837       <entry><type>character_data</type></entry>
2838       <entry>
2839        The standard conformance level for the language binding.  For
2840        ISO 9075:1999 this is always <literal>CORE</literal>.
2841       </entry>
2842      </row>
2843
2844      <row>
2845       <entry><literal>sql_language_integrity</literal></entry>
2846       <entry><type>character_data</type></entry>
2847       <entry>Always null (This value is relevant to an earlier version of the SQL standard.)</entry>
2848      </row>
2849
2850      <row>
2851       <entry><literal>sql_language_implementation</literal></entry>
2852       <entry><type>character_data</type></entry>
2853       <entry>Always null</entry>
2854      </row>
2855
2856      <row>
2857       <entry><literal>sql_language_binding_style</literal></entry>
2858       <entry><type>character_data</type></entry>
2859       <entry>
2860        The language binding style, either <literal>DIRECT</literal> or
2861        <literal>EMBEDDED</literal>
2862       </entry>
2863      </row>
2864
2865      <row>
2866       <entry><literal>sql_language_programming_language</literal></entry>
2867       <entry><type>character_data</type></entry>
2868       <entry>
2869        The programming language, if the binding style is
2870        <literal>EMBEDDED</literal>, else null.  PostgreSQL only
2871        supports the language C.
2872       </entry>
2873      </row>
2874     </tbody>
2875    </tgroup>
2876   </table>
2877  </sect1>
2878
2879  <sect1 id="infoschema-sql-packages">
2880   <title><literal>sql_packages</literal></title>
2881
2882   <para>
2883    The table <literal>sql_packages</literal> contains information
2884    about which features packages defined in the SQL standard are
2885    supported by PostgreSQL.  Refer to <xref linkend="features"> for
2886    background information on feature packages.
2887   </para>
2888
2889   <table>
2890    <title><literal>sql_packages</literal> Columns</title>
2891
2892    <tgroup cols="3">
2893     <thead>
2894      <row>
2895       <entry>Name</entry>
2896       <entry>Data Type</entry>
2897       <entry>Description</entry>
2898      </row>
2899     </thead>
2900
2901     <tbody>
2902      <row>
2903       <entry><literal>feature_id</literal></entry>
2904       <entry><type>character_data</type></entry>
2905       <entry>Identifier string of the package</entry>
2906      </row>
2907
2908      <row>
2909       <entry><literal>feature_name</literal></entry>
2910       <entry><type>character_data</type></entry>
2911       <entry>Descriptive name of the package</entry>
2912      </row>
2913
2914      <row>
2915       <entry><literal>is_supported</literal></entry>
2916       <entry><type>character_data</type></entry>
2917       <entry>
2918        <literal>YES</literal> if the package is fully supported by the
2919        current version of PostgreSQL, <literal>NO</literal> if not
2920       </entry>
2921      </row>
2922
2923      <row>
2924       <entry><literal>is_verified_by</literal></entry>
2925       <entry><type>character_data</type></entry>
2926       <entry>
2927        Always null, since the PostgreSQL development group does not
2928        perform formal testing of feature conformance
2929       </entry>
2930      </row>
2931
2932      <row>
2933       <entry><literal>comments</literal></entry>
2934       <entry><type>character_data</type></entry>
2935       <entry>Possibly a comment about the supported status of the package</entry>
2936      </row>
2937     </tbody>
2938    </tgroup>
2939   </table>
2940  </sect1>
2941
2942  <sect1 id="infoschema-sql-sizing">
2943   <title><literal>sql_sizing</literal></title>
2944
2945   <para>
2946    The table <literal>sql_sizing</literal> contains information about
2947    various size limits and maximum values in PostgreSQL.  This
2948    information is primarily intended for use in the context of the
2949    ODBC interface; users of other interfaces will probably find this
2950    information to be of little use.  For this reason, the individual
2951    sizing items are not described here; you will find them in the
2952    description of the ODBC interface.
2953   </para>
2954
2955   <table>
2956    <title><literal>sql_sizing</literal> Columns</title>
2957
2958    <tgroup cols="3">
2959     <thead>
2960      <row>
2961       <entry>Name</entry>
2962       <entry>Data Type</entry>
2963       <entry>Description</entry>
2964      </row>
2965     </thead>
2966
2967     <tbody>
2968      <row>
2969       <entry><literal>sizing_id</literal></entry>
2970       <entry><type>cardinal_number</type></entry>
2971       <entry>Identifier of the sizing item</entry>
2972      </row>
2973
2974      <row>
2975       <entry><literal>sizing_name</literal></entry>
2976       <entry><type>character_data</type></entry>
2977       <entry>Descriptive name of the sizing item</entry>
2978      </row>
2979
2980      <row>
2981       <entry><literal>supported_value</literal></entry>
2982       <entry><type>cardinal_number</type></entry>
2983       <entry>
2984        Value of the sizing item, or 0 if the size is unlimited or
2985        cannot be determined, or null if the features for which the
2986        sizing item is applicable are not supported
2987       </entry>
2988      </row>
2989
2990      <row>
2991       <entry><literal>comments</literal></entry>
2992       <entry><type>character_data</type></entry>
2993       <entry>Possibly a comment pertaining to the sizing item</entry>
2994      </row>
2995     </tbody>
2996    </tgroup>
2997   </table>
2998  </sect1>
2999
3000  <sect1 id="infoschema-sql-sizing-profiles">
3001   <title><literal>sql_sizing_profiles</literal></title>
3002
3003   <para>
3004    The table <literal>sql_sizing_profiles</literal> contains
3005    information about the <literal>sql_sizing</literal> values that are
3006    required by various profiles of the SQL standard.  PostgreSQL does
3007    not track any SQL profiles, so this table is empty.
3008   </para>
3009
3010   <table>
3011    <title><literal>sql_sizing_profiles</literal> Columns</title>
3012
3013    <tgroup cols="3">
3014     <thead>
3015      <row>
3016       <entry>Name</entry>
3017       <entry>Data Type</entry>
3018       <entry>Description</entry>
3019      </row>
3020     </thead>
3021
3022     <tbody>
3023      <row>
3024       <entry><literal>sizing_id</literal></entry>
3025       <entry><type>cardinal_number</type></entry>
3026       <entry>Identifier of the sizing item</entry>
3027      </row>
3028
3029      <row>
3030       <entry><literal>sizing_name</literal></entry>
3031       <entry><type>character_data</type></entry>
3032       <entry>Descriptive name of the sizing item</entry>
3033      </row>
3034
3035      <row>
3036       <entry><literal>profile_id</literal></entry>
3037       <entry><type>character_data</type></entry>
3038       <entry>Identifier string of a profile</entry>
3039      </row>
3040
3041      <row>
3042       <entry><literal>required_value</literal></entry>
3043       <entry><type>cardinal_number</type></entry>
3044       <entry>
3045        The value required by the SQL profile for the sizing item, or 0
3046        if the profile places no limit on the sizing item, or null if
3047        the profile does not require any of the features for which the
3048        sizing item is applicable
3049       </entry>
3050      </row>
3051
3052      <row>
3053       <entry><literal>comments</literal></entry>
3054       <entry><type>character_data</type></entry>
3055       <entry>Possibly a comment pertaining to the sizing item within the profile</entry>
3056      </row>
3057     </tbody>
3058    </tgroup>
3059   </table>
3060  </sect1>
3061
3062  <sect1 id="infoschema-table-constraints">
3063   <title><literal>table_constraints</literal></title>
3064
3065   <para>
3066    The view <literal>table_constraints</literal> contains all
3067    constraints belonging to tables owned by the current user.
3068   </para>
3069
3070   <table>
3071    <title><literal>table_constraints</literal> Columns</title>
3072
3073    <tgroup cols="3">
3074     <thead>
3075      <row>
3076       <entry>Name</entry>
3077       <entry>Data Type</entry>
3078       <entry>Description</entry>
3079      </row>
3080     </thead>
3081
3082     <tbody>
3083      <row>
3084       <entry><literal>constraint_catalog</literal></entry>
3085       <entry><type>sql_identifier</type></entry>
3086       <entry>Name of the database that contains the constraint (always the current database)</entry>
3087      </row>
3088
3089      <row>
3090       <entry><literal>constraint_schema</literal</entry>
3091       <entry><type>sql_identifier</type></entry>
3092       <entry>Name of the schema that contains the constraint</entry>
3093      </row>
3094
3095      <row>
3096       <entry><literal>constraint_name</literal</entry>
3097       <entry><type>sql_identifier</type></entry>
3098       <entry>Name of the constraint</entry>
3099      </row>
3100
3101      <row>
3102       <entry><literal>table_catalog</literal></entry>
3103       <entry><type>sql_identifier</type></entry>
3104       <entry>Name of the database that contains the table (always the current database)</entry>
3105      </row>
3106
3107      <row>
3108       <entry><literal>table_schema</literal</entry>
3109       <entry><type>sql_identifier</type></entry>
3110       <entry>Name of the schema that contains the table</entry>
3111      </row>
3112
3113      <row>
3114       <entry><literal>table_name</literal</entry>
3115       <entry><type>sql_identifier</type></entry>
3116       <entry>Name of the table</entry>
3117      </row>
3118
3119      <row>
3120       <entry><literal>constraint_type</literal</entry>
3121       <entry><type>character_data</type></entry>
3122       <entry>
3123        Type of the constraint: <literal>CHECK</literal>,
3124        <literal>FOREIGN KEY</literal>, <literal>PRIMARY KEY</literal>,
3125        or <literal>UNIQUE</literal>
3126       </entry>
3127      </row>
3128
3129      <row>
3130       <entry><literal>is_deferrable</literal></entry>
3131       <entry><type>character_data</type></entry>
3132       <entry><literal>YES</literal> if the constraint is deferrable, <literal>NO</literal> if not</entry>
3133      </row>
3134
3135      <row>
3136       <entry><literal>initially_deferred</literal></entry>
3137       <entry><type>character_data</type></entry>
3138       <entry><literal>YES</literal> if the constraint is deferrable and initially deferred, <literal>NO</literal> if not</entry>
3139      </row>
3140     </tbody>
3141    </tgroup>
3142   </table>
3143  </sect1>
3144
3145  <sect1 id="infoschema-table-privileges">
3146   <title><literal>table_privileges</literal></title>
3147
3148   <para>
3149    The view <literal>table_privileges</literal> identifies all
3150    privileges granted on tables to the current user or by the current
3151    user.  There is one row for each combination of table, grantor, and
3152    grantee.
3153   </para>
3154
3155   <table>
3156    <title><literal>table_privileges</literal> Columns</title>
3157
3158    <tgroup cols="3">
3159     <thead>
3160      <row>
3161       <entry>Name</entry>
3162       <entry>Data Type</entry>
3163       <entry>Description</entry>
3164      </row>
3165     </thead>
3166
3167     <tbody>
3168      <row>
3169       <entry><literal>grantor</literal></entry>
3170       <entry><type>sql_identifier</type></entry>
3171       <entry>Name of the user that granted the privilege</entry>
3172      </row>
3173
3174      <row>
3175       <entry><literal>grantee</literal</entry>
3176       <entry><type>sql_identifier</type></entry>
3177       <entry>Name of the user that the privilege was granted to</entry>
3178      </row>
3179
3180      <row>
3181       <entry><literal>table_catalog</literal></entry>
3182       <entry><type>sql_identifier</type></entry>
3183       <entry>Name of the database that contains the table (always the current database)</entry>
3184      </row>
3185
3186      <row>
3187       <entry><literal>table_schema</literal</entry>
3188       <entry><type>sql_identifier</type></entry>
3189       <entry>Name of the schema that contains the table</entry>
3190      </row>
3191
3192      <row>
3193       <entry><literal>table_name</literal</entry>
3194       <entry><type>sql_identifier</type></entry>
3195       <entry>Name of the table</entry>
3196      </row>
3197
3198      <row>
3199       <entry><literal>privilege_type</literal</entry>
3200       <entry><type>character_data</type></entry>
3201       <entry>
3202        Type of the privilege: <literal>SELECT</literal>,
3203        <literal>DELETE</literal>, <literal>INSERT</literal>,
3204        <literal>UPDATE</literal>, <literal>REFERENCES</literal>, or
3205        <literal>TRIGGER</literal>
3206       </entry>
3207      </row>
3208
3209      <row>
3210       <entry><literal>is_grantable</literal></entry>
3211       <entry><type>character_data</type></entry>
3212       <entry><literal>YES</literal> if the privilege is grantable, <literal>NO</literal> if not</entry>
3213      </row>
3214
3215      <row>
3216       <entry><literal>with_hierarchy</literal></entry>
3217       <entry><type>character_data</type></entry>
3218       <entry>Applies to a feature not available in PostgreSQL</entry>
3219      </row>
3220     </tbody>
3221    </tgroup>
3222   </table>
3223  </sect1>
3224
3225  <sect1 id="infoschema-tables">
3226   <title><literal>tables</literal></title>
3227
3228   <para>
3229    The view <literal>tables</literal> contains all tables and views
3230    defined in the current database.  Only those tables and views are
3231    shown that the current user has access to (by way of being the
3232    owner or having some privilege).
3233   </para>
3234
3235   <table>
3236    <title><literal>tables</literal> Columns</title>
3237
3238    <tgroup cols="3">
3239     <thead>
3240      <row>
3241       <entry>Name</entry>
3242       <entry>Data Type</entry>
3243       <entry>Description</entry>
3244      </row>
3245     </thead>
3246
3247     <tbody>
3248      <row>
3249       <entry><literal>table_catalog</literal></entry>
3250       <entry><type>sql_identifier</type></entry>
3251       <entry>Name of the database that contains the table (always the current database)</entry>
3252      </row>
3253
3254      <row>
3255       <entry><literal>table_schema</literal</entry>
3256       <entry><type>sql_identifier</type></entry>
3257       <entry>Name of the schema that contains the table</entry>
3258      </row>
3259
3260      <row>
3261       <entry><literal>table_name</literal</entry>
3262       <entry><type>sql_identifier</type></entry>
3263       <entry>Name of the table</entry>
3264      </row>
3265
3266      <row>
3267       <entry><literal>table_type</literal</entry>
3268       <entry><type>character_data</type></entry>
3269       <entry>
3270        Type of the table: <literal>BASE TABLE</literal> for a
3271        persistent base table (the normal table type),
3272        <literal>VIEW</literal> for a view, or <literal>LOCAL
3273        TEMPORARY</literal> for a temporary table
3274       </entry>
3275      </row>
3276
3277      <row>
3278       <entry><literal>self_referencing_column_name</literal></entry>
3279       <entry><type>sql_identifier</type></entry>
3280       <entry>Applies to a feature not available in PostgreSQL</entry>
3281      </row>
3282
3283      <row>
3284       <entry><literal>reference_generation</literal></entry>
3285       <entry><type>character_data</type></entry>
3286       <entry>Applies to a feature not available in PostgreSQL</entry>
3287      </row>
3288
3289      <row>
3290       <entry><literal>user_defined_type_catalog</literal></entry>
3291       <entry><type>sql_identifier</type></entry>
3292       <entry>Applies to a feature not available in PostgreSQL</entry>
3293      </row>
3294
3295      <row>
3296       <entry><literal>user_defined_type_schema</literal></entry>
3297       <entry><type>sql_identifier</type></entry>
3298       <entry>Applies to a feature not available in PostgreSQL</entry>
3299      </row>
3300
3301      <row>
3302       <entry><literal>user_defined_type_name</literal></entry>
3303       <entry><type>sql_identifier</type></entry>
3304       <entry>Applies to a feature not available in PostgreSQL</entry>
3305      </row>
3306     </tbody>
3307    </tgroup>
3308   </table>
3309  </sect1>
3310
3311  <sect1 id="infoschema-triggers">
3312   <title><literal>triggers</literal></title>
3313
3314   <para>
3315    The view <literal>triggers</literal> contains all triggers defined
3316    in the current database that are owned by the current user.  (The
3317    owner of the table is the owner of the trigger.)
3318   </para>
3319
3320   <table>
3321    <title><literal>triggers</literal> Columns</title>
3322
3323    <tgroup cols="3">
3324     <thead>
3325      <row>
3326       <entry>Name</entry>
3327       <entry>Data Type</entry>
3328       <entry>Description</entry>
3329      </row>
3330     </thead>
3331
3332     <tbody>
3333      <row>
3334       <entry><literal>trigger_catalog</literal></entry>
3335       <entry><type>sql_identifier</type></entry>
3336       <entry>Name of the database that contains the trigger (always the current database)</entry>
3337      </row>
3338
3339      <row>
3340       <entry><literal>trigger_schema</literal</entry>
3341       <entry><type>sql_identifier</type></entry>
3342       <entry>Name of the schema that contains the trigger</entry>
3343      </row>
3344
3345      <row>
3346       <entry><literal>trigger_name</literal</entry>
3347       <entry><type>sql_identifier</type></entry>
3348       <entry>Name of the trigger</entry>
3349      </row>
3350
3351      <row>
3352       <entry><literal>event_manipulation</literal</entry>
3353       <entry><type>character_data</type></entry>
3354       <entry>
3355        Event that fires the trigger (<literal>INSERT</literal>,
3356        <literal>UPDATE</literal>, or <literal>DELETE</literal>)
3357       </entry>
3358      </row>
3359
3360      <row>
3361       <entry><literal>event_object_catalog</literal></entry>
3362       <entry><type>sql_identifier</type></entry>
3363       <entry>
3364        Name of the database that contains the table that the trigger
3365        is defined on (always the current database)
3366       </entry>
3367      </row>
3368
3369      <row>
3370       <entry><literal>event_object_schema</literal</entry>
3371       <entry><type>sql_identifier</type></entry>
3372       <entry>Name of the schema that contains the table that the trigger is defined on</entry>
3373      </row>
3374
3375      <row>
3376       <entry><literal>event_object_name</literal</entry>
3377       <entry><type>sql_identifier</type></entry>
3378       <entry>Name of the table that the trigger is defined on</entry>
3379      </row>
3380
3381      <row>
3382       <entry><literal>action_order</literal</entry>
3383       <entry><type>cardinal_number</type></entry>
3384       <entry>Not yet implemented</entry>
3385      </row>
3386
3387      <row>
3388       <entry><literal>action_condition</literal</entry>
3389       <entry><type>character_data</type></entry>
3390       <entry>Applies to a feature not available in PostgreSQL</entry>
3391      </row>
3392
3393      <row>
3394       <entry><literal>action_statement</literal</entry>
3395       <entry><type>character_data</type></entry>
3396       <entry>
3397        Statement that is executed by the trigger (currently always
3398        <literal>EXECUTE PROCEDURE
3399        <replaceable>function</replaceable>(...)</literal>)
3400       </entry>
3401      </row>
3402
3403      <row>
3404       <entry><literal>action_orientation</literal</entry>
3405       <entry><type>character_data</type></entry>
3406       <entry>
3407        Identifies whether the trigger fires once for each processed
3408        row or once for each statement (<literal>ROW</literal> or
3409        <literal>STATEMENT</literal>)
3410       </entry>
3411      </row>
3412
3413      <row>
3414       <entry><literal>condition_timing</literal</entry>
3415       <entry><type>character_data</type></entry>
3416       <entry>
3417        Time at which the trigger fires (<literal>BEFORE</literal> or
3418        <literal>AFTER</literal>)
3419       </entry>
3420      </row>
3421
3422      <row>
3423       <entry><literal>condition_reference_old_table</literal</entry>
3424       <entry><type>sql_identifier</type></entry>
3425       <entry>Applies to a feature not available in PostgreSQL</entry>
3426      </row>
3427
3428      <row>
3429       <entry><literal>condition_reference_new_table</literal</entry>
3430       <entry><type>sql_identifier</type></entry>
3431       <entry>Applies to a feature not available in PostgreSQL</entry>
3432      </row>
3433     </tbody>
3434    </tgroup>
3435   </table>
3436
3437   <para>
3438    Triggers in PostgreSQL have two incompatibilities with the SQL
3439    standard that affect the representation in the information schema.
3440    First, trigger names are local to the table in PostgreSQL, rather
3441    than independent schema objects.  Therefore there may be duplicate
3442    trigger names defined in one schema, as long as they belong to
3443    different tables.  (<literal>trigger_catalog</literal> and
3444    <literal>trigger_schema</literal> are really the values pertaining
3445    to the table that the trigger is defined on.)  Second, triggers can
3446    be defined to fire on multiple events in PostgreSQL (e.g.,
3447    <literal>ON INSERT OR UPDATE</literal>), whereas the SQL standard
3448    only allows one.  If a trigger is defined to fire on multiple
3449    events, it is represented as multiple rows in the information
3450    schema, one for each type of event.  As a consequence of these two
3451    issues, the primary key of the view <literal>triggers</literal> is
3452    really <literal>(trigger_catalog, trigger_schema, trigger_name,
3453    event_object_name, event_manipulation)</literal> instead of
3454    <literal>(trigger_catalog, trigger_schema, trigger_name)</literal>,
3455    which is what the SQL standard specifies.  Nonetheless, if you
3456    define your triggers in a manner that conforms with the SQL
3457    standard (trigger names unique in the schema and only one event
3458    type per trigger), this will not affect you.
3459   </para>
3460  </sect1>
3461
3462  <sect1 id="infoschema-view-column-usage">
3463   <title><literal>view_column_usage</literal></title>
3464
3465   <para>
3466    The view <literal>view_column_usage</literal> identifies all
3467    columns that are used in the query expression of a view (the
3468    <command>SELECT</command> statement that defines the view).  A
3469    column is only included if the current user is the owner of the
3470    table that contains the column.
3471   </para>
3472
3473   <note>
3474    <para>
3475     Columns of system tables are not included.  This should be fixed
3476     sometime.
3477    </para>
3478   </note>
3479
3480   <table>
3481    <title><literal>view_column_usage</literal> Columns</title>
3482
3483    <tgroup cols="3">
3484     <thead>
3485      <row>
3486       <entry>Name</entry>
3487       <entry>Data Type</entry>
3488       <entry>Description</entry>
3489      </row>
3490     </thead>
3491
3492     <tbody>
3493      <row>
3494       <entry><literal>view_catalog</literal></entry>
3495       <entry><type>sql_identifier</type></entry>
3496       <entry>Name of the database that contains the view (always the current database)</entry>
3497      </row>
3498
3499      <row>
3500       <entry><literal>view_schema</literal</entry>
3501       <entry><type>sql_identifier</type></entry>
3502       <entry>Name of the schema that contains the view</entry>
3503      </row>
3504
3505      <row>
3506       <entry><literal>view_name</literal</entry>
3507       <entry><type>sql_identifier</type></entry>
3508       <entry>Name of the view</entry>
3509      </row>
3510
3511      <row>
3512       <entry><literal>table_catalog</literal></entry>
3513       <entry><type>sql_identifier</type></entry>
3514       <entry>
3515        Name of the database that contains the table that contains the
3516        column that is used by the view (always the current database)
3517       </entry>
3518      </row>
3519
3520      <row>
3521       <entry><literal>table_schema</literal</entry>
3522       <entry><type>sql_identifier</type></entry>
3523       <entry>
3524        Name of the schema that contains the table that contains the
3525        column that is used by the view
3526       </entry>
3527      </row>
3528
3529      <row>
3530       <entry><literal>table_name</literal</entry>
3531       <entry><type>sql_identifier</type></entry>
3532       <entry>
3533        Name of the table that contains the column that is used by the
3534        view
3535       </entry>
3536      </row>
3537
3538      <row>
3539       <entry><literal>column_name</literal</entry>
3540       <entry><type>sql_identifier</type></entry>
3541       <entry>Name of the column that is used by the view</entry>
3542      </row>
3543     </tbody>
3544    </tgroup>
3545   </table>
3546  </sect1>
3547
3548  <sect1 id="infoschema-view-table-usage">
3549   <title><literal>view_table_usage</literal></title>
3550
3551   <para>
3552    The view <literal>view_table_usage</literal> identifies all tables
3553    that are used in the query expression of a view (the
3554    <command>SELECT</command> statement that defines the view).  A
3555    table is only included if the current user is the owner of that
3556    table.
3557   </para>
3558
3559   <note>
3560    <para>
3561     System tables are not included.  This should be fixed sometime.
3562    </para>
3563   </note>
3564
3565   <table>
3566    <title><literal>view_table_usage</literal> Columns</title>
3567
3568    <tgroup cols="3">
3569     <thead>
3570      <row>
3571       <entry>Name</entry>
3572       <entry>Data Type</entry>
3573       <entry>Description</entry>
3574      </row>
3575     </thead>
3576
3577     <tbody>
3578      <row>
3579       <entry><literal>view_catalog</literal></entry>
3580       <entry><type>sql_identifier</type></entry>
3581       <entry>Name of the database that contains the view (always the current database)</entry>
3582      </row>
3583
3584      <row>
3585       <entry><literal>view_schema</literal</entry>
3586       <entry><type>sql_identifier</type></entry>
3587       <entry>Name of the schema that contains the view</entry>
3588      </row>
3589
3590      <row>
3591       <entry><literal>view_name</literal</entry>
3592       <entry><type>sql_identifier</type></entry>
3593       <entry>Name of the view</entry>
3594      </row>
3595
3596      <row>
3597       <entry><literal>table_catalog</literal></entry>
3598       <entry><type>sql_identifier</type></entry>
3599       <entry>
3600        Name of the database that contains the table the table that is
3601        used by the view (always the current database)
3602       </entry>
3603      </row>
3604
3605      <row>
3606       <entry><literal>table_schema</literal</entry>
3607       <entry><type>sql_identifier</type></entry>
3608       <entry>
3609        Name of the schema that contains the table that is used by the
3610        view
3611       </entry>
3612      </row>
3613
3614      <row>
3615       <entry><literal>table_name</literal</entry>
3616       <entry><type>sql_identifier</type></entry>
3617       <entry>
3618        Name of the table that is used by the view
3619       </entry>
3620      </row>
3621     </tbody>
3622    </tgroup>
3623   </table>
3624  </sect1>
3625
3626  <sect1 id="infoschema-views">
3627   <title><literal>views</literal></title>
3628
3629   <para>
3630    The view <literal>views</literal> contains all views defined in the
3631    current database.  Only those views are shown that the current user
3632    has access to (by way of being the owner or having some privilege).
3633   </para>
3634
3635   <table>
3636    <title><literal>views</literal> Columns</title>
3637
3638    <tgroup cols="3">
3639     <thead>
3640      <row>
3641       <entry>Name</entry>
3642       <entry>Data Type</entry>
3643       <entry>Description</entry>
3644      </row>
3645     </thead>
3646
3647     <tbody>
3648      <row>
3649       <entry><literal>table_catalog</literal></entry>
3650       <entry><type>sql_identifier</type></entry>
3651       <entry>Name of the database that contains the view (always the current database)</entry>
3652      </row>
3653
3654      <row>
3655       <entry><literal>table_schema</literal</entry>
3656       <entry><type>sql_identifier</type></entry>
3657       <entry>Name of the schema that contains the view</entry>
3658      </row>
3659
3660      <row>
3661       <entry><literal>table_name</literal</entry>
3662       <entry><type>sql_identifier</type></entry>
3663       <entry>Name of the view</entry>
3664      </row>
3665
3666      <row>
3667       <entry><literal>view definition</literal</entry>
3668       <entry><type>character_data</type></entry>
3669       <entry>
3670        Query expression defining the view (null if the current user is
3671        not the owner of the view)
3672       </entry>
3673      </row>
3674
3675      <row>
3676       <entry><literal>check_option</literal></entry>
3677       <entry><type>character_data</type></entry>
3678       <entry>Applies to a feature not available in PostgreSQL</entry>
3679      </row>
3680
3681      <row>
3682       <entry><literal>is_updatable</literal></entry>
3683       <entry><type>character_data</type></entry>
3684       <entry>Not yet implemented</entry>
3685      </row>
3686
3687      <row>
3688       <entry><literal>is_insertable_into</literal></entry>
3689       <entry><type>character_data</type></entry>
3690       <entry>Not yet implemented</entry>
3691      </row>
3692     </tbody>
3693    </tgroup>
3694   </table>
3695  </sect1>
3696
3697 </chapter>