Commit 5785de72 authored by Sergei Golubchik's avatar Sergei Golubchik

Item_func_like calls escape_item->fix_fields() twice

this happens if Item_func_like is copied (get_copy()).
after one copy gets fixed, the other tries to fix escape item again.
parent d1e9a4c1
......@@ -289,3 +289,8 @@ a b c d
3 f_ 1 0 1
3 f\_ 0 1 0
drop table t1;
create table t1 (f int);
insert t1 values (1),(2);
select 1 from (select distinct * from t1) as x where f < (select 1 like 2 escape (3=1));
1
drop table t1;
......@@ -187,7 +187,7 @@ DROP TABLE t1;
--echo #
#
# Item_func_line::print()
# Item_func_like::print()
#
create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!';
show create view v1;
......@@ -207,3 +207,11 @@ insert t1 (a) values ('3 f_'), ('3 f\_');
set sql_mode=default;
select * from t1;
drop table t1;
#
# Item_func_like::fix_fields()
#
create table t1 (f int);
insert t1 values (1),(2);
select 1 from (select distinct * from t1) as x where f < (select 1 like 2 escape (3=1));
drop table t1;
......@@ -5413,7 +5413,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
{
DBUG_ASSERT(fixed == 0);
if (Item_bool_func2::fix_fields(thd, ref) ||
escape_item->fix_fields(thd, &escape_item) ||
(!escape_item->fixed && escape_item->fix_fields(thd, &escape_item)) ||
fix_escape_item(thd, escape_item, &cmp_value1, escape_used_in_parsing,
cmp_collation.collation, &escape))
return TRUE;
......
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