Commit e28a2419 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx)

          for incorrect byte sequences
parent a471b709
......@@ -487,6 +487,8 @@ drop table t1;
select hex(convert(_big5 0xC84041 using ucs2));
hex(convert(_big5 0xC84041 using ucs2))
003F0041
Warnings:
Warning 1976 Cannot convert 'big5' character 0xC840 to 'ucs2'
End of 4.1 tests
set names big5;
create table t1 (a blob);
......@@ -762,6 +764,71 @@ A2BF Ⅶ
A2C0 Ⅷ
A2C1 Ⅸ
A2C2 Ⅹ
Warnings:
Warning 1976 Cannot convert 'big5' character 0xA3C0 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C0 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C1 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C1 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C2 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C2 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C3 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C3 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C4 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C4 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C5 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C5 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C6 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C6 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C7 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C7 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C8 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C8 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C9 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C9 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CA to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CA to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CB to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CB to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CC to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CC to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CD to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CD to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CE to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CE to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CF to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CF to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D0 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D0 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D1 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D1 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D2 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D2 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D3 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D3 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D4 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D4 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D5 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D5 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D6 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D6 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D7 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D7 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D8 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D8 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D9 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D9 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DA to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DA to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DB to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DB to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DC to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DC to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DD to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DD to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DE to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DE to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DF to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DF to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
......@@ -776,6 +843,71 @@ C7D8 п
C7D9 р
C7DA с
C7DB т
Warnings:
Warning 1976 Cannot convert 'big5' character 0xA3C0 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C0 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C1 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C1 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C2 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C2 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C3 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C3 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C4 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C4 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C5 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C5 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C6 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C6 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C7 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C7 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C8 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C8 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C9 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3C9 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CA to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CA to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CB to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CB to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CC to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CC to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CD to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CD to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CE to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CE to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CF to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3CF to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D0 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D0 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D1 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D1 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D2 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D2 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D3 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D3 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D4 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D4 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D5 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D5 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D6 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D6 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D7 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D7 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D8 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D8 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D9 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3D9 to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DA to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DA to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DB to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DB to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DC to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DC to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DD to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DD to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DE to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DE to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DF to 'utf8'
Warning 1976 Cannot convert 'big5' character 0xA3DF to 'utf8'
DROP TABLE t1;
#
# End of 5.5 tests
......
......@@ -385,6 +385,8 @@ FC FC FC D18C FC
FD FD FD D18D FD
FE FE FE D18E FE
FF FF FF D18F FF
Warnings:
Warning 1976 Cannot convert 'cp1251' character 0x98 to 'utf8'
DROP TABLE t1;
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
ERROR HY000: Unknown locale: '-8388608'
......
This diff is collapsed.
This diff is collapsed.
......@@ -24712,6 +24712,71 @@ WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
A1CA Å
Warnings:
Warning 1976 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2ED to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2ED to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EF to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EF to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AF to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AF to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BD to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
......@@ -24743,6 +24808,71 @@ A8E4 ⓧ
A8E5 ⓨ
A8E6 ⓩ
A9A2 đ
Warnings:
Warning 1976 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2E8 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2E9 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2ED to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2ED to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EF to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2EF to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F0 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F1 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F2 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F3 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F4 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F5 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F6 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F7 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F8 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2F9 to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA2FE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AE to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AF to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5AF to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BA to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BB to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BC to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BD to 'utf8'
Warning 1976 Cannot convert 'euckr' character 0xA5BD to 'utf8'
DROP TABLE t1;
#
# End of 5.5 tests
......
......@@ -740,6 +740,71 @@ A2F9 Ⅸ
A2FA Ⅹ
A2FB Ⅺ
A2FC Ⅻ
Warnings:
Warning 1976 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
......@@ -770,6 +835,71 @@ A8B7 ǚ
A8B8 ǜ
A8B9 ü
A8BA ê
Warnings:
Warning 1976 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A1 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A2 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A3 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A5 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A6 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A7 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A8 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2A9 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AA to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AB to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AC to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AE to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2AF to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2B0 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2E3 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2E4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2EF to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2F0 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2FD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA2FE to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F4 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F5 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F6 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F7 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F8 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4F9 to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FA to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FB to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FC to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
Warning 1976 Cannot convert 'gb2312' character 0xA4FD to 'utf8'
DROP TABLE t1;
#
# End of 5.5 tests
......
......@@ -464,6 +464,8 @@ DROP TABLE t1;
select hex(convert(_gbk 0xA14041 using ucs2));
hex(convert(_gbk 0xA14041 using ucs2))
003F0041
Warnings:
Warning 1976 Cannot convert 'gbk' character 0xA140 to 'ucs2'
create table t1 (c1 text not null, c2 text not null) character set gbk;
alter table t1 change c1 c1 mediumtext character set gbk not null;
show create table t1;
......@@ -770,6 +772,71 @@ HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
code a
A2FB Ⅺ
A2FC Ⅻ
Warnings:
Warning 1976 Cannot convert 'gbk' character 0xA140 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA140 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA141 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA141 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA142 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA142 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA143 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA143 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA144 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA144 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA145 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA145 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA146 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA146 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA147 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA147 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA148 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA148 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA149 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA149 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14A to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14A to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14B to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14B to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14C to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14C to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14D to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14D to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14E to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14E to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14F to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14F to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA150 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA150 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA151 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA151 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA152 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA152 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA153 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA153 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA154 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA154 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA155 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA155 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA156 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA156 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA157 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA157 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA158 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA158 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA159 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA159 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15A to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15A to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15B to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15B to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15C to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15C to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15D to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15D to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15E to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15E to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15F to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15F to 'utf8'
SELECT * FROM t1
WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
......@@ -802,6 +869,71 @@ A8B9 ü
A8BA ê
A8BD ń
A8BE ň
Warnings:
Warning 1976 Cannot convert 'gbk' character 0xA140 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA140 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA141 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA141 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA142 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA142 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA143 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA143 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA144 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA144 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA145 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA145 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA146 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA146 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA147 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA147 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA148 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA148 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA149 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA149 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14A to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14A to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14B to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14B to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14C to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14C to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14D to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14D to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14E to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14E to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14F to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA14F to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA150 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA150 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA151 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA151 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA152 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA152 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA153 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA153 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA154 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA154 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA155 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA155 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA156 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA156 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA157 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA157 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA158 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA158 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA159 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA159 to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15A to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15A to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15B to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15B to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15C to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15C to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15D to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15D to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15E to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15E to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15F to 'utf8'
Warning 1976 Cannot convert 'gbk' character 0xA15F to 'utf8'
DROP TABLE t1;
#
# End of 5.5 tests
......@@ -5755,5 +5887,18 @@ DROP TABLE t1;
# END OF MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion
#
#
# MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences
#
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312));
HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312))
3F41
Warnings:
Warning 1300 Invalid gb2312 character string: '\xA3A'
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8));
HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8))
3F41
Warnings:
Warning 1300 Invalid gb2312 character string: '\xA3A'
#
# End of 10.1 tests
#
This diff is collapsed.
This diff is collapsed.
......@@ -1919,9 +1919,9 @@ Warnings:
Warning 1300 Invalid utf8 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8);
convert(char(0xff,0x8f) using utf8)
??
Warnings:
Warning 1300 Invalid utf8 character string: 'FF8F'
Warning 1300 Invalid utf8 character string: '\xFF\x8F'
set sql_mode=traditional;
select char(0xff,0x8f using utf8);
char(0xff,0x8f using utf8)
......@@ -1947,7 +1947,7 @@ select convert(char(0xff,0x8f) using utf8);
convert(char(0xff,0x8f) using utf8)
NULL
Warnings:
Warning 1300 Invalid utf8 character string: 'FF8F'
Warning 1300 Invalid utf8 character string: '\xFF\x8F'
select hex(convert(char(2557 using latin1) using utf8));
hex(convert(char(2557 using latin1) using utf8))
09C3BD
......@@ -2116,7 +2116,7 @@ select hex(convert(0xFF using utf8));
hex(convert(0xFF using utf8))
NULL
Warnings:
Warning 1300 Invalid utf8 character string: 'FF'
Warning 1300 Invalid utf8 character string: '\xFF'
select hex(_utf8 0x616263FF);
ERROR HY000: Invalid utf8 character string: 'FF'
select hex(_utf8 X'616263FF');
......@@ -2133,9 +2133,9 @@ Warnings:
Warning 1300 Invalid utf8 character string: 'FF'
select hex(convert(0xFF using utf8));
hex(convert(0xFF using utf8))
3F
Warnings:
Warning 1300 Invalid utf8 character string: 'FF'
Warning 1300 Invalid utf8 character string: '\xFF'
select hex(_utf8 0x616263FF);
ERROR HY000: Invalid utf8 character string: 'FF'
select hex(_utf8 X'616263FF');
......
......@@ -1944,9 +1944,9 @@ Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8mb4);
convert(char(0xff,0x8f) using utf8mb4)
??
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F'
set sql_mode=traditional;
select char(0xff,0x8f using utf8mb4);
char(0xff,0x8f using utf8mb4)
......@@ -1972,7 +1972,7 @@ select convert(char(0xff,0x8f) using utf8mb4);
convert(char(0xff,0x8f) using utf8mb4)
NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F'
select hex(convert(char(2557 using latin1) using utf8mb4));
hex(convert(char(2557 using latin1) using utf8mb4))
09C3BD
......@@ -2141,7 +2141,7 @@ select hex(convert(0xFF using utf8mb4));
hex(convert(0xFF using utf8mb4))
NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
Warning 1300 Invalid utf8mb4 character string: '\xFF'
select hex(_utf8mb4 0x616263FF);
ERROR HY000: Invalid utf8mb4 character string: 'FF'
select hex(_utf8mb4 X'616263FF');
......@@ -2158,9 +2158,9 @@ Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
select hex(convert(0xFF using utf8mb4));
hex(convert(0xFF using utf8mb4))
3F
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
Warning 1300 Invalid utf8mb4 character string: '\xFF'
select hex(_utf8mb4 0x616263FF);
ERROR HY000: Invalid utf8mb4 character string: 'FF'
select hex(_utf8mb4 X'616263FF');
......
......@@ -1776,9 +1776,9 @@ Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8mb4);
convert(char(0xff,0x8f) using utf8mb4)
??
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F'
set sql_mode=traditional;
select char(0xff,0x8f using utf8mb4);
char(0xff,0x8f using utf8mb4)
......@@ -1804,7 +1804,7 @@ select convert(char(0xff,0x8f) using utf8mb4);
convert(char(0xff,0x8f) using utf8mb4)
NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F'
select hex(convert(char(2557 using latin1) using utf8mb4));
hex(convert(char(2557 using latin1) using utf8mb4))
09C3BD
......@@ -1973,7 +1973,7 @@ select hex(convert(0xFF using utf8mb4));
hex(convert(0xFF using utf8mb4))
NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
Warning 1300 Invalid utf8mb4 character string: '\xFF'
select hex(_utf8mb4 0x616263FF);
ERROR HY000: Invalid utf8mb4 character string: 'FF'
select hex(_utf8mb4 X'616263FF');
......@@ -1990,9 +1990,9 @@ Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
select hex(convert(0xFF using utf8mb4));
hex(convert(0xFF using utf8mb4))
3F
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
Warning 1300 Invalid utf8mb4 character string: '\xFF'
select hex(_utf8mb4 0x616263FF);
ERROR HY000: Invalid utf8mb4 character string: 'FF'
select hex(_utf8mb4 X'616263FF');
......
......@@ -1904,9 +1904,9 @@ Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8mb4);
convert(char(0xff,0x8f) using utf8mb4)
??
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F'
set sql_mode=traditional;
select char(0xff,0x8f using utf8mb4);
char(0xff,0x8f using utf8mb4)
......@@ -1932,7 +1932,7 @@ select convert(char(0xff,0x8f) using utf8mb4);
convert(char(0xff,0x8f) using utf8mb4)
NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F'
select hex(convert(char(2557 using latin1) using utf8mb4));
hex(convert(char(2557 using latin1) using utf8mb4))
09C3BD
......@@ -2101,7 +2101,7 @@ select hex(convert(0xFF using utf8mb4));
hex(convert(0xFF using utf8mb4))
NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
Warning 1300 Invalid utf8mb4 character string: '\xFF'
select hex(_utf8mb4 0x616263FF);
ERROR HY000: Invalid utf8mb4 character string: 'FF'
select hex(_utf8mb4 X'616263FF');
......@@ -2118,9 +2118,9 @@ Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
select hex(convert(0xFF using utf8mb4));
hex(convert(0xFF using utf8mb4))
3F
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
Warning 1300 Invalid utf8mb4 character string: '\xFF'
select hex(_utf8mb4 0x616263FF);
ERROR HY000: Invalid utf8mb4 character string: 'FF'
select hex(_utf8mb4 X'616263FF');
......
......@@ -1904,9 +1904,9 @@ Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8mb4);
convert(char(0xff,0x8f) using utf8mb4)
??
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F'
set sql_mode=traditional;
select char(0xff,0x8f using utf8mb4);
char(0xff,0x8f using utf8mb4)
......@@ -1932,7 +1932,7 @@ select convert(char(0xff,0x8f) using utf8mb4);
convert(char(0xff,0x8f) using utf8mb4)
NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F'
select hex(convert(char(2557 using latin1) using utf8mb4));
hex(convert(char(2557 using latin1) using utf8mb4))
09C3BD
......@@ -2101,7 +2101,7 @@ select hex(convert(0xFF using utf8mb4));
hex(convert(0xFF using utf8mb4))
NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
Warning 1300 Invalid utf8mb4 character string: '\xFF'
select hex(_utf8mb4 0x616263FF);
ERROR HY000: Invalid utf8mb4 character string: 'FF'
select hex(_utf8mb4 X'616263FF');
......@@ -2118,9 +2118,9 @@ Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
select hex(convert(0xFF using utf8mb4));
hex(convert(0xFF using utf8mb4))
3F
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
Warning 1300 Invalid utf8mb4 character string: '\xFF'
select hex(_utf8mb4 0x616263FF);
ERROR HY000: Invalid utf8mb4 character string: 'FF'
select hex(_utf8mb4 X'616263FF');
......
......@@ -1619,11 +1619,16 @@ insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
select equals(`a`,convert(`a` using utf8)) from `t1`;
equals(`a`,convert(`a` using utf8))
1
0
0
Warnings:
Warning 1300 Invalid utf8 character string: '\xE0C'
Warning 1300 Invalid utf8 character string: '\xE0C'
select equals(`a`,left(`a`,23)) from `t1`;
equals(`a`,left(`a`,23))
NULL
NULL
NULL
Warnings:
Warning 1300 Invalid utf8 character string: 'E043'
Warning 1300 Invalid utf8 character string: 'E043'
drop table t1;
#
# MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0))
......
......@@ -160,6 +160,14 @@ SELECT `
伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 ????????????????????
鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 ????????????????????
齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 ????????????????????
Warnings:
Warning 1976 Cannot convert 'ucs2' character 0x02DB to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
SELECT `C1`, CONVERT(`C1` using utf8) FROM `T4`;
C1 CONVERT(`C1` using utf8)
。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
......@@ -235,6 +243,14 @@ SELECT `
伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 ????????????????????
鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 ????????????????????
齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 ????????????????????
Warnings:
Warning 1976 Cannot convert 'ucs2' character 0x02DB to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
SELECT `C1`, CONVERT(`C1` using utf8) FROM `T7`;
C1 CONVERT(`C1` using utf8)
PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
......@@ -310,6 +326,14 @@ SELECT `
・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・???????????????????
鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 ????????????????????
齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 ????????????????????
Warnings:
Warning 1976 Cannot convert 'ucs2' character 0x02DB to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
Warning 1976 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
drop table `T1`;
drop table `T2`;
drop table `T3`;
......
......@@ -393,6 +393,38 @@ SELECT `
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
Warnings:
Warning 1976 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
SELECT `C1`, CONVERT(`C1` using utf8) FROM `T4`;
C1 CONVERT(`C1` using utf8)
!"#$%&'()*+,-./ !"#$%&'()*+,-./
......@@ -759,6 +791,38 @@ SELECT `
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
Warnings:
Warning 1976 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
SELECT `C1`, CONVERT(`C1` using utf8) FROM `T7`;
C1 CONVERT(`C1` using utf8)
!"#$%&'()*+,-./ !"#$%&'()*+,-./
......@@ -1125,6 +1189,38 @@ SELECT `
齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 ????????????????????
龔龖龗龞龡龢龣龥・・・・・・・・・・・・ ????????・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
Warnings:
Warning 1976 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
Warning 1976 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
drop table `T1`;
drop table `T2`;
drop table `T3`;
......
......@@ -425,6 +425,13 @@ DROP TABLE t1;
--echo # END OF MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion
--echo #
--echo #
--echo # MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences
--echo #
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312));
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8));
--echo #
--echo # End of 10.1 tests
--echo #
......@@ -1377,6 +1377,7 @@ insert into t1 values(geomfromtext("POINT(0 0)"));
insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
select equals(`a`,convert(`a` using utf8)) from `t1`;
select equals(`a`,left(`a`,23)) from `t1`;
drop table t1;
--echo #
......
......@@ -5508,6 +5508,45 @@ String *Item::check_well_formed_result(String *str, bool send_error)
return str;
}
/**
Copy a string with optional character set conversion.
*/
bool
String_copier_for_item::copy_with_warn(CHARSET_INFO *dstcs, String *dst,
CHARSET_INFO *srccs, const char *src,
uint32 src_length, uint32 nchars)
{
if ((dst->copy(dstcs, srccs, src, src_length, nchars, this)))
return true; // EOM
if (const char *pos= well_formed_error_pos())
{
ErrConvString err(pos, src_length - (pos - src), &my_charset_bin);
push_warning_printf(m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_INVALID_CHARACTER_STRING,
ER(ER_INVALID_CHARACTER_STRING),
srccs == &my_charset_bin ?
dstcs->csname : srccs->csname,
err.ptr());
return m_thd->is_strict_mode();
}
if (const char *pos= cannot_convert_error_pos())
{
char buf[16];
int mblen= srccs->cset->charlen(srccs, (const uchar *) pos,
(const uchar *) src + src_length);
DBUG_ASSERT(mblen > 0 && mblen * 2 + 1 <= (int) sizeof(buf));
octet2hex(buf, pos, mblen);
push_warning_printf(m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANNOT_CONVERT_CHARACTER,
ER(ER_CANNOT_CONVERT_CHARACTER),
srccs->csname, buf, dstcs->csname);
return m_thd->is_strict_mode();
}
return false;
}
/*
Compare two items using a given collation
......
......@@ -531,6 +531,21 @@ class st_select_lex_unit;
class Item_func_not;
class Item_splocal;
/**
String_copier that honors the current sql_mode (strict vs non strict)
and can send warnings.
*/
class String_copier_for_item: public String_copier
{
THD *m_thd;
public:
bool copy_with_warn(CHARSET_INFO *dstcs, String *dst,
CHARSET_INFO *srccs, const char *src,
uint32 src_length, uint32 nchars);
String_copier_for_item(THD *thd): m_thd(thd) { }
};
class Item {
Item(const Item &); /* Prevent use of these */
void operator=(Item &);
......
......@@ -3378,15 +3378,12 @@ String *Item_func_conv_charset::val_str(String *str)
if (use_cached_value)
return null_value ? 0 : &str_value;
String *arg= args[0]->val_str(str);
uint dummy_errors;
if (args[0]->null_value)
{
null_value=1;
return 0;
}
null_value= tmp_value.copy(arg->ptr(), arg->length(), arg->charset(),
conv_charset, &dummy_errors);
return null_value ? 0 : check_well_formed_result(&tmp_value);
String_copier_for_item copier(current_thd);
return ((null_value= args[0]->null_value ||
copier.copy_with_warn(conv_charset, &tmp_value,
arg->charset(), arg->ptr(),
arg->length(), arg->length()))) ?
0 : &tmp_value;
}
void Item_func_conv_charset::fix_length_and_dec()
......
......@@ -2356,105 +2356,121 @@ void Item_char_typecast::print(String *str, enum_query_type query_type)
str->append(')');
}
void Item_char_typecast::check_truncation_with_warn(String *src, uint dstlen)
{
if (dstlen < src->length())
{
char char_type[40];
my_snprintf(char_type, sizeof(char_type), "%s(%lu)",
cast_cs == &my_charset_bin ? "BINARY" : "CHAR",
(ulong) cast_length);
ErrConvString err(src);
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), char_type,
err.ptr());
}
}
String *Item_char_typecast::reuse(String *src, uint32 length)
{
DBUG_ASSERT(length <= src->length());
check_truncation_with_warn(src, length);
tmp_value.set(src->ptr(), length, cast_cs);
return &tmp_value;
}
/*
Make a copy, to handle conversion or fix bad bytes.
*/
String *Item_char_typecast::copy(String *str, CHARSET_INFO *strcs)
{
String_copier_for_item copier(current_thd);
if (copier.copy_with_warn(cast_cs, &tmp_value, strcs,
str->ptr(), str->length(), cast_length))
{
null_value= 1; // In strict mode: malformed data or could not convert
return 0;
}
check_truncation_with_warn(str, copier.source_end_pos() - str->ptr());
return &tmp_value;
}
uint Item_char_typecast::adjusted_length_with_warn(uint length)
{
if (length <= current_thd->variables.max_allowed_packet)
return length;
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
cast_cs == &my_charset_bin ?
"cast_as_binary" : func_name(),
current_thd->variables.max_allowed_packet);
return current_thd->variables.max_allowed_packet;
}
String *Item_char_typecast::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String *res;
uint32 length;
if (cast_length != ~0U &&
cast_length > current_thd->variables.max_allowed_packet)
if (has_explicit_length())
cast_length= adjusted_length_with_warn(cast_length);
if (!(res= args[0]->val_str(str)))
{
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
cast_cs == &my_charset_bin ?
"cast_as_binary" : func_name(),
current_thd->variables.max_allowed_packet);
cast_length= current_thd->variables.max_allowed_packet;
null_value= 1;
return 0;
}
if (!charset_conversion)
if (cast_cs == &my_charset_bin &&
has_explicit_length() &&
cast_length > res->length())
{
if (!(res= args[0]->val_str(str)))
// Special case: pad binary value with trailing 0x00
DBUG_ASSERT(cast_length <= current_thd->variables.max_allowed_packet);
if (res->alloced_length() < cast_length)
{
null_value= 1;
return 0;
str_value.alloc(cast_length);
str_value.copy(*res);
res= &str_value;
}
bzero((char*) res->ptr() + res->length(), cast_length - res->length());
res->length(cast_length);
res->set_charset(&my_charset_bin);
}
else
{
/*
Convert character set if differ
from_cs is 0 in the case where the result set may vary between calls,
for example with dynamic columns.
*/
uint dummy_errors;
if (!(res= args[0]->val_str(str)) ||
tmp_value.copy(res->ptr(), res->length(),
from_cs ? from_cs : res->charset(),
cast_cs, &dummy_errors))
{
null_value= 1;
return 0;
}
res= &tmp_value;
}
res->set_charset(cast_cs);
/*
Cut the tail if cast with length
and the result is longer than cast length, e.g.
CAST('string' AS CHAR(1))
*/
if (cast_length != ~0U)
{
if (res->length() > (length= (uint32) res->charpos(cast_length)))
{ // Safe even if const arg
char char_type[40];
my_snprintf(char_type, sizeof(char_type), "%s(%lu)",
cast_cs == &my_charset_bin ? "BINARY" : "CHAR",
(ulong) length);
if (!res->alloced_length())
{ // Don't change const str
str_value= *res; // Not malloced string
res= &str_value;
}
ErrConvString err(res);
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), char_type,
err.ptr());
res->length((uint) length);
}
else if (cast_cs == &my_charset_bin && res->length() < cast_length)
CHARSET_INFO *cs= from_cs ? from_cs : res->charset();
if (!charset_conversion)
{
if (res->alloced_length() < cast_length)
// Try to reuse the original string (if well formed).
MY_STRCOPY_STATUS status;
cs->cset->well_formed_char_length(cs, res->ptr(), res->end(),
cast_length, &status);
if (!status.m_well_formed_error_pos)
{
str_value.alloc(cast_length);
str_value.copy(*res);
res= &str_value;
res= reuse(res, status.m_source_end_pos - res->ptr());
}
bzero((char*) res->ptr() + res->length(), cast_length - res->length());
res->length(cast_length);
goto end;
}
// Character set conversion, or bad bytes were found.
if (!(res= copy(res, cs)))
return 0;
}
null_value= 0;
if (res->length() > current_thd->variables.max_allowed_packet)
{
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
cast_cs == &my_charset_bin ?
"cast_as_binary" : func_name(),
current_thd->variables.max_allowed_packet);
null_value= 1;
return 0;
}
return res;
end:
return ((null_value= (res->length() >
adjusted_length_with_warn(res->length())))) ? 0 : res;
}
......
......@@ -886,6 +886,11 @@ class Item_char_typecast :public Item_str_func
CHARSET_INFO *cast_cs, *from_cs;
bool charset_conversion;
String tmp_value;
bool has_explicit_length() const { return cast_length != ~0U; }
String *reuse(String *src, uint32 length);
String *copy(String *src, CHARSET_INFO *cs);
uint adjusted_length_with_warn(uint length);
void check_truncation_with_warn(String *src, uint dstlen);
public:
Item_char_typecast(Item *a, uint length_arg, CHARSET_INFO *cs_arg)
:Item_str_func(a), cast_length(length_arg), cast_cs(cs_arg) {}
......
......@@ -7125,3 +7125,5 @@ ER_ROLE_CREATE_EXISTS
eng "Can't create role '%-.64s'; it already exists"
ER_ROLE_DROP_EXISTS
eng "Can't drop role '%-.64s'; it doesn't exist"
ER_CANNOT_CONVERT_CHARACTER
eng "Cannot convert '%s' character 0x%-.64s to '%s'"
......@@ -200,6 +200,7 @@ class String
inline bool is_empty() const { return (str_length == 0); }
inline void mark_as_const() { Alloced_length= 0;}
inline const char *ptr() const { return Ptr; }
inline const char *end() const { return Ptr + str_length; }
inline char *c_ptr()
{
DBUG_ASSERT(!alloced || !Ptr || !Alloced_length ||
......@@ -423,6 +424,17 @@ class String
{
return copy(str->ptr(), str->length(), str->charset(), tocs, errors);
}
bool copy(CHARSET_INFO *tocs,
CHARSET_INFO *fromcs, const char *src, uint32 src_length,
uint32 nchars, String_copier *copier)
{
if (alloc(tocs->mbmaxlen * src_length))
return true;
str_length= copier->well_formed_copy(tocs, Ptr, Alloced_length,
fromcs, src, src_length, nchars);
str_charset= tocs;
return false;
}
void move(String &s)
{
free();
......
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