A fix for new conditions being defined and upper condition not updated

parent f2299ee7
......@@ -40,3 +40,4 @@ date numfacture expedition
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
table type possible_keys key key_len ref rows Extra
t1 ref expedition expedition 8 const 1 where used
a b
......@@ -50,3 +50,8 @@ INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00');
SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
drop table t1;
create table t1 (a datetime not null, b datetime not null);
insert into t1 values (now(), now());
insert into t1 values (now(), now());
select * from t1 where a is null or b is null;
drop table t1;
......@@ -3009,6 +3009,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
== Item_func::COND_AND_FUNC;
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
Item::cond_result tmp_cond_value;
bool should_fix_fields=0;
*cond_value=Item::COND_UNDEF;
Item *item;
......@@ -3028,6 +3029,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
delete item; // This may be shared
#endif
VOID(li.replace(new_item));
should_fix_fields=1;
}
if (*cond_value == Item::COND_UNDEF)
*cond_value=tmp_cond_value;
......@@ -3054,6 +3056,9 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
break; /* purecov: deadcode */
}
}
if (should_fix_fields)
cond->fix_fields(current_thd,0);
if (!((Item_cond*) cond)->argument_list()->elements ||
*cond_value != Item::COND_OK)
return (COND*) 0;
......
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