Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Modify column' doesn't support 'set auto_increment'? #40200

Closed
maxshuang opened this issue Dec 27, 2022 · 2 comments
Closed

'Modify column' doesn't support 'set auto_increment'? #40200

maxshuang opened this issue Dec 27, 2022 · 2 comments
Labels
type/question The issue belongs to a question.

Comments

@maxshuang
Copy link

General Question

I scan the official web page about the 'Modify Column' and find no compatible statement about not supporting 'set auto_increment' of 'Modify column'
E7DzQO6HzT

But the following behavior of 'modify column' SQL is not consistent for mysql and tidb:

  • mysql:
#Server version: 5.7.38-log Source distribution

mysql> create table t2(id int key);
Query OK, 0 rows affected (0.29 sec)

mysql> alter table t2 modify column `id` bigint(20) not null auto_increment;
Query OK, 0 rows affected, 1 warning (0.29 sec)
Records: 0  Duplicates: 0  Warnings: 1

mysql> show create table t2;
+-------+---------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------+
| t2    | CREATE TABLE `t2` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.23 sec)

*TIDB:

#Server version: 5.7.25-TiDB-v6.3.0-alpha-1105-g20bb0464e TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

mysql> create table t2(id int key);
Query OK, 0 rows affected (0.17 sec)

mysql> alter table t2 modify column `id` bigint(20) not null auto_increment;
ERROR 8200 (HY000): Unsupported modify column: can't set auto_increment
@maxshuang maxshuang added the type/question The issue belongs to a question. label Dec 27, 2022
@maxshuang
Copy link
Author

limited by:
image

@dveeden
Copy link
Contributor

dveeden commented Dec 27, 2022

See also: #39143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question The issue belongs to a question.
Projects
None yet
Development

No branches or pull requests

2 participants