Skip to content

Commit d516a2a

Browse files
author
Alexander Barkov
committed
MDEV-9823 LOAD DATA INFILE silently truncates incomplete byte sequences
1 parent bddd63c commit d516a2a

14 files changed

+202
-26
lines changed

mysql-test/r/ctype_eucjpms.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33913,3 +33913,24 @@ DROP TABLE t1;
3391333913
#
3391433914
# End of 10.1 tests
3391533915
#
33916+
#
33917+
# End of 10.2 tests
33918+
#
33919+
#
33920+
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
33921+
#
33922+
CREATE TABLE t1 (a TEXT CHARACTER SET eucjpms);
33923+
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.ujis.txt' INTO TABLE t1 CHARACTER SET eucjpms IGNORE 4 LINES;
33924+
SELECT HEX(a) FROM t1;
33925+
HEX(a)
33926+
3F
33927+
78787831
33928+
3F3F
33929+
78787832
33930+
8FA1A1
33931+
78787833
33932+
3F3F
33933+
DROP TABLE t1;
33934+
#
33935+
# End of 10.2 tests
33936+
#

mysql-test/r/ctype_ujis.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26218,3 +26218,24 @@ DROP TABLE t1;
2621826218
#
2621926219
# End of 10.1 tests
2622026220
#
26221+
#
26222+
# End of 10.2 tests
26223+
#
26224+
#
26225+
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
26226+
#
26227+
CREATE TABLE t1 (a TEXT CHARACTER SET ujis);
26228+
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.ujis.txt' INTO TABLE t1 CHARACTER SET ujis IGNORE 4 LINES;
26229+
SELECT HEX(a) FROM t1;
26230+
HEX(a)
26231+
3F
26232+
78787831
26233+
3F3F
26234+
78787832
26235+
8FA1A1
26236+
78787833
26237+
3F3F
26238+
DROP TABLE t1;
26239+
#
26240+
# End of 10.2 tests
26241+
#

mysql-test/r/ctype_utf8.result

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10426,5 +10426,27 @@ b
1042610426
c
1042710427
DROP TABLE t1;
1042810428
#
10429+
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
10430+
#
10431+
CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
10432+
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' INTO TABLE t1 CHARACTER SET utf8 IGNORE 4 LINES;
10433+
Warnings:
10434+
Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
10435+
Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3
10436+
Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5
10437+
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 7
10438+
Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8
10439+
SELECT HEX(a) FROM t1;
10440+
HEX(a)
10441+
3F
10442+
78787831
10443+
3F3F
10444+
78787832
10445+
3F3F3F
10446+
78787833
10447+
3F3F3F3F
10448+
3F3F3F
10449+
DROP TABLE t1;
10450+
#
1042910451
# End of 10.2 tests
1043010452
#

mysql-test/r/ctype_utf8mb4.result

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3398,3 +3398,30 @@ DROP FUNCTION f1;
33983398
#
33993399
# End of 10.1 tests
34003400
#
3401+
#
3402+
# End of 10.2 tests
3403+
#
3404+
#
3405+
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
3406+
#
3407+
CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4);
3408+
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' INTO TABLE t1 CHARACTER SET utf8mb4 IGNORE 4 LINES;
3409+
Warnings:
3410+
Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
3411+
Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3
3412+
Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5
3413+
Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8
3414+
SELECT HEX(a) FROM t1;
3415+
HEX(a)
3416+
3F
3417+
78787831
3418+
3F3F
3419+
78787832
3420+
3F3F3F
3421+
78787833
3422+
F09F988E
3423+
3F3F3F
3424+
DROP TABLE t1;
3425+
#
3426+
# End of 10.2 tests
3427+
#
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file has incomplete UJIS sequences {8F}, {8FA1},
2+
# has a valid UJIS sequence {8FA1A1},
3+
# and has no NL at the end:
4+
# {8F} \n xxx1 {8FA1} \n xxx2 {8FA1A1} \n xxx3 \n {8FA1} EOF
5+
6+
xxx1
7+
��
8+
xxx2
9+
���
10+
xxx3
11+
��
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file has incomplete utf8mb4 sequences {D0}, {E180}, {F09F98},
2+
# has a valid utf8mb4 sequence {F09F988E}
3+
# and has no NL at the end:
4+
# {D0} \n xxx1 {E180} xxx2 \n {F09F98} \n xxx3 {F09F988E} {F09F98} EOF
5+
6+
xxx1
7+
8+
xxx2
9+
10+
xxx3
11+
😎
12+

mysql-test/t/ctype_eucjpms.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,3 +566,19 @@ DROP TABLE t1;
566566
--echo #
567567
--echo # End of 10.1 tests
568568
--echo #
569+
570+
--echo #
571+
--echo # End of 10.2 tests
572+
--echo #
573+
574+
--echo #
575+
--echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
576+
--echo #
577+
CREATE TABLE t1 (a TEXT CHARACTER SET eucjpms);
578+
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.ujis.txt' INTO TABLE t1 CHARACTER SET eucjpms IGNORE 4 LINES;
579+
SELECT HEX(a) FROM t1;
580+
DROP TABLE t1;
581+
582+
--echo #
583+
--echo # End of 10.2 tests
584+
--echo #

mysql-test/t/ctype_ujis.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,3 +1396,20 @@ SELECT HEX(a) FROM t1 ORDER BY a;DROP TABLE t1;
13961396
--echo #
13971397
--echo # End of 10.1 tests
13981398
--echo #
1399+
1400+
1401+
--echo #
1402+
--echo # End of 10.2 tests
1403+
--echo #
1404+
1405+
--echo #
1406+
--echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
1407+
--echo #
1408+
CREATE TABLE t1 (a TEXT CHARACTER SET ujis);
1409+
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.ujis.txt' INTO TABLE t1 CHARACTER SET ujis IGNORE 4 LINES;
1410+
SELECT HEX(a) FROM t1;
1411+
DROP TABLE t1;
1412+
1413+
--echo #
1414+
--echo # End of 10.2 tests
1415+
--echo #

mysql-test/t/ctype_utf8.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,6 +1966,14 @@ LOAD DATA INFILE '../../std_data/loaddata/mdev9824.txt' INTO TABLE t1 CHARACTER
19661966
SELECT c1 FROM t1;
19671967
DROP TABLE t1;
19681968

1969+
--echo #
1970+
--echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
1971+
--echo #
1972+
CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
1973+
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' INTO TABLE t1 CHARACTER SET utf8 IGNORE 4 LINES;
1974+
SELECT HEX(a) FROM t1;
1975+
DROP TABLE t1;
1976+
19691977
--echo #
19701978
--echo # End of 10.2 tests
19711979
--echo #

mysql-test/t/ctype_utf8mb4.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,3 +1919,20 @@ DROP FUNCTION f1;
19191919
--echo #
19201920
--echo # End of 10.1 tests
19211921
--echo #
1922+
1923+
1924+
--echo #
1925+
--echo # End of 10.2 tests
1926+
--echo #
1927+
1928+
--echo #
1929+
--echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
1930+
--echo #
1931+
CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4);
1932+
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' INTO TABLE t1 CHARACTER SET utf8mb4 IGNORE 4 LINES;
1933+
SELECT HEX(a) FROM t1;
1934+
DROP TABLE t1;
1935+
1936+
--echo #
1937+
--echo # End of 10.2 tests
1938+
--echo #

0 commit comments

Comments
 (0)