diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/ctype_recoding.result | 12 | ||||
-rw-r--r-- | mysql-test/t/ctype_recoding.test | 22 |
2 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 72d19885101..dc1f4c12e25 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -174,3 +174,15 @@ Warnings: Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'b' at row 1 drop table t1; +set names koi8r; +create table t1 (a char(10) character set cp1251); +insert into t1 values (_koi8r'×ÁÓÑ'); +select * from t1 where a=_koi8r'×ÁÓÑ'; +a +×ÁÓÑ +select * from t1 where a=concat(_koi8r'×ÁÓÑ'); +ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '=' +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; diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index 5f417352d95..dab898e9f2c 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -131,3 +131,25 @@ create table t1 (a char(10) character set koi8r, b text character set koi8r); insert into t1 values ('test','test'); insert into t1 values ('ÊÃÕË','ÊÃÕË'); drop table t1; + +# +# Try to apply an automatic conversion in some cases: +# E.g. when mixing a column to a string, the string +# is converted into the column character set. +# If conversion loses data, then error. Otherwise, +# the string is replaced by its converted representation +# +set names koi8r; +create table t1 (a char(10) character set cp1251); +insert into t1 values (_koi8r'×ÁÓÑ'); +# this is possible: +select * from t1 where a=_koi8r'×ÁÓÑ'; +# this is not possible, because we have a function, not just a constant: +--error 1267 +select * from t1 where a=concat(_koi8r'×ÁÓÑ'); +# this is not posible, cannot convert _latin1'×ÁÓÑ' into cp1251: +--error 1267 +select * from t1 where a=_latin1'×ÁÓÑ'; +drop table t1; +set names latin1; + |