mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug# 30946: mysqldump silently ignores --default-character-set
when used with --tab
1) New syntax: added CHARACTER SET clause to the
SELECT ... INTO OUTFILE (to complement the same clause in
LOAD DATA INFILE).
mysqldump is updated to use this in --tab mode.
2) ESCAPED BY/ENCLOSED BY field parameters are documented as
accepting CHAR argument, however SELECT .. INTO OUTFILE
silently ignored rests of multisymbol arguments.
For the symmetrical behavior with LOAD DATA INFILE the
server has been modified to fail with the same error:
ERROR 42000: Field separator argument is not what is
expected; check the manual
3) Current LOAD DATA INFILE recognizes field/line separators
"as is" without converting from client charset to data
file charset. So, it is supposed, that input file of
LOAD DATA INFILE consists of data in one charset and
separators in other charset. For the compatibility with
that [buggy] behaviour SELECT INTO OUTFILE implementation
has been saved "as is" too, but the new warning message
has been added:
Non-ASCII separator arguments are not fully supported
This message warns on field/line separators that contain
non-ASCII symbols.
This commit is contained in:
@@ -4502,5 +4502,64 @@ DROP PROCEDURE IF EXISTS pr1;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
#
|
||||
# Bug #30946: mysqldump silently ignores --default-character-set
|
||||
# when used with --tab
|
||||
#
|
||||
# Also see outfile_loaddata.test
|
||||
#
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
|
||||
# error on multi-character ENCLOSED/ESCAPED BY
|
||||
# default '--default-charset' (binary):
|
||||
##################################################
|
||||
1 ABC-<2D><><EFBFBD> DEF-<2D><><EFBFBD>
|
||||
2 \N \N
|
||||
##################################################
|
||||
TRUNCATE t2;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary;
|
||||
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
||||
a b c
|
||||
1 ABC-АБВ DEF-ÂÃÄ
|
||||
2 NULL NULL
|
||||
# utf8:
|
||||
##################################################
|
||||
1 ABC-АБВ DEF-ÂÃÄ
|
||||
2 \N \N
|
||||
##################################################
|
||||
TRUNCATE t2;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET utf8;
|
||||
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
||||
a b c
|
||||
1 ABC-АБВ DEF-ÂÃÄ
|
||||
2 NULL NULL
|
||||
# latin1 (data corruption is expected):
|
||||
##################################################
|
||||
1 ABC-??? DEF-<2D><><EFBFBD>
|
||||
2 \N \N
|
||||
##################################################
|
||||
TRUNCATE t2;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1 ;
|
||||
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
||||
a b c
|
||||
1 ABC-??? DEF-ÂÃÄ
|
||||
1 ABC-АБВ DEF-ÂÃÄ
|
||||
2 NULL NULL
|
||||
# koi8r (data corruption is expected):
|
||||
##################################################
|
||||
1 ABC-<2D><><EFBFBD> DEF-???
|
||||
2 \N \N
|
||||
##################################################
|
||||
TRUNCATE t2;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET koi8r;
|
||||
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
||||
a b c
|
||||
1 ABC-АБВ DEF-???
|
||||
1 ABC-АБВ DEF-ÂÃÄ
|
||||
2 NULL NULL
|
||||
SET NAMES default;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user