From 8c6cece2da9287ddffccb459c4db27951c73e087 Mon Sep 17 00:00:00 2001 From: Ruihao Chen Date: Tue, 30 Jun 2026 11:49:35 +0800 Subject: [PATCH] mysql-compatibility: clarify multi schema change DDL limits --- mysql-compatibility.md | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-compatibility.md b/mysql-compatibility.md index f32687a87e005..8dad646d193ab 100644 --- a/mysql-compatibility.md +++ b/mysql-compatibility.md @@ -162,6 +162,7 @@ TiDB supports most of the built-in functions in MySQL, but not all. You can use In TiDB, all supported DDL changes can be performed online. However, there are some major restrictions on DDL operations in TiDB compared to MySQL: * When using a single `ALTER TABLE` statement to alter multiple schema objects (such as columns or indexes) of a table, specifying the same object in multiple changes is not supported. For example, if you execute the `ALTER TABLE t1 MODIFY COLUMN c1 INT, DROP COLUMN c1` command, the `Unsupported operate same column/index` error is output. +* When using a single `ALTER TABLE` statement to alter multiple schema objects, TiDB validates dependencies in statement order, while MySQL might allow some statements based on the final table definition. For example, MySQL supports `ALTER TABLE t ADD INDEX idx_c(c), ADD COLUMN c INT` and `ALTER TABLE t ADD INDEX idx(...), DROP INDEX idx` with `idx` already existing. * It is not supported to modify multiple TiDB-specific schema objects using a single `ALTER TABLE` statement, such as `TIFLASH REPLICA`, `SHARD_ROW_ID_BITS`, and `AUTO_ID_CACHE`. * TiDB does not support the changes of some data types using `ALTER TABLE`. For example, TiDB does not support the change from the `DECIMAL` type to the `DATE` type. If a data type change is unsupported, TiDB reports the `Unsupported modify column: type %d not match origin %d` error. Refer to [`ALTER TABLE`](/sql-statements/sql-statement-modify-column.md) for more details. * The `ALGORITHM={INSTANT,INPLACE,COPY}` syntax functions only as an assertion in TiDB, and does not modify the `ALTER` algorithm. See [`ALTER TABLE`](/sql-statements/sql-statement-alter-table.md) for further details.