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

ambiguous column in join condition is not resulting error in tidb #32044

Closed
ramanich1 opened this issue Jan 27, 2022 · 0 comments · Fixed by #33567 or #36012
Closed

ambiguous column in join condition is not resulting error in tidb #32044

ramanich1 opened this issue Jan 27, 2022 · 0 comments · Fixed by #33567 or #36012
Assignees
Labels

Comments

@ramanich1
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1,t2,t3,t4;
create table t1 (c int, b int);
create table t2 (a int, b int);
create table t3 (b int, c int);
create table t4 (y int, c int);

select * from t1 natural join (t3 cross join t4);
select * from (t3 cross join t4) natural join t1;
select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
select * from  (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);

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

mysql> select * from t1 natural join (t3 cross join t4);
ERROR 1052 (23000): Column 'c' in from clause is ambiguous
mysql> select * from (t3 cross join t4) natural join t1;
ERROR 1052 (23000): Column 'c' in from clause is ambiguous
mysql> select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
ERROR 1052 (23000): Column 'b' in from clause is ambiguous
mysql> select * from  (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
ERROR 1052 (23000): Column 'b' in from clause is ambiguous

3. What did you see instead (Required)

mysql> 
mysql> select * from t1 natural join (t3 cross join t4);
Empty set (0.00 sec)

mysql> select * from (t3 cross join t4) natural join t1;
Empty set (0.00 sec)

mysql> select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
Empty set (0.00 sec)

mysql> select * from  (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

| Release Version: v5.5.0-alpha-168-g23f7e51ae
Edition: Community
Git Commit Hash: 23f7e51ae01287fa7f811e1462d8987e4d7727a4
Git Branch: master
UTC Build Time: 2022-01-27 17:39:21
GoVersion: go1.17.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
@ramanich1 ramanich1 added the type/bug The issue is confirmed as a bug. label Jan 27, 2022
@AilinKid AilinKid reopened this May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants