I have an enumerated type on PostgreSQL, and I want to create a view that has a column for each enumerated value.
My use case is similar to this question. I have a jsonb column that I want to turn into a view with columns made up of the keys of the json blob. The difference in my case is that the valid keys are defined in an enum rather than aggregated from the objects themselves.
The following SQL statement is essentially what I want to do, but doesn't work:
SELECT json_populate_record(null::activity_type_enum, activities) from some_table;
Is there a way to cast the enumerated type into what is expected by the first argument of json_populate_record
?