Commit 2ead54d0 authored by Igor Babaev's avatar Igor Babaev

Merge

parents 5d5f3a1e f8af4423
......@@ -2016,6 +2016,20 @@ drop table t1,t2;
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
#
# MDEV-4908: Assertion `((Item_cond *) cond)->functype() ==
# ((Item_cond *) new_item)->functype()' fails on a query with
# IN and equal conditions, AND/OR, materialization+semijoin
#
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'materialization=on,semijoin=on';
CREATE TABLE t1 (pk INT, a INT, b INT, PRIMARY KEY(pk)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,3,5),(2,4,6);
SELECT * FROM t1 WHERE 8 IN ( SELECT MIN(pk) FROM t1 ) AND ( pk = a OR pk = b );
pk a b
drop table t1;
SET optimizer_switch=@save_optimizer_switch;
# End of 5.3 tests
set @subselect_mat_test_optimizer_switch_value=null;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
......
......@@ -2056,3 +2056,17 @@ drop table t1,t2;
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
#
# MDEV-4908: Assertion `((Item_cond *) cond)->functype() ==
# ((Item_cond *) new_item)->functype()' fails on a query with
# IN and equal conditions, AND/OR, materialization+semijoin
#
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'materialization=on,semijoin=on';
CREATE TABLE t1 (pk INT, a INT, b INT, PRIMARY KEY(pk)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,3,5),(2,4,6);
SELECT * FROM t1 WHERE 8 IN ( SELECT MIN(pk) FROM t1 ) AND ( pk = a OR pk = b );
pk a b
drop table t1;
SET optimizer_switch=@save_optimizer_switch;
# End of 5.3 tests
......@@ -1700,3 +1700,21 @@ drop table t1,t2;
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
--echo #
--echo # MDEV-4908: Assertion `((Item_cond *) cond)->functype() ==
--echo # ((Item_cond *) new_item)->functype()' fails on a query with
--echo # IN and equal conditions, AND/OR, materialization+semijoin
--echo #
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'materialization=on,semijoin=on';
CREATE TABLE t1 (pk INT, a INT, b INT, PRIMARY KEY(pk)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,3,5),(2,4,6);
SELECT * FROM t1 WHERE 8 IN ( SELECT MIN(pk) FROM t1 ) AND ( pk = a OR pk = b );
drop table t1;
SET optimizer_switch=@save_optimizer_switch;
--echo # End of 5.3 tests
......@@ -5211,10 +5211,12 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
{
eq_cond= new Item_func_eq(subq_pred->left_expr->element_index(i),
new_sink->row[i]);
if (!eq_cond || eq_cond->fix_fields(join->thd, &eq_cond))
if (!eq_cond)
DBUG_RETURN(1);
(*join_where)= and_items(*join_where, eq_cond);
if (!((*join_where)= and_items(*join_where, eq_cond)) ||
(*join_where)->fix_fields(join->thd, join_where))
DBUG_RETURN(1);
}
}
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment