SELECT nspname AS type_schema, typname, array_agg(enumlabel ORDER BY enumsortorder) AS values,
(SELECT string_agg(ns.nspname || '.' || cl.relname || '.' || at.attname, '; ' ORDER BY nspname, relname, attname) AS s
FROM pg_attribute AS at INNER JOIN pg_class AS cl ON at.attrelid=cl.oid
INNER JOIN pg_namespace AS ns ON cl.relnamespace=ns.oid
WHERE at.atttypid=t.oid AND cl.relkind='r') AS columns
FROM pg_catalog.pg_type t LEFT JOIN pg_catalog.pg_enum e ON t.oid=e.enumtypid
INNER JOIN pg_catalog.pg_namespace n ON n.oid=t.typnamespace
WHERE nspname NOT IN (SELECT schema_name
FROM INFORMATION_SCHEMA.schemata
WHERE schema_name<>'public' AND
schema_owner='postgres' AND schema_name IS NOT NULL)
AND typtype='e'
GROUP BY t.oid, nspname, typname
ORDER BY nspname, typname;
Collections
This query belongs to the following collections:
Name
Description
Find problems about base tables
A selection of queries that return information about the data types, field sizes, default values as well as general structure of base tables. Contains all the types of queries - problem detection, software measure, and general overview
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.