diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index e85d379c932286f234342d42cc453244e39bf29a..fe5842f9880db8beae1b7d93921dcf99767314e0 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -187,6 +187,14 @@ select * from t1 where a=_latin1' ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '=' drop table t1; set names latin1; +set names ascii; +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'); +select * from t1 where a='a'; +a +a +drop table t1; +set names latin1; create table t1 (a char(10) character set utf8 collate utf8_bin); insert into t1 values (' xxx'); select * from t1 where a=lpad('xxx',10,' '); diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index c18c46b6b0834540cd4bc32efff9d5977d3e01b6..1f55aea414a5eefefe67e5af2775149d42767445 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -152,6 +152,16 @@ select * from t1 where a=_latin1' drop table t1; set names latin1; +# +# Test the same with ascii +# +set names ascii; +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'); +select * from t1 where a='a'; +drop table t1; +set names latin1; + # # Bug#10446 Illegal mix of collations # diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 53b2499846c6abd3bb8e65dddaeb46361bdcc726..6c7dea6bf22ebf373062f152eb15967a5cf12f24 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -253,8 +253,6 @@ bool String::needs_conversion(uint32 arg_length, (to_cs == &my_charset_bin) || (to_cs == from_cs) || my_charset_same(from_cs, to_cs) || - (my_charset_is_ascii_based(to_cs) && - my_charset_is_8bit_pure_ascii(from_cs)) || ((from_cs == &my_charset_bin) && (!(*offset=(arg_length % to_cs->mbminlen))))) return FALSE;