I am using this query to list the values that are part of an enum:
SELECT unnest(enum_range(null::my_enum_name)) AS enum_values;
It works.
I am trying to make it more reusable by wrapping it in a function that takes the name of the enum (my_enum_name
in the example above) as a parameter, but I can't find a lot of documentation on this.
Is it possible?
regtype
, but couldn't find a way to use it to castnull
in the query.