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

wrong Not unique table/alias error report #24563

Open
xiongjiwei opened this issue May 12, 2021 · 4 comments · May be fixed by #34887
Open

wrong Not unique table/alias error report #24563

xiongjiwei opened this issue May 12, 2021 · 4 comments · May be fixed by #34887
Assignees
Labels
severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug. type/compatibility

Comments

@xiongjiwei
Copy link
Contributor

xiongjiwei commented May 12, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

same with #24550

1. Minimal reproduce step (Required)

create database db1;
create database db2;

-- both in db1 and db2
create table t(a int);
insert into t values (1);

use db1

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

mysql> select * from t, db2.t as t;
+------+------+
| a    | a    |
+------+------+
|    2 |    1 |
+------+------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select * from t, db2.t as t;
ERROR 1066 (42000): Not unique table/alias: 't'

4. What is your TiDB version? (Required)

@ichn-hu
Copy link
Contributor

ichn-hu commented May 13, 2021

/unlabel sig/execution

@AilinKid
Copy link
Contributor

use db1 & use db2 will contribute to different result in MySQL 8.0

mysql> use db2;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> explain select * from t, db2.t as t;
ERROR 1066 (42000): Not unique table/alias: 't'

@AilinKid
Copy link
Contributor

seems MySQL will use the schema name as a part of resolving duplicates.

@winoros
Copy link
Member

winoros commented May 26, 2022

image
We reject this behavior of the MySQL's
TiDB would throw error for both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment