3120
MariaDBERRORNotableDDLHIGH confidence
ALTER TABLE operation not supported for this reason
Production Risk
Medium — table copy can cause prolonged locks on large tables.
What this means
An ALTER TABLE statement requested an in-place or instant algorithm but the operation cannot be performed without a full table copy due to a specific constraint. The server reports the reason why the requested algorithm is not supported.
Why it happens
- 1The requested ALGORITHM=INPLACE or ALGORITHM=INSTANT is incompatible with the specific ALTER operation.
- 2Table properties (foreign keys, triggers, full-text indexes) prevent the optimised path.
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t1 ADD COLUMN x INT, ALGORITHM=INPLACE;
expected output
ERROR 3120 (HY000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
Fix 1
Allow COPY algorithm
Allow COPY algorithm
ALTER TABLE t1 ADD COLUMN x INT, ALGORITHM=COPY;
Why this works
COPY rebuilds the table and supports all ALTER operations.
Fix 2
Remove the ALGORITHM hint
Remove the ALGORITHM hint
ALTER TABLE t1 ADD COLUMN x INT;
Why this works
MySQL automatically selects the best supported algorithm.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3120 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev