Imagine I have a table members with a column role. I add the following constraint:
ALTER TABLE members ADD CONSTRAINT members_role_name CHECK (((role)::text = ANY ((ARRAY['participant'::character varying, 'invitee'::character varying, 'applicant'::character varying])::text[])));
It would be really nice if the type for role was not just string but 'participant' | 'invitee' | 'applicant'