diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-09-15 20:59:04 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-09-15 20:59:04 +0400 |
commit | 65d26d1f31070b5b9c05eba4eb8f4432e56055e0 (patch) | |
tree | 6edf7fb465892e4a64cbfcde3ac071bf094582a1 /mysql-test | |
parent | fa2701c6f7b028782cf231565f578b2fc0f10d51 (diff) | |
download | mariadb-git-65d26d1f31070b5b9c05eba4eb8f4432e56055e0.tar.gz |
MDEV-10191 non convertible chars convert() resulted in Null instead "?" on Windows
The problem was introduced by the patch for MDEV-7661,
which (in addition to the fix itself) included an attempt to make
CONVERT/CAST work in the same way with fields
(i.e. return NULL in strict mode if a non-convertable character found).
It appeared to be a bad idea and some users were affected by this
behavior change. Changing CONVERT/CAST not depend on sql_mode
(restoring pre-10.1.4 behavior).
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/ctype_utf8.result | 29 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8mb4.result | 4 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8mb4_heap.result | 4 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8mb4_innodb.result | 4 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8mb4_myisam.result | 4 | ||||
-rw-r--r-- | mysql-test/t/ctype_utf8.test | 12 |
6 files changed, 47 insertions, 10 deletions
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 2960b648b84..2b53f43cfc9 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1945,7 +1945,7 @@ Warnings: Warning 1300 Invalid utf8 character string: 'FD' select convert(char(0xff,0x8f) using utf8); convert(char(0xff,0x8f) using utf8) -NULL +?? Warnings: Warning 1300 Invalid utf8 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8)); @@ -2114,7 +2114,7 @@ Warnings: Warning 1300 Invalid utf8 character string: 'FF' select hex(convert(0xFF using utf8)); hex(convert(0xFF using utf8)) -NULL +3F Warnings: Warning 1300 Invalid utf8 character string: '\xFF' select hex(_utf8 0x616263FF); @@ -10473,5 +10473,30 @@ END DROP PROCEDURE p1; SET @@SQL_MODE=default; # +# MDEV-10191 non convertible chars convert() resulted in Null instead "?" on Windows +# +SET sql_mode='STRICT_TRANS_TABLES'; +SELECT CONVERT(_utf8 0xC499 USING latin1); +CONVERT(_utf8 0xC499 USING latin1) +? +Warnings: +Warning 1977 Cannot convert 'utf8' character 0xC499 to 'latin1' +SELECT CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1); +CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1) +? +Warnings: +Warning 1977 Cannot convert 'utf8' character 0xC499 to 'latin1' +SET sql_mode=default; +SELECT CONVERT(_utf8 0xC499 USING latin1); +CONVERT(_utf8 0xC499 USING latin1) +? +Warnings: +Warning 1977 Cannot convert 'utf8' character 0xC499 to 'latin1' +SELECT CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1); +CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1) +? +Warnings: +Warning 1977 Cannot convert 'utf8' character 0xC499 to 'latin1' +# # End of 10.1 tests # diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index dd1c5249bc7..bac0fc34f80 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -1970,7 +1970,7 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FD' select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) -NULL +?? Warnings: Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8mb4)); @@ -2139,7 +2139,7 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF' select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) -NULL +3F Warnings: Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); diff --git a/mysql-test/r/ctype_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result index d70e009228e..46b0cc3789f 100644 --- a/mysql-test/r/ctype_utf8mb4_heap.result +++ b/mysql-test/r/ctype_utf8mb4_heap.result @@ -1802,7 +1802,7 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FD' select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) -NULL +?? Warnings: Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8mb4)); @@ -1971,7 +1971,7 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF' select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) -NULL +3F Warnings: Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result index 7d193f397ac..cfd9bf969ad 100644 --- a/mysql-test/r/ctype_utf8mb4_innodb.result +++ b/mysql-test/r/ctype_utf8mb4_innodb.result @@ -1930,7 +1930,7 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FD' select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) -NULL +?? Warnings: Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8mb4)); @@ -2099,7 +2099,7 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF' select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) -NULL +3F Warnings: Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result index 28cf36c7492..53ae410046f 100644 --- a/mysql-test/r/ctype_utf8mb4_myisam.result +++ b/mysql-test/r/ctype_utf8mb4_myisam.result @@ -1930,7 +1930,7 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FD' select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) -NULL +?? Warnings: Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8mb4)); @@ -2099,7 +2099,7 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF' select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) -NULL +3F Warnings: Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 5f1de609df1..e6792922b95 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1983,6 +1983,18 @@ SET @@SQL_MODE=default; #DROP FUNCTION f1; #SET NAMES utf8; +--echo # +--echo # MDEV-10191 non convertible chars convert() resulted in Null instead "?" on Windows +--echo # + +SET sql_mode='STRICT_TRANS_TABLES'; +SELECT CONVERT(_utf8 0xC499 USING latin1); +SELECT CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1); + +SET sql_mode=default; +SELECT CONVERT(_utf8 0xC499 USING latin1); +SELECT CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1); + --echo # --echo # End of 10.1 tests |