mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#52357: Assertion failed: join->best_read in
greedy_search optimizer_search_depth=0 The algorithm inside restore_prev_nj_state failed to properly update the counters within the NESTED_JOIN tree. The counter was decremented each time a table in the node was removed from the QEP, the correct thing to do being only to decrement it when the last table in the child node was removed from the plan. This lead to node counters getting negative values and the plan thus appeared impossible. An assertion caught this. Fixed by not recursing up the tree unless the last table in the join nest node is removed from the plan
This commit is contained in:
@ -1254,3 +1254,33 @@ SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
|
||||
c e d
|
||||
1 0 NULL
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug#52357: Assertion failed: join->best_read in greedy_search
|
||||
# optimizer_search_depth=0
|
||||
#
|
||||
CREATE TABLE t1( a INT );
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
SET optimizer_search_depth = 0;
|
||||
# Should not core dump on query preparation
|
||||
EXPLAIN
|
||||
SELECT 1
|
||||
FROM t1 tt3 LEFT OUTER JOIN t1 tt4 ON 1
|
||||
LEFT OUTER JOIN t1 tt5 ON 1
|
||||
LEFT OUTER JOIN t1 tt6 ON 1
|
||||
LEFT OUTER JOIN t1 tt7 ON 1
|
||||
LEFT OUTER JOIN t1 tt8 ON 1
|
||||
RIGHT OUTER JOIN t1 tt2 ON 1
|
||||
RIGHT OUTER JOIN t1 tt1 ON 1
|
||||
STRAIGHT_JOIN t1 tt9 ON 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tt1 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt2 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt3 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt4 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt5 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt6 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt7 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt8 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE tt9 ALL NULL NULL NULL NULL 2
|
||||
SET optimizer_search_depth = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user