Goal Find all enumerated types.
Type General (Overview of some aspect of the database.)
License MIT License
Data Source INFORMATION_SCHEMA+system catalog
SQL Query
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:

NameDescription
Find problems about base tablesA 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 overviewQueries 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:

NameDescription
Data typesQueries of this category provide information about the data types and their usage.
User-defined typesQueries of this category provide information about user-defined types in the database.

Further reading and related materials:

Reference
https://www.postgresql.org/docs/current/datatype-enum.html