Commit 7907b9b4 authored by Sergey Petrunya's avatar Sergey Petrunya

Merge fix for MDEV-4942, 5.3->5.5

parents b9ce8e60 dbc84ff9
......@@ -2138,4 +2138,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index
drop table t0, t1;
#
# Bug mdev-4942: LEFT JOIN with conjunctive
# <non-nullable datetime field> IS NULL in WHERE
# causes an assert failure
#
CREATE TABLE t1 ( i1 int, d1 date );
INSERT INTO t1 VALUES (1,'2001-06-26'), (2,'2000-11-16');
CREATE TABLE t2 ( i2 int, d2 date NOT NULL );
INSERT INTO t2 VALUES (3,'2000-03-06'), (4,'2007-09-25');
SELECT * FROM t1 LEFT JOIN t2 ON i1 = i2 WHERE d1 IS NULL AND d2 IS NULL;
i1 d1 i2 d2
DROP TABLE t1,t2;
SET optimizer_switch=@save_optimizer_switch;
......@@ -2149,6 +2149,18 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index
drop table t0, t1;
#
# Bug mdev-4942: LEFT JOIN with conjunctive
# <non-nullable datetime field> IS NULL in WHERE
# causes an assert failure
#
CREATE TABLE t1 ( i1 int, d1 date );
INSERT INTO t1 VALUES (1,'2001-06-26'), (2,'2000-11-16');
CREATE TABLE t2 ( i2 int, d2 date NOT NULL );
INSERT INTO t2 VALUES (3,'2000-03-06'), (4,'2007-09-25');
SELECT * FROM t1 LEFT JOIN t2 ON i1 = i2 WHERE d1 IS NULL AND d2 IS NULL;
i1 d1 i2 d2
DROP TABLE t1,t2;
SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;
show variables like 'join_cache_level';
......
......@@ -1687,4 +1687,20 @@ explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo' or
drop table t0, t1;
--echo #
--echo # Bug mdev-4942: LEFT JOIN with conjunctive
--echo # <non-nullable datetime field> IS NULL in WHERE
--echo # causes an assert failure
--echo #
CREATE TABLE t1 ( i1 int, d1 date );
INSERT INTO t1 VALUES (1,'2001-06-26'), (2,'2000-11-16');
CREATE TABLE t2 ( i2 int, d2 date NOT NULL );
INSERT INTO t2 VALUES (3,'2000-03-06'), (4,'2007-09-25');
SELECT * FROM t1 LEFT JOIN t2 ON i1 = i2 WHERE d1 IS NULL AND d2 IS NULL;
DROP TABLE t1,t2;
SET optimizer_switch=@save_optimizer_switch;
......@@ -13642,7 +13642,8 @@ internal_remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
In these cases the disjunct/conjunct must be merged into the
argument list of cond.
*/
if (new_item->type() == Item::COND_ITEM)
if (new_item->type() == Item::COND_ITEM &&
item->type() == Item::COND_ITEM)
{
DBUG_ASSERT(((Item_cond *) cond)->functype() ==
((Item_cond *) new_item)->functype());
......
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