mysqldump.test 5.08 KB
Newer Older
ram@gw.mysql.r18.ru's avatar
ram@gw.mysql.r18.ru committed
1
--disable_warnings
ram@gw.mysql.r18.ru's avatar
ram@gw.mysql.r18.ru committed
2
DROP TABLE IF EXISTS t1, `"t"1`;
ram@gw.mysql.r18.ru's avatar
ram@gw.mysql.r18.ru committed
3 4 5 6 7 8
--enable_warnings

# XML output

CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
monty@mishka.local's avatar
monty@mishka.local committed
9
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
10
DROP TABLE t1;
ram@gw.mysql.r18.ru's avatar
ram@gw.mysql.r18.ru committed
11 12 13 14 15

#
# Bug #2005
#

16 17 18
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
monty@mishka.local's avatar
monty@mishka.local committed
19
--exec $MYSQL_DUMP --compact test t1
20
DROP TABLE t1;
ram@gw.mysql.r18.ru's avatar
ram@gw.mysql.r18.ru committed
21 22 23 24 25

#
# Bug #2055
#

26 27
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
monty@mysql.com's avatar
monty@mysql.com committed
28 29 30
# 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)
monty@mishka.local's avatar
monty@mishka.local committed
31
--exec $MYSQL_DUMP --compact test t1
32
DROP TABLE t1;
33 34

#
monty@mishka.local's avatar
monty@mishka.local committed
35
# Bug #3361 mysqldump quotes DECIMAL values inconsistently
36 37 38 39 40 41 42 43 44 45
#

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);

monty@mishka.local's avatar
monty@mishka.local committed
46 47 48 49 50 51
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;
52 53

# check how mysqldump make quoting
monty@mishka.local's avatar
monty@mishka.local committed
54 55 56 57
--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
ram@gw.mysql.r18.ru's avatar
ram@gw.mysql.r18.ru committed
58
DROP TABLE t1;
59

60 61
CREATE TABLE t1(a int, b text, c varchar(3));
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
monty@mishka.local's avatar
monty@mishka.local committed
62
--exec $MYSQL_DUMP --skip-create --compact -X test t1
63 64
DROP TABLE t1;

65 66 67 68
#
# Bug #1707
#

69 70
CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2");
monty@mishka.local's avatar
monty@mishka.local committed
71
--exec $MYSQL_DUMP --compact --skip-create -X test t1
72
DROP TABLE t1;
73 74 75

#
# Bug #1994
76
# Bug #4261
77 78
#

79
CREATE TABLE t1 (a  VARCHAR(255)) DEFAULT CHARSET koi8r;
80 81
INSERT INTO t1  VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1
82
DROP TABLE t1;
83 84 85 86 87 88 89 90 91 92

#
# 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;
vva@eagle.mysql.r18.ru's avatar
Merge  
vva@eagle.mysql.r18.ru committed
93 94

#
monty@mishka.local's avatar
monty@mishka.local committed
95
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
96 97 98
#

create table ```a` (i int);
monty@mishka.local's avatar
monty@mishka.local committed
99
--exec $MYSQL_DUMP --compact test
100
drop table ```a`;
101

102 103 104 105 106 107 108 109 110 111 112 113
#
# 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;
vva@eagle.mysql.r18.ru's avatar
Merge  
vva@eagle.mysql.r18.ru committed
114

115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
#
# 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;
130 131 132 133 134 135

#
# Bug #6101: create database problem
#

--exec $MYSQL_DUMP --skip-comments --databases test
136 137 138 139

create database mysqldump_test_db character set latin2 collate latin2_bin;
--exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db;
drop database mysqldump_test_db;
140 141 142 143 144 145 146 147 148 149

#
# Bug #7020
# Check that we don't dump in UTF8 in compatible mode by default,
# but use the default compiled values, or the values given in
# --default-character-set=xxx. However, we should dump in UTF8
# if it is explicitely set.

CREATE TABLE t1 (a  CHAR(10));
INSERT INTO t1  VALUES (_latin1 '');
150
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
151 152 153 154 155 156 157 158
#
# Bug#8063: make test mysqldump [ fail ]
# We cannot tes this command because its output depends
# on --default-character-set incompiled into "mysqldump" program.
# If the future we can move this command into a separate test with
# checking that "mysqldump" is compiled with "latin1"
#
#--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1
159 160 161
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
162
DROP TABLE t1;
163 164 165 166 167 168 169 170 171 172 173 174

#
# WL #2319: Exclude Tables from dump
#

CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --skip-comments --ignore-table=test.t1 test
DROP TABLE t1;
DROP TABLE t2;
175 176 177 178 179 180 181

#
#  Bug  #8830
#

CREATE TABLE t1 (`b` blob);
INSERT INTO `t1` VALUES (0x602010000280100005E71A);
182
--exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1
183 184
DROP TABLE t1;