Bug #13104 | LEFT OUTER JOIN and Two Other Tables | ||
---|---|---|---|
Submitted: | 10 Sep 2005 13:15 | Modified: | 23 Sep 2005 10:39 |
Reporter: | David Wedwick | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.12-0 | OS: | Linux (Linux) |
Assigned to: | CPU Architecture: | Any |
[10 Sep 2005 13:15]
David Wedwick
[10 Sep 2005 13:19]
David Wedwick
This worked OK in version 5.0.7
[10 Sep 2005 13:50]
Hartmut Holzgraefe
I assume this is due t the following 5.0.12 changelog item? (see also bug #12964) * Natural joins and joins with USING, including outer join variants, now are processed according to the SQL:2003 standard. (Bug #4789, Bug #6136, Bug #6276, Bug #6495, Bug #6558, Bug #9978, Bug #10646, Bug #10972, Bug #11710)
[11 Sep 2005 3:24]
David Wedwick
I suppose this problem is related to the change listed under Bugs in 5.0.12-0. Using parentheses around the table names does allow the query to work. But, why would rearranging the tables also work? I don't know anything about SQL 2003, so forgive me for asking this, but is this how the query should work and this is not a bug?
[11 Sep 2005 9:38]
Hartmut Holzgraefe
MySQL versions prior to 5.0.12 where processing outer joins in the wrong order, this has changed in 5.0.12. By using parentheses you explicitly set the order and by rearranging tables you make the now standards-compliant ordering produce the desired result again.
[11 Sep 2005 11:21]
Andrey Hristov
Looks very similar to bug #12943, which is in process of fixing (patch committed and in code review).
[31 Oct 2005 13:58]
Lutz Schwarz
Switching tables a and b in the query may be acceptable as a workaround - but not as a solution. Because it won't work if the ON clause refers to both, table a and b, as in the following example: select a.*, b.*, c.* from a, b left join c on (c.key = a.key AND c.itzel = b.itzel) where b.key = a.key; In mysql version 4 and even 3 such queries haven't been a problem.