# # MDEV-33971 Using NAME_CONST() changes the plan # create table t1 (a int, b int); insert into t1 values (1,1),(2,2); explain format=json select * from t1 where a=name_const('varname',1); explain format=json select * from t1 left join t1 as t2 on t1.a=name_const('varname',1) and t1.b=t2.b; create table t2 ( a varchar(100) collate utf8_unicode_ci, b int ); insert into t2 values ('foo', 1),('bar', 1); create procedure p1(var1 varchar(10)) update t2 set b=b+1 where a=var1; call p1('foo'); call p1('foo'); call p1('foo'); select * from t2; create table t3 ( a varchar(100) collate utf8_unicode_ci, b int ); insert into t3 values ('foo', 1),('bar', 1); select * from t3; explain format=json update t3 set b=b+1 where a= NAME_CONST('var1',_latin1'foo' COLLATE 'latin1_swedish_ci'); select * from t3 where a= NAME_CONST('var1',_latin1'foo' COLLATE 'latin1_swedish_ci'); drop procedure p1; drop table t1, t2, t3;