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

unexpected "table does not have column" error #4109

Closed
knutwannheden opened this issue Aug 16, 2022 · 3 comments
Closed

unexpected "table does not have column" error #4109

knutwannheden opened this issue Aug 16, 2022 · 3 comments
Assignees
Labels
bug Something isn't working sql Issue with SQL

Comments

@knutwannheden
Copy link

In relation to #2203 which added support for explicit join tree syntax there is still a problem with slightly more complex queries, hinting at an underlying problem.

When executing the following script:

create table t(x int, y int, z int);

select *
from t
left join (t t1 join t t2 on t1.y = t2.y) on t1.y = t.y
left join (t t3 join t t4 on t3.x is not null) on t3.z = t.z
;

There is an error [HY000][1105] table "t3" does not have column "x" where x apparently refers to the t3.x reference in the last line.

What is interesting is that if the first JOIN is removed then the query is executed successfully. Also when changing the join predicate from t3.x is not null to e.g. t3.x = t4.x there is no problem.

@timsehn timsehn added the bug Something isn't working label Aug 17, 2022
@timsehn
Copy link
Sponsor Contributor

timsehn commented Aug 17, 2022

Thanks. @max-hoffman will look at this issue when he gets a chance.

@max-hoffman
Copy link
Contributor

Hi @knutwannheden, I am looking at this now. I will follow up today with more information and a timeline for fixing this.

@max-hoffman
Copy link
Contributor

Hi @knutwannheden, here's the fix for this one.
dolthub/go-mysql-server#1202

When a join condition is specific to a single table, we hoist the filter for later pushdown. Our condition for filter placement accidentally moved the filter to every child of the join's parent. It works when you change the IS NULL because we can't hoist the filter. It works when you remove the parent join because then there is no sibling node that absorbs a filter it doesn't know how to execute.

Keep them coming.

@timsehn timsehn added the sql Issue with SQL label Aug 24, 2022
@timsehn timsehn closed this as completed Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sql Issue with SQL
Projects
None yet
Development

No branches or pull requests

3 participants