SELECT n.nspname AS type_schema,
t.typname AS type_name,
(SELECT string_agg(attname || ' ' || typname, ', ' ORDER BY attnum) AS type_structure
FROM pg_attribute INNER JOIN pg_type ON pg_attribute.atttypid=pg_type.oid
WHERE pg_attribute.attrelid=t.typrelid
AND pg_attribute.attisdropped='f'
AND pg_attribute.attnum>0) AS type_structure
FROM pg_type AS t INNER JOIN pg_namespace AS n ON n.oid=t.typnamespace
INNER JOIN pg_authid AS a ON n.nspowner=a.oid
WHERE (n.nspname='public' OR rolname<>'postgres')
AND t.typtype='c'
AND NOT EXISTS (SELECT *
FROM pg_class
WHERE pg_class.reltype=t.oid
AND pg_class.relkind<>'c')
ORDER BY type_schema, type_name;
Collections
This query belongs to the following collections:
Name
Description
Find problems by overview
Queries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .
Categories
This query is classified under the following categories:
Name
Description
Data types
Queries of this category provide information about the data types and their usage.
User-defined types
Queries of this category provide information about user-defined types in the database.