-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
create table for invisible unique key with auto_increment should have same behavior with it's show create tables #28093
Comments
It's the expected behavior.
If a has not null, then it would be the implicit primary key in MySQL. To be compatible with MySQL, TiDB also forbids this usage. |
the problem is, create table t0(a int auto_increment, unique key (a) invisible); above sql has't the MySQL > show create table t0\G
***************************[ 1. row ]***************************
Table | t0
Create Table | CREATE TABLE `t0` (
`a` int(11) NOT NULL AUTO_INCREMENT,
UNIQUE KEY `a` (`a`) /*!80000 INVISIBLE */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin while use the for mysql, an unique index with auto_increment but without mysql> create table t0(a int auto_increment, unique key (a) invisible);
ERROR 3522 (HY000): A primary key index cannot be invisible
|
If need to be compatible with MySQL, TiDB should forbids |
I get it. |
Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
the sql of create table t0 should have same behavior with show create table result.
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master( 6ebfe8a)
The text was updated successfully, but these errors were encountered: