Error on ALTER TYPE in postgres relation does not exist

此生再无相见时 提交于 2019-12-05 23:48:57

ALTER TYPE ... RENAME ATTRIBUTE only works for composite types, not for ENUM types.

While there is a way to add new entries to such a type (ALTER TYPE ... ADD VALUE 'new_value'), there is no supported way to remove or rename an enumeration entry.

If you are not afraid to mess with the catalogs, you can try as superuser:

UPDATE pg_enum
SET enumlabel = 'softwaredev'
WHERE enumtypid = 'user_types'::regtype
  AND enumlabel = 'it';

From PostgreSQL v10 on, you can use

ALTER TYPE ... RENAME VALUE ... TO ...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!