Commit graph

10 commits

Author SHA1 Message Date
Igor Babaev
8540fa83bb MDEV-19421 Basic 3-way join queries are not parsed.
The parser returned a syntax error message for the queries with join
expressions like this t1 JOIN t2 [LEFT | RIGHT] JOIN t3 ON ... ON ... when
the second operand of the outer JOIN operation with ON clause was another
join expression with ON clause. In this expression the JOIN operator is
right-associative, i.e. expression has to be parsed as the expression
t1 JOIN (t2 [LEFT | RIGHT] JOIN t3 ON ... ) ON ...
Such join expressions are hard to parse because the outer JOIN is
left-associative if there is no ON clause for the first outer JOIN operator.
The patch implements the solution when the JOIN operator is always parsed
as right-associative and builds first the right-associative tree. If it
happens that there is no corresponding ON clause for this operator the
tree is converted to left-associative.

The idea of the solution was taken from the patch by Martin Hansson
"WL#8083: Fixed the join_table rule" from MySQL-8.0 code line.
As the grammar rules related to join expressions in MySQL-8.0 and
MariaDB-5.5+ are quite different MariaDB solution could not borrow
any code from the MySQL-8.0 solution.
2019-07-11 13:39:21 -07:00
Sergey Petrunya
c0ca15ab9c MDEV-4270: crash in fix_semijoin_strategies_for_picked_join_order
- Added testcase
2013-05-04 01:08:20 +04:00
Igor Babaev
e91e8c8c0b Merge 5.3->5.5. 2013-03-28 19:18:36 -07:00
Igor Babaev
21dad7ec30 Fixed bug mdev-4318.
In some cases, when using views the optimizer incorrectly determined
possible join orders for queries with nested outer and inner joins.
This could lead to invalid execution plans for such queries.
2013-03-22 21:33:06 -07:00
Igor Babaev
8b469eb515 Merge 5.3->5.5. 2012-03-01 14:22:22 -08:00
Igor Babaev
e0a5319db3 Back-ported the fix and test cases for bugs #59487 and #43368 from
the mysql-5.6 code line.
2012-02-22 00:10:39 -08:00
Sergei Golubchik
25609313ff 5.3.4 merge 2012-02-15 18:08:08 +01:00
Igor Babaev
74fdbec68e Fixed LP bug #848652.
The cause of this bug was the same as for bug 902356 fixed for 5.3.
2011-12-29 21:55:17 -08:00
Jorgen Loland
47b774b21c BUG#58456 - Assertion 0 in QUICK_INDEX_MERGE_SELECT::need_sorted_output
in opt_range.h

In this bug, there are two alternative access plans: 
 * Index merge range access
 * Const ref access

best_access_path() decided that the ref access was preferrable, 
but make_join_select() still decided to point 
SQL_SELECT::quick to the index merge because the table had 
type==JT_CONST which was not handled. 

At the same time the table's ref.key still referred to the 
index the ref access would use indicating that ref access 
should be used. In this state, different parts of the 
optimizer code have different perceptions of which access path
is in use (ref or range).

test_if_skip_sort_order() was called to check if the ref access
needed ordering, but test_if_skip_sort_order() got confused and
requested the index merge to return records in sorted order. 
Index merge cannot do this, and fired an ASSERT.

The fix is to take join_tab->type==JT_CONST into concideration
when make_join_select() decides whether or not to use the 
range access method.

mysql-test/r/join_outer_innodb.result:
  Add test for BUG#58456
mysql-test/t/join_outer_innodb.test:
  Add test for BUG#58456
2010-12-16 12:25:02 +01:00
unknown
0dbe99f8aa Move innodb dependent test to join_outer_innodb
mysql-test/r/join_outer_innodb.result:
  New BitKeeper file ``mysql-test/r/join_outer_innodb.result''
mysql-test/t/join_outer_innodb.test:
  New BitKeeper file ``mysql-test/t/join_outer_innodb.test''
2006-05-22 13:57:32 +02:00