SELECT
n.nspname AS table_schema,
c.relname AS table_name,
at.attname AS column_name,
n_type.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_attribute at INNER JOIN pg_class c ON at.attrelid=c.oid
INNER JOIN pg_namespace AS n ON n.oid=c.relnamespace
INNER JOIN pg_authid AS a ON n.nspowner=a.oid
INNER JOIN pg_type AS t ON at.atttypid=t.oid
INNER JOIN pg_class AS c_type ON t.typrelid=c_type.oid
INNER JOIN pg_namespace AS n_type ON n_type.oid=c_type.relnamespace
WHERE (n.nspname='public' OR rolname<>'postgres')
AND c.relkind='r'
AND at.attisdropped='f'
AND at.attnum>0
AND t.typtype='c'
ORDER BY table_schema, table_name, column_name;