4 The view element_types contains the data type descriptors of the
5 elements of arrays. When a table column, composite-type attribute,
6 domain, function parameter, or function return value is defined to be
7 of an array type, the respective information schema view only contains
8 ARRAY in the column data_type. To obtain information on the element
9 type of the array, you can join the respective view with this view. For
10 example, to show the columns of a table with data types and array
11 element types, if applicable, you could do:
12 SELECT c.column_name, c.data_type, e.data_type AS element_type
13 FROM information_schema.columns c LEFT JOIN information_schema.element_types e
14 ON ((c.table_catalog, c.table_schema, c.table_name, 'TABLE', c.dtd_identifi
16 = (e.object_catalog, e.object_schema, e.object_name, e.object_type, e.col
17 lection_type_identifier))
18 WHERE c.table_schema = '...' AND c.table_name = '...'
19 ORDER BY c.ordinal_position;
21 This view only includes objects that the current user has access to, by
22 way of being the owner or having some privilege.
24 Table 35.22. element_types Columns
30 object_catalog sql_identifier
32 Name of the database that contains the object that uses the array being
33 described (always the current database)
35 object_schema sql_identifier
37 Name of the schema that contains the object that uses the array being
40 object_name sql_identifier
42 Name of the object that uses the array being described
44 object_type character_data
46 The type of the object that uses the array being described: one of
47 TABLE (the array is used by a column of that table), USER-DEFINED TYPE
48 (the array is used by an attribute of that composite type), DOMAIN (the
49 array is used by that domain), ROUTINE (the array is used by a
50 parameter or the return data type of that function).
52 collection_type_identifier sql_identifier
54 The identifier of the data type descriptor of the array being
55 described. Use this to join with the dtd_identifier columns of other
56 information schema views.
58 data_type character_data
60 Data type of the array elements, if it is a built-in type, else
61 USER-DEFINED (in that case, the type is identified in udt_name and
64 character_maximum_length cardinal_number
66 Always null, since this information is not applied to array element
67 data types in PostgreSQL
69 character_octet_length cardinal_number
71 Always null, since this information is not applied to array element
72 data types in PostgreSQL
74 character_set_catalog sql_identifier
76 Applies to a feature not available in PostgreSQL
78 character_set_schema sql_identifier
80 Applies to a feature not available in PostgreSQL
82 character_set_name sql_identifier
84 Applies to a feature not available in PostgreSQL
86 collation_catalog sql_identifier
88 Name of the database containing the collation of the element type
89 (always the current database), null if default or the data type of the
90 element is not collatable
92 collation_schema sql_identifier
94 Name of the schema containing the collation of the element type, null
95 if default or the data type of the element is not collatable
97 collation_name sql_identifier
99 Name of the collation of the element type, null if default or the data
100 type of the element is not collatable
102 numeric_precision cardinal_number
104 Always null, since this information is not applied to array element
105 data types in PostgreSQL
107 numeric_precision_radix cardinal_number
109 Always null, since this information is not applied to array element
110 data types in PostgreSQL
112 numeric_scale cardinal_number
114 Always null, since this information is not applied to array element
115 data types in PostgreSQL
117 datetime_precision cardinal_number
119 Always null, since this information is not applied to array element
120 data types in PostgreSQL
122 interval_type character_data
124 Always null, since this information is not applied to array element
125 data types in PostgreSQL
127 interval_precision cardinal_number
129 Always null, since this information is not applied to array element
130 data types in PostgreSQL
132 udt_catalog sql_identifier
134 Name of the database that the data type of the elements is defined in
135 (always the current database)
137 udt_schema sql_identifier
139 Name of the schema that the data type of the elements is defined in
141 udt_name sql_identifier
143 Name of the data type of the elements
145 scope_catalog sql_identifier
147 Applies to a feature not available in PostgreSQL
149 scope_schema sql_identifier
151 Applies to a feature not available in PostgreSQL
153 scope_name sql_identifier
155 Applies to a feature not available in PostgreSQL
157 maximum_cardinality cardinal_number
159 Always null, because arrays always have unlimited maximum cardinality
162 dtd_identifier sql_identifier
164 An identifier of the data type descriptor of the element. This is
165 currently not useful.