As it was mentioned above you can’t edit enum within transaction block. But you can create the new one. Here are the steps:
- Change type from request_type to varchar for all columns/tables which use this type:
ALTER TABLE table_name
ALTER COLUMN column_name TYPE VARCHAR(255);
- Drop and create again request_type enum:
DROP TYPE IF EXISTS request_type;
CREATE TYPE request_type AS ENUM (
'OLD_VALUE_1',
'OLD_VALUE_2',
'NEW_VALUE_1',
'NEW_VALUE_2'
);
- Revert type from varchar to request_type for all columns/tables (revert step one):
ALTER TABLE table_name
ALTER COLUMN column_name TYPE request_type
USING (column_name::request_type);