summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqldump.test
blob: bcfe81dc95f5aaa0640b057ffa0f6c0a109c1729 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
--disable_warnings
DROP TABLE IF EXISTS t1, `"t"1`;
--enable_warnings

# XML output

CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1;

#
# Bug #2005
#

CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;

#
# Bug #2055
#

CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
# The following replaces is here because some systems replaces the above
# double with '-inf' and others with MAX_DOUBLE
--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;

#
# Bug #3361 mysqldump quotes DECIMAL values inconsistently
#

CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);

# check at first how mysql work with quoted decimal

INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456);

SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
--error 1054
INSERT INTO t1 VALUES ("1.2345", 2.3456);
SET SQL_MODE=@OLD_SQL_MODE;

# check how mysqldump make quoting
--exec $MYSQL_DUMP --compact test t1
--exec $MYSQL_DUMP --compact --skip-create test t1
--exec $MYSQL_DUMP --skip-create --skip-comments test t1
--exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments test t1
DROP TABLE t1;

CREATE TABLE t1(a int, b text, c varchar(3));
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
--exec $MYSQL_DUMP --skip-create --compact -X test t1
DROP TABLE t1;

#
# Bug #1707
#

CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2");
--exec $MYSQL_DUMP --compact --skip-create -X test t1
DROP TABLE t1;

#
# Bug #1994
#

CREATE TABLE t1 (a  VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1  VALUES (_koi8r x'C1C2C3C4C5');
--exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1;

#
# Bug #2634
#

CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-comments --compatible=mysql40 test t1
--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
DROP TABLE t1;

#
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
#

create table ```a` (i int);
--exec $MYSQL_DUMP --compact test
drop table ```a`;

#
# Bug #2591 "mysqldump quotes names inconsistently"
#

create table t1(a int);
--exec $MYSQL_DUMP --comments=0 test
--exec $MYSQL_DUMP --comments=0 --compatible=ansi test
set global sql_mode='ANSI_QUOTES';
--exec $MYSQL_DUMP --comments=0 test
--exec $MYSQL_DUMP --comments=0 --compatible=ansi test
set global sql_mode='';
drop table t1;

#
# Bug #2705 'mysqldump --tab extra output'
#

create table t1(a int);
insert into t1 values (1),(2),(3);
--exec $MYSQL_DUMP --skip-comments --tab=$MYSQL_TEST_DIR/var/tmp/ test
--exec cat $MYSQL_TEST_DIR/var/tmp/t1.sql
--exec cat $MYSQL_TEST_DIR/var/tmp/t1.txt
--exec rm $MYSQL_TEST_DIR/var/tmp/t1.sql
--exec rm $MYSQL_TEST_DIR/var/tmp/t1.txt
--exec $MYSQL_DUMP --tab=$MYSQL_TEST_DIR/var/tmp/ test
--exec rm $MYSQL_TEST_DIR/var/tmp/t1.sql
--exec rm $MYSQL_TEST_DIR/var/tmp/t1.txt
drop table t1;