Skip to content

Instantly share code, notes, and snippets.

@rob-murray
Last active May 31, 2018 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rob-murray/d38500e73746284b23a23d9d85205477 to your computer and use it in GitHub Desktop.
Save rob-murray/d38500e73746284b23a23d9d85205477 to your computer and use it in GitHub Desktop.
PG list enums
select n.nspname as enum_schema,
t.typname as enum_name,
string_agg(e.enumlabel, ', ') as enum_values
from pg_type t
join pg_enum e on t.oid = e.enumtypid
join pg_catalog.pg_namespace n ON n.oid = t.typnamespace
group by n.nspname, t.typname
order by enum_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment