[MDEV-9876] SELECT INTO OUTFILE erroneously depends on character_set_client Created: 2016-04-06  Updated: 2020-05-05

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

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 1
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.



 Comments   
Comment by Alexander Barkov [ 2016-04-06 ]

See also:
http://bugs.mysql.com/bug.php?id=26711
https://bugs.mysql.com/bug.php?id=23619

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