在 Postgres 中更改 Enum 类型会出现 42883 错误

Wil*_*oss 1 postgresql enums

我正在尝试回滚对 Postgres 中名为 group_type 的枚举进行的添加,该添加是对我的表组上名为 type 的列进行的。

在Postgress我跑过,

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;
Run Code Online (Sandbox Code Playgroud)

我在最后一条语句中收到以下错误,

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.
Run Code Online (Sandbox Code Playgroud)

你知道我最后的陈述有什么问题吗?

use*_*898 5

物有所值; 当旧枚举中的值仍然被提及为我的表中的 CHECK 约束时,我遇到了此错误,该表也在列中包含枚举。我通过删除约束,更改枚举,然后再次添加(更新的)约束来解决这个问题。