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

View query returns unexpected error when containing subquery #25646

Closed
pcqz opened this issue Jun 22, 2021 · 10 comments
Closed

View query returns unexpected error when containing subquery #25646

pcqz opened this issue Jun 22, 2021 · 10 comments
Assignees
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-6.0 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@pcqz
Copy link

pcqz commented Jun 22, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

https://asktug.com/t/topic/93840

CREATE TABLE table1 (
id int(0) DEFAULT NULL,
name varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

CREATE TABLE table2 (
id int(0) DEFAULT NULL,
name varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

insert into table1(id ,name) values(1,'a');
insert into table2(id ,name) values(1,'a');

CREATE view temp_v as 
select t1.id as i1,t2.id as i2,t3.id as i3
from (select tt.id,tt.name from (select id,name from table1) tt) as t1
LEFT JOIN table1 t2 on t1.name = t2.name
LEFT JOIN table2 t3 on t1.name = t3.name;

select * from temp_v;

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

No error

3. What did you see instead (Required)

mysql>  select * from temp_v;
ERROR 1105 (HY000): line 1 column 158 near "AS `t1` LEFT JOIN `xm_test`.`table1` AS `t2` ON `t1`.`name`=`t2`.`name`) LEFT JOIN `xm_test`.`table2` AS `t3` ON `t1`.`name`=`t3`.`name`" 

4. What is your TiDB version? (Required)

v5.0.2

@pcqz pcqz added the type/bug The issue is confirmed as a bug. label Jun 22, 2021
@zhaoxugang
Copy link
Contributor

this issue seems to belong parser.

@xuyifangreeneyes
Copy link
Contributor

#25647 has fixed the bug and is going to check pick to 5.0/5.1/5.2.

@yudongusa yudongusa assigned yudongusa and lzmhhh123 and unassigned yudongusa Aug 23, 2021
@yudongusa yudongusa added sig/execution SIG execution and removed sig/planner SIG: Planner labels Aug 23, 2021
@fuzhe1989
Copy link
Contributor

any update? @lzmhhh123

@lzmhhh123
Copy link
Contributor

any update? @lzmhhh123

The cherry-pick is not easy. I'm waiting for transferring parser to TiDB.

@lzmhhh123
Copy link
Contributor

lzmhhh123 commented Nov 17, 2021

Now it is done, then we could do it. But the release branch is still not done.

@fuzhe1989
Copy link
Contributor

@lzmhhh123 Any blocking issue? Guess we can cherry-pick to release branches as before.

@lzmhhh123
Copy link
Contributor

@lzmhhh123 Any blocking issue? Guess we can cherry-pick to release branches as before.

There's still another related issue #28476, I'd like to fix it then cherry-pick them together.

@jebter jebter added affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. labels Jan 11, 2022
@windtalker
Copy link
Contributor

I think it is already fixed in master branch, so should not affect 6.1

@zanmato1984 zanmato1984 added sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels May 25, 2022
@zanmato1984
Copy link
Contributor

Changing labels.

@zimulala
Copy link
Contributor

I tried it and the problem was solved in master(5d4745e).

Since this problem is not critical, I think it can be closed without cherry-pick. You can open it again if you have a problem

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

No branches or pull requests