In MySQL and MariaDB, you add a value to an ENUM column with a single ALTER TABLE statement: ALTER TABLE table_name MODIFY COLUMN column_name ENUM('old_value','new_value') NOT NULL DEFAULT 'old_value'; The critical part is that you must restate every existing value in the new list, because MODIFY replaces the whole column definition rather than appending to it. If you list only the new value, you destroy the old options and MySQL may silently convert existing rows to an empty string or error out. PostgreSQL works differently: an ENUM is a standalone type, so you use ALTER TYPE type_name ADD VALUE 'new_value'; and nothing else changes. The steps below cover both engines, because the two behave in opposite ways and mixing the approaches is the most common cause of a broken table.
What You'll Need
- Access to a MySQL, MariaDB or PostgreSQL database with permission to run ALTER statements on the table (usually the owner or an admin account).
- A SQL client: the command-line client (mysql or psql), phpMyAdmin, Adminer, DBeaver, TablePlus or your hosting control panel's database tool.
- A recent backup or export of the table, or at minimum a copy of the current column definition.
- Knowledge of the exact current ENUM values and their order, which you can read with SHOW CREATE TABLE or by inspecting the column in your client.
- A maintenance window or low-traffic moment, since altering a large table can lock it while it rebuilds.
Step-by-Step
- Find the exact current definition. Run
SHOW CREATE TABLE your_table;in MySQL or MariaDB, or\d your_tablein psql. Copy the full ENUM line, including every value, the NULL/NOT NULL setting and the default. You will paste this back in step 4, so accuracy here saves you from data loss. - Back up the table. For a small table,
CREATE TABLE your_table_backup AS SELECT * FROM your_table;is enough. For anything large, use mysqldump or pg_dump. This is your undo button if the ALTER goes wrong. - Decide where the new value goes. In MySQL, order matters for sorting and for the numeric index behind each value. Appending at the end is safest because it does not shift the indexes of existing values. Inserting in the middle reorders sort results and can confuse code that relies on the ordinal position. In PostgreSQL, ADD VALUE also appends, and you can specify BEFORE or AFTER another value if you need a particular order.
- Run the ALTER for MySQL or MariaDB. Restate the entire list with the new value added:
ALTER TABLE your_table MODIFY COLUMN status ENUM('pending','active','archived','cancelled') NOT NULL DEFAULT 'pending';Keep NOT NULL and the DEFAULT exactly as they were unless you deliberately want to change them. Omitting NOT NULL quietly makes the column nullable; omitting the default drops it. - Run the ALTER for PostgreSQL. Use
ALTER TYPE status_type ADD VALUE 'cancelled';where status_type is the name of the enum type, not the column. If you need it in a specific position, add BEFORE 'archived' or AFTER 'active'. Note that in older PostgreSQL versions the new value cannot be used in the same transaction that adds it, so run the ALTER on its own and commit before inserting rows that use it. - Verify the change. Re-run SHOW CREATE TABLE or \d your_table and confirm the new value appears, the nullability is unchanged and the default is intact. Then run a quick
SELECT COUNT(*) FROM your_table WHERE status = 'cancelled';to confirm the value is queryable and returns zero rather than an error. - Test a write. Insert a throwaway row using the new value, or update one row and roll it back inside a transaction. This proves the application path works before real users hit it.
Common Mistakes
The single biggest error is running ALTER TABLE t MODIFY COLUMN c ENUM('new_value'); with only the new value. MySQL accepts the statement, then converts every existing row whose value is not in the new list to an empty string (or fails in strict mode). Always paste the full original list and add to it.
Second is dropping the DEFAULT or NOT NULL clause by accident. The column silently changes behaviour, and inserts that relied on the default start failing or writing NULL.
Third is using MODIFY on PostgreSQL. There is no MODIFY COLUMN in PostgreSQL; you need ALTER TYPE. Conversely, ALTER TYPE does not exist in MySQL. The syntax is not portable, so check which engine you are on before copying a snippet from a forum.
Fourth is reordering values without thinking. Moving an existing value changes its index, which affects ORDER BY and any code that stores the integer rather than the string.
Fifth is running the ALTER on a busy production table during peak hours. On large tables MySQL may rebuild the table, holding a lock for the duration.
Tips
Append new values at the end of the list unless you have a specific reason not to. It is the least disruptive change and keeps existing indexes stable.
Keep a migration file or a note of the exact ALTER you ran, with the full value list, so the next person (or future you) can repeat it on staging and production without guessing.
If you expect to add values often, reconsider whether ENUM is the right type. A lookup table with a foreign key is more flexible and avoids table rebuilds entirely. ENUM is convenient for small, stable lists, not for categories that grow every month.
Run the statement on a staging copy first whenever the table holds data you cannot easily recreate. It takes a minute and catches the missing-value mistake before it reaches production.
Watch out for trailing spaces and case. ENUM values are compared with the collation in force, and 'Active' and 'active' are different values unless the collation says otherwise.
Troubleshooting
The ALTER fails with a data truncated warning or error. Strict mode is rejecting rows that do not match the new list. That means you left a value out. Restore from your backup, re-read the original definition and include every value.
Existing rows now show empty strings. The column was modified with an incomplete list and MySQL converted unmatched values. Restore the backup, then re-run the ALTER with the full list. If you have no backup, you may be able to recover values from a replica, a binlog or an earlier export.
Inserts fail after the change. Check the DEFAULT and NOT NULL clauses. If the default was dropped, inserts that omit the column now write NULL, which a NOT NULL column rejects.
PostgreSQL says the new enum value cannot be used yet. You are trying to use it in the same transaction that added it. Commit the ALTER first, then insert.
The table is locked and the app times out. The ALTER is rebuilding a large table. Wait for it to finish rather than killing it mid-rebuild, and schedule future changes for a quiet period. On MySQL, check whether your version supports online DDL for this operation before running it on a busy table.
Sorting order looks wrong. You inserted a value in the middle. Either accept the new order or rebuild the column with the value at the end.
Frequently Asked Questions
Can I add an ENUM value without rewriting the whole list in MySQL?
No. MODIFY COLUMN replaces the definition, so you must restate every existing value plus the new one. There is no APPEND syntax for MySQL ENUM columns.
Does adding an ENUM value lock the table?
It depends on the engine, version and operation. Some changes are handled online, others rebuild the table and block writes for the duration. Test on staging with realistic data volumes before running it on production.
What happens to existing rows when I add a value?
Nothing, as long as you keep all the old values in the list. Existing rows keep their current values. Rows only change if a value is removed from the definition.
Can I remove an ENUM value later?
Yes, but any row holding that value must be updated first, or the ALTER will fail in strict mode or convert those rows to an empty string. Update the data, then modify the column with the shortened list.
Is ENUM portable between MySQL and PostgreSQL?
No. MySQL defines the list inline on the column; PostgreSQL defines a separate type and alters it with ALTER TYPE. Scripts written for one will not run on the other without changes.
Should I use ENUM or a lookup table?
Use ENUM for short lists that rarely change. Use a lookup table with a foreign key when values change often, when you need extra attributes per value, or when the list is shared across several tables.