The suggested query to list ENUM types is great. But, it merely lists of the schema
and the typname
. How do I list out the actual ENUM values? For
This lists all enum-typed columns and their potential values:
SELECT
table_schema || '.' || table_name || '.' || column_name as field_name,
pg_enum.enumlabel as value
FROM pg_type
JOIN pg_enum ON pg_enum.enumtypid = pg_type.oid
JOIN pg_namespace on pg_type.typnamespace = pg_namespace.oid
JOIN information_schema.columns ON (information_schema.columns.udt_name = pg_type.typname AND information_schema.columns.udt_schema = pg_namespace.nspname)
WHERE pg_type.typtype = 'e'
ORDER BY field_name, pg_enum.enumsortorder;