1787
MySQLERRORNotableDDLHIGH confidence

INPLACE ALTER not supported — AUTO_INCREMENT column change

Production Risk

Low — DDL rejected.

What this means

Changing the AUTO_INCREMENT attribute of a column is not supported with ALGORITHM=INPLACE on some storage engines or MySQL versions.

Why it happens
  1. 1Modifying AUTO_INCREMENT column properties using ALGORITHM=INPLACE.
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE tbl ALGORITHM=INPLACE, MODIFY COLUMN id BIGINT AUTO_INCREMENT;

expected output

ERROR 1787 (0A000): ALGORITHM=INPLACE is not supported. Reason: Auto-increment column cannot be changed inplace.

Fix

Use ALGORITHM=COPY for AUTO_INCREMENT column modifications

Use ALGORITHM=COPY for AUTO_INCREMENT column modifications
ALTER TABLE tbl ALGORITHM=COPY, MODIFY COLUMN id BIGINT AUTO_INCREMENT;

Why this works

COPY algorithm rebuilds the table, safely updating the AUTO_INCREMENT attribute.

What not to do

Version notes

Sources
Official documentation ↗

MySQL 8.0 — 1787 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC

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

← All MySQL errors