rpl_row_basic_3innodb.result 11.5 KB
Newer Older
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 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB'  ;
SELECT * FROM t1;
C1	C2
SELECT * FROM t1;
C1	C2
INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
SELECT * FROM t1 ORDER BY C1,C2;
C1	C2
A	A
A	B
A	C
X	X
X	Y
X	Z
SELECT * FROM t1 ORDER BY C1,C2;
C1	C2
A	A
A	B
A	C
X	X
X	Y
X	Z
DELETE FROM t1 WHERE C1 = C2;
SELECT * FROM t1 ORDER BY C1,C2;
C1	C2
A	B
A	C
X	Y
X	Z
SELECT * FROM t1 ORDER BY C1,C2;
C1	C2
A	B
A	C
X	Y
X	Z
UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SELECT * FROM t1 ORDER BY C1,C2;
C1	C2
A	B
A	I
X	Y
X	Z
SELECT * FROM t1 ORDER BY C1,C2;
C1	C2
A	B
A	I
X	Y
X	Z
UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
SELECT * FROM t1 ORDER BY c1,c2;
C1	C2
A	B
A	I
X	Y
X	Z
SELECT * FROM t1 ORDER BY c1,c2;
C1	C2
A	B
A	I
X	Y
X	Z
CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'INNODB'  ;
INSERT INTO t2
VALUES (1,'A',2),  (2,'A',4),  (3,'A',9),  (4,'A',15), (5,'A',25),
(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
SELECT * FROM t2 ORDER BY c1,c2;
c1	c12	c2
1	A	2
2	A	4
3	A	9
4	A	15
5	A	25
6	A	35
7	A	50
8	A	64
9	A	81
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
c1	c12	c2
2	A	4
3	A	9
5	A	25
8	A	64
9	A	81
SELECT * FROM t2 ORDER BY c1,c2;
c1	c12	c2
1	A	2
2	A	4
3	A	9
4	A	15
5	A	25
6	A	35
7	A	50
8	A	64
9	A	81
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
c1	c12	c2
2	A	4
3	A	9
5	A	25
8	A	64
9	A	81
UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
c1	c12	c2
1	A	1
2	A	4
3	A	9
4	A	16
5	A	25
6	A	36
7	A	49
8	A	64
9	A	81
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
c1	c12	c2
1	A	1
2	A	4
3	A	9
4	A	16
5	A	25
6	A	36
7	A	49
8	A	64
9	A	81
UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
SELECT * FROM t2 ORDER BY c1,c2;
c1	c12	c2
1	A	1
2	A	4
3	A	9
4	A	16
5	A	25
6	A	36
7	A	49
8	A	64
9	A	81
SELECT * FROM t2 ORDER BY c1,c2;
c1	c12	c2
1	A	1
2	A	4
3	A	9
4	A	16
5	A	25
6	A	36
7	A	49
8	A	64
9	A	81
DELETE FROM t2 WHERE c1 % 4 = 0;
SELECT * FROM t2 ORDER BY c1,c2;
c1	c12	c2
1	A	1
2	A	4
3	A	9
5	A	25
6	A	36
7	A	49
9	A	81
SELECT * FROM t2 ORDER BY c1,c2;
c1	c12	c2
1	A	1
2	A	4
3	A	9
5	A	25
6	A	36
7	A	49
9	A	81
UPDATE t2 SET c12='X';
CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'INNODB'  ;
INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
SELECT * FROM t3 ORDER BY C1,C2;
C1	C2	pk1	C3	pk2
A	A	3	B	2
A	B	1	B	1
A	C	1	B	2
X	X	3	B	1
X	Y	2	B	1
X	Z	2	B	2
SELECT * FROM t3 ORDER BY C1,C2;
C1	C2	pk1	C3	pk2
A	A	3	B	2
A	B	1	B	1
A	C	1	B	2
X	X	3	B	1
X	Y	2	B	1
X	Z	2	B	2
DELETE FROM t3 WHERE C1 = C2;
SELECT * FROM t3 ORDER BY C1,C2;
C1	C2	pk1	C3	pk2
A	B	1	B	1
A	C	1	B	2
X	Y	2	B	1
X	Z	2	B	2
SELECT * FROM t3 ORDER BY C1,C2;
C1	C2	pk1	C3	pk2
A	B	1	B	1
A	C	1	B	2
X	Y	2	B	1
X	Z	2	B	2
UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SELECT * FROM t3 ORDER BY C1,C2;
C1	C2	pk1	C3	pk2
A	B	1	B	1
A	I	1	B	2
X	Y	2	B	1
X	Z	2	B	2
SELECT * FROM t3 ORDER BY C1,C2;
C1	C2	pk1	C3	pk2
A	B	1	B	1
A	I	1	B	2
X	Y	2	B	1
X	Z	2	B	2
CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'INNODB' ;
INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
SELECT * FROM t6 ORDER BY C3;
C1	C2	C3
A	B	1
X	Y	2
X	X	3
A	C	4
X	Z	5
A	A	6
SELECT * FROM t6 ORDER BY C3;
C1	C2	C3
A	B	1
X	Y	2
X	X	3
A	C	4
X	Z	5
A	A	6
DELETE FROM t6 WHERE C1 = C2;
SELECT * FROM t6 ORDER BY C3;
C1	C2	C3
A	B	1
X	Y	2
A	C	4
X	Z	5
SELECT * FROM t6 ORDER BY C3;
C1	C2	C3
A	B	1
X	Y	2
A	C	4
X	Z	5
UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SELECT * FROM t6 ORDER BY C3;
C1	C2	C3
A	B	1
X	Y	2
A	I	4
X	Z	5
SELECT * FROM t6 ORDER BY C3;
C1	C2	C3
A	B	1
X	Y	2
A	I	4
X	Z	5
CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'INNODB'  ;
INSERT INTO t5 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	9	R	81	X	Z	2	S	2
X	Q	5	1	R	1	X	Y	2	S	1
X	Q	5	1	R	1	X	Z	2	S	2
X	Q	5	2	R	4	X	Y	2	S	1
X	Q	5	2	R	4	X	Z	2	S	2
X	Q	5	3	R	9	X	Y	2	S	1
X	Q	5	3	R	9	X	Z	2	S	2
X	Q	5	5	R	25	X	Y	2	S	1
X	Q	5	5	R	25	X	Z	2	S	2
X	Q	5	6	R	36	X	Y	2	S	1
X	Q	5	6	R	36	X	Z	2	S	2
X	Q	5	7	R	49	X	Y	2	S	1
X	Q	5	7	R	49	X	Z	2	S	2
X	Q	5	9	R	81	X	Y	2	S	1
X	Q	5	9	R	81	X	Z	2	S	2
CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'INNODB'  ;
INSERT INTO t4 SET C1 = 1;
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
C1	HEX(B1)	HEX(B2)
1	NULL	0
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
C1	HEX(B1)	HEX(B2)
1	NULL	0
CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB'  ;
--- on slave: original values ---
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
SELECT * FROM t7 ORDER BY C1;
C1	C2
1	3
2	6
3	9
373
set @@global.slave_exec_mode= 'IDEMPOTENT';
374 375 376 377 378 379 380
--- on master: new values inserted ---
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
SELECT * FROM t7 ORDER BY C1;
C1	C2
1	2
2	4
3	6
381
set @@global.slave_exec_mode= default;
382 383 384 385 386 387 388
--- on slave: old values should be overwritten by replicated values ---
SELECT * FROM t7 ORDER BY C1;
C1	C2
1	2
2	4
3	6
--- on master ---
389 390 391 392 393 394 395 396 397
CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'INNODB'  ;
INSERT INTO t8 VALUES (99,99,99);
INSERT INTO t8 VALUES (99,22,33);
ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
INSERT INTO t8 VALUES (11,99,33);
ERROR 23000: Duplicate entry '99' for key 'b'
INSERT INTO t8 VALUES (11,22,99);
ERROR 23000: Duplicate entry '99' for key 'c'
SELECT * FROM t8 ORDER BY a;
398 399 400
a	b	c
99	99	99
--- on slave ---
401
SELECT * FROM t8 ORDER BY a;
402 403
a	b	c
99	99	99
404 405
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
SELECT * FROM t8 ORDER BY a;
406 407 408 409 410
a	b	c
1	2	3
2	4	6
3	6	9
99	99	99
411
set @@global.slave_exec_mode= 'IDEMPOTENT';
412
--- on master ---
413
INSERT INTO t8 VALUES (2,4,8);
414
set @@global.slave_exec_mode= default;
415
--- on slave ---
416
SELECT * FROM t8 ORDER BY a;
417 418 419 420 421
a	b	c
1	2	3
2	4	8
3	6	9
99	99	99
422 423 424 425 426 427 428 429 430 431 432
**** Test for BUG#31552 ****
**** On Master ****
DELETE FROM t1;
**** Resetting master and slave ****
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
START SLAVE;
**** On Master ****
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
**** On Master ****
433
set @@global.slave_exec_mode= 'IDEMPOTENT';
434 435 436 437
DELETE FROM t1 WHERE C1 = 'L';
DELETE FROM t1;
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*)	0
438
set @@global.slave_exec_mode= default;
439
Last_SQL_Error
440

