The view element_types contains the data type
- descriptors of the elements of arrays. When a table column,
+ descriptors of the elements of arrays. When a table column, composite-type attribute,
domain, function parameter, or function return value is defined to
be of an array type, the respective information schema view only
contains ARRAY in the column
The type of the object that uses the array being described: one
of TABLE (the array is used by a column of
- that table), DOMAIN (the array is used by
- that domain), ROUTINE (the array is used by
- a parameter or the return data type of that function).
+ that table), USER-DEFINED TYPE (the array is
+ used by an attribute of that composite type),
+ DOMAIN (the array is used by that domain),
+ ROUTINE (the array is used by a parameter or
+ the return data type of that function).
FROM pg_namespace n, pg_type at, pg_namespace nbt, pg_type bt,
(
- /* columns */
+ /* columns, attributes */
SELECT c.relnamespace, CAST(c.relname AS sql_identifier),
- 'TABLE'::text, a.attnum, a.atttypid
+ CASE WHEN c.relkind = 'c' THEN 'USER-DEFINED TYPE'::text ELSE 'TABLE'::text END,
+ a.attnum, a.atttypid
FROM pg_class c, pg_attribute a
WHERE c.oid = a.attrelid
- AND c.relkind IN ('r', 'v', 'f')
+ AND c.relkind IN ('r', 'v', 'f', 'c')
AND attnum > 0 AND NOT attisdropped
UNION ALL