diff options
-rw-r--r-- | mysql-test/r/func_str.result | 17 | ||||
-rw-r--r-- | mysql-test/t/func_str.test | 20 | ||||
-rw-r--r-- | sql/item_strfunc.h | 2 |
3 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 4194a6359c6..8a1302c9b5c 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -4661,3 +4661,20 @@ DROP TABLE t1; # # End of 10.1 tests # +# +# Start of 10.3 tests +# +# +# MDEV-12592 Illegal mix of collations with the HEX function +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES (0x09),('a'); +SELECT IF(a<' ',HEX(a),a) FROM t1 ORDER BY a; +IF(a<' ',HEX(a),a) +09 +a +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index bc5b112e949..b3f6b4faf49 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1806,3 +1806,23 @@ DROP TABLE t1; --echo # --echo # End of 10.1 tests --echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-12592 Illegal mix of collations with the HEX function +--echo # + +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES (0x09),('a'); +SELECT IF(a<' ',HEX(a),a) FROM t1 ORDER BY a; +DROP TABLE t1; + + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 58bd6c99f80..6fdee625749 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1074,7 +1074,7 @@ public: } void fix_length_and_dec() { - collation.set(default_charset()); + collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); decimals=0; fix_char_length(args[0]->max_length * 2); m_arg0_type_handler= args[0]->type_handler(); |