441 442
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*)	0
443 444 445 446 447 448 449 450 451 452
**** Test for BUG#37076 ****
**** On Master ****
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
INSERT INTO t1 VALUES(
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
**** On Slave ****
SELECT * FROM t1;
a	b	c
2005-11-14 01:01:01	2005-11-14 01:01:02	2005-11-14
453
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
454 455
CREATE TABLE t1 (i INT NOT NULL,
c CHAR(16) CHARACTER SET utf8 NOT NULL,
456
j INT NOT NULL) ENGINE = 'INNODB'  ;
457 458
CREATE TABLE t2 (i INT NOT NULL,
c CHAR(16) CHARACTER SET utf8 NOT NULL,
459
j INT NOT NULL) ENGINE = 'INNODB'  ;
460 461 462
ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
CREATE TABLE t3 (i INT NOT NULL,
c CHAR(128) CHARACTER SET utf8 NOT NULL,
463
j INT NOT NULL) ENGINE = 'INNODB'  ;
464 465 466
ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
CREATE TABLE t4 (i INT NOT NULL,
c CHAR(128) CHARACTER SET utf8 NOT NULL,
467
j INT NOT NULL) ENGINE = 'INNODB'  ;
468 469
CREATE TABLE t5 (i INT NOT NULL,
c CHAR(255) CHARACTER SET utf8 NOT NULL,
470
j INT NOT NULL) ENGINE = 'INNODB'  ;
471 472 473
ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
CREATE TABLE t6 (i INT NOT NULL,
c CHAR(255) CHARACTER SET utf8 NOT NULL,
474
j INT NOT NULL) ENGINE = 'INNODB'  ;
475 476 477
ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
CREATE TABLE t7 (i INT NOT NULL,
c CHAR(255) CHARACTER SET utf8 NOT NULL,
478
j INT NOT NULL) ENGINE = 'INNODB'  ;
479 480 481 482 483 484 485 486 487 488 489 490 491
[expecting slave to replicate correctly]
INSERT INTO t1 VALUES (1, "", 1);
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
Comparing tables master:test.t1 and slave:test.t1
[expecting slave to replicate correctly]
INSERT INTO t2 VALUES (1, "", 1);
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
Comparing tables master:test.t2 and slave:test.t2
[expecting slave to stop]
INSERT INTO t3 VALUES (1, "", 1);
INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
Last_SQL_Error
Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.
492 493 494
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
495 496 497 498 499 500 501 502 503 504
START SLAVE;
[expecting slave to replicate correctly]
INSERT INTO t4 VALUES (1, "", 1);
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
Comparing tables master:test.t4 and slave:test.t4
[expecting slave to stop]
INSERT INTO t5 VALUES (1, "", 1);
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
Last_SQL_Error
Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.
505 506 507
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
508 509 510 511 512 513
START SLAVE;
[expecting slave to stop]
INSERT INTO t6 VALUES (1, "", 1);
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
Last_SQL_Error
Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.
514 515 516
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
517 518 519 520 521 522
START SLAVE;
[expecting slave to replicate correctly]
INSERT INTO t7 VALUES (1, "", 1);
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
Comparing tables master:test.t7 and slave:test.t7
drop table t1, t2, t3, t4, t5, t6, t7;