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

Left Join condition association does not support subqueries #4380

Closed
yourmain opened this issue Jul 8, 2020 · 4 comments · Fixed by #4383
Closed

Left Join condition association does not support subqueries #4380

yourmain opened this issue Jul 8, 2020 · 4 comments · Fixed by #4383
Assignees
Labels
bug Something isn't working
Milestone

Comments

@yourmain
Copy link

yourmain commented Jul 8, 2020

sql->whit tmp_auth as (select node_id, node_type from xxx.xxx.organization where status = '1' and node_type <> '0')
select t1.id, t2.name from xxx.xxx.test1 t1 left jon xxx.xxx.test2 t2 on t1.id = t2.o_id and t1.s_id in (select node_id from tmp_auth where node_id = 1) limit 10;

error message -> Column 't1.s_id' cannot be resolved

@martint
Copy link
Member

martint commented Jul 8, 2020

Can you show the schema of the test1 table? You can run DESCRIBE test1 to do so.

@yourmain
Copy link
Author

yourmain commented Jul 8, 2020

whit tmp_auth as (select node_id, node_type from xxx.xxx.organization where status = '1' and node_type <> '0')
select t1.id, t2.name from xxx.xxx.test1 t1 left jon xxx.xxx.test2 t2 on t1.id = t2.o_id and t1.s_id in (‘1’, ‘2’) limit 10;

That's ok, column 's_id' exists in the table

@martint
Copy link
Member

martint commented Jul 8, 2020

I was able to reproduce the issue with this query:

WITH
    t(x, y) AS (VALUES (1, 10), (2, 20)),
    u(x) AS (VALUES 1, 2),
    w(z) AS (VALUES 10, 20)
SELECT *
FROM t LEFT JOIN u ON t.x = u.x AND t.y IN (SELECT z FROM w);

@martint martint added the bug Something isn't working label Jul 8, 2020
@martint martint self-assigned this Jul 8, 2020
@martint martint added this to the 339 milestone Jul 8, 2020
@martint martint mentioned this issue Jul 8, 2020
8 tasks
@martint
Copy link
Member

martint commented Jul 8, 2020

Thanks for reporting this issue! The fix will be available in the next version (339).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants