mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-28871: Assert ... failed in JOIN::dbug_verify_sj_inner_tables...
optimize_semi_joins() calls update_sj_state() to update semi-join optimization state in the JOIN class. greedy_search() algorithm considers different join prefixes, and then picks one table to put into the join prefix. Most of the semi-join optimization state is in the table's entry in the join->positions[cur_prefix_size]. However, it also needs to call update_sj_state() to update the semi-join optimization state in the JOIN class. There is one exception, which is the cause of this bug: when we're inside optimize_semi_join_nests() and are optimizing a subquery, optimize_semi_joins() does nothing, it doesn't call update_sj_state(). greedy_search() must not do that either.
This commit is contained in:
@ -3016,5 +3016,22 @@ EXECUTE stmt;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-28871: Assert ... failed in JOIN::dbug_verify_sj_inner_tables with low optimizer_search_depth
|
||||
--echo #
|
||||
set @tmp_28871=@@optimizer_search_depth;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (b INT);
|
||||
|
||||
# Data is optional, fails either way
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t1 VALUES (3),(4);
|
||||
|
||||
SET optimizer_search_depth= 1;
|
||||
|
||||
SELECT * FROM t1 WHERE a IN (SELECT b FROM t2 JOIN t1);
|
||||
DROP TABLE t1, t2;
|
||||
set optimizer_search_depth= @tmp_28871;
|
||||
|
||||
# The following command must be the last one the file
|
||||
set optimizer_switch=@subselect_sj_tmp;
|
||||
|
Reference in New Issue
Block a user