Bug #29316 | Join not working when using multiple table in from clause | ||
---|---|---|---|
Submitted: | 23 Jun 2007 13:03 | Modified: | 24 Jun 2007 19:46 |
Reporter: | Eugen Borshch | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | >5.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | join, multiple from clause |
[23 Jun 2007 13:03]
Eugen Borshch
[24 Jun 2007 8:22]
Valeriy Kravchuk
Thank you for a problem report. What exect version you had upgraded from? Please, read http://dev.mysql.com/doc/refman/5.0/en/join.html about some changes in join processing since 5.0.12 also.
[24 Jun 2007 17:04]
Eugen Borshch
Hello! Thank you for your answer. Actually it was 4.0.27 and currently I need to have this stuff compatible with latest MySQL 5.0.* version (let's say it's "security" requirement to use latest MySQL 5.0.* release and this requirement comes not from me...). Why I wrote that it works with MySQL 4.1.7 - it's just because I'm using 4.1.* to check and localize problems (whether it appears for 5.0.* only or not). Finally, what I need is to work using latest MySQL 5.0.* version without rewriting of all queries using multiple "from tables" and joins... So please advise, what's better: to wait until this bug will be solved in future versions or to change my queries in case if this future version will be not released soon With best regards
[24 Jun 2007 17:23]
Hartmut Holzgraefe
The 5.0 behavior is correct in regards to what the SQL standard requires, the 4.x behavior was not. Making 5.0 standards compliant required substantial changes in the SQL parser and query execution engine, implementing the new correct way while keeping the old non-standard behavior as an optional backwards compatible mode was simply not possible. So there is no sense in "to wait until this bug will be solved in future versions" as this is not a 'bug' and will not be 'fixed' in any future version. This is explained in detail in the "Join Processing Changes in MySQL 5.0.12" section of http://dev.mysql.com/doc/refman/5.0/en/join.html
[24 Jun 2007 19:46]
Eugen Borshch
Hello! "This is explained in detail in the "Join Processing Changes in MySQL 5.0.12" section of http://dev.mysql.com/doc/refman/5.0/en/join.html" - I have not found which exactly section of this paper you are referring to. However I did some tests and found that "JOIN" sees just last of multiple tables referenced in the from clause (also now I see that it's working in the same way in other modern DBMSs), so query like: SELECT sourcecountry.sourcecountryid FROM country , sourcecountry left join dynamicmessage as x on (x.messagecode=concat('sourcecountry',convert(`sourcecountry`.`sourcecountryid` using latin1)) and x.languageid=1) will work. Unfortunately it will not work for me because as I wrote about it's just simplified query, and real query needs dynamicmessage to be joined twice (for sourcecountry and for country), so it seems to be that I'll need to rewrite these stuff :((
[26 Jun 2007 19:00]
Sergei Golubchik
read the section that starts from "Previously, the comma operator"