CREATE INDEX allows invalid table_name.column_name syntax without error
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
root@127.0.0.1 : test 10:56:22> create table t(a int,b int,c int);
Query OK, 0 rows affected (8.02 sec)
root@127.0.0.1 : test 10:56:35> alter table t add index idx1(a,b.c);
Query OK, 0 rows affected (0.04 sec)
root@127.0.0.1 : test 10:56:50> alter table t add index idx2(a,xx.c);
Query OK, 0 rows affected (0.04 sec)
root@127.0.0.1 : test 10:56:58> show create table t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`a` int DEFAULT NULL,
`b` int DEFAULT NULL,
`c` int DEFAULT NULL,
KEY `idx1` (`a`,`c`),
KEY `idx2` (`a`,`c`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.00 sec)
```
### 2. What did you expect to see? (Required)
MySQL 5.7.39
### 3. What did you see instead (Required)
no error
### 4. What is your TiDB version? (Required)
```
root@127.0.0.1 : test 11:28:50> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v8.5.2
Edition: Community
Git Commit Hash: f43a13324440f92209e2a9f04c0bbe9cf763978d
Git Branch: HEAD
UTC Build Time: 2025-05-29 03:33:08
GoVersion: go1.23.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.01 sec)
```
Contributor guide
Assessment
This issue has not been assessed yet.