Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-9824

LOAD DATA does not work with multi-byte strings in LINES TERMINATED BY when IGNORE is specified

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5, 10.0, 10.1, 10.2
    • 10.2.0
    • Character Sets
    • None

    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.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.