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

The name of the generated unique key is not consistent with mysql #39080

Closed
Mini256 opened this issue Nov 11, 2022 · 1 comment · Fixed by #39145
Closed

The name of the generated unique key is not consistent with mysql #39080

Mini256 opened this issue Nov 11, 2022 · 1 comment · Fixed by #39145
Assignees
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@Mini256
Copy link
Member

Mini256 commented Nov 11, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `Test` (
    `id` INTEGER PRIMARY KEY,
    `authorId` INTEGER AUTO_INCREMENT UNIQUE
);

2. What did you expect to see? (Required)

The unique key name generated by MySQL is authorId.

MySQL root@127.0.0.1:test2> show create table `Test2`\G
***************************[ 1. row ]***************************
Table        | Test2
Create Table | CREATE TABLE `Test2` (
  `id` int(11) NOT NULL,
  `authorId` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`),
  UNIQUE KEY `authorId` (`authorId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

3. What did you see instead (Required)

The unique key name generated by TiDB is authorid.

metadata_for_mysql_should_work> show create table `Test`\G
***************************[ 1. row ]***************************
Table        | Test
Create Table | CREATE TABLE `Test` (
  `id` int(11) NOT NULL,
  `authorId` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `authorid` (`authorId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set
Time: 0.003s

4. What is your TiDB version? (Required)

metadata_for_mysql_should_work> select tidb_version()\G
***************************[ 1. row ]***************************
tidb_version() | Release Version: v6.3.0
Edition: Community
Git Commit Hash: ecd67531f1721d3e49eb15a202ac7c0ae02291ec
Git Branch: heads/refs/tags/v6.3.0
UTC Build Time: 2022-09-23 14:21:08
GoVersion: go1.19.1
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
1 row in set
Time: 0.002s
@Mini256 Mini256 added the type/bug The issue is confirmed as a bug. label Nov 11, 2022
@wxbty
Copy link
Contributor

wxbty commented Nov 11, 2022

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants