To convert an existing
text array to the enum type
letter (like you ask) simply cast:
To actually convert the table column (like you probably wanted to ask):
ALTER TABLE sample ALTER letter_data TYPE letter USING letter_data::letter;
Triggers a whole-table rewrite. Only some noted exceptions allow in-place conversion. See:
We need the explicit cast in a
USING clause since, quoting the manual for
USING clause must be provided if there is no implicit or assignment cast from old to new type.
Aside: I rarely use
enum types. There is often a better solution.