2 --echo # Preparatory cleanup.
5 DROP
TABLE IF EXISTS t1;
9 --echo # We need a fixed timestamp
to avoid varying results.
11 SET timestamp=1000000000;
14 --echo # Delete all existing binary logs.
19 CREATE
TABLE t1 (c01 BIT);
20 INSERT INTO t1 VALUES (0);
21 INSERT INTO t1 VALUES (1);
24 CREATE
TABLE t1 (c01 BIT(7));
25 INSERT INTO t1 VALUES (1);
26 INSERT INTO t1 VALUES (2);
27 INSERT INTO t1 VALUES (4);
28 INSERT INTO t1 VALUES (8);
29 INSERT INTO t1 VALUES (16);
30 INSERT INTO t1 VALUES (32);
31 INSERT INTO t1 VALUES (64);
32 INSERT INTO t1 VALUES (127);
33 DELETE FROM t1 WHERE c01=127;
34 UPDATE t1 SET c01=15 WHERE c01=16;
37 CREATE
TABLE t1 (a BIT(20), b CHAR(2));
38 INSERT INTO t1 VALUES (b
'00010010010010001001',
'ab');
41 CREATE
TABLE t1 (c02 BIT(64));
42 INSERT INTO t1 VALUES (1);
43 INSERT INTO t1 VALUES (2);
44 INSERT INTO t1 VALUES (128);
45 INSERT INTO t1 VALUES (b
'1111111111111111111111111111111111111111111111111111111111111111');
49 CREATE
TABLE t1 (c03 TINYINT);
50 INSERT INTO t1 VALUES (1),(2),(3);
51 INSERT INTO t1 VALUES (-128);
52 UPDATE t1 SET c03=2 WHERE c03=1;
53 DELETE FROM t1 WHERE c03=-128;
56 CREATE
TABLE t1 (c04 TINYINT UNSIGNED);
57 INSERT INTO t1 VALUES (128), (255);
58 UPDATE t1 SET c04=2 WHERE c04=1;
59 DELETE FROM t1 WHERE c04=255;
62 CREATE
TABLE t1 (c06 BOOL);
63 INSERT INTO t1 VALUES (TRUE);
64 DELETE FROM t1 WHERE c06=TRUE;
67 CREATE
TABLE t1 (c07 SMALLINT);
68 INSERT INTO t1 VALUES (1234);
69 DELETE FROM t1 WHERE c07=1234;
72 CREATE
TABLE t1 (c08 SMALLINT UNSIGNED);
73 INSERT INTO t1 VALUES (32768), (65535);
74 UPDATE t1 SET c08=2 WHERE c08=32768;
75 DELETE FROM t1 WHERE c08=65535;
78 CREATE
TABLE t1 (c10 MEDIUMINT);
79 INSERT INTO t1 VALUES (12345);
80 DELETE FROM t1 WHERE c10=12345;
83 CREATE
TABLE t1 (c11 MEDIUMINT UNSIGNED);
84 INSERT INTO t1 VALUES (8388608), (16777215);
85 UPDATE t1 SET c11=2 WHERE c11=8388608;
86 DELETE FROM t1 WHERE c11=16777215;
89 CREATE
TABLE t1 (c13 INT);
90 INSERT INTO t1 VALUES (123456);
91 DELETE FROM t1 WHERE c13=123456;
94 CREATE
TABLE t1 (c14 INT UNSIGNED);
95 INSERT INTO t1 VALUES (2147483648), (4294967295);
96 UPDATE t1 SET c14=2 WHERE c14=2147483648;
97 DELETE FROM t1 WHERE c14=4294967295;
100 CREATE
TABLE t1 (c16 BIGINT);
101 INSERT INTO t1 VALUES (1234567890);
102 DELETE FROM t1 WHERE c16=1234567890;
105 CREATE
TABLE t1 (c17 BIGINT UNSIGNED);
106 INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615);
107 UPDATE t1 SET c17=2 WHERE c17=9223372036854775808;
108 DELETE FROM t1 WHERE c17=18446744073709551615;
111 CREATE
TABLE t1 (c19 FLOAT);
112 INSERT INTO t1 VALUES (123.2234);
113 DELETE FROM t1 WHERE c19>123;
116 CREATE
TABLE t1 (c22 DOUBLE);
117 INSERT INTO t1 VALUES (123434.22344545);
118 DELETE FROM t1 WHERE c22>123434;
123 CREATE
TABLE t1 (c25 DECIMAL(10,5));
124 INSERT INTO t1 VALUES (124.45);
125 INSERT INTO t1 VALUES (-543.21);
126 DELETE FROM t1 WHERE c25=124.45;
131 CREATE
TABLE t1 (c28 DATE);
132 INSERT INTO t1 VALUES (
'2001-02-03');
133 DELETE FROM t1 WHERE c28=
'2001-02-03';
136 CREATE
TABLE t1 (c29 DATETIME);
137 INSERT INTO t1 VALUES (
'2001-02-03 10:20:30');
138 DELETE FROM t1 WHERE c29=
'2001-02-03 10:20:30';
141 CREATE
TABLE t1 (c30 TIMESTAMP);
142 INSERT INTO t1 VALUES (
'2001-02-03 10:20:30');
143 DELETE FROM t1 WHERE c30=
'2001-02-03 10:20:30';
146 CREATE
TABLE t1 (c31 TIME);
147 INSERT INTO t1 VALUES (
'11:22:33');
148 DELETE FROM t1 WHERE c31=
'11:22:33';
151 CREATE
TABLE t1 (c32 YEAR);
152 INSERT INTO t1 VALUES (
'2001');
153 DELETE FROM t1 WHERE c32=2001;
158 CREATE
TABLE t1 (c33 CHAR);
159 INSERT INTO t1 VALUES (
'a');
160 DELETE FROM t1 WHERE c33=
'a';
163 CREATE
TABLE t1 (c34 CHAR(0));
164 INSERT INTO t1 VALUES (
'');
165 DELETE FROM t1 WHERE c34=
'';
168 CREATE
TABLE t1 (c35 CHAR(1));
169 INSERT INTO t1 VALUES (
'b');
170 DELETE FROM t1 WHERE c35=
'b';
173 CREATE
TABLE t1 (c36 CHAR(255));
174 INSERT INTO t1 VALUES (repeat(
'c',255));
175 DELETE FROM t1 WHERE c36>
'c';
180 CREATE
TABLE t1 (c37 NATIONAL CHAR);
181 INSERT INTO t1 VALUES (
'a');
182 DELETE FROM t1 WHERE c37=
'a';
185 CREATE
TABLE t1 (c38 NATIONAL CHAR(0));
186 INSERT INTO t1 VALUES (
'');
187 DELETE FROM t1 WHERE c38=
'';
190 CREATE
TABLE t1 (c39 NATIONAL CHAR(1));
191 INSERT INTO t1 VALUES (
'a');
192 DELETE FROM t1 WHERE c39=
'a';
195 CREATE
TABLE t1 (c40 NATIONAL CHAR(255));
196 INSERT INTO t1 VALUES (repeat(
'a', 255));
197 INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
198 DELETE FROM t1 WHERE c40>
'a';
203 CREATE
TABLE t1 (c41 CHAR CHARACTER SET UCS2);
204 INSERT INTO t1 VALUES (
'a');
205 DELETE FROM t1 WHERE c41=
'a';
208 CREATE
TABLE t1 (c42 CHAR(0) CHARACTER SET UCS2);
209 INSERT INTO t1 VALUES (
'');
210 DELETE FROM t1 WHERE c42=
'';
213 CREATE
TABLE t1 (c43 CHAR(1) CHARACTER SET UCS2);
214 INSERT INTO t1 VALUES (
'a');
215 DELETE FROM t1 WHERE c43=
'a';
218 CREATE
TABLE t1 (c44 CHAR(255) CHARACTER SET UCS2);
219 INSERT INTO t1 VALUES (repeat(
'a', 255));
220 INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
221 DELETE FROM t1 WHERE c44>
'a';
226 CREATE
TABLE t1 (c45 VARCHAR(0));
227 INSERT INTO t1 VALUES (
'');
228 DELETE FROM t1 WHERE c45=
'';
231 CREATE
TABLE t1 (c46 VARCHAR(1));
232 INSERT INTO t1 VALUES (
'a');
233 DELETE FROM t1 WHERE c46=
'a';
236 CREATE
TABLE t1 (c47 VARCHAR(255));
237 INSERT INTO t1 VALUES (repeat(
'a',255));
238 DELETE FROM t1 WHERE c47>
'a';
241 CREATE
TABLE t1 (c48 VARCHAR(261));
242 INSERT INTO t1 VALUES (repeat(
'a',261));
243 DELETE FROM t1 WHERE c48>
'a';
248 CREATE
TABLE t1 (c49 NATIONAL VARCHAR(0));
249 INSERT INTO t1 VALUES (
'');
250 DELETE FROM t1 WHERE c49=
'';
253 CREATE
TABLE t1 (c50 NATIONAL VARCHAR(1));
254 INSERT INTO t1 VALUES (
'a');
255 DELETE FROM t1 WHERE c50=
'a';
258 CREATE
TABLE t1 (c51 NATIONAL VARCHAR(255));
259 INSERT INTO t1 VALUES (repeat(
'a',255));
260 INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
261 DELETE FROM t1 WHERE c51>
'a';
264 CREATE
TABLE t1 (c52 NATIONAL VARCHAR(261));
265 INSERT INTO t1 VALUES (repeat(
'a',261));
266 INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261));
267 DELETE FROM t1 WHERE c52>
'a';
272 CREATE
TABLE t1 (c53 VARCHAR(0) CHARACTER SET ucs2);
273 INSERT INTO t1 VALUES (
'');
274 DELETE FROM t1 WHERE c53=
'';
277 CREATE
TABLE t1 (c54 VARCHAR(1) CHARACTER SET ucs2);
278 INSERT INTO t1 VALUES (
'a');
279 DELETE FROM t1 WHERE c54=
'a';
282 CREATE
TABLE t1 (c55 VARCHAR(255) CHARACTER SET ucs2);
283 INSERT INTO t1 VALUES (repeat(
'ab', 127));
284 DELETE FROM t1 WHERE c55>
'a';
287 CREATE
TABLE t1 (c56 VARCHAR(261) CHARACTER SET ucs2);
288 INSERT INTO t1 VALUES (repeat(
'ab', 130));
289 DELETE FROM t1 WHERE c56>
'a';
294 CREATE
TABLE t1 (c57 BINARY);
295 INSERT INTO t1 VALUES (0x00);
296 INSERT INTO t1 VALUES (0x02);
297 INSERT INTO t1 VALUES (
'a');
298 DELETE FROM t1 WHERE c57=
'a';
301 CREATE
TABLE t1 (c58 BINARY(0));
302 INSERT INTO t1 VALUES (
'');
303 DELETE FROM t1 WHERE c58=
'';
306 CREATE
TABLE t1 (c59 BINARY(1));
307 INSERT INTO t1 VALUES (0x00);
308 INSERT INTO t1 VALUES (0x02);
309 INSERT INTO t1 VALUES (
'a');
310 DELETE FROM t1 WHERE c59=
'a';
313 CREATE
TABLE t1 (c60 BINARY(255));
314 INSERT INTO t1 VALUES (0x00);
315 INSERT INTO t1 VALUES (0x02);
316 INSERT INTO t1 VALUES (repeat(
'a\0',120));
317 DELETE FROM t1 WHERE c60<0x02;
322 CREATE
TABLE t1 (c61 VARBINARY(0));
323 INSERT INTO t1 VALUES (
'');
324 DELETE FROM t1 WHERE c61=
'';
327 CREATE
TABLE t1 (c62 VARBINARY(1));
328 INSERT INTO t1 VALUES (0x00);
329 INSERT INTO t1 VALUES (0x02);
330 INSERT INTO t1 VALUES (
'a');
331 DELETE FROM t1 WHERE c62=0x02;
334 CREATE
TABLE t1 (c63 VARBINARY(255));
335 INSERT INTO t1 VALUES (0x00);
336 INSERT INTO t1 VALUES (0x02);
337 INSERT INTO t1 VALUES (repeat(
'a\0',120));
338 DELETE FROM t1 WHERE c63=0x02;
343 CREATE
TABLE t1 (c65 TINYBLOB);
344 INSERT INTO t1 VALUES (
'tinyblob1');
345 DELETE FROM t1 WHERE c65=
'tinyblob1';
348 CREATE
TABLE t1 (c68 BLOB);
349 INSERT INTO t1 VALUES (
'blob1');
350 DELETE FROM t1 WHERE c68=
'blob1';
353 CREATE
TABLE t1 (c71 MEDIUMBLOB);
354 INSERT INTO t1 VALUES (
'mediumblob1');
355 DELETE FROM t1 WHERE c71=
'mediumblob1';
358 CREATE
TABLE t1 (c74 LONGBLOB);
359 INSERT INTO t1 VALUES (
'longblob1');
360 DELETE FROM t1 WHERE c74=
'longblob1';
363 CREATE
TABLE t1 (c66 TINYTEXT);
364 INSERT INTO t1 VALUES (
'tinytext1');
365 DELETE FROM t1 WHERE c66=
'tinytext1';
368 CREATE
TABLE t1 (c69 TEXT);
369 INSERT INTO t1 VALUES (
'text1');
370 DELETE FROM t1 WHERE c69=
'text1';
373 CREATE
TABLE t1 (c72 MEDIUMTEXT);
374 INSERT INTO t1 VALUES (
'mediumtext1');
375 DELETE FROM t1 WHERE c72=
'mediumtext1';
378 CREATE
TABLE t1 (c75 LONGTEXT);
379 INSERT INTO t1 VALUES (
'longtext1');
380 DELETE FROM t1 WHERE c75=
'longtext1';
385 CREATE
TABLE t1 (c67 TINYTEXT CHARACTER SET UCS2);
386 INSERT INTO t1 VALUES (
'tinytext1');
387 DELETE FROM t1 WHERE c67=
'tinytext1';
390 CREATE
TABLE t1 (c70 TEXT CHARACTER SET UCS2);
391 INSERT INTO t1 VALUES (
'text1');
392 DELETE FROM t1 WHERE c70=
'text1';
395 CREATE
TABLE t1 (c73 MEDIUMTEXT CHARACTER SET UCS2);
396 INSERT INTO t1 VALUES (
'mediumtext1');
397 DELETE FROM t1 WHERE c73=
'mediumtext1';
400 CREATE
TABLE t1 (c76 LONGTEXT CHARACTER SET UCS2);
401 INSERT INTO t1 VALUES (
'longtext1');
402 DELETE FROM t1 WHERE c76=
'longtext1';
407 CREATE
TABLE t1 (c77 ENUM(
'a',
'b',
'c'));
408 INSERT INTO t1 VALUES (
'b');
409 DELETE FROM t1 WHERE c77=
'b';
414 CREATE
TABLE t1 (c78 SET(
'a',
'b',
'c',
'd',
'e',
'f'));
415 INSERT INTO t1 VALUES (
'a,b');
416 INSERT INTO t1 VALUES (
'a,c');
417 INSERT INTO t1 VALUES (
'b,c');
418 INSERT INTO t1 VALUES (
'a,b,c');
419 INSERT INTO t1 VALUES (
'a,b,c,d');
420 INSERT INTO t1 VALUES (
'a,b,c,d,e');
421 INSERT INTO t1 VALUES (
'a,b,c,d,e,f');
422 DELETE FROM t1 WHERE c78=
'a,b';
426 # Start of FSP-enabled data types
428 SET time_zone=
'+00:00';
429 SET timestamp=UNIX_TIMESTAMP(
'2002-02-02 20:20:20') + 0.123456;
430 SET @t=
'00:00:01.123456';
432 c79 TIME(6), c80 TIME(5), c81 TIME(4),
433 c82 TIME(3), c83 TIME(2), c84 TIME(1)
435 INSERT INTO t1 VALUES (@t, @t, @t, @t, @t, @t);
436 INSERT INTO t1 VALUES (NOW(), NOW(), NOW(), NOW(), NOW(), NOW());
437 INSERT INTO t1 VALUES (NOW(6), NOW(6), NOW(6), NOW(6), NOW(6), NOW(6));
440 SET @ts=
'2001-01-01 00:00:00.123456';
442 c85 DATETIME(6), c86 DATETIME(5), c87 DATETIME(4),
443 c88 DATETIME(3), c89 DATETIME(2), c90 DATETIME(1)
445 INSERT INTO t1 VALUES (@ts, @ts, @ts, @ts, @ts, @ts);
446 INSERT INTO t1 VALUES (NOW(), NOW(), NOW(), NOW(), NOW(), NOW());
447 INSERT INTO t1 VALUES (NOW(6), NOW(6), NOW(6), NOW(6), NOW(6), NOW(6));
450 SET @ts=
'2001-01-01 00:00:00.123456';
452 c85 TIMESTAMP(6), c86 TIMESTAMP(5), c87 TIMESTAMP(4),
453 c88 TIMESTAMP(3), c89 TIMESTAMP(2), c90 TIMESTAMP(1)
455 INSERT INTO t1 VALUES (@ts, @ts, @ts, @ts, @ts, @ts);
456 INSERT INTO t1 VALUES (NOW(), NOW(), NOW(), NOW(), NOW(), NOW());
457 INSERT INTO t1 VALUES (NOW(6), NOW(6), NOW(6), NOW(6), NOW(6), NOW(6));
460 SET timestamp=1000000000;
461 SET time_zone=
default;
463 # End of FSP-enabled data types
468 # Check multi-table update
470 CREATE
TABLE t1 (a
int NOT NULL DEFAULT 0, b
int NOT NULL DEFAULT 0);
471 CREATE
TABLE t2 (a
int NOT NULL DEFAULT 0, b
int NOT NULL DEFAULT 0);
472 INSERT INTO t1 SET a=1;
473 INSERT INTO t1 SET b=1;
474 INSERT INTO t2 SET a=1;
475 INSERT INTO t2 SET b=1;
476 UPDATE t1, t2 SET t1.a=10, t2.a=20;
481 let $MYSQLD_DATADIR= `select @@datadir`;
482 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
483 --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /
table id [0-9]*/
table id #/ /mapped
to number [0-9]*/mapped
to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /SET @@SESSION.GTID_NEXT=
'.*'/SET @@SESSION.GTID_NEXT=
'GTID'/ /CRC32 0x[0-9a-f]{8}/CRC32 #/
484 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001