Commit 715a6576 authored by unknown's avatar unknown

fix_fields recoursion didn't stop when some level's fix_length_and_dec

produced an error. This led to server crash in some cases, e.g.:
create table t7 (s1 char);
select * from t7
where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci)
= 'AA';
parent d9ce76e8
......@@ -553,3 +553,8 @@ SUBSTR('abcdefg',-1,-1)
select SUBSTR('abcdefg',1,-1) FROM DUAL;
SUBSTR('abcdefg',1,-1)
create table t7 (s1 char);
select * from t7
where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA';
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'concat'
drop table t7;
......@@ -305,3 +305,13 @@ select SUBSTR('abcdefg',-1,5) FROM DUAL;
select SUBSTR('abcdefg',0,0) FROM DUAL;
select SUBSTR('abcdefg',-1,-1) FROM DUAL;
select SUBSTR('abcdefg',1,-1) FROM DUAL;
#
# Test that fix_fields doesn't follow to upper level (to comparison)
# when an error on a lower level (in concat) has accured:
#
create table t7 (s1 char);
--error 1265
select * from t7
where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA';
drop table t7;
......@@ -192,6 +192,8 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
}
fix_length_and_dec();
if (thd && thd->net.last_errno) // An error inside fix_length_and_dec accured
return 1;
fixed= 1;
return 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