Alter TYPE RENAME VALUE works in Postgres 10 but not in Postgres 9.6?

Viewed 2565

I am using Postgres 10.3.

Based on this question, I use:

ALTER TYPE name RENAME VALUE attribute_name TO new_attribute_name

to rename an enum value.

But I need a solution that works with Postgres 9.6 that does not require updating pg_enum manually because it needs permissions that I don't have.

1 Answers

There is no supported way to rename an enum value in PostgreSQL 9.6.

Directly modifying pg_enum is something you should not only rule out because of permission issues, but also because directly messing with the system catalogs is dangerous and may destroy your data.

You should use enums with care. They are only good if they never need to be modified. If there is a chance that the enum values won't be immutable, use a lookup table instead.

Related