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

SELECT INTO OUTFILE erroneously depends on character_set_client

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.0, 10.1, 10.2
    • Fix Version/s: 10.2
    • Component/s: Character Sets
    • Labels:
      None

      Description

      I run this script:

      rm -f /tmp/test.txt
      mysql-tmp --table --default-character-set=sjis test << END
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a BLOB);
      INSERT INTO t1 VALUES (0xEE5C);
      SELECT * INTO OUTFILE '/tmp/test.txt' FROM t1;
      TRUNCATE TABLE t1;
      LOAD DATA INFILE '/tmp/test.txt' INTO TABLE t1 CHARACTER SET sjis;
      SELECT HEX(a) FROM t1;
      END
      

      it returns this result:

      +--------+
      | HEX(a) |
      +--------+
      | EE5C   |
      +--------+
      

      Now if I run exactly the same script with --default-character-set=utf8:

      rm -f /tmp/test.txt
      mysql-tmp --table --default-character-set=utf8 test << END
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a BLOB);
      INSERT INTO t1 VALUES (0xEE5C);
      SELECT * INTO OUTFILE '/tmp/test.txt' FROM t1;
      TRUNCATE TABLE t1;
      LOAD DATA INFILE '/tmp/test.txt' INTO TABLE t1 CHARACTER SET sjis;
      SELECT HEX(a) FROM t1;
      

      It returns a different result:

      +--------+
      | HEX(a) |
      +--------+
      | EE5C0A |
      +--------+
      

      The result should not depend on --default-character-set=xxx.

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            bar Alexander Barkov
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration

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