Error
Error Code:
55P04
PostgreSQL Error 55P04: Unsafe Enum Value Addition
Description
This error indicates an attempt to add a new value to an existing `ENUM` type in PostgreSQL in a way that the system deems unsafe. It typically occurs when there are existing table columns using the `ENUM` type, and the proposed change could lead to data integrity issues or unexpected behavior without proper handling.
Error Message
unsafe new enum value usage
Known Causes
3 known causesAltering Active Enum Type
Attempting to add a new value to an `ENUM` type that is actively used by one or more table columns with existing data, without a robust migration strategy.
Concurrent Database Activity
Other database transactions are reading or writing data dependent on the `ENUM` type while the `ALTER TYPE ... ADD VALUE` command is being executed.
Application Logic Dependency
Application code or other database objects (like functions or views) might have implicit assumptions about the set or order of `ENUM` values, making a direct addition unsafe.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service