[MDEV-9824] LOAD DATA does not work with multi-byte strings in LINES TERMINATED BY when IGNORE is specified Created: 2016-03-29  Updated: 2016-03-31  Resolved: 2016-03-31

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 5.5, 10.0, 10.1, 10.2
Fix Version/s: 10.2.0

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-6353 my_ismbchar() and my_mbcharlen() refa... Closed

 Description   

I have a file:

printf "\x61\xD1\x91\xD1\x91\x62\xD1\x91\xD1\x91\x63\xD1\x91\xD1\x91" >/tmp/test1.txt

The file looks like this in a text editor:

aёёbёёcёё

This script:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
LOAD DATA INFILE '/tmp/test1.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё';
SHOW WARNINGS;
SELECT * FROM t1;

warns that the separator is non-ASCII:

+---------+------+-------------------------------------------------------+
| Level   | Code | Message                                               |
+---------+------+-------------------------------------------------------+
| Warning | 1638 | Non-ASCII separator arguments are not fully supported |
+---------+------+-------------------------------------------------------+

but otherwise works without problems and correctly returns these records:

+------+
| a    |
+------+
| a    |
| b    |
| c    |
+------+

Now if I slightly modify the script to skip the first line:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
LOAD DATA INFILE '/tmp/test1.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё' IGNORE 1 LINES;
SHOW WARNINGS;
SELECT * FROM t1;

it returns empty set instead of two records.


Generated at Thu Feb 08 07:37:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.