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

parsing error when associated query contains subquery #1258

Open
zhaoxugang opened this issue Jun 27, 2021 · 0 comments
Open

parsing error when associated query contains subquery #1258

zhaoxugang opened this issue Jun 27, 2021 · 0 comments

Comments

@zhaoxugang
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    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');

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;

  1. What did you expect to see?

------+------+------+
| i1 | i2 | i3 |
+------+------+------+
| 1 | 1 | 1 |
+------+------+------+

  1. What did you see instead?

You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 103 near "AS t1 LEFT JOIN test.table1 AS t2 ON t1.name=t2.name) LEFT JOIN test.table2 AS t3 ON t1.name=t3.name"

  1. What version of TiDB SQL Parser are you using?
    master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant