1 <!-- $Header: /cvsroot/pgsql/doc/src/sgml/information_schema.sgml,v 1.5 2003/06/28 20:50:07 petere Exp $ -->
3 <chapter id="information-schema">
4 <title>The Information Schema</title>
6 <indexterm zone="information-schema">
7 <primary>information schema</primary>
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.
22 <sect1 id="infoschema-schema">
23 <title>The Schema</title>
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).
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
44 <sect1 id="infoschema-datatypes">
45 <title>Data Types</title>
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
61 <term><type>cardinal_number</type></term>
64 A nonnegative integer.
70 <term><type>character_data</type></term>
73 A character string (without specific maximum length).
79 <term><type>sql_identifier</type></term>
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
90 <term><type>time_stamp</type></term>
93 A domain over the type <type>timestamp</type>
99 Every column in the information schema has one of these four types.
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
113 <sect1 id="infoschema-information-schema-catalog-name">
114 <title><literal>information_schema_catalog_name</literal></title>
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).
123 <title><literal>information_schema_catalog_name</literal> Columns</title>
129 <entry>Data Type</entry>
130 <entry>Description</entry>
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>
145 <sect1 id="infoschema-check-constraints">
146 <title><literal>check_constraints</literal></title>
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.)
156 <title><literal>check_constraints</literal> Columns</title>
162 <entry>Data Type</entry>
163 <entry>Description</entry>
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>
175 <entry><literal>constraint_schema</literal></entry>
176 <entry><literal>sql_identifier</literal></entry>
177 <entry>Name of the schema containing the constraint</entry>
181 <entry><literal>constraint_name</literal></entry>
182 <entry><literal>sql_identifier</literal></entry>
183 <entry>Name of the constraint</entry>
187 <entry><literal>check_clause</literal></entry>
188 <entry><literal>character_data</literal></entry>
189 <entry>The check expression of the check constraint</entry>
196 <sect1 id="infoschema-column-domain-usage">
197 <title><literal>column_domain_usage</literal></title>
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.
206 <title><literal>column_domain_usage</literal> Columns</title>
212 <entry>Data Type</entry>
213 <entry>Description</entry>
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>
225 <entry><literal>domain_schema</literal></entry>
226 <entry><type>sql_identifier</type></entry>
227 <entry>Name of the schema containing the domain</entry>
231 <entry><literal>domain_name</literal></entry>
232 <entry><type>sql_identifier</type></entry>
233 <entry>Name of the domain</entry>
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>
243 <entry><literal>table_schema</literal></entry>
244 <entry><type>sql_identifier</type></entry>
245 <entry>Name of the schema containing the table</entry>
249 <entry><literal>table_name</literal></entry>
250 <entry><type>sql_identifier</type></entry>
251 <entry>Name of the table</entry>
255 <entry><literal>column_name</literal></entry>
256 <entry><type>sql_identifier</type></entry>
257 <entry>Name of the column</entry>
264 <sect1 id="infoschema-column-privileges">
265 <title><literal>column_privileges</literal></title>
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,
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>.
285 <title><literal>column_privileges</literal> Columns</title>
291 <entry>Data Type</entry>
292 <entry>Description</entry>
298 <entry><literal>grantor</literal></entry>
299 <entry><type>sql_identifier</type></entry>
300 <entry>Name of the user that granted the privilege</entry>
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>
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>
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>
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>
328 <entry><literal>column_name</literal</entry>
329 <entry><type>sql_identifier</type></entry>
330 <entry>Name of the column</entry>
334 <entry><literal>privilege_type</literal</entry>
335 <entry><type>character_data</type></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>
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>
354 <sect1 id="infoschema-column-udt-usage">
355 <title><literal>column_udt_usage</literal></title>
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.
366 <title><literal>column_udt_usage</literal> Columns</title>
372 <entry>Data Type</entry>
373 <entry>Description</entry>
379 <entry><literal>udt_catalog</literal></entry>
380 <entry><type>sql_identifier</type></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
389 <entry><literal>udt_schema</literal></entry>
390 <entry><type>sql_identifier</type></entry>
392 Name of the schema that the column data type (the underlying
393 type of the domain, if applicable) is defined in
398 <entry><literal>udt_name</literal></entry>
399 <entry><type>sql_identifier</type></entry>
401 Name of the column data type (the underlying type of the
402 domain, if applicable)
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>
413 <entry><literal>table_schema</literal></entry>
414 <entry><type>sql_identifier</type></entry>
415 <entry>Name of the schema containing the table</entry>
419 <entry><literal>table_name</literal></entry>
420 <entry><type>sql_identifier</type></entry>
421 <entry>Name of the table</entry>
425 <entry><literal>column_name</literal></entry>
426 <entry><type>sql_identifier</type></entry>
427 <entry>Name of the column</entry>
434 <sect1 id="infoschema-columns">
435 <title><literal>columns</literal></title>
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).
446 <title><literal>columns</literal> Columns</title>
452 <entry>Data Type</entry>
453 <entry>Description</entry>
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>
465 <entry><literal>table_schema</literal></entry>
466 <entry><type>sql_identifier</type></entry>
467 <entry>Name of the schema containing the table</entry>
471 <entry><literal>table_name</literal></entry>
472 <entry><type>sql_identifier</type></entry>
473 <entry>Name of the table</entry>
477 <entry><literal>column_name</literal></entry>
478 <entry><type>sql_identifier</type></entry>
479 <entry>Name of the column</entry>
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>
489 <entry><literal>column_default</literal></entry>
490 <entry><type>character_data</type></entry>
492 Default expression of the column (null if the current user is
493 not the owner of the table containing the column)
498 <entry><literal>is_nullable</literal></entry>
499 <entry><type>character_data</type></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
509 <entry><literal>data_type</literal></entry>
510 <entry><type>character_data</type></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
525 <entry><literal>character_maximum_length</literal></entry>
526 <entry><type>cardinal_number</type></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.
535 <entry><literal>character_octet_length</literal></entry>
536 <entry><type>cardinal_number</type></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
546 <entry><literal>numeric_precision</literal></entry>
547 <entry><type>cardinal_number</type></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.
560 <entry><literal>numeric_precision_radix</literal></entry>
561 <entry><type>cardinal_number</type></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.
572 <entry><literal>numeric_scale</literal></entry>
573 <entry><type>cardinal_number</type></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.
587 <entry><literal>datetime_precision</literal></entry>
588 <entry><type>cardinal_number</type></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.
597 <entry><literal>interval_type</literal></entry>
598 <entry><type>character_data</type></entry>
599 <entry>Not yet implemented</entry>
603 <entry><literal>interval_precision</literal></entry>
604 <entry><type>character_data</type></entry>
605 <entry>Not yet implemented</entry>
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>
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>
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>
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>
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>
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>
645 <entry><literal>domain_catalog</literal></entry>
646 <entry><type>sql_identifier</type></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
655 <entry><literal>domain_schema</literal></entry>
656 <entry><type>sql_identifier</type></entry>
658 If the column has a domain type, the name of the schema that
659 the domain is defined in, else null.
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>
670 <entry><literal>udt_catalog</literal></entry>
671 <entry><type>sql_identifier</type></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
680 <entry><literal>udt_schema</literal></entry>
681 <entry><type>sql_identifier</type></entry>
683 Name of the schema that the column data type (the underlying
684 type of the domain, if applicable) is defined in
689 <entry><literal>udt_name</literal></entry>
690 <entry><type>sql_identifier</type></entry>
692 Name of the column data type (the underlying type of the
693 domain, if applicable)
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>
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>
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>
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>
722 <entry><literal>dtd_identifier</literal></entry>
723 <entry><type>sql_identifier</type></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
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>
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.
771 <sect1 id="infoschema-constraint-column-usage">
772 <title><literal>constraint_column_usage</literal></title>
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.
786 <title><literal>constraint_column_usage</literal> Columns</title>
792 <entry>Data Type</entry>
793 <entry>Description</entry>
799 <entry><literal>table_catalog</literal></entry>
800 <entry><type>sql_identifier</type></entry>
802 Name of the database that contains the table that contains the
803 column that is used by some constraint (always the current
809 <entry><literal>table_schema</literal</entry>
810 <entry><type>sql_identifier</type></entry>
812 Name of the schema that contains the table that contains the
813 column that is used by some constraint
818 <entry><literal>table_name</literal</entry>
819 <entry><type>sql_identifier</type></entry>
821 Name of the table that contains the column that is used by some
827 <entry><literal>column_name</literal</entry>
828 <entry><type>sql_identifier</type></entry>
830 Name of the column that is used by some constraint
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>
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>
847 <entry><literal>constraint_name</literal</entry>
848 <entry><type>sql_identifier</type></entry>
849 <entry>Name of the constraint</entry>
856 <sect1 id="infoschema-constraint-table-usage">
857 <title><literal>constraint_table_usage</literal></title>
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
873 <title><literal>constraint_table_usage</literal> Columns</title>
879 <entry>Data Type</entry>
880 <entry>Description</entry>
886 <entry><literal>table_catalog</literal></entry>
887 <entry><type>sql_identifier</type></entry>
889 Name of the database that contains the table that is used by
890 some constraint (always the current database)
895 <entry><literal>table_schema</literal</entry>
896 <entry><type>sql_identifier</type></entry>
898 Name of the schema that contains the table that is used by some
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>
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>
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>
922 <entry><literal>constraint_name</literal</entry>
923 <entry><type>sql_identifier</type></entry>
924 <entry>Name of the constraint</entry>
931 <sect1 id="infoschema-data-type-privileges">
932 <title><literal>data_type_privileges</literal></title>
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
951 <title><literal>domain_constraints</literal> Columns</title>
957 <entry>Data Type</entry>
958 <entry>Description</entry>
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>
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>
976 <entry><literal>object_name</literal</entry>
977 <entry><type>sql_identifier</type></entry>
978 <entry>Name of the described object</entry>
982 <entry><literal>object_type</literal</entry>
983 <entry><type>character_data</type></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).
995 <entry><literal>dtd_identifier</literal</entry>
996 <entry><type>sql_identifier</type></entry>
998 The identifier of the data type descriptor, which is unique
999 among the data type descriptors for that same object.
1007 <sect1 id="infoschema-domain-constraints">
1008 <title><literal>domain_constraints</literal></title>
1011 The view <literal>domain_constraints</literal> contains all
1012 constraints belonging to domains owned by the current user.
1016 <title><literal>domain_constraints</literal> Columns</title>
1022 <entry>Data Type</entry>
1023 <entry>Description</entry>
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>
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>
1041 <entry><literal>constraint_name</literal</entry>
1042 <entry><type>sql_identifier</type></entry>
1043 <entry>Name of the constraint</entry>
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>
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>
1059 <entry><literal>domain_name</literal</entry>
1060 <entry><type>sql_identifier</type></entry>
1061 <entry>Name of the domain</entry>
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>
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>
1080 <sect1 id="infoschema-domain-udt-usage">
1081 <title><literal>domain_udt_usage</literal></title>
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.
1091 <title><literal>domain_udt_usage</literal> Columns</title>
1097 <entry>Data Type</entry>
1098 <entry>Description</entry>
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>
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>
1116 <entry><literal>udt_name</literal></entry>
1117 <entry><type>sql_identifier</type></entry>
1118 <entry>Name of the domain data type</entry>
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>
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>
1134 <entry><literal>domain_name</literal</entry>
1135 <entry><type>sql_identifier</type></entry>
1136 <entry>Name of the domain</entry>
1143 <sect1 id="infoschema-domains">
1144 <title><literal>domains</literal></title>
1147 The view <literal>domains</literal> contains all domains defined in
1148 the current database.
1152 <title><literal>domains</literal> Columns</title>
1158 <entry>Data Type</entry>
1159 <entry>Description</entry>
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>
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>
1177 <entry><literal>domain_name</literal</entry>
1178 <entry><type>sql_identifier</type></entry>
1179 <entry>Name of the domain</entry>
1183 <entry><literal>data_type</literal></entry>
1184 <entry><type>character_data</type></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
1196 <entry><literal>character_maximum_length</literal></entry>
1197 <entry><type>cardinal_number</type></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.
1206 <entry><literal>character_octet_length</literal></entry>
1207 <entry><type>cardinal_number</type></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.
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>
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>
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>
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>
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>
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>
1252 <entry><literal>numeric_precision</literal></entry>
1253 <entry><type>cardinal_number</type></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.
1266 <entry><literal>numeric_precision_radix</literal></entry>
1267 <entry><type>cardinal_number</type></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.
1278 <entry><literal>numeric_scale</literal></entry>
1279 <entry><type>cardinal_number</type></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.
1292 <entry><literal>datetime_precision</literal></entry>
1293 <entry><type>cardinal_number</type></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
1302 <entry><literal>interval_type</literal></entry>
1303 <entry><type>character_data</type></entry>
1304 <entry>Not yet implemented</entry>
1308 <entry><literal>interval_precision</literal></entry>
1309 <entry><type>character_data</type></entry>
1310 <entry>Not yet implemented</entry>
1314 <entry><literal>domain_default</literal></entry>
1315 <entry><type>character_data</type></entry>
1316 <entry>Default expression of the domain</entry>
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>
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>
1332 <entry><literal>udt_name</literal></entry>
1333 <entry><type>sql_identifier</type></entry>
1334 <entry>Name of the domain data type</entry>
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>
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>
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>
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>
1362 <entry><literal>dtd_identifier</literal></entry>
1363 <entry><type>sql_identifier</type></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.)
1379 <sect1 id="infoschema-element-types">
1380 <title><literal>element_types</literal></title>
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
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;
1400 This view only includes objects that the current user has access
1401 to, by way of being the owner or having some privilege.
1405 <title><literal>element_types</literal> Columns</title>
1411 <entry>Data Type</entry>
1412 <entry>Description</entry>
1418 <entry><literal>object_catalog</literal></entry>
1419 <entry><type>sql_identifier</type></entry>
1421 Name of the database that contains the object that uses the
1422 array being described (always the current database)
1427 <entry><literal>object_schema</literal</entry>
1428 <entry><type>sql_identifier</type></entry>
1430 Name of the schema that contains the object that uses the array
1436 <entry><literal>object_name</literal</entry>
1437 <entry><type>sql_identifier</type></entry>
1439 Name of the object that uses the array being described
1444 <entry><literal>object_type</literal</entry>
1445 <entry><type>character_data</type></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).
1456 <entry><literal>array_type_identifier</literal</entry>
1457 <entry><type>sql_identifier</type></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
1467 <entry><literal>data_type</literal></entry>
1468 <entry><type>character_data</type></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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
1562 <entry><literal>domain_default</literal></entry>
1563 <entry><type>character_data</type></entry>
1564 <entry>Not yet implemented</entry>
1568 <entry><literal>udt_catalog</literal></entry>
1569 <entry><type>sql_identifier</type></entry>
1571 Name of the database that the data type of the elements is
1572 defined in (always the current database)
1577 <entry><literal>udt_schema</literal></entry>
1578 <entry><type>sql_identifier</type></entry>
1580 Name of the schema that the data type of the elements is
1586 <entry><literal>udt_name</literal></entry>
1587 <entry><type>sql_identifier</type></entry>
1589 Name of the data type of the elements
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>
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>
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>
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>
1618 <entry><literal>dtd_identifier</literal></entry>
1619 <entry><type>sql_identifier</type></entry>
1621 An identifier of the data type descriptor of the element. This
1622 is currently not useful.
1630 <sect1 id="infoschema-key-column-usage">
1631 <title><literal>key_column_usage</literal></title>
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.
1642 <title><literal>key_column_usage</literal> Columns</title>
1648 <entry>Data Type</entry>
1649 <entry>Description</entry>
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>
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>
1667 <entry><literal>constraint_name</literal</entry>
1668 <entry><type>sql_identifier</type></entry>
1669 <entry>Name of the constraint</entry>
1673 <entry><literal>table_catalog</literal></entry>
1674 <entry><type>sql_identifier</type></entry>
1676 Name of the database that contains the table that contains the
1677 column that is restricted by some constraint (always the
1683 <entry><literal>table_schema</literal</entry>
1684 <entry><type>sql_identifier</type></entry>
1686 Name of the schema that contains the table that contains the
1687 column that is restricted by some constraint
1692 <entry><literal>table_name</literal</entry>
1693 <entry><type>sql_identifier</type></entry>
1695 Name of the table that contains the column that is restricted
1701 <entry><literal>column_name</literal</entry>
1702 <entry><type>sql_identifier</type></entry>
1704 Name of the column that is restricted by some constraint
1709 <entry><literal>ordinal_position</literal</entry>
1710 <entry><type>cardinal_number</type></entry>
1712 Ordinal position of the column within the constraint key (count
1721 <sect1 id="infoschema-parameters">
1722 <title><literal>parameters</literal></title>
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).
1732 <title><literal>parameters</literal> Columns</title>
1738 <entry>Data Type</entry>
1739 <entry>Description</entry>
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>
1751 <entry><literal>specific_schema</literal></entry>
1752 <entry><type>sql_identifier</type></entry>
1753 <entry>Name of the schema containing the function</entry>
1757 <entry><literal>specific_name</literal></entry>
1758 <entry><type>sql_identifier</type></entry>
1760 The <quote>specific name</quote> of the function. See <xref
1761 linkend="infoschema-routines"> for more information.
1766 <entry><literal>ordinal_position</literal></entry>
1767 <entry><type>cardinal_number</type></entry>
1769 Ordinal position of the parameter in the argument list of the
1770 function (count starts at 1)
1775 <entry><literal>parameter_mode</literal></entry>
1776 <entry><type>character_data</type></entry>
1778 Always <literal>IN</literal>, meaning input parameter (In the
1779 future there might be other parameter modes.)
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>
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>
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>
1802 <entry><literal>data_type</literal></entry>
1803 <entry><type>character_data</type></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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
1899 <entry><literal>udt_catalog</literal></entry>
1900 <entry><type>sql_identifier</type></entry>
1902 Name of the database that the data type of the parameter is
1903 defined in (always the current database)
1908 <entry><literal>udt_schema</literal></entry>
1909 <entry><type>sql_identifier</type></entry>
1911 Name of the schema that the data type of the parameter is
1917 <entry><literal>udt_name</literal></entry>
1918 <entry><type>sql_identifier</type></entry>
1920 Name of the data type of the parameter
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>
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>
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>
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>
1949 <entry><literal>dtd_identifier</literal></entry>
1950 <entry><type>sql_identifier</type></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.)
1965 <sect1 id="infoschema-referential-constraints">
1966 <title><literal>referential_constraints</literal></title>
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.
1975 <title><literal>referential_constraints</literal> Columns</title>
1981 <entry>Data Type</entry>
1982 <entry>Description</entry>
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>
1994 <entry><literal>constraint_schema</literal></entry>
1995 <entry><literal>sql_identifier</literal></entry>
1996 <entry>Name of the schema containing the constraint</entry>
2000 <entry><literal>constraint_name</literal></entry>
2001 <entry><literal>sql_identifier</literal></entry>
2002 <entry>Name of the constraint</entry>
2006 <entry><literal>unique_constraint_catalog</literal></entry>
2007 <entry><literal>sql_identifier</literal></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)
2016 <entry><literal>unique_constraint_schema</literal></entry>
2017 <entry><literal>sql_identifier</literal></entry>
2019 Name of the schema that contains the unique or primary key
2020 constraint that the foreign key constraint references
2025 <entry><literal>unique_constraint_name</literal></entry>
2026 <entry><literal>sql_identifier</literal></entry>
2028 Name of the unique or primary key constraint that the foreign
2029 key constraint references
2034 <entry><literal>match_option</literal></entry>
2035 <entry><literal>character_data</literal></entry>
2037 Match option of the foreign key constraint:
2038 <literal>FULL</literal>, <literal>PARTIAL</literal>, or
2039 <literal>NONE</literal>.
2044 <entry><literal>update_rule</literal></entry>
2045 <entry><literal>character_data</literal></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>.
2055 <entry><literal>delete_rule</literal></entry>
2056 <entry><literal>character_data</literal></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>.
2069 <sect1 id="infoschema-routine-privileges">
2070 <title><literal>routine_privileges</literal></title>
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.
2080 <title><literal>routine_privileges</literal> Columns</title>
2086 <entry>Data Type</entry>
2087 <entry>Description</entry>
2093 <entry><literal>grantor</literal></entry>
2094 <entry><type>sql_identifier</type></entry>
2095 <entry>Name of the user that granted the privilege</entry>
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>
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>
2111 <entry><literal>specific_schema</literal></entry>
2112 <entry><type>sql_identifier</type></entry>
2113 <entry>Name of the schema containing the function</entry>
2117 <entry><literal>specific_name</literal></entry>
2118 <entry><type>sql_identifier</type></entry>
2120 The <quote>specific name</quote> of the function. See <xref
2121 linkend="infoschema-routines"> for more information.
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>
2132 <entry><literal>routine_schema</literal></entry>
2133 <entry><type>sql_identifier</type></entry>
2134 <entry>Name of the schema containing the function</entry>
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>
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>
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>
2159 <sect1 id="infoschema-routines">
2160 <title><literal>routines</literal></title>
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
2170 <title><literal>routines</literal> Columns</title>
2176 <entry>Data Type</entry>
2177 <entry>Description</entry>
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>
2189 <entry><literal>specific_schema</literal></entry>
2190 <entry><type>sql_identifier</type></entry>
2191 <entry>Name of the schema containing the function</entry>
2195 <entry><literal>specific_name</literal></entry>
2196 <entry><type>sql_identifier</type></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.
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>
2213 <entry><literal>routine_schema</literal></entry>
2214 <entry><type>sql_identifier</type></entry>
2215 <entry>Name of the schema containing the function</entry>
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>
2225 <entry><literal>routine_type</literal></entry>
2226 <entry><type>character_data</type></entry>
2228 Always <literal>FUNCTION</literal> (In the future there might
2229 be other types of routines.)
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>
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>
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>
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>
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>
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>
2270 <entry><literal>data_type</literal></entry>
2271 <entry><type>character_data</type></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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
2367 <entry><literal>type_udt_catalog</literal></entry>
2368 <entry><type>sql_identifier</type></entry>
2370 Name of the database that the return data type of the function
2371 is defined in (always the current database)
2376 <entry><literal>type_udt_schema</literal></entry>
2377 <entry><type>sql_identifier</type></entry>
2379 Name of the schema that the return data type of the function is
2385 <entry><literal>type_udt_name</literal></entry>
2386 <entry><type>sql_identifier</type></entry>
2388 Name of the return data type of the function
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>
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>
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>
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>
2417 <entry><literal>dtd_identifier</literal></entry>
2418 <entry><type>sql_identifier</type></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.)
2430 <entry><literal>routine_body</literal></entry>
2431 <entry><type>character_data</type></entry>
2433 If the function is an SQL function, then
2434 <literal>SQL</literal>, else <literal>EXTERNAL</literal>.
2439 <entry><literal>routine_definition</literal></entry>
2440 <entry><type>character_data</type></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.)
2452 <entry><literal>external_name</literal></entry>
2453 <entry><type>character_data</type></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>.)
2463 <entry><literal>external_language</literal></entry>
2464 <entry><type>character_data</type></entry>
2465 <entry>The language the function is written in</entry>
2469 <entry><literal>parameter_style</literal></entry>
2470 <entry><type>character_data</type></entry>
2472 Always <literal>GENERAL</literal> (The SQL standard defines
2473 other parameter styles, which are not available in PostgreSQL.)
2478 <entry><literal>is_deterministic</literal></entry>
2479 <entry><type>character_data</type></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.)
2489 <entry><literal>sql_data_access</literal></entry>
2490 <entry><type>character_data</type></entry>
2492 Always <literal>MODIFIES</literal>, meaning that the function
2493 possibly modifies SQL data. This information is not useful for
2499 <entry><literal>is_null_call</literal></entry>
2500 <entry><type>character_data</type></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>.
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>
2515 <entry><literal>schema_level_routine</literal></entry>
2516 <entry><type>character_data</type></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
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>
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>
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>
2543 <entry><literal>security_type</literal></entry>
2544 <entry><type>character_data</type></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>.
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>
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>
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>
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>
2581 <sect1 id="infoschema-schemata">
2582 <title><literal>schemata</literal></title>
2585 The view <literal>schemata</literal> contains all schemas in the
2586 current database that are owned by the current user.
2590 <title><literal>schemata</literal> Columns</title>
2596 <entry>Data Type</entry>
2597 <entry>Description</entry>
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>
2609 <entry><literal>schema_name</literal></entry>
2610 <entry><type>sql_identifier</type></entry>
2611 <entry>Name of the schema</entry>
2615 <entry><literal>schema_owner</literal></entry>
2616 <entry><type>sql_identifier</type></entry>
2617 <entry>Name of the owner of the schema</entry>
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>
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>
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>
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>
2648 <sect1 id="infoschema-sql-features">
2649 <title><literal>sql_features</literal></title>
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.
2660 <title><literal>sql_features</literal> Columns</title>
2666 <entry>Data Type</entry>
2667 <entry>Description</entry>
2673 <entry><literal>feature_id</literal></entry>
2674 <entry><type>character_data</type></entry>
2675 <entry>Identifier string of the feature</entry>
2679 <entry><literal>feature_name</literal></entry>
2680 <entry><type>character_data</type></entry>
2681 <entry>Descriptive name of the feature</entry>
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>
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>
2697 <entry><literal>is_supported</literal></entry>
2698 <entry><type>character_data</type></entry>
2700 <literal>YES</literal> if the feature is fully supported by the
2701 current version of PostgreSQL, <literal>NO</literal> if not
2706 <entry><literal>is_verified_by</literal></entry>
2707 <entry><type>character_data</type></entry>
2709 Always null, since the PostgreSQL development group does not
2710 perform formal testing of feature conformance
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>
2724 <sect1 id="infoschema-sql-implementation-info">
2725 <title><literal>sql_implementation_info</literal></title>
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.
2739 <title><literal>sql_implementation_info</literal> Columns</title>
2745 <entry>Data Type</entry>
2746 <entry>Description</entry>
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>
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>
2764 <entry><literal>integer_value</literal></entry>
2765 <entry><type>cardinal_number</type></entry>
2767 Value of the implementation information item, or null if the
2768 value is contained in the column
2769 <literal>character_value</literal>
2774 <entry><literal>character_value</literal></entry>
2775 <entry><type>character_data</type></entry>
2777 Value of the implementation information item, or null if the
2778 value is contained in the column
2779 <literal>integer_value</literal>
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>
2793 <sect1 id="infoschema-sql-languages">
2794 <title><literal>sql_languages</literal></title>
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.
2804 <title><literal>sql_languages</literal> Columns</title>
2810 <entry>Data Type</entry>
2811 <entry>Description</entry>
2817 <entry><literal>sql_language_source</literal></entry>
2818 <entry><type>character_data</type></entry>
2820 The name of the source of the language definition; always
2821 <literal>ISO 9075</literal>, that is, the SQL standard
2826 <entry><literal>sql_language_year</literal></entry>
2827 <entry><type>character_data</type></entry>
2829 The year the standard referenced in
2830 <literal>sql_language_source</literal> was approved; currently
2836 <entry><literal>sql_language_comformance</literal></entry>
2837 <entry><type>character_data</type></entry>
2839 The standard conformance level for the language binding. For
2840 ISO 9075:1999 this is always <literal>CORE</literal>.
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>
2851 <entry><literal>sql_language_implementation</literal></entry>
2852 <entry><type>character_data</type></entry>
2853 <entry>Always null</entry>
2857 <entry><literal>sql_language_binding_style</literal></entry>
2858 <entry><type>character_data</type></entry>
2860 The language binding style, either <literal>DIRECT</literal> or
2861 <literal>EMBEDDED</literal>
2866 <entry><literal>sql_language_programming_language</literal></entry>
2867 <entry><type>character_data</type></entry>
2869 The programming language, if the binding style is
2870 <literal>EMBEDDED</literal>, else null. PostgreSQL only
2871 supports the language C.
2879 <sect1 id="infoschema-sql-packages">
2880 <title><literal>sql_packages</literal></title>
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.
2890 <title><literal>sql_packages</literal> Columns</title>
2896 <entry>Data Type</entry>
2897 <entry>Description</entry>
2903 <entry><literal>feature_id</literal></entry>
2904 <entry><type>character_data</type></entry>
2905 <entry>Identifier string of the package</entry>
2909 <entry><literal>feature_name</literal></entry>
2910 <entry><type>character_data</type></entry>
2911 <entry>Descriptive name of the package</entry>
2915 <entry><literal>is_supported</literal></entry>
2916 <entry><type>character_data</type></entry>
2918 <literal>YES</literal> if the package is fully supported by the
2919 current version of PostgreSQL, <literal>NO</literal> if not
2924 <entry><literal>is_verified_by</literal></entry>
2925 <entry><type>character_data</type></entry>
2927 Always null, since the PostgreSQL development group does not
2928 perform formal testing of feature conformance
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>
2942 <sect1 id="infoschema-sql-sizing">
2943 <title><literal>sql_sizing</literal></title>
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.
2956 <title><literal>sql_sizing</literal> Columns</title>
2962 <entry>Data Type</entry>
2963 <entry>Description</entry>
2969 <entry><literal>sizing_id</literal></entry>
2970 <entry><type>cardinal_number</type></entry>
2971 <entry>Identifier of the sizing item</entry>
2975 <entry><literal>sizing_name</literal></entry>
2976 <entry><type>character_data</type></entry>
2977 <entry>Descriptive name of the sizing item</entry>
2981 <entry><literal>supported_value</literal></entry>
2982 <entry><type>cardinal_number</type></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
2991 <entry><literal>comments</literal></entry>
2992 <entry><type>character_data</type></entry>
2993 <entry>Possibly a comment pertaining to the sizing item</entry>
3000 <sect1 id="infoschema-sql-sizing-profiles">
3001 <title><literal>sql_sizing_profiles</literal></title>
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.
3011 <title><literal>sql_sizing_profiles</literal> Columns</title>
3017 <entry>Data Type</entry>
3018 <entry>Description</entry>
3024 <entry><literal>sizing_id</literal></entry>
3025 <entry><type>cardinal_number</type></entry>
3026 <entry>Identifier of the sizing item</entry>
3030 <entry><literal>sizing_name</literal></entry>
3031 <entry><type>character_data</type></entry>
3032 <entry>Descriptive name of the sizing item</entry>
3036 <entry><literal>profile_id</literal></entry>
3037 <entry><type>character_data</type></entry>
3038 <entry>Identifier string of a profile</entry>
3042 <entry><literal>required_value</literal></entry>
3043 <entry><type>cardinal_number</type></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
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>
3062 <sect1 id="infoschema-table-constraints">
3063 <title><literal>table_constraints</literal></title>
3066 The view <literal>table_constraints</literal> contains all
3067 constraints belonging to tables owned by the current user.
3071 <title><literal>table_constraints</literal> Columns</title>
3077 <entry>Data Type</entry>
3078 <entry>Description</entry>
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>
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>
3096 <entry><literal>constraint_name</literal</entry>
3097 <entry><type>sql_identifier</type></entry>
3098 <entry>Name of the constraint</entry>
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>
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>
3114 <entry><literal>table_name</literal</entry>
3115 <entry><type>sql_identifier</type></entry>
3116 <entry>Name of the table</entry>
3120 <entry><literal>constraint_type</literal</entry>
3121 <entry><type>character_data</type></entry>
3123 Type of the constraint: <literal>CHECK</literal>,
3124 <literal>FOREIGN KEY</literal>, <literal>PRIMARY KEY</literal>,
3125 or <literal>UNIQUE</literal>
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>
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>
3145 <sect1 id="infoschema-table-privileges">
3146 <title><literal>table_privileges</literal></title>
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
3156 <title><literal>table_privileges</literal> Columns</title>
3162 <entry>Data Type</entry>
3163 <entry>Description</entry>
3169 <entry><literal>grantor</literal></entry>
3170 <entry><type>sql_identifier</type></entry>
3171 <entry>Name of the user that granted the privilege</entry>
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>
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>
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>
3193 <entry><literal>table_name</literal</entry>
3194 <entry><type>sql_identifier</type></entry>
3195 <entry>Name of the table</entry>
3199 <entry><literal>privilege_type</literal</entry>
3200 <entry><type>character_data</type></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>
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>
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>
3225 <sect1 id="infoschema-tables">
3226 <title><literal>tables</literal></title>
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).
3236 <title><literal>tables</literal> Columns</title>
3242 <entry>Data Type</entry>
3243 <entry>Description</entry>
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>
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>
3261 <entry><literal>table_name</literal</entry>
3262 <entry><type>sql_identifier</type></entry>
3263 <entry>Name of the table</entry>
3267 <entry><literal>table_type</literal</entry>
3268 <entry><type>character_data</type></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
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>
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>
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>
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>
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>
3311 <sect1 id="infoschema-triggers">
3312 <title><literal>triggers</literal></title>
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.)
3321 <title><literal>triggers</literal> Columns</title>
3327 <entry>Data Type</entry>
3328 <entry>Description</entry>
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>
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>
3346 <entry><literal>trigger_name</literal</entry>
3347 <entry><type>sql_identifier</type></entry>
3348 <entry>Name of the trigger</entry>
3352 <entry><literal>event_manipulation</literal</entry>
3353 <entry><type>character_data</type></entry>
3355 Event that fires the trigger (<literal>INSERT</literal>,
3356 <literal>UPDATE</literal>, or <literal>DELETE</literal>)
3361 <entry><literal>event_object_catalog</literal></entry>
3362 <entry><type>sql_identifier</type></entry>
3364 Name of the database that contains the table that the trigger
3365 is defined on (always the current database)
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>
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>
3382 <entry><literal>action_order</literal</entry>
3383 <entry><type>cardinal_number</type></entry>
3384 <entry>Not yet implemented</entry>
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>
3394 <entry><literal>action_statement</literal</entry>
3395 <entry><type>character_data</type></entry>
3397 Statement that is executed by the trigger (currently always
3398 <literal>EXECUTE PROCEDURE
3399 <replaceable>function</replaceable>(...)</literal>)
3404 <entry><literal>action_orientation</literal</entry>
3405 <entry><type>character_data</type></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>)
3414 <entry><literal>condition_timing</literal</entry>
3415 <entry><type>character_data</type></entry>
3417 Time at which the trigger fires (<literal>BEFORE</literal> or
3418 <literal>AFTER</literal>)
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>
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>
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.
3462 <sect1 id="infoschema-view-column-usage">
3463 <title><literal>view_column_usage</literal></title>
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.
3475 Columns of system tables are not included. This should be fixed
3481 <title><literal>view_column_usage</literal> Columns</title>
3487 <entry>Data Type</entry>
3488 <entry>Description</entry>
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>
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>
3506 <entry><literal>view_name</literal</entry>
3507 <entry><type>sql_identifier</type></entry>
3508 <entry>Name of the view</entry>
3512 <entry><literal>table_catalog</literal></entry>
3513 <entry><type>sql_identifier</type></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)
3521 <entry><literal>table_schema</literal</entry>
3522 <entry><type>sql_identifier</type></entry>
3524 Name of the schema that contains the table that contains the
3525 column that is used by the view
3530 <entry><literal>table_name</literal</entry>
3531 <entry><type>sql_identifier</type></entry>
3533 Name of the table that contains the column that is used by the
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>
3548 <sect1 id="infoschema-view-table-usage">
3549 <title><literal>view_table_usage</literal></title>
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
3561 System tables are not included. This should be fixed sometime.
3566 <title><literal>view_table_usage</literal> Columns</title>
3572 <entry>Data Type</entry>
3573 <entry>Description</entry>
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>
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>
3591 <entry><literal>view_name</literal</entry>
3592 <entry><type>sql_identifier</type></entry>
3593 <entry>Name of the view</entry>
3597 <entry><literal>table_catalog</literal></entry>
3598 <entry><type>sql_identifier</type></entry>
3600 Name of the database that contains the table the table that is
3601 used by the view (always the current database)
3606 <entry><literal>table_schema</literal</entry>
3607 <entry><type>sql_identifier</type></entry>
3609 Name of the schema that contains the table that is used by the
3615 <entry><literal>table_name</literal</entry>
3616 <entry><type>sql_identifier</type></entry>
3618 Name of the table that is used by the view
3626 <sect1 id="infoschema-views">
3627 <title><literal>views</literal></title>
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).
3636 <title><literal>views</literal> Columns</title>
3642 <entry>Data Type</entry>
3643 <entry>Description</entry>
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>
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>
3661 <entry><literal>table_name</literal</entry>
3662 <entry><type>sql_identifier</type></entry>
3663 <entry>Name of the view</entry>
3667 <entry><literal>view definition</literal</entry>
3668 <entry><type>character_data</type></entry>
3670 Query expression defining the view (null if the current user is
3671 not the owner of the view)
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>
3682 <entry><literal>is_updatable</literal></entry>
3683 <entry><type>character_data</type></entry>
3684 <entry>Not yet implemented</entry>
3688 <entry><literal>is_insertable_into</literal></entry>
3689 <entry><type>character_data</type></entry>
3690 <entry>Not yet implemented</entry>