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

Valid join query erroneously reported as ambiguous #1902

Closed
nicktobey opened this issue Jul 26, 2023 · 1 comment
Closed

Valid join query erroneously reported as ambiguous #1902

nicktobey opened this issue Jul 26, 2023 · 1 comment

Comments

@nicktobey
Copy link
Contributor

Reproduction steps:

create table a (b int);
create table c (d int);

select * from a join c c1 on b = d join c c2 on c1.d = c2.d;

MySql result: query runs

GMS output:

ambiguous column name "d", it's present in all these tables: c1, c2

We seem to be trying to resolve the references in b = d in the context of the complete 3-way join, even though it should be resolved just in the context of a join c c1

Out of curiosity I changed the query to:

select * from a join c c1 on b = c2.d join c c2 on c1.d = c2.d;

This is an invalid query and MySQL recognizes it as such:

Unknown column 'c2.d' in 'on clause'

GMS also fails but with a different, nonsensical error:

table "c2" does not have column "d"

(table c2, does, in fact, have a column d. Perhaps it returns this error because it thinks the table exists but the column doesn't.)

@timsehn
Copy link
Sponsor Contributor

timsehn commented Jul 26, 2023

We should make these types of issues in Dolt for visibility and tag them with label analyzer.

GMS issues are reserved for issues that only effect GMS, not Dolt.

@nicktobey nicktobey closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2023
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

2 participants