Skip to content

Commit 5594d14

Browse files
committed
Add composite-type attributes to information_schema.element_types view
1 parent c533c14 commit 5594d14

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

doc/src/sgml/information_schema.sgml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@
21472147

21482148
<para>
21492149
The view <literal>element_types</literal> contains the data type
2150-
descriptors of the elements of arrays. When a table column,
2150+
descriptors of the elements of arrays. When a table column, composite-type attribute,
21512151
domain, function parameter, or function return value is defined to
21522152
be of an array type, the respective information schema view only
21532153
contains <literal>ARRAY</literal> in the column
@@ -2212,9 +2212,11 @@ ORDER BY c.ordinal_position;
22122212
<entry>
22132213
The type of the object that uses the array being described: one
22142214
of <literal>TABLE</literal> (the array is used by a column of
2215-
that table), <literal>DOMAIN</literal> (the array is used by
2216-
that domain), <literal>ROUTINE</literal> (the array is used by
2217-
a parameter or the return data type of that function).
2215+
that table), <literal>USER-DEFINED TYPE</literal> (the array is
2216+
used by an attribute of that composite type),
2217+
<literal>DOMAIN</literal> (the array is used by that domain),
2218+
<literal>ROUTINE</literal> (the array is used by a parameter or
2219+
the return data type of that function).
22182220
</entry>
22192221
</row>
22202222

src/backend/catalog/information_schema.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,12 +2467,13 @@ CREATE VIEW element_types AS
24672467

24682468
FROM pg_namespace n, pg_type at, pg_namespace nbt, pg_type bt,
24692469
(
2470-
/* columns */
2470+
/* columns, attributes */
24712471
SELECT c.relnamespace, CAST(c.relname AS sql_identifier),
2472-
'TABLE'::text, a.attnum, a.atttypid
2472+
CASE WHEN c.relkind = 'c' THEN 'USER-DEFINED TYPE'::text ELSE 'TABLE'::text END,
2473+
a.attnum, a.atttypid
24732474
FROM pg_class c, pg_attribute a
24742475
WHERE c.oid = a.attrelid
2475-
AND c.relkind IN ('r', 'v', 'f')
2476+
AND c.relkind IN ('r', 'v', 'f', 'c')
24762477
AND attnum > 0 AND NOT attisdropped
24772478

24782479
UNION ALL

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy