From c6e88899460bd3478761f37a873a822f379a170d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Aug 2007 19:25:45 +0500 Subject: [PATCH] Reversing additional change suggested by Serg under terms of bug#28875 for better performance. The change appeared to require more changes in item_cmpfunc.cc, which is dangerous in 5.0. Conversion between a latin1 column and an ascii string constant stopped to work. mysql-test/r/ctype_recoding.result: Adding test case. mysql-test/t/ctype_recoding.test: Adding test case. --- mysql-test/r/ctype_recoding.result | 8 ++++++++ mysql-test/t/ctype_recoding.test | 10 ++++++++++ sql/sql_string.cc | 2 -- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 125e0edd1f9..3826792306f 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 c18c46b6b08..1f55aea414a 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 a87074c3359..9d7df73cd7a 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -263,8 +263,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;