-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Building statement with FORCE INDEX results in wrong SQL #593
Comments
Thank you for reporting this bug ! |
Yeah, this one might be something I could get involved into. I do think that #497 is very similar and fixing this will fix both. |
Sure, thank you for all your help ! |
Based on the MySQL documentation about the SELECT statement and the JOIN clause, it seems that the
(we're talking about That means the "index_hints" should be stored on the expected item of the "join" property of the select statement, rather than being stored in the select statement directly, as it's currently the case. The "index_hints" property from the SelectStatement class should be removed, and rather added in the JoinKeyword class. From this step, we could be able to rebuild the query with Unfortunately, this looks like a lot to a BC Break to me, so I don't know if you want me to go through this, @williamdes . And if that's the case, which branch should I start from? |
Well, it really seems like a breaking change. The master branch should be the right one for such a change |
Hi @williamdes So, after a closer look, fixing this is not a BC Break as the index hint part can also be on the FROM clause, which makes sense to keep into the Therefore, I provided you #614 which fixes (according to unit tests I added) this issue + #497, ready to be merged into 5.10.x (and can be applied to 5.11.x too). As you can see, I also provided you #613 as I started to work on Please tell me if something more is to do about it. |
Hello,
I have query that's not parsed or built properly when
FORCE INDEX
is used:The query becomes:
FORCE INDEX
got moved from tableorders
ontocustomers
.a.id = b.customer_id
join condition was removed.I see the same linting errors as #497, so this is probably related.
Example code
The text was updated successfully, but these errors were encountered: