You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, AUTO_INCREMENT has the following restrictions when used in TiDB:
...
It cannot be specified on the same column with the DEFAULT column value.
...
create table t (a bigint auto_increment primary key);
alter table t modify column a bigint auto_increment default 3;
show create table t;
2. What did you expect to see? (Required)
Execute alter table failed. The error message like : Invalid auto increment: auto_increment is incompatible with default
3. What did you see instead (Required)
tidb> alter table t modify column a bigint auto_increment default 3;
Query OK, 0 rows affected (0.03 sec)
tidb> show create table t;
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`a` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Docs in : https://docs.pingcap.com/tidb/stable/auto-increment#restrictions
2. What did you expect to see? (Required)
Execute
alter table
failed. The error message like :Invalid auto increment: auto_increment is incompatible with default
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master
The text was updated successfully, but these errors were encountered: