Bug #30842 | multiple ON clauses allowed in LEFT JOIN | ||
---|---|---|---|
Submitted: | 5 Sep 2007 20:15 | Modified: | 6 Sep 2007 14:27 |
Reporter: | Baron Schwartz (Basic Quality Contributor) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[5 Sep 2007 20:15]
Baron Schwartz
[5 Sep 2007 20:16]
Baron Schwartz
I forgot to say my version: mysql> select version(); +----------------------------+ | version() | +----------------------------+ | 5.0.38-Ubuntu_0ubuntu1-log | +----------------------------+ 1 row in set (0.00 sec)
[5 Sep 2007 20:49]
MySQL Verification Team
Thank you for the bug report. Looks like that query is valid SQL query MS SQL Server and Oracles agrees with MySQL too: mysql> select * -> from t1 -> left join t2 -> left join t3 -> on b = c -> on b = c; +---+------+------+ | a | b | c | +---+------+------+ | 1 | 1 | 1 | | 2 | 1 | 1 | | 3 | 1 | 1 | +---+------+------+ 3 rows in set (0.00 sec) ------------------------------------- 1> select * 2> from t1 3> left join t2 4> left join t3 5> on b = c 6> on b = c 7> go a b c ----------- ----------- ----------- 1 1 1 2 1 1 3 1 1 (3 rows affected) 1> ------------------------------------- SQL> select * 2 from t1 3 left join t2 4 left join t3 5 on b = c 6 on b = c; A B C ---------- ---------- ---------- 1 1 1 2 1 1 3 1 1 SQL>
[6 Sep 2007 14:27]
Baron Schwartz
Should we change it to a doc bug, and update the documentation to indicate that the join_condition is optional for a LEFT JOIN? Or should something else in the docs be changed to indicate that a LEFT JOIN without a join_condition may be rewritten to an INNER JOIN without a join_condition?