Patch by Hartmut Holzgraefe
STRAIGHT_JOIN couldn't be combined with NATURAL or USING(), INNER JOIN not with NATURAL (MDEV-4271, MySQL Bug #35268) Separate rules existed for "natural" (non-outer) joins and for STRAIGHT_JOIN, with the only difference code wise being that with STRAIGHT_JOIN the "straight" property of the right side table was set before calling the appropriate add_...() function. The "natural_join" parser rule has now been extended to also accept STRAIGHT_JOIN, and the rule result value is set to 1 for straight joins, 0 otherwise, so acting as a "straight" flag that can directly be assigned to the "straight" property of the right side table. The rule parsing NATURAL JOIN was hard coded to accept just this keyword combination, without support for either STRAIGHT_JOIN or the optional INNER. The "natural_join" rule has now been split up in an inner "inner_join" rule that matches the JOIN, INNER JOIN and STRAIGHT_JOIN cases while "natural_join" also matches CROSS JOIN. The NATURAL rule has been changed to accept "inner_join" instead of just JOIN, so now NATURAL STRAIGHT_JOIN and NATURAL INNER JOIN also work as expected. As a side effect the removal of the duplciated rules for STRAIGHT_JOIN handling has reduced the shift/reduce conflict count by one. mysql-test/r/join.result: Added new test cases mysql-test/t/join.test: Added new test cases sql/sql_yacc.yy: The "natural_join" parser rule was extended to also accept STRAIGHT_JOIN NATURAL STRAIGHT_JOIN and NATURAL INNER JOIN also now work as expected
Showing
Please register or sign in to comment