I'm trying to rollback an addition that was made to this Enum named group_type in Postgres that was made to a column named type on my table groups.
In Postgress I've run,
ALTER TYPE group_type RENAME TO group_type_old;
CREATE TYPE group_type AS ENUM ('public', 'private');
ALTER TABLE groups ALTER COLUMN type DROP DEFAULT;
ALTER TABLE groups ALTER COLUMN "type" TYPE group_type USING "type"::text::group_type;
And I get the following error on the last statement,
Query 1 ERROR: ERROR: operator does not exist: text = group_type_old
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
Any ideas what the issue is with my last statement?
For what it's worth; I ran into this error when a value from the old enum was still mentioned as a CHECK constraint in my table, which also had the enum in a column. I solved it by dropping the constraint, changing the enum, then adding the (updated) constraint again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With