Commit 6f40d5c8 authored by Sergei Golubchik's avatar Sergei Golubchik

Item_func_like::walk() was ignoring escape_item

in particular, it caused escape_item->is_expensive() property
to be lost instead of being properly propagated up.
parent 59211ab7
...@@ -302,3 +302,8 @@ select * from (select 1 like 2 escape (1 in (select 1 from t1))) x; ...@@ -302,3 +302,8 @@ select * from (select 1 like 2 escape (1 in (select 1 from t1))) x;
1 like 2 escape (1 in (select 1 from t1)) 1 like 2 escape (1 in (select 1 from t1))
0 0
drop table t1; drop table t1;
create table t1 (f int);
insert t1 values (1),(2);
create view v1 as select * from t1 where (1 like 2 escape (3 in (('h', 'b') in (select 'k', 'k' union select 'g', 'j'))) and f >= 0);
drop view v1;
drop table t1;
...@@ -225,3 +225,12 @@ insert into t1 values(1); ...@@ -225,3 +225,12 @@ insert into t1 values(1);
update (select 1 like 2 escape (1 in (select 1 from t1))) x, t1 as d set d.f1 = 1; update (select 1 like 2 escape (1 in (select 1 from t1))) x, t1 as d set d.f1 = 1;
select * from (select 1 like 2 escape (1 in (select 1 from t1))) x; select * from (select 1 like 2 escape (1 in (select 1 from t1))) x;
drop table t1; drop table t1;
#
# Item_func_like::walk
#
create table t1 (f int);
insert t1 values (1),(2);
create view v1 as select * from t1 where (1 like 2 escape (3 in (('h', 'b') in (select 'k', 'k' union select 'g', 'j'))) and f >= 0);
drop view v1;
drop table t1;
...@@ -2013,6 +2013,13 @@ class Item_func_like :public Item_bool_func2 ...@@ -2013,6 +2013,13 @@ class Item_func_like :public Item_bool_func2
return this; return this;
} }
bool walk(Item_processor processor, bool walk_subquery, void *arg)
{
return walk_args(processor, walk_subquery, arg)
|| escape_item->walk(processor, walk_subquery, arg)
|| (this->*processor)(arg);
}
bool find_selective_predicates_list_processor(void *arg); bool find_selective_predicates_list_processor(void *arg);
Item *get_copy(THD *thd, MEM_ROOT *mem_root) Item *get_copy(THD *thd, MEM_ROOT *mem_root)
......
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