3620
MySQLERRORNotableDDLHIGH confidence

Online ALTER not supported for virtual column change

Production Risk

Medium — ALTER fails; a table copy may be required with associated locking impact.

How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t MODIFY COLUMN vc INT GENERATED ALWAYS AS (a + 2) VIRTUAL, ALGORITHM=INPLACE;

expected output

ERROR 3620 (HY000): ALGORITHM=INPLACE is not supported for this change; try ALGORITHM=COPY.

Fix

Use ALGORITHM=COPY

Use ALGORITHM=COPY
ALTER TABLE t MODIFY COLUMN vc INT GENERATED ALWAYS AS (a + 2) VIRTUAL, ALGORITHM=COPY;

Why this works

Forces a full table copy to apply the virtual column change.

What not to do

Version notes

Sources
Official documentation ↗

MySQL 8.0 — 3620 ER_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN

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

← All MySQL errors