Last active
July 27, 2017 21:51
-
-
Save rcanepa/b0ae87479a57a15aced7cbe33d5a2180 to your computer and use it in GitHub Desktop.
Get values from a PostgreSQL enum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 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