diff options
-rw-r--r-- | mysql-test/r/func_misc.result | 17 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_sp_variables.result | 24 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_sp_variables.test | 28 | ||||
-rw-r--r-- | mysql-test/t/func_misc.test | 11 | ||||
-rw-r--r-- | sql/item.cc | 5 |
5 files changed, 84 insertions, 1 deletions
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 580982f1ede..e44335f1b51 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -1390,3 +1390,20 @@ DROP TABLE t2; # -- Done. +# +# MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +# +SET NAMES utf8; +SELECT COERCIBILITY(NAME_CONST('name','test')); +COERCIBILITY(NAME_CONST('name','test')) +2 +SELECT COERCIBILITY(NAME_CONST('name',TIME'00:00:00')); +COERCIBILITY(NAME_CONST('name',TIME'00:00:00')) +5 +SELECT COERCIBILITY(NAME_CONST('name',15)); +COERCIBILITY(NAME_CONST('name',15)) +5 +SELECT CONCAT(NAME_CONST('name',15),'오'); +CONCAT(NAME_CONST('name',15),'오') +15오 +SET NAMES latin1; diff --git a/mysql-test/suite/rpl/r/rpl_sp_variables.result b/mysql-test/suite/rpl/r/rpl_sp_variables.result new file mode 100644 index 00000000000..d64bc1a80f0 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_sp_variables.result @@ -0,0 +1,24 @@ +include/master-slave.inc +[connection master] +# +# MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +CREATE PROCEDURE p1() +BEGIN +DECLARE v_id INT DEFAULT 2017; +INSERT INTO test.t1 SELECT CONCAT(v_id, '오'); +END; +$$ +CALL p1; +SELECT * FROM t1; +a +2017오 +SET NAMES utf8; +SELECT * FROM t1; +a +2017오 +DROP PROCEDURE p1; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sp_variables.test b/mysql-test/suite/rpl/t/rpl_sp_variables.test new file mode 100644 index 00000000000..87e9fe194ea --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_sp_variables.test @@ -0,0 +1,28 @@ +source include/master-slave.inc; + +--echo # +--echo # MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +--echo # + +connection master; +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE v_id INT DEFAULT 2017; + INSERT INTO test.t1 SELECT CONCAT(v_id, '오'); +END; +$$ +DELIMITER ;$$ +CALL p1; +SELECT * FROM t1; +sync_slave_with_master; +SET NAMES utf8; +SELECT * FROM t1; +connection master; +DROP PROCEDURE p1; +DROP TABLE t1; +sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 04fbfb713e2..ebd5675e031 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -1080,3 +1080,14 @@ DROP TABLE t2; --echo --echo # -- Done. --echo + + +--echo # +--echo # MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +--echo # +SET NAMES utf8; +SELECT COERCIBILITY(NAME_CONST('name','test')); +SELECT COERCIBILITY(NAME_CONST('name',TIME'00:00:00')); +SELECT COERCIBILITY(NAME_CONST('name',15)); +SELECT CONCAT(NAME_CONST('name',15),'오'); +SET NAMES latin1; diff --git a/sql/item.cc b/sql/item.cc index 6bd982f8854..0b603e1ad2c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1796,7 +1796,10 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref) { set_name(item_name->ptr(), (uint) item_name->length(), system_charset_info); } - collation.set(value_item->collation.collation, DERIVATION_IMPLICIT); + if (value_item->collation.derivation == DERIVATION_NUMERIC) + collation.set_numeric(); + else + collation.set(value_item->collation.collation, DERIVATION_IMPLICIT); max_length= value_item->max_length; decimals= value_item->decimals; fixed= 1; |