Created
February 2, 2026 19:12
-
-
Save luiz/abae946a34604cbd39324d6c0f4f2b22 to your computer and use it in GitHub Desktop.
Get enum type allowed values (Postgres)
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
| SELECT | |
| n.nspname AS enum_schema, | |
| t.typname AS enum_name, | |
| e.enumlabel AS enum_value | |
| FROM | |
| pg_type t | |
| JOIN | |
| pg_enum e ON t.oid = e.enumtypid | |
| JOIN | |
| pg_namespace n ON n.oid = t.typnamespace | |
| WHERE | |
| t.typtype = 'e' -- Filters for ENUM types | |
| AND t.typname = 'XXXXX' -- replace here | |
| ORDER BY | |
| enum_schema, enum_name, e.enumsortorder; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment