Reputation: 13527
I created an enum like this:
CREATE TYPE status as ENUM ('INVALID', 'VALID', 'EXPIRED');
How can I query the database to get the possible values for this enum? I tried something like this:
SELECT * FROM status;
Doesn't work. Any ideas as to how to do this?
Upvotes: 0
Views: 297
Reputation:
Something like this:
select e.enumlabel
from pg_type t
join pg_enum e on t.oid = e.enumtypid
join pg_catalog.pg_namespace n ON n.oid = t.typnamespace
where t.typname = 'status'
and n.nspname = 'public';
Upvotes: 2