Skip to content

Instantly share code, notes, and snippets.

@rcanepa
Last active July 27, 2017 21:51
Show Gist options
  • Select an option

  • Save rcanepa/b0ae87479a57a15aced7cbe33d5a2180 to your computer and use it in GitHub Desktop.

Select an option

Save rcanepa/b0ae87479a57a15aced7cbe33d5a2180 to your computer and use it in GitHub Desktop.
Get values from a PostgreSQL enum
-- Returns an array of all values
SELECT enum_range(NULL::my_enum_name)
-- Returns a row for each value
SELECT unnest(enum_range(NULL::my_enum_name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment