pingcap / pingcap/tidb

TiDB incorrectly accepts invalid USING(t1.a) syntax in JOIN clause (MySQL incompatibility)

Open
#67,101 2 comments 0 reactions 1 assignee Claimed by @xhebox View on GitHub
severity/moderate sig/sql-infra type/bug
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)

In MySQL, the USING clause in a JOIN only accepts unqualified column names.
Using a qualified column name (e.g., t1.a) is considered invalid syntax and results in a parse error.

```sql
mysql> create table t(a int,b varchar(20),c double,index(a),index(b,c));
Query OK, 0 rows affected (0.09 sec)

mysql> select t1.a from t t1 join t t2 using(t1.a) ;
Empty set (0.05 sec)

```
### 2. What did you expect to see? (Required)
no error
### 3. What did you see instead (Required)
```sql
-- mysql(8.4.4) behavior
mysql> select t1.a from t t1 join t t2 using(t1.a) ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.a)' at line 1
```
### 4. What is your TiDB version? (Required)

Release Version: v9.0.0-beta.2.pre-1391-g78cea37
Edition: Community
Git Commit Hash: 78cea37e8d7a69914fb7affb0a982ffd57ce4c08
Git Branch: HEAD
UTC Build Time: 2026-03-17 21:35:30
GoVersion: go1.25.8
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Kernel Type: Classic

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.