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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, padding VARCHAR(200) NOT NULL
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, "I love testing.");
INSERT INTO t1 VALUES (2, "I hate testing.");
REPLACE INTO t1 VALUE (2, "I love testing.");
DROP TABLE t1;
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, padding VARCHAR(200) NOT NULL
) ENGINE=InnoDB;
CREATE TABLE t2 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, fk_id INT NOT NULL
, CONSTRAINT fk_t1 FOREIGN KEY (fk_id) REFERENCES t1 (id) ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, "I love testing.");
INSERT INTO t1 VALUES (2, "I hate testing.");
REPLACE INTO t1 VALUE (2, "I love testing.");
DROP TABLE t2, t1;
create table t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b char(1), c INT, d INT, unique key(b), unique key(c));
insert into t1 values (1,"a",1,1),(2,"b",2,2),(3,"c",3,3);
replace into t1 values (1,"b",3,4);
select * from t1 order by a;
a b c d
1 b 3 4
drop table t1;
create table t1 (a CHAR(5) NOT NULL PRIMARY KEY, b char(1), c INT, d INT, unique key(b), unique key(c));
insert into t1 values ("a","a",1,1),("bb","b",2,2),("ccc","c",3,3);
replace into t1 values ("a","b",3,4);
select * from t1 order by a;
a b c d
a b 3 4
drop table t1;
create table t1 (a DATE NOT NULL PRIMARY KEY, b char(1), c INT, d INT, unique key(b), unique key(c));
insert into t1 values ("2010-01-01","a",1,1),("2010-02-02","b",2,2),("2010-03-03","c",3,3);
replace into t1 values ("2010-01-01","b",3,4);
select * from t1 order by a;
a b c d
2010-01-01 b 3 4
drop table t1;
create table t1 (a DOUBLE NOT NULL PRIMARY KEY, b char(1), c INT, d INT, unique key(b), unique key(c));
insert into t1 values (1.1,"a",1,1),(22.22,"b",2,2),(333.333,"c",3,3);
replace into t1 values (1.1,"b",3,4);
select * from t1 order by a;
a b c d
1.1 b 3 4
drop table t1;
create table t1 (a FLOAT NOT NULL PRIMARY KEY, b char(1), c INT, d INT, unique key(b), unique key(c));
insert into t1 values (1.1,"a",1,1),(22.22,"b",2,2),(333.333,"c",3,3);
replace into t1 values (1.1,"b",3,4);
select * from t1 order by a;
a b c d
1.1 b 3 4
drop table t1;
create table t1 (a ENUM("a","bb","ccc") NOT NULL PRIMARY KEY, b char(1), c INT, d INT, unique key(b), unique key(c));
insert into t1 values ("a","a",1,1),("bb","b",2,2),("ccc","c",3,3);
replace into t1 values ("a","b",3,4);
select * from t1 order by a;
a b c d
a b 3 4
drop table t1;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `id` INT NOT NULL AUTO_INCREMENT, `padding` VARCHAR(200) COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
COMMIT;
START TRANSACTION;
UPDATE `test`.`t1` SET `padding`='I love testing.' WHERE `id`=2;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `id` INT NOT NULL AUTO_INCREMENT, `padding` VARCHAR(200) COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t2` ( `id` INT NOT NULL AUTO_INCREMENT, `fk_id` INT NOT NULL, PRIMARY KEY (`id`), KEY `fk_t1` (`fk_id`), CONSTRAINT `fk_t1` FOREIGN KEY (`fk_id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `id`=2;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I love testing.');
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t2`;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` INT NOT NULL AUTO_INCREMENT, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (1,'a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (2,'b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (3,'c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`=1;
DELETE FROM `test`.`t1` WHERE `a`=2;
UPDATE `test`.`t1` SET `a`=1,`b`='b',`d`=4 WHERE `a`=3;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` VARCHAR(5) COLLATE utf8_general_ci NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('a','a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('bb','b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('ccc','c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`='a';
DELETE FROM `test`.`t1` WHERE `a`='bb';
UPDATE `test`.`t1` SET `a`='a',`b`='b',`d`=4 WHERE `a`='ccc';
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` DATE NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('2010-01-01','a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('2010-02-02','b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('2010-03-03','c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`='2010-01-01';
DELETE FROM `test`.`t1` WHERE `a`='2010-02-02';
UPDATE `test`.`t1` SET `a`='2010-01-01',`b`='b',`d`=4 WHERE `a`='2010-03-03';
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` DOUBLE NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (1.1,'a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (22.22,'b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (333.333,'c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`=1.1;
DELETE FROM `test`.`t1` WHERE `a`=22.22;
UPDATE `test`.`t1` SET `a`=1.1,`b`='b',`d`=4 WHERE `a`=333.333;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` DOUBLE NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (1.1,'a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (22.22,'b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (333.333,'c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`=1.1;
DELETE FROM `test`.`t1` WHERE `a`=22.22;
UPDATE `test`.`t1` SET `a`=1.1,`b`='b',`d`=4 WHERE `a`=333.333;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` ENUM('a','bb','ccc') NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('a','a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('bb','b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('ccc','c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`='a';
DELETE FROM `test`.`t1` WHERE `a`='bb';
UPDATE `test`.`t1` SET `a`='a',`b`='b',`d`=4 WHERE `a`='ccc';
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
Generating statements for innodb replication log
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `id` INT NOT NULL AUTO_INCREMENT, `padding` VARCHAR(200) COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
COMMIT;
START TRANSACTION;
UPDATE `test`.`t1` SET `padding`='I love testing.' WHERE `id`=2;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `id` INT NOT NULL AUTO_INCREMENT, `padding` VARCHAR(200) COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t2` ( `id` INT NOT NULL AUTO_INCREMENT, `fk_id` INT NOT NULL, PRIMARY KEY (`id`), KEY `fk_t1` (`fk_id`), CONSTRAINT `fk_t1` FOREIGN KEY (`fk_id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `id`=2;
INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I love testing.');
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t2`;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` INT NOT NULL AUTO_INCREMENT, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (1,'a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (2,'b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (3,'c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`=1;
DELETE FROM `test`.`t1` WHERE `a`=2;
UPDATE `test`.`t1` SET `a`=1,`b`='b',`d`=4 WHERE `a`=3;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` VARCHAR(5) COLLATE utf8_general_ci NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('a','a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('bb','b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('ccc','c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`='a';
DELETE FROM `test`.`t1` WHERE `a`='bb';
UPDATE `test`.`t1` SET `a`='a',`b`='b',`d`=4 WHERE `a`='ccc';
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` DATE NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('2010-01-01','a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('2010-02-02','b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('2010-03-03','c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`='2010-01-01';
DELETE FROM `test`.`t1` WHERE `a`='2010-02-02';
UPDATE `test`.`t1` SET `a`='2010-01-01',`b`='b',`d`=4 WHERE `a`='2010-03-03';
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` DOUBLE NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (1.1,'a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (22.22,'b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (333.333,'c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`=1.1;
DELETE FROM `test`.`t1` WHERE `a`=22.22;
UPDATE `test`.`t1` SET `a`=1.1,`b`='b',`d`=4 WHERE `a`=333.333;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` DOUBLE NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (1.1,'a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (22.22,'b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES (333.333,'c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`=1.1;
DELETE FROM `test`.`t1` WHERE `a`=22.22;
UPDATE `test`.`t1` SET `a`=1.1,`b`='b',`d`=4 WHERE `a`=333.333;
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
START TRANSACTION;
CREATE TABLE `test`.`t1` ( `a` ENUM('a','bb','ccc') NOT NULL, `b` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL, `c` INT DEFAULT NULL, `d` INT DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), UNIQUE KEY `c` (`c`) ) ENGINE=InnoDB COLLATE = utf8_general_ci;
COMMIT;
START TRANSACTION;
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('a','a',1,1);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('bb','b',2,2);
INSERT INTO `test`.`t1` (`a`,`b`,`c`,`d`) VALUES ('ccc','c',3,3);
COMMIT;
START TRANSACTION;
DELETE FROM `test`.`t1` WHERE `a`='a';
DELETE FROM `test`.`t1` WHERE `a`='bb';
UPDATE `test`.`t1` SET `a`='a',`b`='b',`d`=4 WHERE `a`='ccc';
COMMIT;
START TRANSACTION;
DROP TABLE `test`.`t1`;
COMMIT;
SET GLOBAL transaction_log_truncate_debug= true;
|