Commit a5184bb3 authored by Alexander Barkov's avatar Alexander Barkov

Bug#44352 UPPER/LOWER function doesn't work correctly

on cp932 and sjis environment.
Problem: case conversion erroneously changes the second bytes
of multi-byte sequences because single-byte functions were
called in a mistake.
Fix: call multi-byte aware functions instead.
parent 0f8ae023
......@@ -46,4 +46,12 @@ master-bin.000001 1137 Query 1 1216 use `test`; DROP TABLE t4
End of 5.0 tests
SHOW BINLOG EVENTS FROM 364;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
hex(a) hex(lower(a)) hex(upper(a))
8352835E 8352835E 8352835E
8372835E 8372835E 8372835E
DROP TABLE t1;
End of 5.1 tests
......@@ -209,3 +209,13 @@ SET NAMES sjis;
SELECT HEX('@\') FROM DUAL;
HEX('@\')
8DB2939181408C5C
# Start of 5.1 tests
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set sjis;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
hex(a) hex(lower(a)) hex(upper(a))
8352835E 8352835E 8352835E
8372835E 8372835E 8372835E
DROP TABLE t1;
# End of 5.1 tests
......@@ -34,4 +34,10 @@ delimiter ;|
--error 1220
SHOW BINLOG EVENTS FROM 364;
--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
DROP TABLE t1;
--echo End of 5.1 tests
......@@ -83,3 +83,13 @@ SET NAMES sjis;
SELECT HEX('@\') FROM DUAL;
# End of 4.1 tests
--echo # Start of 5.1 tests
--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set sjis;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
DROP TABLE t1;
--echo # End of 5.1 tests
......@@ -5489,10 +5489,10 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mb_wc_cp932, /* mb_wc */
my_wc_mb_cp932, /* wc_mb */
my_mb_ctype_mb,
my_caseup_str_8bit,
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
my_caseup_str_mb,
my_casedn_str_mb,
my_caseup_mb,
my_casedn_mb,
my_snprintf_8bit,
my_long10_to_str_8bit,
my_longlong10_to_str_8bit,
......
......@@ -4650,10 +4650,10 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mb_wc_sjis, /* mb_wc */
my_wc_mb_sjis, /* wc_mb */
my_mb_ctype_mb,
my_caseup_str_8bit,
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
my_caseup_str_mb,
my_casedn_str_mb,
my_caseup_mb,
my_casedn_mb,
my_snprintf_8bit,
my_long10_to_str_8bit,
my_longlong10_to_str_8bit,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment