3124
MariaDBERRORNotableDDLHIGH confidence

ALTER TABLE not supported: column type change requires table copy

Production Risk

Medium — table rebuild on large tables requires a maintenance window.

What this means

Changing the data type of a column requires a full table rebuild and cannot be performed with ALGORITHM=INPLACE or ALGORITHM=INSTANT.

Why it happens
  1. 1MODIFY COLUMN changing a column to an incompatible type while ALGORITHM=INPLACE is requested.
  2. 2Type changes that alter on-disk storage format cannot be done in-place.
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t1 MODIFY COLUMN name VARCHAR(500), ALGORITHM=INPLACE;

expected output

ERROR 3124 (HY000): ALGORITHM=INPLACE is not supported. Reason: Column type change requires table copy.

Fix 1

Allow table copy

Allow table copy
ALTER TABLE t1 MODIFY COLUMN name VARCHAR(500), ALGORITHM=COPY;

Why this works

Rebuilds the table with the new column type.

Fix 2

Check if INSTANT is supported

Check if INSTANT is supported
ALTER TABLE t1 MODIFY COLUMN name VARCHAR(500), ALGORITHM=INSTANT;

Why this works

MySQL 8.0.29+ supports instant column type changes in some cases.

What not to do

Version notes
MySQL 8.0.29+

More column type changes support INSTANT algorithm.

Sources
Official documentation ↗

MySQL 8.0 — 3124 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE2

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors