2
SET @@session.storage_engine = 'MyISAM';
4
#------------------------------------------------------------------------
5
# 0. Setting of auxiliary variables + Creation of an auxiliary tables
6
# needed in many testcases
7
#------------------------------------------------------------------------
8
SELECT @max_row DIV 2 INTO @max_row_div2;
9
SELECT @max_row DIV 3 INTO @max_row_div3;
10
SELECT @max_row DIV 4 INTO @max_row_div4;
11
SET @max_int_4 = 2147483647;
12
DROP TABLE IF EXISTS t0_template;
13
CREATE TABLE t0_template (
18
f_charbig VARCHAR(1000) ,
21
# Logging of <max_row> INSERTs into t0_template suppressed
22
DROP TABLE IF EXISTS t0_definition;
23
CREATE TABLE t0_definition (
25
create_command VARBINARY(5000),
26
file_list VARBINARY(10000),
29
DROP TABLE IF EXISTS t0_aux;
30
CREATE TABLE t0_aux ( f_int1 INTEGER,
34
f_charbig VARCHAR(1000) )
37
SET @@session.sql_mode= '';
38
# End of basic preparations needed for all tests
39
#-----------------------------------------------
41
#========================================================================
42
# Check partitioning methods on just created tables
43
# The tables should be defined without/with PRIMARY KEY and
45
# Every test round has to check
46
# PARTITION BY HASH/KEY/LIST/RANGE
47
# PARTITION BY RANGE/LIST ... SUBPARTITION BY HASH/KEY ...
48
#========================================================================
49
#------------------------------------------------------------------------
50
# 1 Tables without PRIMARY KEY or UNIQUE INDEXes
51
#------------------------------------------------------------------------
52
# 1.1 The partitioning function contains one column.
53
DROP TABLE IF EXISTS t1;
59
f_charbig VARCHAR(1000)
62
PARTITION BY HASH(f_int1) PARTITIONS 2;
63
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
64
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
65
# Start usability test (inc/partition_check.inc)
69
t1 CREATE TABLE `t1` (
70
`f_int1` int(11) DEFAULT NULL,
71
`f_int2` int(11) DEFAULT NULL,
72
`f_char1` char(20) DEFAULT NULL,
73
`f_char2` char(20) DEFAULT NULL,
74
`f_charbig` varchar(1000) DEFAULT NULL
75
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */
78
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
79
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
80
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
81
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
82
$MYSQLTEST_VARDIR/master-data/test/t1.frm
83
$MYSQLTEST_VARDIR/master-data/test/t1.par
85
# check prerequisites-1 success: 1
86
# check COUNT(*) success: 1
87
# check MIN/MAX(f_int1) success: 1
88
# check MIN/MAX(f_int2) success: 1
89
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
90
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
91
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
92
WHERE f_int1 IN (2,3);
93
# check prerequisites-3 success: 1
94
DELETE FROM t1 WHERE f_charbig = 'delete me';
95
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
96
# check read via f_int1 success: 1
97
# check read via f_int2 success: 1
99
# check multiple-1 success: 1
100
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
102
# check multiple-2 success: 1
103
INSERT INTO t1 SELECT * FROM t0_template
104
WHERE MOD(f_int1,3) = 0;
106
# check multiple-3 success: 1
107
UPDATE t1 SET f_int1 = f_int1 + @max_row
108
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
109
AND @max_row_div2 + @max_row_div4;
111
# check multiple-4 success: 1
113
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
114
AND @max_row_div2 + @max_row_div4 + @max_row;
116
# check multiple-5 success: 1
117
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
119
SET f_int1 = @cur_value , f_int2 = @cur_value,
120
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
121
f_charbig = '#SINGLE#';
123
# check single-1 success: 1
124
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
126
SET f_int1 = @cur_value , f_int2 = @cur_value,
127
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
128
f_charbig = '#SINGLE#';
130
# check single-2 success: 1
131
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
132
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
133
UPDATE t1 SET f_int1 = @cur_value2
134
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
136
# check single-3 success: 1
138
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
139
UPDATE t1 SET f_int1 = @cur_value1
140
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
142
# check single-4 success: 1
143
SELECT MAX(f_int1) INTO @cur_value FROM t1;
144
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
146
# check single-5 success: 1
147
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
149
# check single-6 success: 1
150
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
152
# check single-7 success: 1
153
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
154
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
155
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
156
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
157
f_charbig = '#NULL#';
159
SET f_int1 = NULL , f_int2 = -@max_row,
160
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
161
f_charbig = '#NULL#';
162
# check null success: 1
164
# check null-1 success: 1
165
UPDATE t1 SET f_int1 = -@max_row
166
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
167
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
169
# check null-2 success: 1
170
UPDATE t1 SET f_int1 = NULL
171
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
172
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
174
# check null-3 success: 1
176
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
177
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
179
# check null-4 success: 1
181
WHERE f_int1 = 0 AND f_int2 = 0
182
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
183
AND f_charbig = '#NULL#';
185
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
186
SELECT f_int1, f_int1, '', '', 'was inserted'
187
FROM t0_template source_tab
188
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
190
# check transactions-1 success: 1
193
# check transactions-2 success: 1
196
# check transactions-3 success: 1
197
DELETE FROM t1 WHERE f_charbig = 'was inserted';
201
# check transactions-4 success: 1
202
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
203
SELECT f_int1, f_int1, '', '', 'was inserted'
204
FROM t0_template source_tab
205
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
207
# check transactions-5 success: 1
210
Warning 1196 Some non-transactional changed tables couldn't be rolled back
212
# check transactions-6 success: 1
213
# INFO: Storage engine used for t1 seems to be not transactional.
216
# check transactions-7 success: 1
217
DELETE FROM t1 WHERE f_charbig = 'was inserted';
219
SET @@session.sql_mode = 'traditional';
220
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
221
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
222
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
223
'', '', 'was inserted' FROM t0_template
224
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
225
ERROR 22012: Division by 0
228
# check transactions-8 success: 1
229
# INFO: Storage engine used for t1 seems to be unable to revert
230
# changes made by the failing statement.
231
SET @@session.sql_mode = '';
233
DELETE FROM t1 WHERE f_charbig = 'was inserted';
235
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
237
# check special-1 success: 1
238
UPDATE t1 SET f_charbig = '';
240
# check special-2 success: 1
241
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
242
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
243
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
244
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
245
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
246
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
247
'just inserted' FROM t0_template
248
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
249
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
251
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
252
f_charbig = 'updated by trigger'
253
WHERE f_int1 = new.f_int1;
255
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
256
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
257
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
259
# check trigger-1 success: 1
261
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
262
f_int2 = CAST(f_char1 AS SIGNED INT),
263
f_charbig = 'just inserted'
264
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
266
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
267
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
268
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
269
'just inserted' FROM t0_template
270
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
271
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
273
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
274
f_charbig = 'updated by trigger'
275
WHERE f_int1 = new.f_int1;
277
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
278
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
279
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
281
# check trigger-2 success: 1
283
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
284
f_int2 = CAST(f_char1 AS SIGNED INT),
285
f_charbig = 'just inserted'
286
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
288
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
289
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
290
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
291
'just inserted' FROM t0_template
292
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
293
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
295
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
296
f_charbig = 'updated by trigger'
297
WHERE f_int1 = new.f_int1;
299
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
300
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
302
# check trigger-3 success: 1
304
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
305
f_int2 = CAST(f_char1 AS SIGNED INT),
306
f_charbig = 'just inserted'
307
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
309
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
310
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
311
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
312
'just inserted' FROM t0_template
313
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
314
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
316
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
317
f_charbig = 'updated by trigger'
318
WHERE f_int1 = - old.f_int1;
320
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
321
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
323
# check trigger-4 success: 1
325
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
326
f_int2 = CAST(f_char1 AS SIGNED INT),
327
f_charbig = 'just inserted'
328
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
330
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
331
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
332
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
333
'just inserted' FROM t0_template
334
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
335
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
337
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
338
f_charbig = 'updated by trigger'
339
WHERE f_int1 = new.f_int1;
341
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
342
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
344
# check trigger-5 success: 1
346
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
347
f_int2 = CAST(f_char1 AS SIGNED INT),
348
f_charbig = 'just inserted'
349
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
351
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
352
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
353
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
354
'just inserted' FROM t0_template
355
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
356
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
358
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
359
f_charbig = 'updated by trigger'
360
WHERE f_int1 = - old.f_int1;
362
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
363
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
365
# check trigger-6 success: 1
367
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
368
f_int2 = CAST(f_char1 AS SIGNED INT),
369
f_charbig = 'just inserted'
370
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
372
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
373
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
374
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
375
'just inserted' FROM t0_template
376
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
377
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
379
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
380
f_charbig = 'updated by trigger'
381
WHERE f_int1 = - old.f_int1;
384
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
386
# check trigger-7 success: 1
388
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
389
f_int2 = CAST(f_char1 AS SIGNED INT),
390
f_charbig = 'just inserted'
391
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
393
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
394
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
395
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
396
'just inserted' FROM t0_template
397
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
398
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
400
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
401
f_charbig = 'updated by trigger'
402
WHERE f_int1 = - old.f_int1;
405
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
407
# check trigger-8 success: 1
409
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
410
f_int2 = CAST(f_char1 AS SIGNED INT),
411
f_charbig = 'just inserted'
412
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
414
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
416
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
417
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
419
SET new.f_int1 = old.f_int1 + @max_row,
420
new.f_int2 = old.f_int2 - @max_row,
421
new.f_charbig = '####updated per update trigger####';
424
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
425
f_charbig = '####updated per update statement itself####';
427
# check trigger-9 success: 1
429
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
430
f_int2 = CAST(f_char1 AS SIGNED INT),
431
f_charbig = CONCAT('===',f_char1,'===');
432
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
434
SET new.f_int1 = new.f_int1 + @max_row,
435
new.f_int2 = new.f_int2 - @max_row,
436
new.f_charbig = '####updated per update trigger####';
439
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
440
f_charbig = '####updated per update statement itself####';
442
# check trigger-10 success: 1
444
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
445
f_int2 = CAST(f_char1 AS SIGNED INT),
446
f_charbig = CONCAT('===',f_char1,'===');
447
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
449
SET new.f_int1 = @my_max1 + @counter,
450
new.f_int2 = @my_min2 - @counter,
451
new.f_charbig = '####updated per insert trigger####';
452
SET @counter = @counter + 1;
455
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
456
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
457
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
458
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
459
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
463
# check trigger-11 success: 1
465
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
466
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
467
AND f_charbig = '####updated per insert trigger####';
468
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
470
SET new.f_int1 = @my_max1 + @counter,
471
new.f_int2 = @my_min2 - @counter,
472
new.f_charbig = '####updated per insert trigger####';
473
SET @counter = @counter + 1;
476
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
477
INSERT INTO t1 (f_char1, f_char2, f_charbig)
478
SELECT CAST(f_int1 AS CHAR),
479
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
480
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
484
# check trigger-12 success: 1
486
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
487
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
488
AND f_charbig = '####updated per insert trigger####';
490
Table Op Msg_type Msg_text
491
test.t1 analyze note The storage engine for the table doesn't support analyze
492
CHECK TABLE t1 EXTENDED;
493
Table Op Msg_type Msg_text
494
test.t1 check note The storage engine for the table doesn't support check
495
CHECKSUM TABLE t1 EXTENDED;
499
Table Op Msg_type Msg_text
500
test.t1 optimize note The storage engine for the table doesn't support optimize
501
# check layout success: 1
502
REPAIR TABLE t1 EXTENDED;
503
Table Op Msg_type Msg_text
504
test.t1 repair note The storage engine for the table doesn't support repair
505
# check layout success: 1
508
# check TRUNCATE success: 1
509
# check layout success: 1
510
# End usability test (inc/partition_check.inc)
517
f_charbig VARCHAR(1000)
520
PARTITION BY KEY(f_int1) PARTITIONS 5;
521
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
522
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
523
# Start usability test (inc/partition_check.inc)
525
SHOW CREATE TABLE t1;
527
t1 CREATE TABLE `t1` (
528
`f_int1` int(11) DEFAULT NULL,
529
`f_int2` int(11) DEFAULT NULL,
530
`f_char1` char(20) DEFAULT NULL,
531
`f_char2` char(20) DEFAULT NULL,
532
`f_charbig` varchar(1000) DEFAULT NULL
533
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */
536
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
537
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
538
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
539
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
540
$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD
541
$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI
542
$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD
543
$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI
544
$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
545
$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
546
$MYSQLTEST_VARDIR/master-data/test/t1.frm
547
$MYSQLTEST_VARDIR/master-data/test/t1.par
549
# check prerequisites-1 success: 1
550
# check COUNT(*) success: 1
551
# check MIN/MAX(f_int1) success: 1
552
# check MIN/MAX(f_int2) success: 1
553
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
554
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
555
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
556
WHERE f_int1 IN (2,3);
557
# check prerequisites-3 success: 1
558
DELETE FROM t1 WHERE f_charbig = 'delete me';
559
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
560
# check read via f_int1 success: 1
561
# check read via f_int2 success: 1
563
# check multiple-1 success: 1
564
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
566
# check multiple-2 success: 1
567
INSERT INTO t1 SELECT * FROM t0_template
568
WHERE MOD(f_int1,3) = 0;
570
# check multiple-3 success: 1
571
UPDATE t1 SET f_int1 = f_int1 + @max_row
572
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
573
AND @max_row_div2 + @max_row_div4;
575
# check multiple-4 success: 1
577
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
578
AND @max_row_div2 + @max_row_div4 + @max_row;
580
# check multiple-5 success: 1
581
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
583
SET f_int1 = @cur_value , f_int2 = @cur_value,
584
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
585
f_charbig = '#SINGLE#';
587
# check single-1 success: 1
588
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
590
SET f_int1 = @cur_value , f_int2 = @cur_value,
591
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
592
f_charbig = '#SINGLE#';
594
# check single-2 success: 1
595
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
596
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
597
UPDATE t1 SET f_int1 = @cur_value2
598
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
600
# check single-3 success: 1
602
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
603
UPDATE t1 SET f_int1 = @cur_value1
604
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
606
# check single-4 success: 1
607
SELECT MAX(f_int1) INTO @cur_value FROM t1;
608
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
610
# check single-5 success: 1
611
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
613
# check single-6 success: 1
614
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
616
# check single-7 success: 1
617
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
618
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
619
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
620
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
621
f_charbig = '#NULL#';
623
SET f_int1 = NULL , f_int2 = -@max_row,
624
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
625
f_charbig = '#NULL#';
626
# check null success: 1
628
# check null-1 success: 1
629
UPDATE t1 SET f_int1 = -@max_row
630
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
631
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
633
# check null-2 success: 1
634
UPDATE t1 SET f_int1 = NULL
635
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
636
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
638
# check null-3 success: 1
640
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
641
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
643
# check null-4 success: 1
645
WHERE f_int1 = 0 AND f_int2 = 0
646
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
647
AND f_charbig = '#NULL#';
649
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
650
SELECT f_int1, f_int1, '', '', 'was inserted'
651
FROM t0_template source_tab
652
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
654
# check transactions-1 success: 1
657
# check transactions-2 success: 1
660
# check transactions-3 success: 1
661
DELETE FROM t1 WHERE f_charbig = 'was inserted';
665
# check transactions-4 success: 1
666
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
667
SELECT f_int1, f_int1, '', '', 'was inserted'
668
FROM t0_template source_tab
669
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
671
# check transactions-5 success: 1
674
Warning 1196 Some non-transactional changed tables couldn't be rolled back
676
# check transactions-6 success: 1
677
# INFO: Storage engine used for t1 seems to be not transactional.
680
# check transactions-7 success: 1
681
DELETE FROM t1 WHERE f_charbig = 'was inserted';
683
SET @@session.sql_mode = 'traditional';
684
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
685
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
686
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
687
'', '', 'was inserted' FROM t0_template
688
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
689
ERROR 22012: Division by 0
692
# check transactions-8 success: 1
693
# INFO: Storage engine used for t1 seems to be unable to revert
694
# changes made by the failing statement.
695
SET @@session.sql_mode = '';
697
DELETE FROM t1 WHERE f_charbig = 'was inserted';
699
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
701
# check special-1 success: 1
702
UPDATE t1 SET f_charbig = '';
704
# check special-2 success: 1
705
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
706
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
707
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
708
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
709
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
710
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
711
'just inserted' FROM t0_template
712
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
713
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
715
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
716
f_charbig = 'updated by trigger'
717
WHERE f_int1 = new.f_int1;
719
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
720
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
721
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
723
# check trigger-1 success: 1
725
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
726
f_int2 = CAST(f_char1 AS SIGNED INT),
727
f_charbig = 'just inserted'
728
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
730
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
731
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
732
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
733
'just inserted' FROM t0_template
734
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
735
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
737
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
738
f_charbig = 'updated by trigger'
739
WHERE f_int1 = new.f_int1;
741
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
742
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
743
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
745
# check trigger-2 success: 1
747
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
748
f_int2 = CAST(f_char1 AS SIGNED INT),
749
f_charbig = 'just inserted'
750
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
752
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
753
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
754
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
755
'just inserted' FROM t0_template
756
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
757
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
759
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
760
f_charbig = 'updated by trigger'
761
WHERE f_int1 = new.f_int1;
763
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
764
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
766
# check trigger-3 success: 1
768
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
769
f_int2 = CAST(f_char1 AS SIGNED INT),
770
f_charbig = 'just inserted'
771
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
773
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
774
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
775
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
776
'just inserted' FROM t0_template
777
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
778
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
780
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
781
f_charbig = 'updated by trigger'
782
WHERE f_int1 = - old.f_int1;
784
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
785
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
787
# check trigger-4 success: 1
789
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
790
f_int2 = CAST(f_char1 AS SIGNED INT),
791
f_charbig = 'just inserted'
792
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
794
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
795
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
796
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
797
'just inserted' FROM t0_template
798
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
799
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
801
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
802
f_charbig = 'updated by trigger'
803
WHERE f_int1 = new.f_int1;
805
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
806
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
808
# check trigger-5 success: 1
810
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
811
f_int2 = CAST(f_char1 AS SIGNED INT),
812
f_charbig = 'just inserted'
813
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
815
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
816
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
817
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
818
'just inserted' FROM t0_template
819
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
820
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
822
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
823
f_charbig = 'updated by trigger'
824
WHERE f_int1 = - old.f_int1;
826
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
827
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
829
# check trigger-6 success: 1
831
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
832
f_int2 = CAST(f_char1 AS SIGNED INT),
833
f_charbig = 'just inserted'
834
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
836
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
837
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
838
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
839
'just inserted' FROM t0_template
840
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
841
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
843
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
844
f_charbig = 'updated by trigger'
845
WHERE f_int1 = - old.f_int1;
848
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
850
# check trigger-7 success: 1
852
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
853
f_int2 = CAST(f_char1 AS SIGNED INT),
854
f_charbig = 'just inserted'
855
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
857
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
858
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
859
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
860
'just inserted' FROM t0_template
861
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
862
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
864
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
865
f_charbig = 'updated by trigger'
866
WHERE f_int1 = - old.f_int1;
869
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
871
# check trigger-8 success: 1
873
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
874
f_int2 = CAST(f_char1 AS SIGNED INT),
875
f_charbig = 'just inserted'
876
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
878
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
880
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
881
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
883
SET new.f_int1 = old.f_int1 + @max_row,
884
new.f_int2 = old.f_int2 - @max_row,
885
new.f_charbig = '####updated per update trigger####';
888
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
889
f_charbig = '####updated per update statement itself####';
891
# check trigger-9 success: 1
893
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
894
f_int2 = CAST(f_char1 AS SIGNED INT),
895
f_charbig = CONCAT('===',f_char1,'===');
896
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
898
SET new.f_int1 = new.f_int1 + @max_row,
899
new.f_int2 = new.f_int2 - @max_row,
900
new.f_charbig = '####updated per update trigger####';
903
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
904
f_charbig = '####updated per update statement itself####';
906
# check trigger-10 success: 1
908
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
909
f_int2 = CAST(f_char1 AS SIGNED INT),
910
f_charbig = CONCAT('===',f_char1,'===');
911
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
913
SET new.f_int1 = @my_max1 + @counter,
914
new.f_int2 = @my_min2 - @counter,
915
new.f_charbig = '####updated per insert trigger####';
916
SET @counter = @counter + 1;
919
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
920
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
921
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
922
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
923
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
927
# check trigger-11 success: 1
929
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
930
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
931
AND f_charbig = '####updated per insert trigger####';
932
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
934
SET new.f_int1 = @my_max1 + @counter,
935
new.f_int2 = @my_min2 - @counter,
936
new.f_charbig = '####updated per insert trigger####';
937
SET @counter = @counter + 1;
940
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
941
INSERT INTO t1 (f_char1, f_char2, f_charbig)
942
SELECT CAST(f_int1 AS CHAR),
943
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
944
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
948
# check trigger-12 success: 1
950
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
951
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
952
AND f_charbig = '####updated per insert trigger####';
954
Table Op Msg_type Msg_text
955
test.t1 analyze note The storage engine for the table doesn't support analyze
956
CHECK TABLE t1 EXTENDED;
957
Table Op Msg_type Msg_text
958
test.t1 check note The storage engine for the table doesn't support check
959
CHECKSUM TABLE t1 EXTENDED;
963
Table Op Msg_type Msg_text
964
test.t1 optimize note The storage engine for the table doesn't support optimize
965
# check layout success: 1
966
REPAIR TABLE t1 EXTENDED;
967
Table Op Msg_type Msg_text
968
test.t1 repair note The storage engine for the table doesn't support repair
969
# check layout success: 1
972
# check TRUNCATE success: 1
973
# check layout success: 1
974
# End usability test (inc/partition_check.inc)
981
f_charbig VARCHAR(1000)
984
PARTITION BY LIST(MOD(f_int1,4))
985
(PARTITION part_3 VALUES IN (-3),
986
PARTITION part_2 VALUES IN (-2),
987
PARTITION part_1 VALUES IN (-1),
988
PARTITION part_N VALUES IN (NULL),
989
PARTITION part0 VALUES IN (0),
990
PARTITION part1 VALUES IN (1),
991
PARTITION part2 VALUES IN (2),
992
PARTITION part3 VALUES IN (3));
993
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
994
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
995
# Start usability test (inc/partition_check.inc)
997
SHOW CREATE TABLE t1;
999
t1 CREATE TABLE `t1` (
1000
`f_int1` int(11) DEFAULT NULL,
1001
`f_int2` int(11) DEFAULT NULL,
1002
`f_char1` char(20) DEFAULT NULL,
1003
`f_char2` char(20) DEFAULT NULL,
1004
`f_charbig` varchar(1000) DEFAULT NULL
1005
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) ENGINE = MyISAM, PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */
1008
$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD
1009
$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI
1010
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
1011
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
1012
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
1013
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
1014
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD
1015
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI
1016
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD
1017
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI
1018
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD
1019
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI
1020
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD
1021
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI
1022
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD
1023
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI
1024
$MYSQLTEST_VARDIR/master-data/test/t1.frm
1025
$MYSQLTEST_VARDIR/master-data/test/t1.par
1027
# check prerequisites-1 success: 1
1028
# check COUNT(*) success: 1
1029
# check MIN/MAX(f_int1) success: 1
1030
# check MIN/MAX(f_int2) success: 1
1031
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1032
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
1033
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
1034
WHERE f_int1 IN (2,3);
1035
# check prerequisites-3 success: 1
1036
DELETE FROM t1 WHERE f_charbig = 'delete me';
1037
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
1038
# check read via f_int1 success: 1
1039
# check read via f_int2 success: 1
1041
# check multiple-1 success: 1
1042
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
1044
# check multiple-2 success: 1
1045
INSERT INTO t1 SELECT * FROM t0_template
1046
WHERE MOD(f_int1,3) = 0;
1048
# check multiple-3 success: 1
1049
UPDATE t1 SET f_int1 = f_int1 + @max_row
1050
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
1051
AND @max_row_div2 + @max_row_div4;
1053
# check multiple-4 success: 1
1055
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
1056
AND @max_row_div2 + @max_row_div4 + @max_row;
1058
# check multiple-5 success: 1
1059
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
1061
SET f_int1 = @cur_value , f_int2 = @cur_value,
1062
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
1063
f_charbig = '#SINGLE#';
1065
# check single-1 success: 1
1066
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
1068
SET f_int1 = @cur_value , f_int2 = @cur_value,
1069
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
1070
f_charbig = '#SINGLE#';
1072
# check single-2 success: 1
1073
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
1074
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
1075
UPDATE t1 SET f_int1 = @cur_value2
1076
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
1078
# check single-3 success: 1
1079
SET @cur_value1= -1;
1080
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
1081
UPDATE t1 SET f_int1 = @cur_value1
1082
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
1084
# check single-4 success: 1
1085
SELECT MAX(f_int1) INTO @cur_value FROM t1;
1086
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
1088
# check single-5 success: 1
1089
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
1091
# check single-6 success: 1
1092
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
1094
# check single-7 success: 1
1095
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
1096
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
1097
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
1098
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
1099
f_charbig = '#NULL#';
1101
SET f_int1 = NULL , f_int2 = -@max_row,
1102
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
1103
f_charbig = '#NULL#';
1104
# check null success: 1
1106
# check null-1 success: 1
1107
UPDATE t1 SET f_int1 = -@max_row
1108
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
1109
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
1111
# check null-2 success: 1
1112
UPDATE t1 SET f_int1 = NULL
1113
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
1114
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
1116
# check null-3 success: 1
1118
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
1119
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
1121
# check null-4 success: 1
1123
WHERE f_int1 = 0 AND f_int2 = 0
1124
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
1125
AND f_charbig = '#NULL#';
1127
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1128
SELECT f_int1, f_int1, '', '', 'was inserted'
1129
FROM t0_template source_tab
1130
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
1132
# check transactions-1 success: 1
1135
# check transactions-2 success: 1
1138
# check transactions-3 success: 1
1139
DELETE FROM t1 WHERE f_charbig = 'was inserted';
1143
# check transactions-4 success: 1
1144
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1145
SELECT f_int1, f_int1, '', '', 'was inserted'
1146
FROM t0_template source_tab
1147
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
1149
# check transactions-5 success: 1
1152
Warning 1196 Some non-transactional changed tables couldn't be rolled back
1154
# check transactions-6 success: 1
1155
# INFO: Storage engine used for t1 seems to be not transactional.
1158
# check transactions-7 success: 1
1159
DELETE FROM t1 WHERE f_charbig = 'was inserted';
1161
SET @@session.sql_mode = 'traditional';
1162
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
1163
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1164
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
1165
'', '', 'was inserted' FROM t0_template
1166
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
1167
ERROR 22012: Division by 0
1170
# check transactions-8 success: 1
1171
# INFO: Storage engine used for t1 seems to be unable to revert
1172
# changes made by the failing statement.
1173
SET @@session.sql_mode = '';
1175
DELETE FROM t1 WHERE f_charbig = 'was inserted';
1177
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
1179
# check special-1 success: 1
1180
UPDATE t1 SET f_charbig = '';
1182
# check special-2 success: 1
1183
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
1184
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
1185
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
1186
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1187
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1188
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1189
'just inserted' FROM t0_template
1190
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1191
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
1193
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1194
f_charbig = 'updated by trigger'
1195
WHERE f_int1 = new.f_int1;
1197
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1198
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
1199
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1201
# check trigger-1 success: 1
1203
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1204
f_int2 = CAST(f_char1 AS SIGNED INT),
1205
f_charbig = 'just inserted'
1206
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1208
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1209
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1210
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1211
'just inserted' FROM t0_template
1212
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1213
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
1215
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1216
f_charbig = 'updated by trigger'
1217
WHERE f_int1 = new.f_int1;
1219
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1220
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
1221
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1223
# check trigger-2 success: 1
1225
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1226
f_int2 = CAST(f_char1 AS SIGNED INT),
1227
f_charbig = 'just inserted'
1228
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1230
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1231
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1232
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1233
'just inserted' FROM t0_template
1234
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1235
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
1237
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1238
f_charbig = 'updated by trigger'
1239
WHERE f_int1 = new.f_int1;
1241
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
1242
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1244
# check trigger-3 success: 1
1246
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1247
f_int2 = CAST(f_char1 AS SIGNED INT),
1248
f_charbig = 'just inserted'
1249
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1251
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1252
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1253
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1254
'just inserted' FROM t0_template
1255
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1256
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
1258
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1259
f_charbig = 'updated by trigger'
1260
WHERE f_int1 = - old.f_int1;
1262
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
1263
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1265
# check trigger-4 success: 1
1267
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1268
f_int2 = CAST(f_char1 AS SIGNED INT),
1269
f_charbig = 'just inserted'
1270
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1272
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1273
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1274
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1275
'just inserted' FROM t0_template
1276
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1277
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
1279
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1280
f_charbig = 'updated by trigger'
1281
WHERE f_int1 = new.f_int1;
1283
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
1284
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1286
# check trigger-5 success: 1
1288
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1289
f_int2 = CAST(f_char1 AS SIGNED INT),
1290
f_charbig = 'just inserted'
1291
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1293
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1294
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1295
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1296
'just inserted' FROM t0_template
1297
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1298
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
1300
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1301
f_charbig = 'updated by trigger'
1302
WHERE f_int1 = - old.f_int1;
1304
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
1305
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1307
# check trigger-6 success: 1
1309
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1310
f_int2 = CAST(f_char1 AS SIGNED INT),
1311
f_charbig = 'just inserted'
1312
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1314
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1315
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1316
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1317
'just inserted' FROM t0_template
1318
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1319
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
1321
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1322
f_charbig = 'updated by trigger'
1323
WHERE f_int1 = - old.f_int1;
1326
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1328
# check trigger-7 success: 1
1330
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1331
f_int2 = CAST(f_char1 AS SIGNED INT),
1332
f_charbig = 'just inserted'
1333
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1335
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1336
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1337
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1338
'just inserted' FROM t0_template
1339
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1340
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
1342
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1343
f_charbig = 'updated by trigger'
1344
WHERE f_int1 = - old.f_int1;
1347
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1349
# check trigger-8 success: 1
1351
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1352
f_int2 = CAST(f_char1 AS SIGNED INT),
1353
f_charbig = 'just inserted'
1354
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1356
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1358
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1359
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
1361
SET new.f_int1 = old.f_int1 + @max_row,
1362
new.f_int2 = old.f_int2 - @max_row,
1363
new.f_charbig = '####updated per update trigger####';
1366
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
1367
f_charbig = '####updated per update statement itself####';
1369
# check trigger-9 success: 1
1371
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1372
f_int2 = CAST(f_char1 AS SIGNED INT),
1373
f_charbig = CONCAT('===',f_char1,'===');
1374
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
1376
SET new.f_int1 = new.f_int1 + @max_row,
1377
new.f_int2 = new.f_int2 - @max_row,
1378
new.f_charbig = '####updated per update trigger####';
1381
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
1382
f_charbig = '####updated per update statement itself####';
1384
# check trigger-10 success: 1
1386
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1387
f_int2 = CAST(f_char1 AS SIGNED INT),
1388
f_charbig = CONCAT('===',f_char1,'===');
1389
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
1391
SET new.f_int1 = @my_max1 + @counter,
1392
new.f_int2 = @my_min2 - @counter,
1393
new.f_charbig = '####updated per insert trigger####';
1394
SET @counter = @counter + 1;
1397
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
1398
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1399
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
1400
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
1401
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
1405
# check trigger-11 success: 1
1407
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
1408
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
1409
AND f_charbig = '####updated per insert trigger####';
1410
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
1412
SET new.f_int1 = @my_max1 + @counter,
1413
new.f_int2 = @my_min2 - @counter,
1414
new.f_charbig = '####updated per insert trigger####';
1415
SET @counter = @counter + 1;
1418
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
1419
INSERT INTO t1 (f_char1, f_char2, f_charbig)
1420
SELECT CAST(f_int1 AS CHAR),
1421
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
1422
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
1426
# check trigger-12 success: 1
1428
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
1429
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
1430
AND f_charbig = '####updated per insert trigger####';
1432
Table Op Msg_type Msg_text
1433
test.t1 analyze note The storage engine for the table doesn't support analyze
1434
CHECK TABLE t1 EXTENDED;
1435
Table Op Msg_type Msg_text
1436
test.t1 check note The storage engine for the table doesn't support check
1437
CHECKSUM TABLE t1 EXTENDED;
1439
test.t1 <some_value>
1441
Table Op Msg_type Msg_text
1442
test.t1 optimize note The storage engine for the table doesn't support optimize
1443
# check layout success: 1
1444
REPAIR TABLE t1 EXTENDED;
1445
Table Op Msg_type Msg_text
1446
test.t1 repair note The storage engine for the table doesn't support repair
1447
# check layout success: 1
1450
# check TRUNCATE success: 1
1451
# check layout success: 1
1452
# End usability test (inc/partition_check.inc)
1459
f_charbig VARCHAR(1000)
1462
PARTITION BY RANGE(f_int1)
1463
(PARTITION parta VALUES LESS THAN (0),
1464
PARTITION partb VALUES LESS THAN (5),
1465
PARTITION partc VALUES LESS THAN (10),
1466
PARTITION partd VALUES LESS THAN (10 + 5),
1467
PARTITION parte VALUES LESS THAN (20),
1468
PARTITION partf VALUES LESS THAN (2147483646));
1469
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
1470
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
1471
# Start usability test (inc/partition_check.inc)
1473
SHOW CREATE TABLE t1;
1475
t1 CREATE TABLE `t1` (
1476
`f_int1` int(11) DEFAULT NULL,
1477
`f_int2` int(11) DEFAULT NULL,
1478
`f_char1` char(20) DEFAULT NULL,
1479
`f_char2` char(20) DEFAULT NULL,
1480
`f_charbig` varchar(1000) DEFAULT NULL
1481
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */
1484
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD
1485
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI
1486
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD
1487
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI
1488
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD
1489
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI
1490
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD
1491
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI
1492
$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD
1493
$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI
1494
$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD
1495
$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI
1496
$MYSQLTEST_VARDIR/master-data/test/t1.frm
1497
$MYSQLTEST_VARDIR/master-data/test/t1.par
1499
# check prerequisites-1 success: 1
1500
# check COUNT(*) success: 1
1501
# check MIN/MAX(f_int1) success: 1
1502
# check MIN/MAX(f_int2) success: 1
1503
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1504
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
1505
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
1506
WHERE f_int1 IN (2,3);
1507
# check prerequisites-3 success: 1
1508
DELETE FROM t1 WHERE f_charbig = 'delete me';
1509
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
1510
# check read via f_int1 success: 1
1511
# check read via f_int2 success: 1
1513
# check multiple-1 success: 1
1514
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
1516
# check multiple-2 success: 1
1517
INSERT INTO t1 SELECT * FROM t0_template
1518
WHERE MOD(f_int1,3) = 0;
1520
# check multiple-3 success: 1
1521
UPDATE t1 SET f_int1 = f_int1 + @max_row
1522
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
1523
AND @max_row_div2 + @max_row_div4;
1525
# check multiple-4 success: 1
1527
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
1528
AND @max_row_div2 + @max_row_div4 + @max_row;
1530
# check multiple-5 success: 1
1531
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
1533
SET f_int1 = @cur_value , f_int2 = @cur_value,
1534
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
1535
f_charbig = '#SINGLE#';
1537
# check single-1 success: 1
1538
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
1540
SET f_int1 = @cur_value , f_int2 = @cur_value,
1541
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
1542
f_charbig = '#SINGLE#';
1544
# check single-2 success: 1
1545
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
1546
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
1547
UPDATE t1 SET f_int1 = @cur_value2
1548
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
1550
# check single-3 success: 1
1551
SET @cur_value1= -1;
1552
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
1553
UPDATE t1 SET f_int1 = @cur_value1
1554
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
1556
# check single-4 success: 1
1557
SELECT MAX(f_int1) INTO @cur_value FROM t1;
1558
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
1560
# check single-5 success: 1
1561
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
1563
# check single-6 success: 1
1564
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
1565
ERROR HY000: Table has no partition for value 2147483647
1566
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
1567
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
1568
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
1569
f_charbig = '#NULL#';
1571
SET f_int1 = NULL , f_int2 = -@max_row,
1572
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
1573
f_charbig = '#NULL#';
1574
# check null success: 1
1576
# check null-1 success: 1
1577
UPDATE t1 SET f_int1 = -@max_row
1578
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
1579
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
1581
# check null-2 success: 1
1582
UPDATE t1 SET f_int1 = NULL
1583
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
1584
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
1586
# check null-3 success: 1
1588
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
1589
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
1591
# check null-4 success: 1
1593
WHERE f_int1 = 0 AND f_int2 = 0
1594
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
1595
AND f_charbig = '#NULL#';
1597
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1598
SELECT f_int1, f_int1, '', '', 'was inserted'
1599
FROM t0_template source_tab
1600
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
1602
# check transactions-1 success: 1
1605
# check transactions-2 success: 1
1608
# check transactions-3 success: 1
1609
DELETE FROM t1 WHERE f_charbig = 'was inserted';
1613
# check transactions-4 success: 1
1614
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1615
SELECT f_int1, f_int1, '', '', 'was inserted'
1616
FROM t0_template source_tab
1617
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
1619
# check transactions-5 success: 1
1622
Warning 1196 Some non-transactional changed tables couldn't be rolled back
1624
# check transactions-6 success: 1
1625
# INFO: Storage engine used for t1 seems to be not transactional.
1628
# check transactions-7 success: 1
1629
DELETE FROM t1 WHERE f_charbig = 'was inserted';
1631
SET @@session.sql_mode = 'traditional';
1632
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
1633
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1634
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
1635
'', '', 'was inserted' FROM t0_template
1636
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
1637
ERROR 22012: Division by 0
1640
# check transactions-8 success: 1
1641
# INFO: Storage engine used for t1 seems to be unable to revert
1642
# changes made by the failing statement.
1643
SET @@session.sql_mode = '';
1645
DELETE FROM t1 WHERE f_charbig = 'was inserted';
1647
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
1649
# check special-1 success: 1
1650
UPDATE t1 SET f_charbig = '';
1652
# check special-2 success: 1
1653
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
1654
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
1655
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
1656
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1657
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1658
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1659
'just inserted' FROM t0_template
1660
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1661
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
1663
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1664
f_charbig = 'updated by trigger'
1665
WHERE f_int1 = new.f_int1;
1667
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1668
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
1669
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1671
# check trigger-1 success: 1
1673
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1674
f_int2 = CAST(f_char1 AS SIGNED INT),
1675
f_charbig = 'just inserted'
1676
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1678
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1679
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1680
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1681
'just inserted' FROM t0_template
1682
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1683
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
1685
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1686
f_charbig = 'updated by trigger'
1687
WHERE f_int1 = new.f_int1;
1689
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1690
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
1691
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1693
# check trigger-2 success: 1
1695
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1696
f_int2 = CAST(f_char1 AS SIGNED INT),
1697
f_charbig = 'just inserted'
1698
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1700
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1701
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1702
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1703
'just inserted' FROM t0_template
1704
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1705
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
1707
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1708
f_charbig = 'updated by trigger'
1709
WHERE f_int1 = new.f_int1;
1711
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
1712
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1714
# check trigger-3 success: 1
1716
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1717
f_int2 = CAST(f_char1 AS SIGNED INT),
1718
f_charbig = 'just inserted'
1719
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1721
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1722
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1723
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1724
'just inserted' FROM t0_template
1725
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1726
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
1728
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1729
f_charbig = 'updated by trigger'
1730
WHERE f_int1 = - old.f_int1;
1732
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
1733
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1735
# check trigger-4 success: 1
1737
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1738
f_int2 = CAST(f_char1 AS SIGNED INT),
1739
f_charbig = 'just inserted'
1740
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1742
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1743
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1744
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1745
'just inserted' FROM t0_template
1746
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1747
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
1749
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1750
f_charbig = 'updated by trigger'
1751
WHERE f_int1 = new.f_int1;
1753
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
1754
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1756
# check trigger-5 success: 1
1758
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1759
f_int2 = CAST(f_char1 AS SIGNED INT),
1760
f_charbig = 'just inserted'
1761
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1763
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1764
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1765
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1766
'just inserted' FROM t0_template
1767
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1768
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
1770
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1771
f_charbig = 'updated by trigger'
1772
WHERE f_int1 = - old.f_int1;
1774
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
1775
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1777
# check trigger-6 success: 1
1779
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1780
f_int2 = CAST(f_char1 AS SIGNED INT),
1781
f_charbig = 'just inserted'
1782
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1784
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1785
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1786
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1787
'just inserted' FROM t0_template
1788
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1789
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
1791
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1792
f_charbig = 'updated by trigger'
1793
WHERE f_int1 = - old.f_int1;
1796
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1798
# check trigger-7 success: 1
1800
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1801
f_int2 = CAST(f_char1 AS SIGNED INT),
1802
f_charbig = 'just inserted'
1803
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1805
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1806
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
1807
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
1808
'just inserted' FROM t0_template
1809
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1810
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
1812
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
1813
f_charbig = 'updated by trigger'
1814
WHERE f_int1 = - old.f_int1;
1817
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
1819
# check trigger-8 success: 1
1821
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1822
f_int2 = CAST(f_char1 AS SIGNED INT),
1823
f_charbig = 'just inserted'
1824
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
1826
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1828
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
1829
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
1831
SET new.f_int1 = old.f_int1 + @max_row,
1832
new.f_int2 = old.f_int2 - @max_row,
1833
new.f_charbig = '####updated per update trigger####';
1836
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
1837
f_charbig = '####updated per update statement itself####';
1839
# check trigger-9 success: 1
1841
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1842
f_int2 = CAST(f_char1 AS SIGNED INT),
1843
f_charbig = CONCAT('===',f_char1,'===');
1844
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
1846
SET new.f_int1 = new.f_int1 + @max_row,
1847
new.f_int2 = new.f_int2 - @max_row,
1848
new.f_charbig = '####updated per update trigger####';
1851
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
1852
f_charbig = '####updated per update statement itself####';
1854
# check trigger-10 success: 1
1856
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
1857
f_int2 = CAST(f_char1 AS SIGNED INT),
1858
f_charbig = CONCAT('===',f_char1,'===');
1859
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
1861
SET new.f_int1 = @my_max1 + @counter,
1862
new.f_int2 = @my_min2 - @counter,
1863
new.f_charbig = '####updated per insert trigger####';
1864
SET @counter = @counter + 1;
1867
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
1868
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1869
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
1870
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
1871
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
1875
# check trigger-11 success: 1
1877
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
1878
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
1879
AND f_charbig = '####updated per insert trigger####';
1880
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
1882
SET new.f_int1 = @my_max1 + @counter,
1883
new.f_int2 = @my_min2 - @counter,
1884
new.f_charbig = '####updated per insert trigger####';
1885
SET @counter = @counter + 1;
1888
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
1889
INSERT INTO t1 (f_char1, f_char2, f_charbig)
1890
SELECT CAST(f_int1 AS CHAR),
1891
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
1892
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
1896
# check trigger-12 success: 1
1898
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
1899
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
1900
AND f_charbig = '####updated per insert trigger####';
1902
Table Op Msg_type Msg_text
1903
test.t1 analyze note The storage engine for the table doesn't support analyze
1904
CHECK TABLE t1 EXTENDED;
1905
Table Op Msg_type Msg_text
1906
test.t1 check note The storage engine for the table doesn't support check
1907
CHECKSUM TABLE t1 EXTENDED;
1909
test.t1 <some_value>
1911
Table Op Msg_type Msg_text
1912
test.t1 optimize note The storage engine for the table doesn't support optimize
1913
# check layout success: 1
1914
REPAIR TABLE t1 EXTENDED;
1915
Table Op Msg_type Msg_text
1916
test.t1 repair note The storage engine for the table doesn't support repair
1917
# check layout success: 1
1920
# check TRUNCATE success: 1
1921
# check layout success: 1
1922
# End usability test (inc/partition_check.inc)
1929
f_charbig VARCHAR(1000)
1932
PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
1933
(PARTITION parta VALUES LESS THAN (0),
1934
PARTITION partb VALUES LESS THAN (5),
1935
PARTITION partc VALUES LESS THAN (10),
1936
PARTITION partd VALUES LESS THAN (2147483646));
1937
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
1938
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
1939
# Start usability test (inc/partition_check.inc)
1941
SHOW CREATE TABLE t1;
1943
t1 CREATE TABLE `t1` (
1944
`f_int1` int(11) DEFAULT NULL,
1945
`f_int2` int(11) DEFAULT NULL,
1946
`f_char1` char(20) DEFAULT NULL,
1947
`f_char2` char(20) DEFAULT NULL,
1948
`f_charbig` varchar(1000) DEFAULT NULL
1949
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */
1952
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD
1953
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI
1954
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD
1955
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI
1956
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD
1957
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI
1958
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD
1959
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI
1960
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD
1961
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI
1962
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD
1963
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI
1964
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD
1965
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI
1966
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD
1967
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI
1968
$MYSQLTEST_VARDIR/master-data/test/t1.frm
1969
$MYSQLTEST_VARDIR/master-data/test/t1.par
1971
# check prerequisites-1 success: 1
1972
# check COUNT(*) success: 1
1973
# check MIN/MAX(f_int1) success: 1
1974
# check MIN/MAX(f_int2) success: 1
1975
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
1976
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
1977
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
1978
WHERE f_int1 IN (2,3);
1979
# check prerequisites-3 success: 1
1980
DELETE FROM t1 WHERE f_charbig = 'delete me';
1981
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
1982
# check read via f_int1 success: 1
1983
# check read via f_int2 success: 1
1985
# check multiple-1 success: 1
1986
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
1988
# check multiple-2 success: 1
1989
INSERT INTO t1 SELECT * FROM t0_template
1990
WHERE MOD(f_int1,3) = 0;
1992
# check multiple-3 success: 1
1993
UPDATE t1 SET f_int1 = f_int1 + @max_row
1994
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
1995
AND @max_row_div2 + @max_row_div4;
1997
# check multiple-4 success: 1
1999
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
2000
AND @max_row_div2 + @max_row_div4 + @max_row;
2002
# check multiple-5 success: 1
2003
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
2005
SET f_int1 = @cur_value , f_int2 = @cur_value,
2006
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
2007
f_charbig = '#SINGLE#';
2009
# check single-1 success: 1
2010
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
2012
SET f_int1 = @cur_value , f_int2 = @cur_value,
2013
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
2014
f_charbig = '#SINGLE#';
2016
# check single-2 success: 1
2017
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
2018
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
2019
UPDATE t1 SET f_int1 = @cur_value2
2020
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
2022
# check single-3 success: 1
2023
SET @cur_value1= -1;
2024
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
2025
UPDATE t1 SET f_int1 = @cur_value1
2026
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
2028
# check single-4 success: 1
2029
SELECT MAX(f_int1) INTO @cur_value FROM t1;
2030
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
2032
# check single-5 success: 1
2033
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
2035
# check single-6 success: 1
2036
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
2038
# check single-7 success: 1
2039
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
2040
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
2041
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
2042
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
2043
f_charbig = '#NULL#';
2045
SET f_int1 = NULL , f_int2 = -@max_row,
2046
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
2047
f_charbig = '#NULL#';
2048
# check null success: 1
2050
# check null-1 success: 1
2051
UPDATE t1 SET f_int1 = -@max_row
2052
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
2053
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
2055
# check null-2 success: 1
2056
UPDATE t1 SET f_int1 = NULL
2057
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
2058
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
2060
# check null-3 success: 1
2062
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
2063
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
2065
# check null-4 success: 1
2067
WHERE f_int1 = 0 AND f_int2 = 0
2068
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
2069
AND f_charbig = '#NULL#';
2071
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2072
SELECT f_int1, f_int1, '', '', 'was inserted'
2073
FROM t0_template source_tab
2074
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
2076
# check transactions-1 success: 1
2079
# check transactions-2 success: 1
2082
# check transactions-3 success: 1
2083
DELETE FROM t1 WHERE f_charbig = 'was inserted';
2087
# check transactions-4 success: 1
2088
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2089
SELECT f_int1, f_int1, '', '', 'was inserted'
2090
FROM t0_template source_tab
2091
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
2093
# check transactions-5 success: 1
2096
Warning 1196 Some non-transactional changed tables couldn't be rolled back
2098
# check transactions-6 success: 1
2099
# INFO: Storage engine used for t1 seems to be not transactional.
2102
# check transactions-7 success: 1
2103
DELETE FROM t1 WHERE f_charbig = 'was inserted';
2105
SET @@session.sql_mode = 'traditional';
2106
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
2107
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2108
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
2109
'', '', 'was inserted' FROM t0_template
2110
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
2111
ERROR 22012: Division by 0
2114
# check transactions-8 success: 1
2115
# INFO: Storage engine used for t1 seems to be unable to revert
2116
# changes made by the failing statement.
2117
SET @@session.sql_mode = '';
2119
DELETE FROM t1 WHERE f_charbig = 'was inserted';
2121
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
2123
# check special-1 success: 1
2124
UPDATE t1 SET f_charbig = '';
2126
# check special-2 success: 1
2127
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
2128
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2129
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
2130
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2131
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2132
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2133
'just inserted' FROM t0_template
2134
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2135
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
2137
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2138
f_charbig = 'updated by trigger'
2139
WHERE f_int1 = new.f_int1;
2141
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2142
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
2143
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2145
# check trigger-1 success: 1
2147
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2148
f_int2 = CAST(f_char1 AS SIGNED INT),
2149
f_charbig = 'just inserted'
2150
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2152
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2153
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2154
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2155
'just inserted' FROM t0_template
2156
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2157
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
2159
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2160
f_charbig = 'updated by trigger'
2161
WHERE f_int1 = new.f_int1;
2163
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2164
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
2165
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2167
# check trigger-2 success: 1
2169
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2170
f_int2 = CAST(f_char1 AS SIGNED INT),
2171
f_charbig = 'just inserted'
2172
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2174
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2175
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2176
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2177
'just inserted' FROM t0_template
2178
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2179
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
2181
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2182
f_charbig = 'updated by trigger'
2183
WHERE f_int1 = new.f_int1;
2185
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
2186
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2188
# check trigger-3 success: 1
2190
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2191
f_int2 = CAST(f_char1 AS SIGNED INT),
2192
f_charbig = 'just inserted'
2193
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2195
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2196
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2197
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2198
'just inserted' FROM t0_template
2199
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2200
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
2202
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2203
f_charbig = 'updated by trigger'
2204
WHERE f_int1 = - old.f_int1;
2206
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
2207
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2209
# check trigger-4 success: 1
2211
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2212
f_int2 = CAST(f_char1 AS SIGNED INT),
2213
f_charbig = 'just inserted'
2214
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2216
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2217
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2218
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2219
'just inserted' FROM t0_template
2220
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2221
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
2223
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2224
f_charbig = 'updated by trigger'
2225
WHERE f_int1 = new.f_int1;
2227
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
2228
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2230
# check trigger-5 success: 1
2232
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2233
f_int2 = CAST(f_char1 AS SIGNED INT),
2234
f_charbig = 'just inserted'
2235
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2237
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2238
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2239
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2240
'just inserted' FROM t0_template
2241
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2242
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
2244
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2245
f_charbig = 'updated by trigger'
2246
WHERE f_int1 = - old.f_int1;
2248
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
2249
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2251
# check trigger-6 success: 1
2253
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2254
f_int2 = CAST(f_char1 AS SIGNED INT),
2255
f_charbig = 'just inserted'
2256
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2258
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2259
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2260
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2261
'just inserted' FROM t0_template
2262
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2263
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
2265
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2266
f_charbig = 'updated by trigger'
2267
WHERE f_int1 = - old.f_int1;
2270
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2272
# check trigger-7 success: 1
2274
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2275
f_int2 = CAST(f_char1 AS SIGNED INT),
2276
f_charbig = 'just inserted'
2277
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2279
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2280
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2281
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2282
'just inserted' FROM t0_template
2283
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2284
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
2286
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2287
f_charbig = 'updated by trigger'
2288
WHERE f_int1 = - old.f_int1;
2291
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2293
# check trigger-8 success: 1
2295
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2296
f_int2 = CAST(f_char1 AS SIGNED INT),
2297
f_charbig = 'just inserted'
2298
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2300
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2302
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2303
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
2305
SET new.f_int1 = old.f_int1 + @max_row,
2306
new.f_int2 = old.f_int2 - @max_row,
2307
new.f_charbig = '####updated per update trigger####';
2310
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
2311
f_charbig = '####updated per update statement itself####';
2313
# check trigger-9 success: 1
2315
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2316
f_int2 = CAST(f_char1 AS SIGNED INT),
2317
f_charbig = CONCAT('===',f_char1,'===');
2318
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
2320
SET new.f_int1 = new.f_int1 + @max_row,
2321
new.f_int2 = new.f_int2 - @max_row,
2322
new.f_charbig = '####updated per update trigger####';
2325
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
2326
f_charbig = '####updated per update statement itself####';
2328
# check trigger-10 success: 1
2330
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2331
f_int2 = CAST(f_char1 AS SIGNED INT),
2332
f_charbig = CONCAT('===',f_char1,'===');
2333
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
2335
SET new.f_int1 = @my_max1 + @counter,
2336
new.f_int2 = @my_min2 - @counter,
2337
new.f_charbig = '####updated per insert trigger####';
2338
SET @counter = @counter + 1;
2341
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
2342
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2343
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
2344
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
2345
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
2349
# check trigger-11 success: 1
2351
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
2352
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
2353
AND f_charbig = '####updated per insert trigger####';
2354
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
2356
SET new.f_int1 = @my_max1 + @counter,
2357
new.f_int2 = @my_min2 - @counter,
2358
new.f_charbig = '####updated per insert trigger####';
2359
SET @counter = @counter + 1;
2362
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
2363
INSERT INTO t1 (f_char1, f_char2, f_charbig)
2364
SELECT CAST(f_int1 AS CHAR),
2365
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
2366
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
2370
# check trigger-12 success: 1
2372
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
2373
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
2374
AND f_charbig = '####updated per insert trigger####';
2376
Table Op Msg_type Msg_text
2377
test.t1 analyze note The storage engine for the table doesn't support analyze
2378
CHECK TABLE t1 EXTENDED;
2379
Table Op Msg_type Msg_text
2380
test.t1 check note The storage engine for the table doesn't support check
2381
CHECKSUM TABLE t1 EXTENDED;
2383
test.t1 <some_value>
2385
Table Op Msg_type Msg_text
2386
test.t1 optimize note The storage engine for the table doesn't support optimize
2387
# check layout success: 1
2388
REPAIR TABLE t1 EXTENDED;
2389
Table Op Msg_type Msg_text
2390
test.t1 repair note The storage engine for the table doesn't support repair
2391
# check layout success: 1
2394
# check TRUNCATE success: 1
2395
# check layout success: 1
2396
# End usability test (inc/partition_check.inc)
2403
f_charbig VARCHAR(1000)
2406
PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
2407
(PARTITION part1 VALUES LESS THAN (0)
2408
(SUBPARTITION subpart11, SUBPARTITION subpart12),
2409
PARTITION part2 VALUES LESS THAN (5)
2410
(SUBPARTITION subpart21, SUBPARTITION subpart22),
2411
PARTITION part3 VALUES LESS THAN (10)
2412
(SUBPARTITION subpart31, SUBPARTITION subpart32),
2413
PARTITION part4 VALUES LESS THAN (2147483646)
2414
(SUBPARTITION subpart41, SUBPARTITION subpart42));
2415
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2416
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
2417
# Start usability test (inc/partition_check.inc)
2419
SHOW CREATE TABLE t1;
2421
t1 CREATE TABLE `t1` (
2422
`f_int1` int(11) DEFAULT NULL,
2423
`f_int2` int(11) DEFAULT NULL,
2424
`f_char1` char(20) DEFAULT NULL,
2425
`f_char2` char(20) DEFAULT NULL,
2426
`f_charbig` varchar(1000) DEFAULT NULL
2427
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */
2430
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD
2431
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI
2432
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD
2433
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI
2434
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD
2435
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI
2436
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD
2437
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI
2438
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD
2439
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI
2440
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD
2441
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI
2442
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD
2443
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI
2444
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD
2445
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI
2446
$MYSQLTEST_VARDIR/master-data/test/t1.frm
2447
$MYSQLTEST_VARDIR/master-data/test/t1.par
2449
# check prerequisites-1 success: 1
2450
# check COUNT(*) success: 1
2451
# check MIN/MAX(f_int1) success: 1
2452
# check MIN/MAX(f_int2) success: 1
2453
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2454
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
2455
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
2456
WHERE f_int1 IN (2,3);
2457
# check prerequisites-3 success: 1
2458
DELETE FROM t1 WHERE f_charbig = 'delete me';
2459
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
2460
# check read via f_int1 success: 1
2461
# check read via f_int2 success: 1
2463
# check multiple-1 success: 1
2464
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
2466
# check multiple-2 success: 1
2467
INSERT INTO t1 SELECT * FROM t0_template
2468
WHERE MOD(f_int1,3) = 0;
2470
# check multiple-3 success: 1
2471
UPDATE t1 SET f_int1 = f_int1 + @max_row
2472
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
2473
AND @max_row_div2 + @max_row_div4;
2475
# check multiple-4 success: 1
2477
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
2478
AND @max_row_div2 + @max_row_div4 + @max_row;
2480
# check multiple-5 success: 1
2481
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
2483
SET f_int1 = @cur_value , f_int2 = @cur_value,
2484
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
2485
f_charbig = '#SINGLE#';
2487
# check single-1 success: 1
2488
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
2490
SET f_int1 = @cur_value , f_int2 = @cur_value,
2491
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
2492
f_charbig = '#SINGLE#';
2494
# check single-2 success: 1
2495
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
2496
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
2497
UPDATE t1 SET f_int1 = @cur_value2
2498
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
2500
# check single-3 success: 1
2501
SET @cur_value1= -1;
2502
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
2503
UPDATE t1 SET f_int1 = @cur_value1
2504
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
2506
# check single-4 success: 1
2507
SELECT MAX(f_int1) INTO @cur_value FROM t1;
2508
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
2510
# check single-5 success: 1
2511
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
2513
# check single-6 success: 1
2514
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
2515
ERROR HY000: Table has no partition for value 2147483647
2516
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
2517
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
2518
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
2519
f_charbig = '#NULL#';
2521
SET f_int1 = NULL , f_int2 = -@max_row,
2522
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
2523
f_charbig = '#NULL#';
2524
# check null success: 1
2526
# check null-1 success: 1
2527
UPDATE t1 SET f_int1 = -@max_row
2528
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
2529
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
2531
# check null-2 success: 1
2532
UPDATE t1 SET f_int1 = NULL
2533
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
2534
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
2536
# check null-3 success: 1
2538
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
2539
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
2541
# check null-4 success: 1
2543
WHERE f_int1 = 0 AND f_int2 = 0
2544
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
2545
AND f_charbig = '#NULL#';
2547
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2548
SELECT f_int1, f_int1, '', '', 'was inserted'
2549
FROM t0_template source_tab
2550
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
2552
# check transactions-1 success: 1
2555
# check transactions-2 success: 1
2558
# check transactions-3 success: 1
2559
DELETE FROM t1 WHERE f_charbig = 'was inserted';
2563
# check transactions-4 success: 1
2564
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2565
SELECT f_int1, f_int1, '', '', 'was inserted'
2566
FROM t0_template source_tab
2567
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
2569
# check transactions-5 success: 1
2572
Warning 1196 Some non-transactional changed tables couldn't be rolled back
2574
# check transactions-6 success: 1
2575
# INFO: Storage engine used for t1 seems to be not transactional.
2578
# check transactions-7 success: 1
2579
DELETE FROM t1 WHERE f_charbig = 'was inserted';
2581
SET @@session.sql_mode = 'traditional';
2582
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
2583
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2584
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
2585
'', '', 'was inserted' FROM t0_template
2586
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
2587
ERROR 22012: Division by 0
2590
# check transactions-8 success: 1
2591
# INFO: Storage engine used for t1 seems to be unable to revert
2592
# changes made by the failing statement.
2593
SET @@session.sql_mode = '';
2595
DELETE FROM t1 WHERE f_charbig = 'was inserted';
2597
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
2599
# check special-1 success: 1
2600
UPDATE t1 SET f_charbig = '';
2602
# check special-2 success: 1
2603
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
2604
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2605
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
2606
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2607
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2608
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2609
'just inserted' FROM t0_template
2610
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2611
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
2613
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2614
f_charbig = 'updated by trigger'
2615
WHERE f_int1 = new.f_int1;
2617
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2618
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
2619
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2621
# check trigger-1 success: 1
2623
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2624
f_int2 = CAST(f_char1 AS SIGNED INT),
2625
f_charbig = 'just inserted'
2626
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2628
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2629
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2630
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2631
'just inserted' FROM t0_template
2632
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2633
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
2635
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2636
f_charbig = 'updated by trigger'
2637
WHERE f_int1 = new.f_int1;
2639
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2640
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
2641
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2643
# check trigger-2 success: 1
2645
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2646
f_int2 = CAST(f_char1 AS SIGNED INT),
2647
f_charbig = 'just inserted'
2648
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2650
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2651
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2652
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2653
'just inserted' FROM t0_template
2654
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2655
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
2657
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2658
f_charbig = 'updated by trigger'
2659
WHERE f_int1 = new.f_int1;
2661
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
2662
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2664
# check trigger-3 success: 1
2666
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2667
f_int2 = CAST(f_char1 AS SIGNED INT),
2668
f_charbig = 'just inserted'
2669
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2671
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2672
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2673
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2674
'just inserted' FROM t0_template
2675
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2676
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
2678
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2679
f_charbig = 'updated by trigger'
2680
WHERE f_int1 = - old.f_int1;
2682
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
2683
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2685
# check trigger-4 success: 1
2687
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2688
f_int2 = CAST(f_char1 AS SIGNED INT),
2689
f_charbig = 'just inserted'
2690
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2692
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2693
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2694
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2695
'just inserted' FROM t0_template
2696
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2697
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
2699
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2700
f_charbig = 'updated by trigger'
2701
WHERE f_int1 = new.f_int1;
2703
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
2704
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2706
# check trigger-5 success: 1
2708
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2709
f_int2 = CAST(f_char1 AS SIGNED INT),
2710
f_charbig = 'just inserted'
2711
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2713
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2714
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2715
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2716
'just inserted' FROM t0_template
2717
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2718
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
2720
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2721
f_charbig = 'updated by trigger'
2722
WHERE f_int1 = - old.f_int1;
2724
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
2725
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2727
# check trigger-6 success: 1
2729
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2730
f_int2 = CAST(f_char1 AS SIGNED INT),
2731
f_charbig = 'just inserted'
2732
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2734
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2735
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2736
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2737
'just inserted' FROM t0_template
2738
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2739
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
2741
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2742
f_charbig = 'updated by trigger'
2743
WHERE f_int1 = - old.f_int1;
2746
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2748
# check trigger-7 success: 1
2750
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2751
f_int2 = CAST(f_char1 AS SIGNED INT),
2752
f_charbig = 'just inserted'
2753
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2755
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2756
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
2757
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
2758
'just inserted' FROM t0_template
2759
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2760
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
2762
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
2763
f_charbig = 'updated by trigger'
2764
WHERE f_int1 = - old.f_int1;
2767
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
2769
# check trigger-8 success: 1
2771
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2772
f_int2 = CAST(f_char1 AS SIGNED INT),
2773
f_charbig = 'just inserted'
2774
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
2776
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2778
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
2779
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
2781
SET new.f_int1 = old.f_int1 + @max_row,
2782
new.f_int2 = old.f_int2 - @max_row,
2783
new.f_charbig = '####updated per update trigger####';
2786
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
2787
f_charbig = '####updated per update statement itself####';
2789
# check trigger-9 success: 1
2791
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2792
f_int2 = CAST(f_char1 AS SIGNED INT),
2793
f_charbig = CONCAT('===',f_char1,'===');
2794
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
2796
SET new.f_int1 = new.f_int1 + @max_row,
2797
new.f_int2 = new.f_int2 - @max_row,
2798
new.f_charbig = '####updated per update trigger####';
2801
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
2802
f_charbig = '####updated per update statement itself####';
2804
# check trigger-10 success: 1
2806
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
2807
f_int2 = CAST(f_char1 AS SIGNED INT),
2808
f_charbig = CONCAT('===',f_char1,'===');
2809
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
2811
SET new.f_int1 = @my_max1 + @counter,
2812
new.f_int2 = @my_min2 - @counter,
2813
new.f_charbig = '####updated per insert trigger####';
2814
SET @counter = @counter + 1;
2817
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
2818
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2819
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
2820
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
2821
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
2825
# check trigger-11 success: 1
2827
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
2828
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
2829
AND f_charbig = '####updated per insert trigger####';
2830
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
2832
SET new.f_int1 = @my_max1 + @counter,
2833
new.f_int2 = @my_min2 - @counter,
2834
new.f_charbig = '####updated per insert trigger####';
2835
SET @counter = @counter + 1;
2838
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
2839
INSERT INTO t1 (f_char1, f_char2, f_charbig)
2840
SELECT CAST(f_int1 AS CHAR),
2841
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
2842
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
2846
# check trigger-12 success: 1
2848
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
2849
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
2850
AND f_charbig = '####updated per insert trigger####';
2852
Table Op Msg_type Msg_text
2853
test.t1 analyze note The storage engine for the table doesn't support analyze
2854
CHECK TABLE t1 EXTENDED;
2855
Table Op Msg_type Msg_text
2856
test.t1 check note The storage engine for the table doesn't support check
2857
CHECKSUM TABLE t1 EXTENDED;
2859
test.t1 <some_value>
2861
Table Op Msg_type Msg_text
2862
test.t1 optimize note The storage engine for the table doesn't support optimize
2863
# check layout success: 1
2864
REPAIR TABLE t1 EXTENDED;
2865
Table Op Msg_type Msg_text
2866
test.t1 repair note The storage engine for the table doesn't support repair
2867
# check layout success: 1
2870
# check TRUNCATE success: 1
2871
# check layout success: 1
2872
# End usability test (inc/partition_check.inc)
2879
f_charbig VARCHAR(1000)
2882
PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1)
2883
(PARTITION part1 VALUES IN (0)
2886
PARTITION part2 VALUES IN (1)
2889
PARTITION part3 VALUES IN (2)
2892
PARTITION part4 VALUES IN (NULL)
2894
SUBPARTITION sp42));
2895
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2896
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
2897
# Start usability test (inc/partition_check.inc)
2899
SHOW CREATE TABLE t1;
2901
t1 CREATE TABLE `t1` (
2902
`f_int1` int(11) DEFAULT NULL,
2903
`f_int2` int(11) DEFAULT NULL,
2904
`f_char1` char(20) DEFAULT NULL,
2905
`f_char2` char(20) DEFAULT NULL,
2906
`f_charbig` varchar(1000) DEFAULT NULL
2907
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, SUBPARTITION sp12 ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = MyISAM, SUBPARTITION sp22 ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = MyISAM, SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, SUBPARTITION sp42 ENGINE = MyISAM)) */
2910
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD
2911
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI
2912
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD
2913
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI
2914
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD
2915
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI
2916
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD
2917
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI
2918
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD
2919
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI
2920
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD
2921
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI
2922
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD
2923
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI
2924
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD
2925
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI
2926
$MYSQLTEST_VARDIR/master-data/test/t1.frm
2927
$MYSQLTEST_VARDIR/master-data/test/t1.par
2929
# check prerequisites-1 success: 1
2930
# check COUNT(*) success: 1
2931
# check MIN/MAX(f_int1) success: 1
2932
# check MIN/MAX(f_int2) success: 1
2933
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
2934
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
2935
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
2936
WHERE f_int1 IN (2,3);
2937
# check prerequisites-3 success: 1
2938
DELETE FROM t1 WHERE f_charbig = 'delete me';
2939
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
2940
# check read via f_int1 success: 1
2941
# check read via f_int2 success: 1
2943
# check multiple-1 success: 1
2944
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
2946
# check multiple-2 success: 1
2947
INSERT INTO t1 SELECT * FROM t0_template
2948
WHERE MOD(f_int1,3) = 0;
2950
# check multiple-3 success: 1
2951
UPDATE t1 SET f_int1 = f_int1 + @max_row
2952
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
2953
AND @max_row_div2 + @max_row_div4;
2955
# check multiple-4 success: 1
2957
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
2958
AND @max_row_div2 + @max_row_div4 + @max_row;
2960
# check multiple-5 success: 1
2961
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
2963
SET f_int1 = @cur_value , f_int2 = @cur_value,
2964
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
2965
f_charbig = '#SINGLE#';
2967
# check single-1 success: 1
2968
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
2970
SET f_int1 = @cur_value , f_int2 = @cur_value,
2971
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
2972
f_charbig = '#SINGLE#';
2974
# check single-2 success: 1
2975
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
2976
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
2977
UPDATE t1 SET f_int1 = @cur_value2
2978
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
2980
# check single-3 success: 1
2981
SET @cur_value1= -1;
2982
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
2983
UPDATE t1 SET f_int1 = @cur_value1
2984
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
2986
# check single-4 success: 1
2987
SELECT MAX(f_int1) INTO @cur_value FROM t1;
2988
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
2990
# check single-5 success: 1
2991
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
2993
# check single-6 success: 1
2994
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
2996
# check single-7 success: 1
2997
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
2998
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
2999
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
3000
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
3001
f_charbig = '#NULL#';
3003
SET f_int1 = NULL , f_int2 = -@max_row,
3004
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
3005
f_charbig = '#NULL#';
3006
# check null success: 1
3008
# check null-1 success: 1
3009
UPDATE t1 SET f_int1 = -@max_row
3010
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3011
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3013
# check null-2 success: 1
3014
UPDATE t1 SET f_int1 = NULL
3015
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3016
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3018
# check null-3 success: 1
3020
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3021
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3023
# check null-4 success: 1
3025
WHERE f_int1 = 0 AND f_int2 = 0
3026
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
3027
AND f_charbig = '#NULL#';
3029
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3030
SELECT f_int1, f_int1, '', '', 'was inserted'
3031
FROM t0_template source_tab
3032
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
3034
# check transactions-1 success: 1
3037
# check transactions-2 success: 1
3040
# check transactions-3 success: 1
3041
DELETE FROM t1 WHERE f_charbig = 'was inserted';
3045
# check transactions-4 success: 1
3046
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3047
SELECT f_int1, f_int1, '', '', 'was inserted'
3048
FROM t0_template source_tab
3049
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
3051
# check transactions-5 success: 1
3054
Warning 1196 Some non-transactional changed tables couldn't be rolled back
3056
# check transactions-6 success: 1
3057
# INFO: Storage engine used for t1 seems to be not transactional.
3060
# check transactions-7 success: 1
3061
DELETE FROM t1 WHERE f_charbig = 'was inserted';
3063
SET @@session.sql_mode = 'traditional';
3064
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
3065
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3066
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
3067
'', '', 'was inserted' FROM t0_template
3068
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
3069
ERROR 22012: Division by 0
3072
# check transactions-8 success: 1
3073
# INFO: Storage engine used for t1 seems to be unable to revert
3074
# changes made by the failing statement.
3075
SET @@session.sql_mode = '';
3077
DELETE FROM t1 WHERE f_charbig = 'was inserted';
3079
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
3081
# check special-1 success: 1
3082
UPDATE t1 SET f_charbig = '';
3084
# check special-2 success: 1
3085
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
3086
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
3087
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
3088
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3089
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3090
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3091
'just inserted' FROM t0_template
3092
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3093
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
3095
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3096
f_charbig = 'updated by trigger'
3097
WHERE f_int1 = new.f_int1;
3099
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3100
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
3101
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3103
# check trigger-1 success: 1
3105
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3106
f_int2 = CAST(f_char1 AS SIGNED INT),
3107
f_charbig = 'just inserted'
3108
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3110
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3111
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3112
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3113
'just inserted' FROM t0_template
3114
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3115
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
3117
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3118
f_charbig = 'updated by trigger'
3119
WHERE f_int1 = new.f_int1;
3121
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3122
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
3123
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3125
# check trigger-2 success: 1
3127
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3128
f_int2 = CAST(f_char1 AS SIGNED INT),
3129
f_charbig = 'just inserted'
3130
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3132
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3133
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3134
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3135
'just inserted' FROM t0_template
3136
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3137
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
3139
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3140
f_charbig = 'updated by trigger'
3141
WHERE f_int1 = new.f_int1;
3143
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
3144
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3146
# check trigger-3 success: 1
3148
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3149
f_int2 = CAST(f_char1 AS SIGNED INT),
3150
f_charbig = 'just inserted'
3151
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3153
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3154
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3155
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3156
'just inserted' FROM t0_template
3157
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3158
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
3160
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3161
f_charbig = 'updated by trigger'
3162
WHERE f_int1 = - old.f_int1;
3164
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
3165
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3167
# check trigger-4 success: 1
3169
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3170
f_int2 = CAST(f_char1 AS SIGNED INT),
3171
f_charbig = 'just inserted'
3172
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3174
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3175
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3176
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3177
'just inserted' FROM t0_template
3178
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3179
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
3181
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3182
f_charbig = 'updated by trigger'
3183
WHERE f_int1 = new.f_int1;
3185
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
3186
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3188
# check trigger-5 success: 1
3190
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3191
f_int2 = CAST(f_char1 AS SIGNED INT),
3192
f_charbig = 'just inserted'
3193
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3195
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3196
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3197
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3198
'just inserted' FROM t0_template
3199
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3200
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
3202
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3203
f_charbig = 'updated by trigger'
3204
WHERE f_int1 = - old.f_int1;
3206
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
3207
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3209
# check trigger-6 success: 1
3211
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3212
f_int2 = CAST(f_char1 AS SIGNED INT),
3213
f_charbig = 'just inserted'
3214
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3216
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3217
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3218
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3219
'just inserted' FROM t0_template
3220
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3221
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
3223
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3224
f_charbig = 'updated by trigger'
3225
WHERE f_int1 = - old.f_int1;
3228
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3230
# check trigger-7 success: 1
3232
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3233
f_int2 = CAST(f_char1 AS SIGNED INT),
3234
f_charbig = 'just inserted'
3235
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3237
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3238
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3239
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3240
'just inserted' FROM t0_template
3241
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3242
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
3244
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3245
f_charbig = 'updated by trigger'
3246
WHERE f_int1 = - old.f_int1;
3249
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3251
# check trigger-8 success: 1
3253
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3254
f_int2 = CAST(f_char1 AS SIGNED INT),
3255
f_charbig = 'just inserted'
3256
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3258
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3260
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3261
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
3263
SET new.f_int1 = old.f_int1 + @max_row,
3264
new.f_int2 = old.f_int2 - @max_row,
3265
new.f_charbig = '####updated per update trigger####';
3268
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
3269
f_charbig = '####updated per update statement itself####';
3271
# check trigger-9 success: 1
3273
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3274
f_int2 = CAST(f_char1 AS SIGNED INT),
3275
f_charbig = CONCAT('===',f_char1,'===');
3276
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
3278
SET new.f_int1 = new.f_int1 + @max_row,
3279
new.f_int2 = new.f_int2 - @max_row,
3280
new.f_charbig = '####updated per update trigger####';
3283
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
3284
f_charbig = '####updated per update statement itself####';
3286
# check trigger-10 success: 1
3288
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3289
f_int2 = CAST(f_char1 AS SIGNED INT),
3290
f_charbig = CONCAT('===',f_char1,'===');
3291
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
3293
SET new.f_int1 = @my_max1 + @counter,
3294
new.f_int2 = @my_min2 - @counter,
3295
new.f_charbig = '####updated per insert trigger####';
3296
SET @counter = @counter + 1;
3299
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
3300
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3301
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
3302
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
3303
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
3307
# check trigger-11 success: 1
3309
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
3310
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
3311
AND f_charbig = '####updated per insert trigger####';
3312
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
3314
SET new.f_int1 = @my_max1 + @counter,
3315
new.f_int2 = @my_min2 - @counter,
3316
new.f_charbig = '####updated per insert trigger####';
3317
SET @counter = @counter + 1;
3320
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
3321
INSERT INTO t1 (f_char1, f_char2, f_charbig)
3322
SELECT CAST(f_int1 AS CHAR),
3323
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
3324
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
3328
# check trigger-12 success: 1
3330
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
3331
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
3332
AND f_charbig = '####updated per insert trigger####';
3334
Table Op Msg_type Msg_text
3335
test.t1 analyze note The storage engine for the table doesn't support analyze
3336
CHECK TABLE t1 EXTENDED;
3337
Table Op Msg_type Msg_text
3338
test.t1 check note The storage engine for the table doesn't support check
3339
CHECKSUM TABLE t1 EXTENDED;
3341
test.t1 <some_value>
3343
Table Op Msg_type Msg_text
3344
test.t1 optimize note The storage engine for the table doesn't support optimize
3345
# check layout success: 1
3346
REPAIR TABLE t1 EXTENDED;
3347
Table Op Msg_type Msg_text
3348
test.t1 repair note The storage engine for the table doesn't support repair
3349
# check layout success: 1
3352
# check TRUNCATE success: 1
3353
# check layout success: 1
3354
# End usability test (inc/partition_check.inc)
3361
f_charbig VARCHAR(1000)
3364
PARTITION BY LIST(ABS(MOD(f_int1,2)))
3365
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3
3366
(PARTITION part1 VALUES IN (0),
3367
PARTITION part2 VALUES IN (1),
3368
PARTITION part3 VALUES IN (NULL));
3369
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
3370
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
3371
# Start usability test (inc/partition_check.inc)
3373
SHOW CREATE TABLE t1;
3375
t1 CREATE TABLE `t1` (
3376
`f_int1` int(11) DEFAULT NULL,
3377
`f_int2` int(11) DEFAULT NULL,
3378
`f_char1` char(20) DEFAULT NULL,
3379
`f_char2` char(20) DEFAULT NULL,
3380
`f_charbig` varchar(1000) DEFAULT NULL
3381
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */
3384
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD
3385
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI
3386
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD
3387
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI
3388
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD
3389
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI
3390
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD
3391
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI
3392
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD
3393
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI
3394
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD
3395
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI
3396
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD
3397
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI
3398
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD
3399
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI
3400
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD
3401
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI
3402
$MYSQLTEST_VARDIR/master-data/test/t1.frm
3403
$MYSQLTEST_VARDIR/master-data/test/t1.par
3405
# check prerequisites-1 success: 1
3406
# check COUNT(*) success: 1
3407
# check MIN/MAX(f_int1) success: 1
3408
# check MIN/MAX(f_int2) success: 1
3409
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3410
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
3411
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
3412
WHERE f_int1 IN (2,3);
3413
# check prerequisites-3 success: 1
3414
DELETE FROM t1 WHERE f_charbig = 'delete me';
3415
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
3416
# check read via f_int1 success: 1
3417
# check read via f_int2 success: 1
3419
# check multiple-1 success: 1
3420
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
3422
# check multiple-2 success: 1
3423
INSERT INTO t1 SELECT * FROM t0_template
3424
WHERE MOD(f_int1,3) = 0;
3426
# check multiple-3 success: 1
3427
UPDATE t1 SET f_int1 = f_int1 + @max_row
3428
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
3429
AND @max_row_div2 + @max_row_div4;
3431
# check multiple-4 success: 1
3433
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
3434
AND @max_row_div2 + @max_row_div4 + @max_row;
3436
# check multiple-5 success: 1
3437
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
3439
SET f_int1 = @cur_value , f_int2 = @cur_value,
3440
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
3441
f_charbig = '#SINGLE#';
3443
# check single-1 success: 1
3444
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
3446
SET f_int1 = @cur_value , f_int2 = @cur_value,
3447
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
3448
f_charbig = '#SINGLE#';
3450
# check single-2 success: 1
3451
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
3452
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
3453
UPDATE t1 SET f_int1 = @cur_value2
3454
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
3456
# check single-3 success: 1
3457
SET @cur_value1= -1;
3458
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
3459
UPDATE t1 SET f_int1 = @cur_value1
3460
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
3462
# check single-4 success: 1
3463
SELECT MAX(f_int1) INTO @cur_value FROM t1;
3464
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
3466
# check single-5 success: 1
3467
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
3469
# check single-6 success: 1
3470
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
3472
# check single-7 success: 1
3473
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
3474
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
3475
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
3476
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
3477
f_charbig = '#NULL#';
3479
SET f_int1 = NULL , f_int2 = -@max_row,
3480
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
3481
f_charbig = '#NULL#';
3482
# check null success: 1
3484
# check null-1 success: 1
3485
UPDATE t1 SET f_int1 = -@max_row
3486
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3487
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3489
# check null-2 success: 1
3490
UPDATE t1 SET f_int1 = NULL
3491
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3492
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3494
# check null-3 success: 1
3496
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3497
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3499
# check null-4 success: 1
3501
WHERE f_int1 = 0 AND f_int2 = 0
3502
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
3503
AND f_charbig = '#NULL#';
3505
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3506
SELECT f_int1, f_int1, '', '', 'was inserted'
3507
FROM t0_template source_tab
3508
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
3510
# check transactions-1 success: 1
3513
# check transactions-2 success: 1
3516
# check transactions-3 success: 1
3517
DELETE FROM t1 WHERE f_charbig = 'was inserted';
3521
# check transactions-4 success: 1
3522
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3523
SELECT f_int1, f_int1, '', '', 'was inserted'
3524
FROM t0_template source_tab
3525
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
3527
# check transactions-5 success: 1
3530
Warning 1196 Some non-transactional changed tables couldn't be rolled back
3532
# check transactions-6 success: 1
3533
# INFO: Storage engine used for t1 seems to be not transactional.
3536
# check transactions-7 success: 1
3537
DELETE FROM t1 WHERE f_charbig = 'was inserted';
3539
SET @@session.sql_mode = 'traditional';
3540
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
3541
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3542
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
3543
'', '', 'was inserted' FROM t0_template
3544
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
3545
ERROR 22012: Division by 0
3548
# check transactions-8 success: 1
3549
# INFO: Storage engine used for t1 seems to be unable to revert
3550
# changes made by the failing statement.
3551
SET @@session.sql_mode = '';
3553
DELETE FROM t1 WHERE f_charbig = 'was inserted';
3555
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
3557
# check special-1 success: 1
3558
UPDATE t1 SET f_charbig = '';
3560
# check special-2 success: 1
3561
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
3562
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
3563
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
3564
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3565
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3566
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3567
'just inserted' FROM t0_template
3568
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3569
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
3571
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3572
f_charbig = 'updated by trigger'
3573
WHERE f_int1 = new.f_int1;
3575
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3576
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
3577
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3579
# check trigger-1 success: 1
3581
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3582
f_int2 = CAST(f_char1 AS SIGNED INT),
3583
f_charbig = 'just inserted'
3584
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3586
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3587
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3588
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3589
'just inserted' FROM t0_template
3590
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3591
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
3593
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3594
f_charbig = 'updated by trigger'
3595
WHERE f_int1 = new.f_int1;
3597
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3598
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
3599
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3601
# check trigger-2 success: 1
3603
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3604
f_int2 = CAST(f_char1 AS SIGNED INT),
3605
f_charbig = 'just inserted'
3606
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3608
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3609
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3610
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3611
'just inserted' FROM t0_template
3612
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3613
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
3615
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3616
f_charbig = 'updated by trigger'
3617
WHERE f_int1 = new.f_int1;
3619
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
3620
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3622
# check trigger-3 success: 1
3624
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3625
f_int2 = CAST(f_char1 AS SIGNED INT),
3626
f_charbig = 'just inserted'
3627
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3629
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3630
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3631
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3632
'just inserted' FROM t0_template
3633
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3634
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
3636
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3637
f_charbig = 'updated by trigger'
3638
WHERE f_int1 = - old.f_int1;
3640
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
3641
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3643
# check trigger-4 success: 1
3645
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3646
f_int2 = CAST(f_char1 AS SIGNED INT),
3647
f_charbig = 'just inserted'
3648
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3650
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3651
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3652
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3653
'just inserted' FROM t0_template
3654
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3655
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
3657
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3658
f_charbig = 'updated by trigger'
3659
WHERE f_int1 = new.f_int1;
3661
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
3662
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3664
# check trigger-5 success: 1
3666
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3667
f_int2 = CAST(f_char1 AS SIGNED INT),
3668
f_charbig = 'just inserted'
3669
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3671
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3672
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3673
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3674
'just inserted' FROM t0_template
3675
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3676
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
3678
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3679
f_charbig = 'updated by trigger'
3680
WHERE f_int1 = - old.f_int1;
3682
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
3683
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3685
# check trigger-6 success: 1
3687
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3688
f_int2 = CAST(f_char1 AS SIGNED INT),
3689
f_charbig = 'just inserted'
3690
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3692
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3693
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3694
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3695
'just inserted' FROM t0_template
3696
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3697
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
3699
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3700
f_charbig = 'updated by trigger'
3701
WHERE f_int1 = - old.f_int1;
3704
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3706
# check trigger-7 success: 1
3708
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3709
f_int2 = CAST(f_char1 AS SIGNED INT),
3710
f_charbig = 'just inserted'
3711
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3713
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3714
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
3715
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
3716
'just inserted' FROM t0_template
3717
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3718
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
3720
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
3721
f_charbig = 'updated by trigger'
3722
WHERE f_int1 = - old.f_int1;
3725
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
3727
# check trigger-8 success: 1
3729
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3730
f_int2 = CAST(f_char1 AS SIGNED INT),
3731
f_charbig = 'just inserted'
3732
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
3734
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3736
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
3737
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
3739
SET new.f_int1 = old.f_int1 + @max_row,
3740
new.f_int2 = old.f_int2 - @max_row,
3741
new.f_charbig = '####updated per update trigger####';
3744
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
3745
f_charbig = '####updated per update statement itself####';
3747
# check trigger-9 success: 1
3749
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3750
f_int2 = CAST(f_char1 AS SIGNED INT),
3751
f_charbig = CONCAT('===',f_char1,'===');
3752
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
3754
SET new.f_int1 = new.f_int1 + @max_row,
3755
new.f_int2 = new.f_int2 - @max_row,
3756
new.f_charbig = '####updated per update trigger####';
3759
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
3760
f_charbig = '####updated per update statement itself####';
3762
# check trigger-10 success: 1
3764
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
3765
f_int2 = CAST(f_char1 AS SIGNED INT),
3766
f_charbig = CONCAT('===',f_char1,'===');
3767
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
3769
SET new.f_int1 = @my_max1 + @counter,
3770
new.f_int2 = @my_min2 - @counter,
3771
new.f_charbig = '####updated per insert trigger####';
3772
SET @counter = @counter + 1;
3775
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
3776
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3777
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
3778
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
3779
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
3783
# check trigger-11 success: 1
3785
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
3786
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
3787
AND f_charbig = '####updated per insert trigger####';
3788
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
3790
SET new.f_int1 = @my_max1 + @counter,
3791
new.f_int2 = @my_min2 - @counter,
3792
new.f_charbig = '####updated per insert trigger####';
3793
SET @counter = @counter + 1;
3796
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
3797
INSERT INTO t1 (f_char1, f_char2, f_charbig)
3798
SELECT CAST(f_int1 AS CHAR),
3799
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
3800
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
3804
# check trigger-12 success: 1
3806
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
3807
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
3808
AND f_charbig = '####updated per insert trigger####';
3810
Table Op Msg_type Msg_text
3811
test.t1 analyze note The storage engine for the table doesn't support analyze
3812
CHECK TABLE t1 EXTENDED;
3813
Table Op Msg_type Msg_text
3814
test.t1 check note The storage engine for the table doesn't support check
3815
CHECKSUM TABLE t1 EXTENDED;
3817
test.t1 <some_value>
3819
Table Op Msg_type Msg_text
3820
test.t1 optimize note The storage engine for the table doesn't support optimize
3821
# check layout success: 1
3822
REPAIR TABLE t1 EXTENDED;
3823
Table Op Msg_type Msg_text
3824
test.t1 repair note The storage engine for the table doesn't support repair
3825
# check layout success: 1
3828
# check TRUNCATE success: 1
3829
# check layout success: 1
3830
# End usability test (inc/partition_check.inc)
3832
# 1.2 The partitioning function contains two columns.
3833
DROP TABLE IF EXISTS t1;
3839
f_charbig VARCHAR(1000)
3842
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
3843
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
3844
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
3845
# Start usability test (inc/partition_check.inc)
3847
SHOW CREATE TABLE t1;
3849
t1 CREATE TABLE `t1` (
3850
`f_int1` int(11) DEFAULT NULL,
3851
`f_int2` int(11) DEFAULT NULL,
3852
`f_char1` char(20) DEFAULT NULL,
3853
`f_char2` char(20) DEFAULT NULL,
3854
`f_charbig` varchar(1000) DEFAULT NULL
3855
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */
3858
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
3859
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
3860
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
3861
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
3862
$MYSQLTEST_VARDIR/master-data/test/t1.frm
3863
$MYSQLTEST_VARDIR/master-data/test/t1.par
3865
# check prerequisites-1 success: 1
3866
# check COUNT(*) success: 1
3867
# check MIN/MAX(f_int1) success: 1
3868
# check MIN/MAX(f_int2) success: 1
3869
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3870
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
3871
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
3872
WHERE f_int1 IN (2,3);
3873
# check prerequisites-3 success: 1
3874
DELETE FROM t1 WHERE f_charbig = 'delete me';
3875
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
3876
# check read via f_int1 success: 1
3877
# check read via f_int2 success: 1
3879
# check multiple-1 success: 1
3880
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
3882
# check multiple-2 success: 1
3883
INSERT INTO t1 SELECT * FROM t0_template
3884
WHERE MOD(f_int1,3) = 0;
3886
# check multiple-3 success: 1
3887
UPDATE t1 SET f_int1 = f_int1 + @max_row
3888
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
3889
AND @max_row_div2 + @max_row_div4;
3891
# check multiple-4 success: 1
3893
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
3894
AND @max_row_div2 + @max_row_div4 + @max_row;
3896
# check multiple-5 success: 1
3897
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
3899
SET f_int1 = @cur_value , f_int2 = @cur_value,
3900
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
3901
f_charbig = '#SINGLE#';
3903
# check single-1 success: 1
3904
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
3906
SET f_int1 = @cur_value , f_int2 = @cur_value,
3907
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
3908
f_charbig = '#SINGLE#';
3910
# check single-2 success: 1
3911
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
3912
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
3913
UPDATE t1 SET f_int1 = @cur_value2
3914
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
3916
# check single-3 success: 1
3917
SET @cur_value1= -1;
3918
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
3919
UPDATE t1 SET f_int1 = @cur_value1
3920
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
3922
# check single-4 success: 1
3923
SELECT MAX(f_int1) INTO @cur_value FROM t1;
3924
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
3926
# check single-5 success: 1
3927
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
3929
# check single-6 success: 1
3930
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
3932
# check single-7 success: 1
3933
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
3934
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
3935
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
3936
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
3937
f_charbig = '#NULL#';
3939
SET f_int1 = NULL , f_int2 = -@max_row,
3940
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
3941
f_charbig = '#NULL#';
3942
# check null success: 1
3944
# check null-1 success: 1
3945
UPDATE t1 SET f_int1 = -@max_row
3946
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3947
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3949
# check null-2 success: 1
3950
UPDATE t1 SET f_int1 = NULL
3951
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3952
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3954
# check null-3 success: 1
3956
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
3957
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
3959
# check null-4 success: 1
3961
WHERE f_int1 = 0 AND f_int2 = 0
3962
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
3963
AND f_charbig = '#NULL#';
3965
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3966
SELECT f_int1, f_int1, '', '', 'was inserted'
3967
FROM t0_template source_tab
3968
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
3970
# check transactions-1 success: 1
3973
# check transactions-2 success: 1
3976
# check transactions-3 success: 1
3977
DELETE FROM t1 WHERE f_charbig = 'was inserted';
3981
# check transactions-4 success: 1
3982
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
3983
SELECT f_int1, f_int1, '', '', 'was inserted'
3984
FROM t0_template source_tab
3985
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
3987
# check transactions-5 success: 1
3990
Warning 1196 Some non-transactional changed tables couldn't be rolled back
3992
# check transactions-6 success: 1
3993
# INFO: Storage engine used for t1 seems to be not transactional.
3996
# check transactions-7 success: 1
3997
DELETE FROM t1 WHERE f_charbig = 'was inserted';
3999
SET @@session.sql_mode = 'traditional';
4000
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
4001
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4002
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
4003
'', '', 'was inserted' FROM t0_template
4004
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
4005
ERROR 22012: Division by 0
4008
# check transactions-8 success: 1
4009
# INFO: Storage engine used for t1 seems to be unable to revert
4010
# changes made by the failing statement.
4011
SET @@session.sql_mode = '';
4013
DELETE FROM t1 WHERE f_charbig = 'was inserted';
4015
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
4017
# check special-1 success: 1
4018
UPDATE t1 SET f_charbig = '';
4020
# check special-2 success: 1
4021
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
4022
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
4023
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
4024
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4025
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4026
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4027
'just inserted' FROM t0_template
4028
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4029
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
4031
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4032
f_charbig = 'updated by trigger'
4033
WHERE f_int1 = new.f_int1;
4035
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4036
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
4037
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4039
# check trigger-1 success: 1
4041
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4042
f_int2 = CAST(f_char1 AS SIGNED INT),
4043
f_charbig = 'just inserted'
4044
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4046
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4047
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4048
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4049
'just inserted' FROM t0_template
4050
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4051
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
4053
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4054
f_charbig = 'updated by trigger'
4055
WHERE f_int1 = new.f_int1;
4057
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4058
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
4059
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4061
# check trigger-2 success: 1
4063
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4064
f_int2 = CAST(f_char1 AS SIGNED INT),
4065
f_charbig = 'just inserted'
4066
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4068
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4069
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4070
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4071
'just inserted' FROM t0_template
4072
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4073
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
4075
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4076
f_charbig = 'updated by trigger'
4077
WHERE f_int1 = new.f_int1;
4079
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
4080
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4082
# check trigger-3 success: 1
4084
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4085
f_int2 = CAST(f_char1 AS SIGNED INT),
4086
f_charbig = 'just inserted'
4087
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4089
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4090
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4091
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4092
'just inserted' FROM t0_template
4093
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4094
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
4096
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4097
f_charbig = 'updated by trigger'
4098
WHERE f_int1 = - old.f_int1;
4100
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
4101
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4103
# check trigger-4 success: 1
4105
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4106
f_int2 = CAST(f_char1 AS SIGNED INT),
4107
f_charbig = 'just inserted'
4108
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4110
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4111
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4112
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4113
'just inserted' FROM t0_template
4114
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4115
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
4117
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4118
f_charbig = 'updated by trigger'
4119
WHERE f_int1 = new.f_int1;
4121
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
4122
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4124
# check trigger-5 success: 1
4126
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4127
f_int2 = CAST(f_char1 AS SIGNED INT),
4128
f_charbig = 'just inserted'
4129
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4131
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4132
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4133
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4134
'just inserted' FROM t0_template
4135
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4136
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
4138
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4139
f_charbig = 'updated by trigger'
4140
WHERE f_int1 = - old.f_int1;
4142
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
4143
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4145
# check trigger-6 success: 1
4147
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4148
f_int2 = CAST(f_char1 AS SIGNED INT),
4149
f_charbig = 'just inserted'
4150
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4152
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4153
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4154
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4155
'just inserted' FROM t0_template
4156
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4157
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
4159
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4160
f_charbig = 'updated by trigger'
4161
WHERE f_int1 = - old.f_int1;
4164
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4166
# check trigger-7 success: 1
4168
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4169
f_int2 = CAST(f_char1 AS SIGNED INT),
4170
f_charbig = 'just inserted'
4171
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4173
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4174
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4175
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4176
'just inserted' FROM t0_template
4177
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4178
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
4180
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4181
f_charbig = 'updated by trigger'
4182
WHERE f_int1 = - old.f_int1;
4185
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4187
# check trigger-8 success: 1
4189
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4190
f_int2 = CAST(f_char1 AS SIGNED INT),
4191
f_charbig = 'just inserted'
4192
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4194
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4196
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4197
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
4199
SET new.f_int1 = old.f_int1 + @max_row,
4200
new.f_int2 = old.f_int2 - @max_row,
4201
new.f_charbig = '####updated per update trigger####';
4204
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
4205
f_charbig = '####updated per update statement itself####';
4207
# check trigger-9 success: 1
4209
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4210
f_int2 = CAST(f_char1 AS SIGNED INT),
4211
f_charbig = CONCAT('===',f_char1,'===');
4212
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
4214
SET new.f_int1 = new.f_int1 + @max_row,
4215
new.f_int2 = new.f_int2 - @max_row,
4216
new.f_charbig = '####updated per update trigger####';
4219
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
4220
f_charbig = '####updated per update statement itself####';
4222
# check trigger-10 success: 1
4224
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4225
f_int2 = CAST(f_char1 AS SIGNED INT),
4226
f_charbig = CONCAT('===',f_char1,'===');
4227
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
4229
SET new.f_int1 = @my_max1 + @counter,
4230
new.f_int2 = @my_min2 - @counter,
4231
new.f_charbig = '####updated per insert trigger####';
4232
SET @counter = @counter + 1;
4235
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
4236
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4237
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
4238
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
4239
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
4243
# check trigger-11 success: 1
4245
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
4246
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
4247
AND f_charbig = '####updated per insert trigger####';
4248
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
4250
SET new.f_int1 = @my_max1 + @counter,
4251
new.f_int2 = @my_min2 - @counter,
4252
new.f_charbig = '####updated per insert trigger####';
4253
SET @counter = @counter + 1;
4256
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
4257
INSERT INTO t1 (f_char1, f_char2, f_charbig)
4258
SELECT CAST(f_int1 AS CHAR),
4259
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
4260
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
4264
# check trigger-12 success: 1
4266
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
4267
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
4268
AND f_charbig = '####updated per insert trigger####';
4270
Table Op Msg_type Msg_text
4271
test.t1 analyze note The storage engine for the table doesn't support analyze
4272
CHECK TABLE t1 EXTENDED;
4273
Table Op Msg_type Msg_text
4274
test.t1 check note The storage engine for the table doesn't support check
4275
CHECKSUM TABLE t1 EXTENDED;
4277
test.t1 <some_value>
4279
Table Op Msg_type Msg_text
4280
test.t1 optimize note The storage engine for the table doesn't support optimize
4281
# check layout success: 1
4282
REPAIR TABLE t1 EXTENDED;
4283
Table Op Msg_type Msg_text
4284
test.t1 repair note The storage engine for the table doesn't support repair
4285
# check layout success: 1
4288
# check TRUNCATE success: 1
4289
# check layout success: 1
4290
# End usability test (inc/partition_check.inc)
4297
f_charbig VARCHAR(1000)
4300
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5;
4301
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
4302
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
4303
# Start usability test (inc/partition_check.inc)
4305
SHOW CREATE TABLE t1;
4307
t1 CREATE TABLE `t1` (
4308
`f_int1` int(11) DEFAULT NULL,
4309
`f_int2` int(11) DEFAULT NULL,
4310
`f_char1` char(20) DEFAULT NULL,
4311
`f_char2` char(20) DEFAULT NULL,
4312
`f_charbig` varchar(1000) DEFAULT NULL
4313
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */
4316
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
4317
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
4318
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
4319
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
4320
$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD
4321
$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI
4322
$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD
4323
$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI
4324
$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
4325
$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
4326
$MYSQLTEST_VARDIR/master-data/test/t1.frm
4327
$MYSQLTEST_VARDIR/master-data/test/t1.par
4329
# check prerequisites-1 success: 1
4330
# check COUNT(*) success: 1
4331
# check MIN/MAX(f_int1) success: 1
4332
# check MIN/MAX(f_int2) success: 1
4333
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4334
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
4335
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
4336
WHERE f_int1 IN (2,3);
4337
# check prerequisites-3 success: 1
4338
DELETE FROM t1 WHERE f_charbig = 'delete me';
4339
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
4340
# check read via f_int1 success: 1
4341
# check read via f_int2 success: 1
4343
# check multiple-1 success: 1
4344
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
4346
# check multiple-2 success: 1
4347
INSERT INTO t1 SELECT * FROM t0_template
4348
WHERE MOD(f_int1,3) = 0;
4350
# check multiple-3 success: 1
4351
UPDATE t1 SET f_int1 = f_int1 + @max_row
4352
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
4353
AND @max_row_div2 + @max_row_div4;
4355
# check multiple-4 success: 1
4357
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
4358
AND @max_row_div2 + @max_row_div4 + @max_row;
4360
# check multiple-5 success: 1
4361
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
4363
SET f_int1 = @cur_value , f_int2 = @cur_value,
4364
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
4365
f_charbig = '#SINGLE#';
4367
# check single-1 success: 1
4368
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
4370
SET f_int1 = @cur_value , f_int2 = @cur_value,
4371
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
4372
f_charbig = '#SINGLE#';
4374
# check single-2 success: 1
4375
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
4376
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
4377
UPDATE t1 SET f_int1 = @cur_value2
4378
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
4380
# check single-3 success: 1
4381
SET @cur_value1= -1;
4382
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
4383
UPDATE t1 SET f_int1 = @cur_value1
4384
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
4386
# check single-4 success: 1
4387
SELECT MAX(f_int1) INTO @cur_value FROM t1;
4388
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
4390
# check single-5 success: 1
4391
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
4393
# check single-6 success: 1
4394
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
4396
# check single-7 success: 1
4397
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
4398
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
4399
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
4400
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
4401
f_charbig = '#NULL#';
4403
SET f_int1 = NULL , f_int2 = -@max_row,
4404
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
4405
f_charbig = '#NULL#';
4406
# check null success: 1
4408
# check null-1 success: 1
4409
UPDATE t1 SET f_int1 = -@max_row
4410
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
4411
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
4413
# check null-2 success: 1
4414
UPDATE t1 SET f_int1 = NULL
4415
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
4416
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
4418
# check null-3 success: 1
4420
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
4421
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
4423
# check null-4 success: 1
4425
WHERE f_int1 = 0 AND f_int2 = 0
4426
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
4427
AND f_charbig = '#NULL#';
4429
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4430
SELECT f_int1, f_int1, '', '', 'was inserted'
4431
FROM t0_template source_tab
4432
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
4434
# check transactions-1 success: 1
4437
# check transactions-2 success: 1
4440
# check transactions-3 success: 1
4441
DELETE FROM t1 WHERE f_charbig = 'was inserted';
4445
# check transactions-4 success: 1
4446
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4447
SELECT f_int1, f_int1, '', '', 'was inserted'
4448
FROM t0_template source_tab
4449
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
4451
# check transactions-5 success: 1
4454
Warning 1196 Some non-transactional changed tables couldn't be rolled back
4456
# check transactions-6 success: 1
4457
# INFO: Storage engine used for t1 seems to be not transactional.
4460
# check transactions-7 success: 1
4461
DELETE FROM t1 WHERE f_charbig = 'was inserted';
4463
SET @@session.sql_mode = 'traditional';
4464
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
4465
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4466
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
4467
'', '', 'was inserted' FROM t0_template
4468
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
4469
ERROR 22012: Division by 0
4472
# check transactions-8 success: 1
4473
# INFO: Storage engine used for t1 seems to be unable to revert
4474
# changes made by the failing statement.
4475
SET @@session.sql_mode = '';
4477
DELETE FROM t1 WHERE f_charbig = 'was inserted';
4479
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
4481
# check special-1 success: 1
4482
UPDATE t1 SET f_charbig = '';
4484
# check special-2 success: 1
4485
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
4486
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
4487
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
4488
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4489
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4490
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4491
'just inserted' FROM t0_template
4492
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4493
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
4495
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4496
f_charbig = 'updated by trigger'
4497
WHERE f_int1 = new.f_int1;
4499
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4500
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
4501
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4503
# check trigger-1 success: 1
4505
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4506
f_int2 = CAST(f_char1 AS SIGNED INT),
4507
f_charbig = 'just inserted'
4508
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4510
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4511
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4512
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4513
'just inserted' FROM t0_template
4514
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4515
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
4517
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4518
f_charbig = 'updated by trigger'
4519
WHERE f_int1 = new.f_int1;
4521
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4522
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
4523
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4525
# check trigger-2 success: 1
4527
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4528
f_int2 = CAST(f_char1 AS SIGNED INT),
4529
f_charbig = 'just inserted'
4530
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4532
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4533
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4534
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4535
'just inserted' FROM t0_template
4536
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4537
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
4539
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4540
f_charbig = 'updated by trigger'
4541
WHERE f_int1 = new.f_int1;
4543
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
4544
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4546
# check trigger-3 success: 1
4548
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4549
f_int2 = CAST(f_char1 AS SIGNED INT),
4550
f_charbig = 'just inserted'
4551
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4553
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4554
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4555
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4556
'just inserted' FROM t0_template
4557
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4558
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
4560
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4561
f_charbig = 'updated by trigger'
4562
WHERE f_int1 = - old.f_int1;
4564
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
4565
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4567
# check trigger-4 success: 1
4569
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4570
f_int2 = CAST(f_char1 AS SIGNED INT),
4571
f_charbig = 'just inserted'
4572
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4574
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4575
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4576
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4577
'just inserted' FROM t0_template
4578
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4579
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
4581
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4582
f_charbig = 'updated by trigger'
4583
WHERE f_int1 = new.f_int1;
4585
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
4586
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4588
# check trigger-5 success: 1
4590
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4591
f_int2 = CAST(f_char1 AS SIGNED INT),
4592
f_charbig = 'just inserted'
4593
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4595
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4596
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4597
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4598
'just inserted' FROM t0_template
4599
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4600
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
4602
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4603
f_charbig = 'updated by trigger'
4604
WHERE f_int1 = - old.f_int1;
4606
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
4607
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4609
# check trigger-6 success: 1
4611
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4612
f_int2 = CAST(f_char1 AS SIGNED INT),
4613
f_charbig = 'just inserted'
4614
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4616
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4617
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4618
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4619
'just inserted' FROM t0_template
4620
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4621
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
4623
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4624
f_charbig = 'updated by trigger'
4625
WHERE f_int1 = - old.f_int1;
4628
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4630
# check trigger-7 success: 1
4632
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4633
f_int2 = CAST(f_char1 AS SIGNED INT),
4634
f_charbig = 'just inserted'
4635
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4637
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4638
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4639
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4640
'just inserted' FROM t0_template
4641
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4642
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
4644
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4645
f_charbig = 'updated by trigger'
4646
WHERE f_int1 = - old.f_int1;
4649
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
4651
# check trigger-8 success: 1
4653
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4654
f_int2 = CAST(f_char1 AS SIGNED INT),
4655
f_charbig = 'just inserted'
4656
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4658
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4660
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4661
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
4663
SET new.f_int1 = old.f_int1 + @max_row,
4664
new.f_int2 = old.f_int2 - @max_row,
4665
new.f_charbig = '####updated per update trigger####';
4668
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
4669
f_charbig = '####updated per update statement itself####';
4671
# check trigger-9 success: 1
4673
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4674
f_int2 = CAST(f_char1 AS SIGNED INT),
4675
f_charbig = CONCAT('===',f_char1,'===');
4676
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
4678
SET new.f_int1 = new.f_int1 + @max_row,
4679
new.f_int2 = new.f_int2 - @max_row,
4680
new.f_charbig = '####updated per update trigger####';
4683
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
4684
f_charbig = '####updated per update statement itself####';
4686
# check trigger-10 success: 1
4688
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4689
f_int2 = CAST(f_char1 AS SIGNED INT),
4690
f_charbig = CONCAT('===',f_char1,'===');
4691
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
4693
SET new.f_int1 = @my_max1 + @counter,
4694
new.f_int2 = @my_min2 - @counter,
4695
new.f_charbig = '####updated per insert trigger####';
4696
SET @counter = @counter + 1;
4699
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
4700
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4701
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
4702
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
4703
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
4707
# check trigger-11 success: 1
4709
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
4710
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
4711
AND f_charbig = '####updated per insert trigger####';
4712
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
4714
SET new.f_int1 = @my_max1 + @counter,
4715
new.f_int2 = @my_min2 - @counter,
4716
new.f_charbig = '####updated per insert trigger####';
4717
SET @counter = @counter + 1;
4720
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
4721
INSERT INTO t1 (f_char1, f_char2, f_charbig)
4722
SELECT CAST(f_int1 AS CHAR),
4723
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
4724
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
4728
# check trigger-12 success: 1
4730
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
4731
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
4732
AND f_charbig = '####updated per insert trigger####';
4734
Table Op Msg_type Msg_text
4735
test.t1 analyze note The storage engine for the table doesn't support analyze
4736
CHECK TABLE t1 EXTENDED;
4737
Table Op Msg_type Msg_text
4738
test.t1 check note The storage engine for the table doesn't support check
4739
CHECKSUM TABLE t1 EXTENDED;
4741
test.t1 <some_value>
4743
Table Op Msg_type Msg_text
4744
test.t1 optimize note The storage engine for the table doesn't support optimize
4745
# check layout success: 1
4746
REPAIR TABLE t1 EXTENDED;
4747
Table Op Msg_type Msg_text
4748
test.t1 repair note The storage engine for the table doesn't support repair
4749
# check layout success: 1
4752
# check TRUNCATE success: 1
4753
# check layout success: 1
4754
# End usability test (inc/partition_check.inc)
4761
f_charbig VARCHAR(1000)
4764
PARTITION BY LIST(MOD(f_int1 + f_int2,4))
4765
(PARTITION part_3 VALUES IN (-3),
4766
PARTITION part_2 VALUES IN (-2),
4767
PARTITION part_1 VALUES IN (-1),
4768
PARTITION part_N VALUES IN (NULL),
4769
PARTITION part0 VALUES IN (0),
4770
PARTITION part1 VALUES IN (1),
4771
PARTITION part2 VALUES IN (2),
4772
PARTITION part3 VALUES IN (3));
4773
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
4774
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
4775
# Start usability test (inc/partition_check.inc)
4777
SHOW CREATE TABLE t1;
4779
t1 CREATE TABLE `t1` (
4780
`f_int1` int(11) DEFAULT NULL,
4781
`f_int2` int(11) DEFAULT NULL,
4782
`f_char1` char(20) DEFAULT NULL,
4783
`f_char2` char(20) DEFAULT NULL,
4784
`f_charbig` varchar(1000) DEFAULT NULL
4785
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) ENGINE = MyISAM, PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */
4788
$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD
4789
$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI
4790
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
4791
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
4792
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
4793
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
4794
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD
4795
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI
4796
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD
4797
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI
4798
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD
4799
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI
4800
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD
4801
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI
4802
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD
4803
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI
4804
$MYSQLTEST_VARDIR/master-data/test/t1.frm
4805
$MYSQLTEST_VARDIR/master-data/test/t1.par
4807
# check prerequisites-1 success: 1
4808
# check COUNT(*) success: 1
4809
# check MIN/MAX(f_int1) success: 1
4810
# check MIN/MAX(f_int2) success: 1
4811
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4812
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
4813
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
4814
WHERE f_int1 IN (2,3);
4815
# check prerequisites-3 success: 1
4816
DELETE FROM t1 WHERE f_charbig = 'delete me';
4817
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
4818
# check read via f_int1 success: 1
4819
# check read via f_int2 success: 1
4821
# check multiple-1 success: 1
4822
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
4824
# check multiple-2 success: 1
4825
INSERT INTO t1 SELECT * FROM t0_template
4826
WHERE MOD(f_int1,3) = 0;
4828
# check multiple-3 success: 1
4829
UPDATE t1 SET f_int1 = f_int1 + @max_row
4830
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
4831
AND @max_row_div2 + @max_row_div4;
4833
# check multiple-4 success: 1
4835
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
4836
AND @max_row_div2 + @max_row_div4 + @max_row;
4838
# check multiple-5 success: 1
4839
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
4841
SET f_int1 = @cur_value , f_int2 = @cur_value,
4842
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
4843
f_charbig = '#SINGLE#';
4845
# check single-1 success: 1
4846
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
4848
SET f_int1 = @cur_value , f_int2 = @cur_value,
4849
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
4850
f_charbig = '#SINGLE#';
4852
# check single-2 success: 1
4853
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
4854
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
4855
UPDATE t1 SET f_int1 = @cur_value2
4856
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
4858
# check single-3 success: 1
4859
SET @cur_value1= -1;
4860
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
4861
UPDATE t1 SET f_int1 = @cur_value1
4862
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
4864
# check single-4 success: 1
4865
SELECT MAX(f_int1) INTO @cur_value FROM t1;
4866
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
4868
# check single-5 success: 1
4869
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
4871
# check single-6 success: 1
4872
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
4874
# check single-7 success: 1
4875
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
4876
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
4877
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
4878
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
4879
f_charbig = '#NULL#';
4881
SET f_int1 = NULL , f_int2 = -@max_row,
4882
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
4883
f_charbig = '#NULL#';
4884
# check null success: 1
4886
# check null-1 success: 1
4887
UPDATE t1 SET f_int1 = -@max_row
4888
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
4889
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
4891
# check null-2 success: 1
4892
UPDATE t1 SET f_int1 = NULL
4893
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
4894
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
4896
# check null-3 success: 1
4898
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
4899
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
4901
# check null-4 success: 1
4903
WHERE f_int1 = 0 AND f_int2 = 0
4904
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
4905
AND f_charbig = '#NULL#';
4907
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4908
SELECT f_int1, f_int1, '', '', 'was inserted'
4909
FROM t0_template source_tab
4910
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
4912
# check transactions-1 success: 1
4915
# check transactions-2 success: 1
4918
# check transactions-3 success: 1
4919
DELETE FROM t1 WHERE f_charbig = 'was inserted';
4923
# check transactions-4 success: 1
4924
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4925
SELECT f_int1, f_int1, '', '', 'was inserted'
4926
FROM t0_template source_tab
4927
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
4929
# check transactions-5 success: 1
4932
Warning 1196 Some non-transactional changed tables couldn't be rolled back
4934
# check transactions-6 success: 1
4935
# INFO: Storage engine used for t1 seems to be not transactional.
4938
# check transactions-7 success: 1
4939
DELETE FROM t1 WHERE f_charbig = 'was inserted';
4941
SET @@session.sql_mode = 'traditional';
4942
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
4943
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
4944
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
4945
'', '', 'was inserted' FROM t0_template
4946
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
4947
ERROR 22012: Division by 0
4950
# check transactions-8 success: 1
4951
# INFO: Storage engine used for t1 seems to be unable to revert
4952
# changes made by the failing statement.
4953
SET @@session.sql_mode = '';
4955
DELETE FROM t1 WHERE f_charbig = 'was inserted';
4957
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
4959
# check special-1 success: 1
4960
UPDATE t1 SET f_charbig = '';
4962
# check special-2 success: 1
4963
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
4964
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
4965
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
4966
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4967
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4968
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4969
'just inserted' FROM t0_template
4970
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4971
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
4973
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4974
f_charbig = 'updated by trigger'
4975
WHERE f_int1 = new.f_int1;
4977
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4978
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
4979
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4981
# check trigger-1 success: 1
4983
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
4984
f_int2 = CAST(f_char1 AS SIGNED INT),
4985
f_charbig = 'just inserted'
4986
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
4988
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4989
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
4990
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
4991
'just inserted' FROM t0_template
4992
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
4993
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
4995
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
4996
f_charbig = 'updated by trigger'
4997
WHERE f_int1 = new.f_int1;
4999
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5000
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
5001
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5003
# check trigger-2 success: 1
5005
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5006
f_int2 = CAST(f_char1 AS SIGNED INT),
5007
f_charbig = 'just inserted'
5008
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5010
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5011
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5012
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5013
'just inserted' FROM t0_template
5014
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5015
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
5017
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5018
f_charbig = 'updated by trigger'
5019
WHERE f_int1 = new.f_int1;
5021
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5022
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5024
# check trigger-3 success: 1
5026
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5027
f_int2 = CAST(f_char1 AS SIGNED INT),
5028
f_charbig = 'just inserted'
5029
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5031
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5032
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5033
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5034
'just inserted' FROM t0_template
5035
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5036
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
5038
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5039
f_charbig = 'updated by trigger'
5040
WHERE f_int1 = - old.f_int1;
5042
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5043
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5045
# check trigger-4 success: 1
5047
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5048
f_int2 = CAST(f_char1 AS SIGNED INT),
5049
f_charbig = 'just inserted'
5050
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5052
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5053
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5054
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5055
'just inserted' FROM t0_template
5056
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5057
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
5059
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5060
f_charbig = 'updated by trigger'
5061
WHERE f_int1 = new.f_int1;
5063
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5064
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5066
# check trigger-5 success: 1
5068
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5069
f_int2 = CAST(f_char1 AS SIGNED INT),
5070
f_charbig = 'just inserted'
5071
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5073
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5074
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5075
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5076
'just inserted' FROM t0_template
5077
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5078
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
5080
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5081
f_charbig = 'updated by trigger'
5082
WHERE f_int1 = - old.f_int1;
5084
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5085
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5087
# check trigger-6 success: 1
5089
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5090
f_int2 = CAST(f_char1 AS SIGNED INT),
5091
f_charbig = 'just inserted'
5092
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5094
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5095
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5096
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5097
'just inserted' FROM t0_template
5098
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5099
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
5101
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5102
f_charbig = 'updated by trigger'
5103
WHERE f_int1 = - old.f_int1;
5106
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5108
# check trigger-7 success: 1
5110
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5111
f_int2 = CAST(f_char1 AS SIGNED INT),
5112
f_charbig = 'just inserted'
5113
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5115
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5116
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5117
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5118
'just inserted' FROM t0_template
5119
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5120
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
5122
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5123
f_charbig = 'updated by trigger'
5124
WHERE f_int1 = - old.f_int1;
5127
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5129
# check trigger-8 success: 1
5131
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5132
f_int2 = CAST(f_char1 AS SIGNED INT),
5133
f_charbig = 'just inserted'
5134
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5136
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5138
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5139
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
5141
SET new.f_int1 = old.f_int1 + @max_row,
5142
new.f_int2 = old.f_int2 - @max_row,
5143
new.f_charbig = '####updated per update trigger####';
5146
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
5147
f_charbig = '####updated per update statement itself####';
5149
# check trigger-9 success: 1
5151
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5152
f_int2 = CAST(f_char1 AS SIGNED INT),
5153
f_charbig = CONCAT('===',f_char1,'===');
5154
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
5156
SET new.f_int1 = new.f_int1 + @max_row,
5157
new.f_int2 = new.f_int2 - @max_row,
5158
new.f_charbig = '####updated per update trigger####';
5161
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
5162
f_charbig = '####updated per update statement itself####';
5164
# check trigger-10 success: 1
5166
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5167
f_int2 = CAST(f_char1 AS SIGNED INT),
5168
f_charbig = CONCAT('===',f_char1,'===');
5169
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
5171
SET new.f_int1 = @my_max1 + @counter,
5172
new.f_int2 = @my_min2 - @counter,
5173
new.f_charbig = '####updated per insert trigger####';
5174
SET @counter = @counter + 1;
5177
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
5178
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5179
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
5180
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
5181
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
5185
# check trigger-11 success: 1
5187
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
5188
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
5189
AND f_charbig = '####updated per insert trigger####';
5190
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
5192
SET new.f_int1 = @my_max1 + @counter,
5193
new.f_int2 = @my_min2 - @counter,
5194
new.f_charbig = '####updated per insert trigger####';
5195
SET @counter = @counter + 1;
5198
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
5199
INSERT INTO t1 (f_char1, f_char2, f_charbig)
5200
SELECT CAST(f_int1 AS CHAR),
5201
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
5202
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
5206
# check trigger-12 success: 1
5208
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
5209
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
5210
AND f_charbig = '####updated per insert trigger####';
5212
Table Op Msg_type Msg_text
5213
test.t1 analyze note The storage engine for the table doesn't support analyze
5214
CHECK TABLE t1 EXTENDED;
5215
Table Op Msg_type Msg_text
5216
test.t1 check note The storage engine for the table doesn't support check
5217
CHECKSUM TABLE t1 EXTENDED;
5219
test.t1 <some_value>
5221
Table Op Msg_type Msg_text
5222
test.t1 optimize note The storage engine for the table doesn't support optimize
5223
# check layout success: 1
5224
REPAIR TABLE t1 EXTENDED;
5225
Table Op Msg_type Msg_text
5226
test.t1 repair note The storage engine for the table doesn't support repair
5227
# check layout success: 1
5230
# check TRUNCATE success: 1
5231
# check layout success: 1
5232
# End usability test (inc/partition_check.inc)
5239
f_charbig VARCHAR(1000)
5242
PARTITION BY RANGE((f_int1 + f_int2) DIV 2)
5243
(PARTITION parta VALUES LESS THAN (0),
5244
PARTITION partb VALUES LESS THAN (5),
5245
PARTITION partc VALUES LESS THAN (10),
5246
PARTITION partd VALUES LESS THAN (10 + 5),
5247
PARTITION parte VALUES LESS THAN (20),
5248
PARTITION partf VALUES LESS THAN (2147483646));
5249
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
5250
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
5251
# Start usability test (inc/partition_check.inc)
5253
SHOW CREATE TABLE t1;
5255
t1 CREATE TABLE `t1` (
5256
`f_int1` int(11) DEFAULT NULL,
5257
`f_int2` int(11) DEFAULT NULL,
5258
`f_char1` char(20) DEFAULT NULL,
5259
`f_char2` char(20) DEFAULT NULL,
5260
`f_charbig` varchar(1000) DEFAULT NULL
5261
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */
5264
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD
5265
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI
5266
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD
5267
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI
5268
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD
5269
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI
5270
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD
5271
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI
5272
$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD
5273
$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI
5274
$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD
5275
$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI
5276
$MYSQLTEST_VARDIR/master-data/test/t1.frm
5277
$MYSQLTEST_VARDIR/master-data/test/t1.par
5279
# check prerequisites-1 success: 1
5280
# check COUNT(*) success: 1
5281
# check MIN/MAX(f_int1) success: 1
5282
# check MIN/MAX(f_int2) success: 1
5283
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5284
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
5285
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
5286
WHERE f_int1 IN (2,3);
5287
# check prerequisites-3 success: 1
5288
DELETE FROM t1 WHERE f_charbig = 'delete me';
5289
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
5290
# check read via f_int1 success: 1
5291
# check read via f_int2 success: 1
5293
# check multiple-1 success: 1
5294
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
5296
# check multiple-2 success: 1
5297
INSERT INTO t1 SELECT * FROM t0_template
5298
WHERE MOD(f_int1,3) = 0;
5300
# check multiple-3 success: 1
5301
UPDATE t1 SET f_int1 = f_int1 + @max_row
5302
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
5303
AND @max_row_div2 + @max_row_div4;
5305
# check multiple-4 success: 1
5307
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
5308
AND @max_row_div2 + @max_row_div4 + @max_row;
5310
# check multiple-5 success: 1
5311
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
5313
SET f_int1 = @cur_value , f_int2 = @cur_value,
5314
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
5315
f_charbig = '#SINGLE#';
5317
# check single-1 success: 1
5318
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
5320
SET f_int1 = @cur_value , f_int2 = @cur_value,
5321
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
5322
f_charbig = '#SINGLE#';
5324
# check single-2 success: 1
5325
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
5326
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
5327
UPDATE t1 SET f_int1 = @cur_value2
5328
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
5330
# check single-3 success: 1
5331
SET @cur_value1= -1;
5332
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
5333
UPDATE t1 SET f_int1 = @cur_value1
5334
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
5336
# check single-4 success: 1
5337
SELECT MAX(f_int1) INTO @cur_value FROM t1;
5338
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
5340
# check single-5 success: 1
5341
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
5343
# check single-6 success: 1
5344
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
5345
ERROR HY000: Table has no partition for value 2147483647
5346
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
5347
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
5348
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
5349
f_charbig = '#NULL#';
5351
SET f_int1 = NULL , f_int2 = -@max_row,
5352
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
5353
f_charbig = '#NULL#';
5354
# check null success: 1
5356
# check null-1 success: 1
5357
UPDATE t1 SET f_int1 = -@max_row
5358
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
5359
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
5361
# check null-2 success: 1
5362
UPDATE t1 SET f_int1 = NULL
5363
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
5364
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
5366
# check null-3 success: 1
5368
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
5369
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
5371
# check null-4 success: 1
5373
WHERE f_int1 = 0 AND f_int2 = 0
5374
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
5375
AND f_charbig = '#NULL#';
5377
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5378
SELECT f_int1, f_int1, '', '', 'was inserted'
5379
FROM t0_template source_tab
5380
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
5382
# check transactions-1 success: 1
5385
# check transactions-2 success: 1
5388
# check transactions-3 success: 1
5389
DELETE FROM t1 WHERE f_charbig = 'was inserted';
5393
# check transactions-4 success: 1
5394
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5395
SELECT f_int1, f_int1, '', '', 'was inserted'
5396
FROM t0_template source_tab
5397
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
5399
# check transactions-5 success: 1
5402
Warning 1196 Some non-transactional changed tables couldn't be rolled back
5404
# check transactions-6 success: 1
5405
# INFO: Storage engine used for t1 seems to be not transactional.
5408
# check transactions-7 success: 1
5409
DELETE FROM t1 WHERE f_charbig = 'was inserted';
5411
SET @@session.sql_mode = 'traditional';
5412
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
5413
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5414
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
5415
'', '', 'was inserted' FROM t0_template
5416
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
5417
ERROR 22012: Division by 0
5420
# check transactions-8 success: 1
5421
# INFO: Storage engine used for t1 seems to be unable to revert
5422
# changes made by the failing statement.
5423
SET @@session.sql_mode = '';
5425
DELETE FROM t1 WHERE f_charbig = 'was inserted';
5427
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
5429
# check special-1 success: 1
5430
UPDATE t1 SET f_charbig = '';
5432
# check special-2 success: 1
5433
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
5434
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
5435
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
5436
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5437
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5438
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5439
'just inserted' FROM t0_template
5440
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5441
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
5443
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5444
f_charbig = 'updated by trigger'
5445
WHERE f_int1 = new.f_int1;
5447
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5448
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
5449
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5451
# check trigger-1 success: 1
5453
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5454
f_int2 = CAST(f_char1 AS SIGNED INT),
5455
f_charbig = 'just inserted'
5456
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5458
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5459
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5460
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5461
'just inserted' FROM t0_template
5462
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5463
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
5465
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5466
f_charbig = 'updated by trigger'
5467
WHERE f_int1 = new.f_int1;
5469
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5470
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
5471
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5473
# check trigger-2 success: 1
5475
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5476
f_int2 = CAST(f_char1 AS SIGNED INT),
5477
f_charbig = 'just inserted'
5478
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5480
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5481
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5482
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5483
'just inserted' FROM t0_template
5484
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5485
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
5487
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5488
f_charbig = 'updated by trigger'
5489
WHERE f_int1 = new.f_int1;
5491
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5492
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5494
# check trigger-3 success: 1
5496
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5497
f_int2 = CAST(f_char1 AS SIGNED INT),
5498
f_charbig = 'just inserted'
5499
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5501
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5502
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5503
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5504
'just inserted' FROM t0_template
5505
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5506
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
5508
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5509
f_charbig = 'updated by trigger'
5510
WHERE f_int1 = - old.f_int1;
5512
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5513
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5515
# check trigger-4 success: 1
5517
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5518
f_int2 = CAST(f_char1 AS SIGNED INT),
5519
f_charbig = 'just inserted'
5520
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5522
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5523
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5524
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5525
'just inserted' FROM t0_template
5526
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5527
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
5529
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5530
f_charbig = 'updated by trigger'
5531
WHERE f_int1 = new.f_int1;
5533
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5534
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5536
# check trigger-5 success: 1
5538
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5539
f_int2 = CAST(f_char1 AS SIGNED INT),
5540
f_charbig = 'just inserted'
5541
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5543
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5544
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5545
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5546
'just inserted' FROM t0_template
5547
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5548
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
5550
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5551
f_charbig = 'updated by trigger'
5552
WHERE f_int1 = - old.f_int1;
5554
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5555
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5557
# check trigger-6 success: 1
5559
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5560
f_int2 = CAST(f_char1 AS SIGNED INT),
5561
f_charbig = 'just inserted'
5562
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5564
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5565
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5566
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5567
'just inserted' FROM t0_template
5568
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5569
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
5571
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5572
f_charbig = 'updated by trigger'
5573
WHERE f_int1 = - old.f_int1;
5576
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5578
# check trigger-7 success: 1
5580
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5581
f_int2 = CAST(f_char1 AS SIGNED INT),
5582
f_charbig = 'just inserted'
5583
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5585
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5586
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5587
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5588
'just inserted' FROM t0_template
5589
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5590
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
5592
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5593
f_charbig = 'updated by trigger'
5594
WHERE f_int1 = - old.f_int1;
5597
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5599
# check trigger-8 success: 1
5601
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5602
f_int2 = CAST(f_char1 AS SIGNED INT),
5603
f_charbig = 'just inserted'
5604
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5606
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5608
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5609
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
5611
SET new.f_int1 = old.f_int1 + @max_row,
5612
new.f_int2 = old.f_int2 - @max_row,
5613
new.f_charbig = '####updated per update trigger####';
5616
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
5617
f_charbig = '####updated per update statement itself####';
5619
# check trigger-9 success: 1
5621
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5622
f_int2 = CAST(f_char1 AS SIGNED INT),
5623
f_charbig = CONCAT('===',f_char1,'===');
5624
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
5626
SET new.f_int1 = new.f_int1 + @max_row,
5627
new.f_int2 = new.f_int2 - @max_row,
5628
new.f_charbig = '####updated per update trigger####';
5631
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
5632
f_charbig = '####updated per update statement itself####';
5634
# check trigger-10 success: 1
5636
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5637
f_int2 = CAST(f_char1 AS SIGNED INT),
5638
f_charbig = CONCAT('===',f_char1,'===');
5639
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
5641
SET new.f_int1 = @my_max1 + @counter,
5642
new.f_int2 = @my_min2 - @counter,
5643
new.f_charbig = '####updated per insert trigger####';
5644
SET @counter = @counter + 1;
5647
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
5648
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5649
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
5650
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
5651
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
5655
# check trigger-11 success: 1
5657
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
5658
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
5659
AND f_charbig = '####updated per insert trigger####';
5660
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
5662
SET new.f_int1 = @my_max1 + @counter,
5663
new.f_int2 = @my_min2 - @counter,
5664
new.f_charbig = '####updated per insert trigger####';
5665
SET @counter = @counter + 1;
5668
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
5669
INSERT INTO t1 (f_char1, f_char2, f_charbig)
5670
SELECT CAST(f_int1 AS CHAR),
5671
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
5672
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
5676
# check trigger-12 success: 1
5678
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
5679
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
5680
AND f_charbig = '####updated per insert trigger####';
5682
Table Op Msg_type Msg_text
5683
test.t1 analyze note The storage engine for the table doesn't support analyze
5684
CHECK TABLE t1 EXTENDED;
5685
Table Op Msg_type Msg_text
5686
test.t1 check note The storage engine for the table doesn't support check
5687
CHECKSUM TABLE t1 EXTENDED;
5689
test.t1 <some_value>
5691
Table Op Msg_type Msg_text
5692
test.t1 optimize note The storage engine for the table doesn't support optimize
5693
# check layout success: 1
5694
REPAIR TABLE t1 EXTENDED;
5695
Table Op Msg_type Msg_text
5696
test.t1 repair note The storage engine for the table doesn't support repair
5697
# check layout success: 1
5700
# check TRUNCATE success: 1
5701
# check layout success: 1
5702
# End usability test (inc/partition_check.inc)
5709
f_charbig VARCHAR(1000)
5712
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2
5713
(PARTITION parta VALUES LESS THAN (0),
5714
PARTITION partb VALUES LESS THAN (5),
5715
PARTITION partc VALUES LESS THAN (10),
5716
PARTITION partd VALUES LESS THAN (2147483646));
5717
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
5718
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
5719
# Start usability test (inc/partition_check.inc)
5721
SHOW CREATE TABLE t1;
5723
t1 CREATE TABLE `t1` (
5724
`f_int1` int(11) DEFAULT NULL,
5725
`f_int2` int(11) DEFAULT NULL,
5726
`f_char1` char(20) DEFAULT NULL,
5727
`f_char2` char(20) DEFAULT NULL,
5728
`f_charbig` varchar(1000) DEFAULT NULL
5729
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */
5732
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD
5733
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI
5734
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD
5735
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI
5736
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD
5737
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI
5738
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD
5739
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI
5740
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD
5741
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI
5742
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD
5743
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI
5744
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD
5745
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI
5746
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD
5747
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI
5748
$MYSQLTEST_VARDIR/master-data/test/t1.frm
5749
$MYSQLTEST_VARDIR/master-data/test/t1.par
5751
# check prerequisites-1 success: 1
5752
# check COUNT(*) success: 1
5753
# check MIN/MAX(f_int1) success: 1
5754
# check MIN/MAX(f_int2) success: 1
5755
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5756
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
5757
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
5758
WHERE f_int1 IN (2,3);
5759
# check prerequisites-3 success: 1
5760
DELETE FROM t1 WHERE f_charbig = 'delete me';
5761
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
5762
# check read via f_int1 success: 1
5763
# check read via f_int2 success: 1
5765
# check multiple-1 success: 1
5766
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
5768
# check multiple-2 success: 1
5769
INSERT INTO t1 SELECT * FROM t0_template
5770
WHERE MOD(f_int1,3) = 0;
5772
# check multiple-3 success: 1
5773
UPDATE t1 SET f_int1 = f_int1 + @max_row
5774
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
5775
AND @max_row_div2 + @max_row_div4;
5777
# check multiple-4 success: 1
5779
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
5780
AND @max_row_div2 + @max_row_div4 + @max_row;
5782
# check multiple-5 success: 1
5783
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
5785
SET f_int1 = @cur_value , f_int2 = @cur_value,
5786
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
5787
f_charbig = '#SINGLE#';
5789
# check single-1 success: 1
5790
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
5792
SET f_int1 = @cur_value , f_int2 = @cur_value,
5793
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
5794
f_charbig = '#SINGLE#';
5796
# check single-2 success: 1
5797
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
5798
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
5799
UPDATE t1 SET f_int1 = @cur_value2
5800
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
5802
# check single-3 success: 1
5803
SET @cur_value1= -1;
5804
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
5805
UPDATE t1 SET f_int1 = @cur_value1
5806
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
5808
# check single-4 success: 1
5809
SELECT MAX(f_int1) INTO @cur_value FROM t1;
5810
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
5812
# check single-5 success: 1
5813
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
5815
# check single-6 success: 1
5816
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
5817
ERROR HY000: Table has no partition for value 2147483647
5818
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
5819
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
5820
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
5821
f_charbig = '#NULL#';
5823
SET f_int1 = NULL , f_int2 = -@max_row,
5824
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
5825
f_charbig = '#NULL#';
5826
# check null success: 1
5828
# check null-1 success: 1
5829
UPDATE t1 SET f_int1 = -@max_row
5830
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
5831
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
5833
# check null-2 success: 1
5834
UPDATE t1 SET f_int1 = NULL
5835
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
5836
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
5838
# check null-3 success: 1
5840
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
5841
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
5843
# check null-4 success: 1
5845
WHERE f_int1 = 0 AND f_int2 = 0
5846
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
5847
AND f_charbig = '#NULL#';
5849
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5850
SELECT f_int1, f_int1, '', '', 'was inserted'
5851
FROM t0_template source_tab
5852
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
5854
# check transactions-1 success: 1
5857
# check transactions-2 success: 1
5860
# check transactions-3 success: 1
5861
DELETE FROM t1 WHERE f_charbig = 'was inserted';
5865
# check transactions-4 success: 1
5866
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5867
SELECT f_int1, f_int1, '', '', 'was inserted'
5868
FROM t0_template source_tab
5869
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
5871
# check transactions-5 success: 1
5874
Warning 1196 Some non-transactional changed tables couldn't be rolled back
5876
# check transactions-6 success: 1
5877
# INFO: Storage engine used for t1 seems to be not transactional.
5880
# check transactions-7 success: 1
5881
DELETE FROM t1 WHERE f_charbig = 'was inserted';
5883
SET @@session.sql_mode = 'traditional';
5884
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
5885
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
5886
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
5887
'', '', 'was inserted' FROM t0_template
5888
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
5889
ERROR 22012: Division by 0
5892
# check transactions-8 success: 1
5893
# INFO: Storage engine used for t1 seems to be unable to revert
5894
# changes made by the failing statement.
5895
SET @@session.sql_mode = '';
5897
DELETE FROM t1 WHERE f_charbig = 'was inserted';
5899
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
5901
# check special-1 success: 1
5902
UPDATE t1 SET f_charbig = '';
5904
# check special-2 success: 1
5905
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
5906
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
5907
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
5908
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5909
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5910
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5911
'just inserted' FROM t0_template
5912
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5913
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
5915
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5916
f_charbig = 'updated by trigger'
5917
WHERE f_int1 = new.f_int1;
5919
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5920
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
5921
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5923
# check trigger-1 success: 1
5925
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5926
f_int2 = CAST(f_char1 AS SIGNED INT),
5927
f_charbig = 'just inserted'
5928
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5930
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5931
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5932
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5933
'just inserted' FROM t0_template
5934
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5935
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
5937
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5938
f_charbig = 'updated by trigger'
5939
WHERE f_int1 = new.f_int1;
5941
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5942
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
5943
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5945
# check trigger-2 success: 1
5947
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5948
f_int2 = CAST(f_char1 AS SIGNED INT),
5949
f_charbig = 'just inserted'
5950
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5952
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5953
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5954
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5955
'just inserted' FROM t0_template
5956
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5957
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
5959
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5960
f_charbig = 'updated by trigger'
5961
WHERE f_int1 = new.f_int1;
5963
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5964
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5966
# check trigger-3 success: 1
5968
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5969
f_int2 = CAST(f_char1 AS SIGNED INT),
5970
f_charbig = 'just inserted'
5971
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5973
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5974
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5975
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5976
'just inserted' FROM t0_template
5977
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5978
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
5980
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
5981
f_charbig = 'updated by trigger'
5982
WHERE f_int1 = - old.f_int1;
5984
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
5985
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
5987
# check trigger-4 success: 1
5989
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
5990
f_int2 = CAST(f_char1 AS SIGNED INT),
5991
f_charbig = 'just inserted'
5992
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
5994
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5995
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
5996
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
5997
'just inserted' FROM t0_template
5998
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
5999
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
6001
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6002
f_charbig = 'updated by trigger'
6003
WHERE f_int1 = new.f_int1;
6005
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6006
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6008
# check trigger-5 success: 1
6010
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6011
f_int2 = CAST(f_char1 AS SIGNED INT),
6012
f_charbig = 'just inserted'
6013
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6015
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6016
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6017
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6018
'just inserted' FROM t0_template
6019
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6020
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
6022
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6023
f_charbig = 'updated by trigger'
6024
WHERE f_int1 = - old.f_int1;
6026
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6027
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6029
# check trigger-6 success: 1
6031
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6032
f_int2 = CAST(f_char1 AS SIGNED INT),
6033
f_charbig = 'just inserted'
6034
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6036
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6037
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6038
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6039
'just inserted' FROM t0_template
6040
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6041
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
6043
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6044
f_charbig = 'updated by trigger'
6045
WHERE f_int1 = - old.f_int1;
6048
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6050
# check trigger-7 success: 1
6052
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6053
f_int2 = CAST(f_char1 AS SIGNED INT),
6054
f_charbig = 'just inserted'
6055
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6057
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6058
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6059
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6060
'just inserted' FROM t0_template
6061
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6062
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
6064
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6065
f_charbig = 'updated by trigger'
6066
WHERE f_int1 = - old.f_int1;
6069
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6071
# check trigger-8 success: 1
6073
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6074
f_int2 = CAST(f_char1 AS SIGNED INT),
6075
f_charbig = 'just inserted'
6076
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6078
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6080
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6081
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
6083
SET new.f_int1 = old.f_int1 + @max_row,
6084
new.f_int2 = old.f_int2 - @max_row,
6085
new.f_charbig = '####updated per update trigger####';
6088
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
6089
f_charbig = '####updated per update statement itself####';
6091
# check trigger-9 success: 1
6093
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6094
f_int2 = CAST(f_char1 AS SIGNED INT),
6095
f_charbig = CONCAT('===',f_char1,'===');
6096
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
6098
SET new.f_int1 = new.f_int1 + @max_row,
6099
new.f_int2 = new.f_int2 - @max_row,
6100
new.f_charbig = '####updated per update trigger####';
6103
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
6104
f_charbig = '####updated per update statement itself####';
6106
# check trigger-10 success: 1
6108
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6109
f_int2 = CAST(f_char1 AS SIGNED INT),
6110
f_charbig = CONCAT('===',f_char1,'===');
6111
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
6113
SET new.f_int1 = @my_max1 + @counter,
6114
new.f_int2 = @my_min2 - @counter,
6115
new.f_charbig = '####updated per insert trigger####';
6116
SET @counter = @counter + 1;
6119
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
6120
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6121
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
6122
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
6123
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
6127
# check trigger-11 success: 1
6129
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
6130
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
6131
AND f_charbig = '####updated per insert trigger####';
6132
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
6134
SET new.f_int1 = @my_max1 + @counter,
6135
new.f_int2 = @my_min2 - @counter,
6136
new.f_charbig = '####updated per insert trigger####';
6137
SET @counter = @counter + 1;
6140
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
6141
INSERT INTO t1 (f_char1, f_char2, f_charbig)
6142
SELECT CAST(f_int1 AS CHAR),
6143
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
6144
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
6148
# check trigger-12 success: 1
6150
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
6151
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
6152
AND f_charbig = '####updated per insert trigger####';
6154
Table Op Msg_type Msg_text
6155
test.t1 analyze note The storage engine for the table doesn't support analyze
6156
CHECK TABLE t1 EXTENDED;
6157
Table Op Msg_type Msg_text
6158
test.t1 check note The storage engine for the table doesn't support check
6159
CHECKSUM TABLE t1 EXTENDED;
6161
test.t1 <some_value>
6163
Table Op Msg_type Msg_text
6164
test.t1 optimize note The storage engine for the table doesn't support optimize
6165
# check layout success: 1
6166
REPAIR TABLE t1 EXTENDED;
6167
Table Op Msg_type Msg_text
6168
test.t1 repair note The storage engine for the table doesn't support repair
6169
# check layout success: 1
6172
# check TRUNCATE success: 1
6173
# check layout success: 1
6174
# End usability test (inc/partition_check.inc)
6181
f_charbig VARCHAR(1000)
6184
PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2)
6185
(PARTITION part1 VALUES LESS THAN (0)
6186
(SUBPARTITION subpart11, SUBPARTITION subpart12),
6187
PARTITION part2 VALUES LESS THAN (5)
6188
(SUBPARTITION subpart21, SUBPARTITION subpart22),
6189
PARTITION part3 VALUES LESS THAN (10)
6190
(SUBPARTITION subpart31, SUBPARTITION subpart32),
6191
PARTITION part4 VALUES LESS THAN (2147483646)
6192
(SUBPARTITION subpart41, SUBPARTITION subpart42));
6193
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
6194
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
6195
# Start usability test (inc/partition_check.inc)
6197
SHOW CREATE TABLE t1;
6199
t1 CREATE TABLE `t1` (
6200
`f_int1` int(11) DEFAULT NULL,
6201
`f_int2` int(11) DEFAULT NULL,
6202
`f_char1` char(20) DEFAULT NULL,
6203
`f_char2` char(20) DEFAULT NULL,
6204
`f_charbig` varchar(1000) DEFAULT NULL
6205
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */
6208
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD
6209
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI
6210
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD
6211
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI
6212
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD
6213
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI
6214
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD
6215
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI
6216
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD
6217
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI
6218
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD
6219
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI
6220
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD
6221
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI
6222
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD
6223
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI
6224
$MYSQLTEST_VARDIR/master-data/test/t1.frm
6225
$MYSQLTEST_VARDIR/master-data/test/t1.par
6227
# check prerequisites-1 success: 1
6228
# check COUNT(*) success: 1
6229
# check MIN/MAX(f_int1) success: 1
6230
# check MIN/MAX(f_int2) success: 1
6231
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6232
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
6233
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
6234
WHERE f_int1 IN (2,3);
6235
# check prerequisites-3 success: 1
6236
DELETE FROM t1 WHERE f_charbig = 'delete me';
6237
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
6238
# check read via f_int1 success: 1
6239
# check read via f_int2 success: 1
6241
# check multiple-1 success: 1
6242
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
6244
# check multiple-2 success: 1
6245
INSERT INTO t1 SELECT * FROM t0_template
6246
WHERE MOD(f_int1,3) = 0;
6248
# check multiple-3 success: 1
6249
UPDATE t1 SET f_int1 = f_int1 + @max_row
6250
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
6251
AND @max_row_div2 + @max_row_div4;
6253
# check multiple-4 success: 1
6255
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
6256
AND @max_row_div2 + @max_row_div4 + @max_row;
6258
# check multiple-5 success: 1
6259
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
6261
SET f_int1 = @cur_value , f_int2 = @cur_value,
6262
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
6263
f_charbig = '#SINGLE#';
6265
# check single-1 success: 1
6266
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
6268
SET f_int1 = @cur_value , f_int2 = @cur_value,
6269
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
6270
f_charbig = '#SINGLE#';
6272
# check single-2 success: 1
6273
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
6274
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
6275
UPDATE t1 SET f_int1 = @cur_value2
6276
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
6278
# check single-3 success: 1
6279
SET @cur_value1= -1;
6280
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
6281
UPDATE t1 SET f_int1 = @cur_value1
6282
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
6284
# check single-4 success: 1
6285
SELECT MAX(f_int1) INTO @cur_value FROM t1;
6286
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
6288
# check single-5 success: 1
6289
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
6291
# check single-6 success: 1
6292
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
6293
ERROR HY000: Table has no partition for value 2147483647
6294
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
6295
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
6296
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
6297
f_charbig = '#NULL#';
6299
SET f_int1 = NULL , f_int2 = -@max_row,
6300
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
6301
f_charbig = '#NULL#';
6302
# check null success: 1
6304
# check null-1 success: 1
6305
UPDATE t1 SET f_int1 = -@max_row
6306
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
6307
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
6309
# check null-2 success: 1
6310
UPDATE t1 SET f_int1 = NULL
6311
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
6312
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
6314
# check null-3 success: 1
6316
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
6317
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
6319
# check null-4 success: 1
6321
WHERE f_int1 = 0 AND f_int2 = 0
6322
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
6323
AND f_charbig = '#NULL#';
6325
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6326
SELECT f_int1, f_int1, '', '', 'was inserted'
6327
FROM t0_template source_tab
6328
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
6330
# check transactions-1 success: 1
6333
# check transactions-2 success: 1
6336
# check transactions-3 success: 1
6337
DELETE FROM t1 WHERE f_charbig = 'was inserted';
6341
# check transactions-4 success: 1
6342
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6343
SELECT f_int1, f_int1, '', '', 'was inserted'
6344
FROM t0_template source_tab
6345
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
6347
# check transactions-5 success: 1
6350
Warning 1196 Some non-transactional changed tables couldn't be rolled back
6352
# check transactions-6 success: 1
6353
# INFO: Storage engine used for t1 seems to be not transactional.
6356
# check transactions-7 success: 1
6357
DELETE FROM t1 WHERE f_charbig = 'was inserted';
6359
SET @@session.sql_mode = 'traditional';
6360
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
6361
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6362
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
6363
'', '', 'was inserted' FROM t0_template
6364
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
6365
ERROR 22012: Division by 0
6368
# check transactions-8 success: 1
6369
# INFO: Storage engine used for t1 seems to be unable to revert
6370
# changes made by the failing statement.
6371
SET @@session.sql_mode = '';
6373
DELETE FROM t1 WHERE f_charbig = 'was inserted';
6375
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
6377
# check special-1 success: 1
6378
UPDATE t1 SET f_charbig = '';
6380
# check special-2 success: 1
6381
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
6382
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
6383
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
6384
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6385
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6386
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6387
'just inserted' FROM t0_template
6388
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6389
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
6391
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6392
f_charbig = 'updated by trigger'
6393
WHERE f_int1 = new.f_int1;
6395
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6396
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
6397
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6399
# check trigger-1 success: 1
6401
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6402
f_int2 = CAST(f_char1 AS SIGNED INT),
6403
f_charbig = 'just inserted'
6404
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6406
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6407
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6408
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6409
'just inserted' FROM t0_template
6410
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6411
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
6413
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6414
f_charbig = 'updated by trigger'
6415
WHERE f_int1 = new.f_int1;
6417
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6418
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
6419
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6421
# check trigger-2 success: 1
6423
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6424
f_int2 = CAST(f_char1 AS SIGNED INT),
6425
f_charbig = 'just inserted'
6426
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6428
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6429
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6430
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6431
'just inserted' FROM t0_template
6432
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6433
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
6435
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6436
f_charbig = 'updated by trigger'
6437
WHERE f_int1 = new.f_int1;
6439
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6440
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6442
# check trigger-3 success: 1
6444
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6445
f_int2 = CAST(f_char1 AS SIGNED INT),
6446
f_charbig = 'just inserted'
6447
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6449
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6450
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6451
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6452
'just inserted' FROM t0_template
6453
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6454
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
6456
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6457
f_charbig = 'updated by trigger'
6458
WHERE f_int1 = - old.f_int1;
6460
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6461
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6463
# check trigger-4 success: 1
6465
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6466
f_int2 = CAST(f_char1 AS SIGNED INT),
6467
f_charbig = 'just inserted'
6468
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6470
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6471
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6472
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6473
'just inserted' FROM t0_template
6474
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6475
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
6477
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6478
f_charbig = 'updated by trigger'
6479
WHERE f_int1 = new.f_int1;
6481
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6482
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6484
# check trigger-5 success: 1
6486
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6487
f_int2 = CAST(f_char1 AS SIGNED INT),
6488
f_charbig = 'just inserted'
6489
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6491
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6492
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6493
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6494
'just inserted' FROM t0_template
6495
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6496
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
6498
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6499
f_charbig = 'updated by trigger'
6500
WHERE f_int1 = - old.f_int1;
6502
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6503
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6505
# check trigger-6 success: 1
6507
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6508
f_int2 = CAST(f_char1 AS SIGNED INT),
6509
f_charbig = 'just inserted'
6510
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6512
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6513
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6514
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6515
'just inserted' FROM t0_template
6516
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6517
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
6519
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6520
f_charbig = 'updated by trigger'
6521
WHERE f_int1 = - old.f_int1;
6524
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6526
# check trigger-7 success: 1
6528
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6529
f_int2 = CAST(f_char1 AS SIGNED INT),
6530
f_charbig = 'just inserted'
6531
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6533
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6534
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6535
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6536
'just inserted' FROM t0_template
6537
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6538
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
6540
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6541
f_charbig = 'updated by trigger'
6542
WHERE f_int1 = - old.f_int1;
6545
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6547
# check trigger-8 success: 1
6549
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6550
f_int2 = CAST(f_char1 AS SIGNED INT),
6551
f_charbig = 'just inserted'
6552
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6554
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6556
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6557
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
6559
SET new.f_int1 = old.f_int1 + @max_row,
6560
new.f_int2 = old.f_int2 - @max_row,
6561
new.f_charbig = '####updated per update trigger####';
6564
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
6565
f_charbig = '####updated per update statement itself####';
6567
# check trigger-9 success: 1
6569
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6570
f_int2 = CAST(f_char1 AS SIGNED INT),
6571
f_charbig = CONCAT('===',f_char1,'===');
6572
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
6574
SET new.f_int1 = new.f_int1 + @max_row,
6575
new.f_int2 = new.f_int2 - @max_row,
6576
new.f_charbig = '####updated per update trigger####';
6579
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
6580
f_charbig = '####updated per update statement itself####';
6582
# check trigger-10 success: 1
6584
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6585
f_int2 = CAST(f_char1 AS SIGNED INT),
6586
f_charbig = CONCAT('===',f_char1,'===');
6587
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
6589
SET new.f_int1 = @my_max1 + @counter,
6590
new.f_int2 = @my_min2 - @counter,
6591
new.f_charbig = '####updated per insert trigger####';
6592
SET @counter = @counter + 1;
6595
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
6596
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6597
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
6598
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
6599
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
6603
# check trigger-11 success: 1
6605
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
6606
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
6607
AND f_charbig = '####updated per insert trigger####';
6608
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
6610
SET new.f_int1 = @my_max1 + @counter,
6611
new.f_int2 = @my_min2 - @counter,
6612
new.f_charbig = '####updated per insert trigger####';
6613
SET @counter = @counter + 1;
6616
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
6617
INSERT INTO t1 (f_char1, f_char2, f_charbig)
6618
SELECT CAST(f_int1 AS CHAR),
6619
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
6620
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
6624
# check trigger-12 success: 1
6626
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
6627
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
6628
AND f_charbig = '####updated per insert trigger####';
6630
Table Op Msg_type Msg_text
6631
test.t1 analyze note The storage engine for the table doesn't support analyze
6632
CHECK TABLE t1 EXTENDED;
6633
Table Op Msg_type Msg_text
6634
test.t1 check note The storage engine for the table doesn't support check
6635
CHECKSUM TABLE t1 EXTENDED;
6637
test.t1 <some_value>
6639
Table Op Msg_type Msg_text
6640
test.t1 optimize note The storage engine for the table doesn't support optimize
6641
# check layout success: 1
6642
REPAIR TABLE t1 EXTENDED;
6643
Table Op Msg_type Msg_text
6644
test.t1 repair note The storage engine for the table doesn't support repair
6645
# check layout success: 1
6648
# check TRUNCATE success: 1
6649
# check layout success: 1
6650
# End usability test (inc/partition_check.inc)
6657
f_charbig VARCHAR(1000)
6660
PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1)
6661
(PARTITION part1 VALUES IN (0)
6662
(SUBPARTITION sp11, SUBPARTITION sp12),
6663
PARTITION part2 VALUES IN (1)
6664
(SUBPARTITION sp21, SUBPARTITION sp22),
6665
PARTITION part3 VALUES IN (2)
6666
(SUBPARTITION sp31, SUBPARTITION sp32),
6667
PARTITION part4 VALUES IN (NULL)
6668
(SUBPARTITION sp41, SUBPARTITION sp42));
6669
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
6670
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
6671
# Start usability test (inc/partition_check.inc)
6673
SHOW CREATE TABLE t1;
6675
t1 CREATE TABLE `t1` (
6676
`f_int1` int(11) DEFAULT NULL,
6677
`f_int2` int(11) DEFAULT NULL,
6678
`f_char1` char(20) DEFAULT NULL,
6679
`f_char2` char(20) DEFAULT NULL,
6680
`f_charbig` varchar(1000) DEFAULT NULL
6681
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, SUBPARTITION sp12 ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = MyISAM, SUBPARTITION sp22 ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = MyISAM, SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, SUBPARTITION sp42 ENGINE = MyISAM)) */
6684
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD
6685
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI
6686
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD
6687
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI
6688
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD
6689
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI
6690
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD
6691
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI
6692
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD
6693
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI
6694
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD
6695
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI
6696
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD
6697
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI
6698
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD
6699
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI
6700
$MYSQLTEST_VARDIR/master-data/test/t1.frm
6701
$MYSQLTEST_VARDIR/master-data/test/t1.par
6703
# check prerequisites-1 success: 1
6704
# check COUNT(*) success: 1
6705
# check MIN/MAX(f_int1) success: 1
6706
# check MIN/MAX(f_int2) success: 1
6707
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6708
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
6709
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
6710
WHERE f_int1 IN (2,3);
6711
# check prerequisites-3 success: 1
6712
DELETE FROM t1 WHERE f_charbig = 'delete me';
6713
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
6714
# check read via f_int1 success: 1
6715
# check read via f_int2 success: 1
6717
# check multiple-1 success: 1
6718
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
6720
# check multiple-2 success: 1
6721
INSERT INTO t1 SELECT * FROM t0_template
6722
WHERE MOD(f_int1,3) = 0;
6724
# check multiple-3 success: 1
6725
UPDATE t1 SET f_int1 = f_int1 + @max_row
6726
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
6727
AND @max_row_div2 + @max_row_div4;
6729
# check multiple-4 success: 1
6731
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
6732
AND @max_row_div2 + @max_row_div4 + @max_row;
6734
# check multiple-5 success: 1
6735
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
6737
SET f_int1 = @cur_value , f_int2 = @cur_value,
6738
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
6739
f_charbig = '#SINGLE#';
6741
# check single-1 success: 1
6742
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
6744
SET f_int1 = @cur_value , f_int2 = @cur_value,
6745
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
6746
f_charbig = '#SINGLE#';
6748
# check single-2 success: 1
6749
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
6750
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
6751
UPDATE t1 SET f_int1 = @cur_value2
6752
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
6754
# check single-3 success: 1
6755
SET @cur_value1= -1;
6756
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
6757
UPDATE t1 SET f_int1 = @cur_value1
6758
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
6760
# check single-4 success: 1
6761
SELECT MAX(f_int1) INTO @cur_value FROM t1;
6762
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
6764
# check single-5 success: 1
6765
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
6767
# check single-6 success: 1
6768
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
6770
# check single-7 success: 1
6771
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
6772
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
6773
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
6774
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
6775
f_charbig = '#NULL#';
6777
SET f_int1 = NULL , f_int2 = -@max_row,
6778
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
6779
f_charbig = '#NULL#';
6780
# check null success: 1
6782
# check null-1 success: 1
6783
UPDATE t1 SET f_int1 = -@max_row
6784
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
6785
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
6787
# check null-2 success: 1
6788
UPDATE t1 SET f_int1 = NULL
6789
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
6790
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
6792
# check null-3 success: 1
6794
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
6795
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
6797
# check null-4 success: 1
6799
WHERE f_int1 = 0 AND f_int2 = 0
6800
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
6801
AND f_charbig = '#NULL#';
6803
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6804
SELECT f_int1, f_int1, '', '', 'was inserted'
6805
FROM t0_template source_tab
6806
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
6808
# check transactions-1 success: 1
6811
# check transactions-2 success: 1
6814
# check transactions-3 success: 1
6815
DELETE FROM t1 WHERE f_charbig = 'was inserted';
6819
# check transactions-4 success: 1
6820
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6821
SELECT f_int1, f_int1, '', '', 'was inserted'
6822
FROM t0_template source_tab
6823
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
6825
# check transactions-5 success: 1
6828
Warning 1196 Some non-transactional changed tables couldn't be rolled back
6830
# check transactions-6 success: 1
6831
# INFO: Storage engine used for t1 seems to be not transactional.
6834
# check transactions-7 success: 1
6835
DELETE FROM t1 WHERE f_charbig = 'was inserted';
6837
SET @@session.sql_mode = 'traditional';
6838
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
6839
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
6840
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
6841
'', '', 'was inserted' FROM t0_template
6842
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
6843
ERROR 22012: Division by 0
6846
# check transactions-8 success: 1
6847
# INFO: Storage engine used for t1 seems to be unable to revert
6848
# changes made by the failing statement.
6849
SET @@session.sql_mode = '';
6851
DELETE FROM t1 WHERE f_charbig = 'was inserted';
6853
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
6855
# check special-1 success: 1
6856
UPDATE t1 SET f_charbig = '';
6858
# check special-2 success: 1
6859
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
6860
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
6861
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
6862
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6863
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6864
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6865
'just inserted' FROM t0_template
6866
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6867
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
6869
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6870
f_charbig = 'updated by trigger'
6871
WHERE f_int1 = new.f_int1;
6873
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6874
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
6875
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6877
# check trigger-1 success: 1
6879
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6880
f_int2 = CAST(f_char1 AS SIGNED INT),
6881
f_charbig = 'just inserted'
6882
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6884
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6885
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6886
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6887
'just inserted' FROM t0_template
6888
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6889
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
6891
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6892
f_charbig = 'updated by trigger'
6893
WHERE f_int1 = new.f_int1;
6895
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6896
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
6897
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6899
# check trigger-2 success: 1
6901
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6902
f_int2 = CAST(f_char1 AS SIGNED INT),
6903
f_charbig = 'just inserted'
6904
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6906
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6907
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6908
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6909
'just inserted' FROM t0_template
6910
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6911
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
6913
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6914
f_charbig = 'updated by trigger'
6915
WHERE f_int1 = new.f_int1;
6917
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6918
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6920
# check trigger-3 success: 1
6922
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6923
f_int2 = CAST(f_char1 AS SIGNED INT),
6924
f_charbig = 'just inserted'
6925
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6927
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6928
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6929
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6930
'just inserted' FROM t0_template
6931
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6932
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
6934
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6935
f_charbig = 'updated by trigger'
6936
WHERE f_int1 = - old.f_int1;
6938
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6939
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6941
# check trigger-4 success: 1
6943
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6944
f_int2 = CAST(f_char1 AS SIGNED INT),
6945
f_charbig = 'just inserted'
6946
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6948
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6949
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6950
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6951
'just inserted' FROM t0_template
6952
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6953
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
6955
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6956
f_charbig = 'updated by trigger'
6957
WHERE f_int1 = new.f_int1;
6959
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6960
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6962
# check trigger-5 success: 1
6964
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6965
f_int2 = CAST(f_char1 AS SIGNED INT),
6966
f_charbig = 'just inserted'
6967
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6969
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6970
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6971
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6972
'just inserted' FROM t0_template
6973
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6974
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
6976
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6977
f_charbig = 'updated by trigger'
6978
WHERE f_int1 = - old.f_int1;
6980
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
6981
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
6983
# check trigger-6 success: 1
6985
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
6986
f_int2 = CAST(f_char1 AS SIGNED INT),
6987
f_charbig = 'just inserted'
6988
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
6990
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6991
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
6992
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
6993
'just inserted' FROM t0_template
6994
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
6995
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
6997
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
6998
f_charbig = 'updated by trigger'
6999
WHERE f_int1 = - old.f_int1;
7002
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7004
# check trigger-7 success: 1
7006
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7007
f_int2 = CAST(f_char1 AS SIGNED INT),
7008
f_charbig = 'just inserted'
7009
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7011
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7012
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7013
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7014
'just inserted' FROM t0_template
7015
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7016
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
7018
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7019
f_charbig = 'updated by trigger'
7020
WHERE f_int1 = - old.f_int1;
7023
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7025
# check trigger-8 success: 1
7027
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7028
f_int2 = CAST(f_char1 AS SIGNED INT),
7029
f_charbig = 'just inserted'
7030
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7032
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7034
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7035
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
7037
SET new.f_int1 = old.f_int1 + @max_row,
7038
new.f_int2 = old.f_int2 - @max_row,
7039
new.f_charbig = '####updated per update trigger####';
7042
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
7043
f_charbig = '####updated per update statement itself####';
7045
# check trigger-9 success: 1
7047
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7048
f_int2 = CAST(f_char1 AS SIGNED INT),
7049
f_charbig = CONCAT('===',f_char1,'===');
7050
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
7052
SET new.f_int1 = new.f_int1 + @max_row,
7053
new.f_int2 = new.f_int2 - @max_row,
7054
new.f_charbig = '####updated per update trigger####';
7057
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
7058
f_charbig = '####updated per update statement itself####';
7060
# check trigger-10 success: 1
7062
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7063
f_int2 = CAST(f_char1 AS SIGNED INT),
7064
f_charbig = CONCAT('===',f_char1,'===');
7065
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
7067
SET new.f_int1 = @my_max1 + @counter,
7068
new.f_int2 = @my_min2 - @counter,
7069
new.f_charbig = '####updated per insert trigger####';
7070
SET @counter = @counter + 1;
7073
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
7074
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7075
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
7076
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
7077
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
7081
# check trigger-11 success: 1
7083
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
7084
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
7085
AND f_charbig = '####updated per insert trigger####';
7086
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
7088
SET new.f_int1 = @my_max1 + @counter,
7089
new.f_int2 = @my_min2 - @counter,
7090
new.f_charbig = '####updated per insert trigger####';
7091
SET @counter = @counter + 1;
7094
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
7095
INSERT INTO t1 (f_char1, f_char2, f_charbig)
7096
SELECT CAST(f_int1 AS CHAR),
7097
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
7098
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
7102
# check trigger-12 success: 1
7104
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
7105
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
7106
AND f_charbig = '####updated per insert trigger####';
7108
Table Op Msg_type Msg_text
7109
test.t1 analyze note The storage engine for the table doesn't support analyze
7110
CHECK TABLE t1 EXTENDED;
7111
Table Op Msg_type Msg_text
7112
test.t1 check note The storage engine for the table doesn't support check
7113
CHECKSUM TABLE t1 EXTENDED;
7115
test.t1 <some_value>
7117
Table Op Msg_type Msg_text
7118
test.t1 optimize note The storage engine for the table doesn't support optimize
7119
# check layout success: 1
7120
REPAIR TABLE t1 EXTENDED;
7121
Table Op Msg_type Msg_text
7122
test.t1 repair note The storage engine for the table doesn't support repair
7123
# check layout success: 1
7126
# check TRUNCATE success: 1
7127
# check layout success: 1
7128
# End usability test (inc/partition_check.inc)
7135
f_charbig VARCHAR(1000)
7138
PARTITION BY LIST(ABS(MOD(f_int1,2)))
7139
SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3
7140
(PARTITION part1 VALUES IN (0),
7141
PARTITION part2 VALUES IN (1),
7142
PARTITION part3 VALUES IN (NULL));
7143
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
7144
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
7145
# Start usability test (inc/partition_check.inc)
7147
SHOW CREATE TABLE t1;
7149
t1 CREATE TABLE `t1` (
7150
`f_int1` int(11) DEFAULT NULL,
7151
`f_int2` int(11) DEFAULT NULL,
7152
`f_char1` char(20) DEFAULT NULL,
7153
`f_char2` char(20) DEFAULT NULL,
7154
`f_charbig` varchar(1000) DEFAULT NULL
7155
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */
7158
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD
7159
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI
7160
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD
7161
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI
7162
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD
7163
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI
7164
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD
7165
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI
7166
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD
7167
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI
7168
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD
7169
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI
7170
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD
7171
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI
7172
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD
7173
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI
7174
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD
7175
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI
7176
$MYSQLTEST_VARDIR/master-data/test/t1.frm
7177
$MYSQLTEST_VARDIR/master-data/test/t1.par
7179
# check prerequisites-1 success: 1
7180
# check COUNT(*) success: 1
7181
# check MIN/MAX(f_int1) success: 1
7182
# check MIN/MAX(f_int2) success: 1
7183
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7184
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
7185
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
7186
WHERE f_int1 IN (2,3);
7187
# check prerequisites-3 success: 1
7188
DELETE FROM t1 WHERE f_charbig = 'delete me';
7189
# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE
7190
# check read via f_int1 success: 1
7191
# check read via f_int2 success: 1
7193
# check multiple-1 success: 1
7194
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
7196
# check multiple-2 success: 1
7197
INSERT INTO t1 SELECT * FROM t0_template
7198
WHERE MOD(f_int1,3) = 0;
7200
# check multiple-3 success: 1
7201
UPDATE t1 SET f_int1 = f_int1 + @max_row
7202
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
7203
AND @max_row_div2 + @max_row_div4;
7205
# check multiple-4 success: 1
7207
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
7208
AND @max_row_div2 + @max_row_div4 + @max_row;
7210
# check multiple-5 success: 1
7211
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
7213
SET f_int1 = @cur_value , f_int2 = @cur_value,
7214
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
7215
f_charbig = '#SINGLE#';
7217
# check single-1 success: 1
7218
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
7220
SET f_int1 = @cur_value , f_int2 = @cur_value,
7221
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
7222
f_charbig = '#SINGLE#';
7224
# check single-2 success: 1
7225
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
7226
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
7227
UPDATE t1 SET f_int1 = @cur_value2
7228
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
7230
# check single-3 success: 1
7231
SET @cur_value1= -1;
7232
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
7233
UPDATE t1 SET f_int1 = @cur_value1
7234
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
7236
# check single-4 success: 1
7237
SELECT MAX(f_int1) INTO @cur_value FROM t1;
7238
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
7240
# check single-5 success: 1
7241
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
7243
# check single-6 success: 1
7244
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
7246
# check single-7 success: 1
7247
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
7248
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
7249
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
7250
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
7251
f_charbig = '#NULL#';
7253
SET f_int1 = NULL , f_int2 = -@max_row,
7254
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
7255
f_charbig = '#NULL#';
7256
# check null success: 1
7258
# check null-1 success: 1
7259
UPDATE t1 SET f_int1 = -@max_row
7260
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
7261
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
7263
# check null-2 success: 1
7264
UPDATE t1 SET f_int1 = NULL
7265
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
7266
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
7268
# check null-3 success: 1
7270
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
7271
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
7273
# check null-4 success: 1
7275
WHERE f_int1 = 0 AND f_int2 = 0
7276
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
7277
AND f_charbig = '#NULL#';
7279
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7280
SELECT f_int1, f_int1, '', '', 'was inserted'
7281
FROM t0_template source_tab
7282
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
7284
# check transactions-1 success: 1
7287
# check transactions-2 success: 1
7290
# check transactions-3 success: 1
7291
DELETE FROM t1 WHERE f_charbig = 'was inserted';
7295
# check transactions-4 success: 1
7296
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7297
SELECT f_int1, f_int1, '', '', 'was inserted'
7298
FROM t0_template source_tab
7299
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
7301
# check transactions-5 success: 1
7304
Warning 1196 Some non-transactional changed tables couldn't be rolled back
7306
# check transactions-6 success: 1
7307
# INFO: Storage engine used for t1 seems to be not transactional.
7310
# check transactions-7 success: 1
7311
DELETE FROM t1 WHERE f_charbig = 'was inserted';
7313
SET @@session.sql_mode = 'traditional';
7314
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
7315
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7316
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
7317
'', '', 'was inserted' FROM t0_template
7318
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
7319
ERROR 22012: Division by 0
7322
# check transactions-8 success: 1
7323
# INFO: Storage engine used for t1 seems to be unable to revert
7324
# changes made by the failing statement.
7325
SET @@session.sql_mode = '';
7327
DELETE FROM t1 WHERE f_charbig = 'was inserted';
7329
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
7331
# check special-1 success: 1
7332
UPDATE t1 SET f_charbig = '';
7334
# check special-2 success: 1
7335
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
7336
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
7337
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
7338
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7339
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7340
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7341
'just inserted' FROM t0_template
7342
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7343
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
7345
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7346
f_charbig = 'updated by trigger'
7347
WHERE f_int1 = new.f_int1;
7349
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7350
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
7351
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7353
# check trigger-1 success: 1
7355
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7356
f_int2 = CAST(f_char1 AS SIGNED INT),
7357
f_charbig = 'just inserted'
7358
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7360
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7361
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7362
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7363
'just inserted' FROM t0_template
7364
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7365
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
7367
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7368
f_charbig = 'updated by trigger'
7369
WHERE f_int1 = new.f_int1;
7371
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7372
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
7373
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7375
# check trigger-2 success: 1
7377
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7378
f_int2 = CAST(f_char1 AS SIGNED INT),
7379
f_charbig = 'just inserted'
7380
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7382
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7383
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7384
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7385
'just inserted' FROM t0_template
7386
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7387
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
7389
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7390
f_charbig = 'updated by trigger'
7391
WHERE f_int1 = new.f_int1;
7393
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
7394
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7396
# check trigger-3 success: 1
7398
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7399
f_int2 = CAST(f_char1 AS SIGNED INT),
7400
f_charbig = 'just inserted'
7401
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7403
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7404
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7405
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7406
'just inserted' FROM t0_template
7407
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7408
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
7410
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7411
f_charbig = 'updated by trigger'
7412
WHERE f_int1 = - old.f_int1;
7414
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
7415
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7417
# check trigger-4 success: 1
7419
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7420
f_int2 = CAST(f_char1 AS SIGNED INT),
7421
f_charbig = 'just inserted'
7422
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7424
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7425
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7426
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7427
'just inserted' FROM t0_template
7428
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7429
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
7431
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7432
f_charbig = 'updated by trigger'
7433
WHERE f_int1 = new.f_int1;
7435
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
7436
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7438
# check trigger-5 success: 1
7440
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7441
f_int2 = CAST(f_char1 AS SIGNED INT),
7442
f_charbig = 'just inserted'
7443
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7445
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7446
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7447
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7448
'just inserted' FROM t0_template
7449
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7450
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
7452
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7453
f_charbig = 'updated by trigger'
7454
WHERE f_int1 = - old.f_int1;
7456
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
7457
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7459
# check trigger-6 success: 1
7461
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7462
f_int2 = CAST(f_char1 AS SIGNED INT),
7463
f_charbig = 'just inserted'
7464
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7466
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7467
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7468
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7469
'just inserted' FROM t0_template
7470
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7471
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
7473
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7474
f_charbig = 'updated by trigger'
7475
WHERE f_int1 = - old.f_int1;
7478
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7480
# check trigger-7 success: 1
7482
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7483
f_int2 = CAST(f_char1 AS SIGNED INT),
7484
f_charbig = 'just inserted'
7485
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7487
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7488
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7489
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7490
'just inserted' FROM t0_template
7491
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7492
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
7494
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7495
f_charbig = 'updated by trigger'
7496
WHERE f_int1 = - old.f_int1;
7499
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7501
# check trigger-8 success: 1
7503
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7504
f_int2 = CAST(f_char1 AS SIGNED INT),
7505
f_charbig = 'just inserted'
7506
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7508
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7510
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7511
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
7513
SET new.f_int1 = old.f_int1 + @max_row,
7514
new.f_int2 = old.f_int2 - @max_row,
7515
new.f_charbig = '####updated per update trigger####';
7518
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
7519
f_charbig = '####updated per update statement itself####';
7521
# check trigger-9 success: 1
7523
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7524
f_int2 = CAST(f_char1 AS SIGNED INT),
7525
f_charbig = CONCAT('===',f_char1,'===');
7526
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
7528
SET new.f_int1 = new.f_int1 + @max_row,
7529
new.f_int2 = new.f_int2 - @max_row,
7530
new.f_charbig = '####updated per update trigger####';
7533
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
7534
f_charbig = '####updated per update statement itself####';
7536
# check trigger-10 success: 1
7538
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7539
f_int2 = CAST(f_char1 AS SIGNED INT),
7540
f_charbig = CONCAT('===',f_char1,'===');
7541
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
7543
SET new.f_int1 = @my_max1 + @counter,
7544
new.f_int2 = @my_min2 - @counter,
7545
new.f_charbig = '####updated per insert trigger####';
7546
SET @counter = @counter + 1;
7549
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
7550
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7551
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
7552
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
7553
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
7557
# check trigger-11 success: 1
7559
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
7560
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
7561
AND f_charbig = '####updated per insert trigger####';
7562
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
7564
SET new.f_int1 = @my_max1 + @counter,
7565
new.f_int2 = @my_min2 - @counter,
7566
new.f_charbig = '####updated per insert trigger####';
7567
SET @counter = @counter + 1;
7570
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
7571
INSERT INTO t1 (f_char1, f_char2, f_charbig)
7572
SELECT CAST(f_int1 AS CHAR),
7573
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
7574
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
7578
# check trigger-12 success: 1
7580
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
7581
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
7582
AND f_charbig = '####updated per insert trigger####';
7584
Table Op Msg_type Msg_text
7585
test.t1 analyze note The storage engine for the table doesn't support analyze
7586
CHECK TABLE t1 EXTENDED;
7587
Table Op Msg_type Msg_text
7588
test.t1 check note The storage engine for the table doesn't support check
7589
CHECKSUM TABLE t1 EXTENDED;
7591
test.t1 <some_value>
7593
Table Op Msg_type Msg_text
7594
test.t1 optimize note The storage engine for the table doesn't support optimize
7595
# check layout success: 1
7596
REPAIR TABLE t1 EXTENDED;
7597
Table Op Msg_type Msg_text
7598
test.t1 repair note The storage engine for the table doesn't support repair
7599
# check layout success: 1
7602
# check TRUNCATE success: 1
7603
# check layout success: 1
7604
# End usability test (inc/partition_check.inc)
7606
#------------------------------------------------------------------------
7607
# 2 Tables with PRIMARY KEY and/or UNIQUE INDEXes
7608
# The partitioning function contains one column.
7609
#------------------------------------------------------------------------
7610
# 2.5 PRIMARY KEY + UNIQUE INDEX consisting of two columns
7611
DROP TABLE IF EXISTS t1;
7617
f_charbig VARCHAR(1000)
7618
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
7620
PARTITION BY HASH(f_int1) PARTITIONS 2;
7621
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
7622
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
7623
# Start usability test (inc/partition_check.inc)
7625
SHOW CREATE TABLE t1;
7627
t1 CREATE TABLE `t1` (
7628
`f_int1` int(11) DEFAULT NULL,
7629
`f_int2` int(11) DEFAULT NULL,
7630
`f_char1` char(20) DEFAULT NULL,
7631
`f_char2` char(20) DEFAULT NULL,
7632
`f_charbig` varchar(1000) DEFAULT NULL,
7633
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
7634
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
7635
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */
7638
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
7639
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
7640
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
7641
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
7642
$MYSQLTEST_VARDIR/master-data/test/t1.frm
7643
$MYSQLTEST_VARDIR/master-data/test/t1.par
7645
# check prerequisites-1 success: 1
7646
# check COUNT(*) success: 1
7647
# check MIN/MAX(f_int1) success: 1
7648
# check MIN/MAX(f_int2) success: 1
7649
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7650
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
7651
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
7652
WHERE f_int1 IN (2,3);
7653
ERROR 23000: Can't write; duplicate key in table 't1'
7654
# check prerequisites-3 success: 1
7655
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
7656
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7657
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
7658
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
7659
WHERE f_int1 IN (2,3);
7660
DELETE FROM t1 WHERE f_charbig = 'delete me';
7661
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7662
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
7663
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
7664
WHERE f_int1 IN (2,3);
7665
DELETE FROM t1 WHERE f_charbig = 'delete me';
7666
# check read via f_int1 success: 1
7667
# check read via f_int2 success: 1
7669
# check multiple-1 success: 1
7670
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
7672
# check multiple-2 success: 1
7673
INSERT INTO t1 SELECT * FROM t0_template
7674
WHERE MOD(f_int1,3) = 0;
7676
# check multiple-3 success: 1
7677
UPDATE t1 SET f_int1 = f_int1 + @max_row
7678
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
7679
AND @max_row_div2 + @max_row_div4;
7681
# check multiple-4 success: 1
7683
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
7684
AND @max_row_div2 + @max_row_div4 + @max_row;
7686
# check multiple-5 success: 1
7687
SELECT COUNT(*) INTO @try_count FROM t0_template
7688
WHERE MOD(f_int1,3) = 0
7689
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
7690
SELECT COUNT(*) INTO @clash_count
7691
FROM t1 INNER JOIN t0_template USING(f_int1)
7692
WHERE MOD(f_int1,3) = 0
7693
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
7694
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
7696
SET f_int1 = @cur_value , f_int2 = @cur_value,
7697
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
7698
f_charbig = '#SINGLE#';
7700
# check single-1 success: 1
7701
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
7703
SET f_int1 = @cur_value , f_int2 = @cur_value,
7704
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
7705
f_charbig = '#SINGLE#';
7707
# check single-2 success: 1
7708
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
7709
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
7710
UPDATE t1 SET f_int1 = @cur_value2
7711
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
7713
# check single-3 success: 1
7714
SET @cur_value1= -1;
7715
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
7716
UPDATE t1 SET f_int1 = @cur_value1
7717
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
7719
# check single-4 success: 1
7720
SELECT MAX(f_int1) INTO @cur_value FROM t1;
7721
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
7723
# check single-5 success: 1
7724
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
7726
# check single-6 success: 1
7727
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
7729
# check single-7 success: 1
7730
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
7731
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
7732
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
7733
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
7734
f_charbig = '#NULL#';
7736
SET f_int1 = NULL , f_int2 = -@max_row,
7737
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
7738
f_charbig = '#NULL#';
7739
# check null success: 1
7741
# check null-1 success: 1
7742
UPDATE t1 SET f_int1 = -@max_row
7743
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
7744
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
7746
# check null-2 success: 1
7747
UPDATE t1 SET f_int1 = NULL
7748
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
7749
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
7751
# check null-3 success: 1
7753
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
7754
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
7756
# check null-4 success: 1
7758
WHERE f_int1 = 0 AND f_int2 = 0
7759
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
7760
AND f_charbig = '#NULL#';
7761
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7762
SELECT f_int1, f_int1, '', '', 'was inserted'
7763
FROM t0_template source_tab
7764
WHERE MOD(f_int1,3) = 0
7765
AND f_int1 BETWEEN @max_row_div2 AND @max_row
7767
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
7768
f_int2 = 2 * @max_row + source_tab.f_int1,
7769
f_charbig = 'was updated';
7771
# check unique-1-a success: 1
7773
# check unique-1-b success: 1
7774
DELETE FROM t1 WHERE f_charbig = 'was inserted';
7775
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7776
f_int2 = CAST(f_char1 AS SIGNED INT),
7777
f_charbig = CONCAT('===',f_char1,'===')
7778
WHERE f_charbig = 'was updated';
7779
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7780
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
7781
FROM t0_template source_tab
7782
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
7784
# check replace success: 1
7786
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
7788
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
7789
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
7790
UPDATE t1 SET f_int2 = f_int1,
7791
f_char1 = CAST(f_int1 AS CHAR),
7792
f_char2 = CAST(f_int1 AS CHAR),
7793
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
7794
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
7796
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7797
SELECT f_int1, f_int1, '', '', 'was inserted'
7798
FROM t0_template source_tab
7799
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
7801
# check transactions-1 success: 1
7804
# check transactions-2 success: 1
7807
# check transactions-3 success: 1
7808
DELETE FROM t1 WHERE f_charbig = 'was inserted';
7812
# check transactions-4 success: 1
7813
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7814
SELECT f_int1, f_int1, '', '', 'was inserted'
7815
FROM t0_template source_tab
7816
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
7818
# check transactions-5 success: 1
7821
Warning 1196 Some non-transactional changed tables couldn't be rolled back
7823
# check transactions-6 success: 1
7824
# INFO: Storage engine used for t1 seems to be not transactional.
7827
# check transactions-7 success: 1
7828
DELETE FROM t1 WHERE f_charbig = 'was inserted';
7830
SET @@session.sql_mode = 'traditional';
7831
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
7832
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
7833
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
7834
'', '', 'was inserted' FROM t0_template
7835
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
7836
ERROR 22012: Division by 0
7839
# check transactions-8 success: 1
7840
# INFO: Storage engine used for t1 seems to be unable to revert
7841
# changes made by the failing statement.
7842
SET @@session.sql_mode = '';
7844
DELETE FROM t1 WHERE f_charbig = 'was inserted';
7846
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
7848
# check special-1 success: 1
7849
UPDATE t1 SET f_charbig = '';
7851
# check special-2 success: 1
7852
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
7853
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
7854
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
7855
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7856
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7857
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7858
'just inserted' FROM t0_template
7859
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7860
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
7862
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7863
f_charbig = 'updated by trigger'
7864
WHERE f_int1 = new.f_int1;
7866
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7867
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
7868
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7870
# check trigger-1 success: 1
7872
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7873
f_int2 = CAST(f_char1 AS SIGNED INT),
7874
f_charbig = 'just inserted'
7875
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7877
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7878
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7879
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7880
'just inserted' FROM t0_template
7881
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7882
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
7884
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7885
f_charbig = 'updated by trigger'
7886
WHERE f_int1 = new.f_int1;
7888
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7889
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
7890
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7892
# check trigger-2 success: 1
7894
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7895
f_int2 = CAST(f_char1 AS SIGNED INT),
7896
f_charbig = 'just inserted'
7897
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7899
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7900
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7901
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7902
'just inserted' FROM t0_template
7903
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7904
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
7906
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7907
f_charbig = 'updated by trigger'
7908
WHERE f_int1 = new.f_int1;
7910
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
7911
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7913
# check trigger-3 success: 1
7915
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7916
f_int2 = CAST(f_char1 AS SIGNED INT),
7917
f_charbig = 'just inserted'
7918
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7920
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7921
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7922
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7923
'just inserted' FROM t0_template
7924
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7925
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
7927
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7928
f_charbig = 'updated by trigger'
7929
WHERE f_int1 = - old.f_int1;
7931
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
7932
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7934
# check trigger-4 success: 1
7936
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7937
f_int2 = CAST(f_char1 AS SIGNED INT),
7938
f_charbig = 'just inserted'
7939
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7941
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7942
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7943
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7944
'just inserted' FROM t0_template
7945
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7946
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
7948
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7949
f_charbig = 'updated by trigger'
7950
WHERE f_int1 = new.f_int1;
7952
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
7953
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7955
# check trigger-5 success: 1
7957
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7958
f_int2 = CAST(f_char1 AS SIGNED INT),
7959
f_charbig = 'just inserted'
7960
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7962
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7963
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7964
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7965
'just inserted' FROM t0_template
7966
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7967
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
7969
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7970
f_charbig = 'updated by trigger'
7971
WHERE f_int1 = - old.f_int1;
7973
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
7974
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7976
# check trigger-6 success: 1
7978
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
7979
f_int2 = CAST(f_char1 AS SIGNED INT),
7980
f_charbig = 'just inserted'
7981
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
7983
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7984
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
7985
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
7986
'just inserted' FROM t0_template
7987
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
7988
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
7990
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
7991
f_charbig = 'updated by trigger'
7992
WHERE f_int1 = - old.f_int1;
7995
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
7997
# check trigger-7 success: 1
7999
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8000
f_int2 = CAST(f_char1 AS SIGNED INT),
8001
f_charbig = 'just inserted'
8002
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8004
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8005
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8006
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8007
'just inserted' FROM t0_template
8008
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8009
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
8011
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8012
f_charbig = 'updated by trigger'
8013
WHERE f_int1 = - old.f_int1;
8016
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8018
# check trigger-8 success: 1
8020
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8021
f_int2 = CAST(f_char1 AS SIGNED INT),
8022
f_charbig = 'just inserted'
8023
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8025
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8027
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8028
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
8030
SET new.f_int1 = old.f_int1 + @max_row,
8031
new.f_int2 = old.f_int2 - @max_row,
8032
new.f_charbig = '####updated per update trigger####';
8035
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
8036
f_charbig = '####updated per update statement itself####';
8038
# check trigger-9 success: 1
8040
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8041
f_int2 = CAST(f_char1 AS SIGNED INT),
8042
f_charbig = CONCAT('===',f_char1,'===');
8043
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
8045
SET new.f_int1 = new.f_int1 + @max_row,
8046
new.f_int2 = new.f_int2 - @max_row,
8047
new.f_charbig = '####updated per update trigger####';
8050
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
8051
f_charbig = '####updated per update statement itself####';
8053
# check trigger-10 success: 1
8055
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8056
f_int2 = CAST(f_char1 AS SIGNED INT),
8057
f_charbig = CONCAT('===',f_char1,'===');
8058
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
8060
SET new.f_int1 = @my_max1 + @counter,
8061
new.f_int2 = @my_min2 - @counter,
8062
new.f_charbig = '####updated per insert trigger####';
8063
SET @counter = @counter + 1;
8066
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
8067
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8068
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
8069
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
8070
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
8074
# check trigger-11 success: 1
8076
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
8077
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
8078
AND f_charbig = '####updated per insert trigger####';
8079
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
8081
SET new.f_int1 = @my_max1 + @counter,
8082
new.f_int2 = @my_min2 - @counter,
8083
new.f_charbig = '####updated per insert trigger####';
8084
SET @counter = @counter + 1;
8087
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
8088
INSERT INTO t1 (f_char1, f_char2, f_charbig)
8089
SELECT CAST(f_int1 AS CHAR),
8090
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
8091
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
8095
# check trigger-12 success: 1
8097
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
8098
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
8099
AND f_charbig = '####updated per insert trigger####';
8101
Table Op Msg_type Msg_text
8102
test.t1 analyze note The storage engine for the table doesn't support analyze
8103
CHECK TABLE t1 EXTENDED;
8104
Table Op Msg_type Msg_text
8105
test.t1 check note The storage engine for the table doesn't support check
8106
CHECKSUM TABLE t1 EXTENDED;
8108
test.t1 <some_value>
8110
Table Op Msg_type Msg_text
8111
test.t1 optimize note The storage engine for the table doesn't support optimize
8112
# check layout success: 1
8113
REPAIR TABLE t1 EXTENDED;
8114
Table Op Msg_type Msg_text
8115
test.t1 repair note The storage engine for the table doesn't support repair
8116
# check layout success: 1
8119
# check TRUNCATE success: 1
8120
# check layout success: 1
8121
# End usability test (inc/partition_check.inc)
8128
f_charbig VARCHAR(1000)
8129
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
8131
PARTITION BY KEY(f_int1) PARTITIONS 5;
8132
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
8133
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
8134
# Start usability test (inc/partition_check.inc)
8136
SHOW CREATE TABLE t1;
8138
t1 CREATE TABLE `t1` (
8139
`f_int1` int(11) DEFAULT NULL,
8140
`f_int2` int(11) DEFAULT NULL,
8141
`f_char1` char(20) DEFAULT NULL,
8142
`f_char2` char(20) DEFAULT NULL,
8143
`f_charbig` varchar(1000) DEFAULT NULL,
8144
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
8145
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
8146
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */
8149
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
8150
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
8151
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
8152
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
8153
$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD
8154
$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI
8155
$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD
8156
$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI
8157
$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
8158
$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
8159
$MYSQLTEST_VARDIR/master-data/test/t1.frm
8160
$MYSQLTEST_VARDIR/master-data/test/t1.par
8162
# check prerequisites-1 success: 1
8163
# check COUNT(*) success: 1
8164
# check MIN/MAX(f_int1) success: 1
8165
# check MIN/MAX(f_int2) success: 1
8166
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8167
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
8168
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
8169
WHERE f_int1 IN (2,3);
8170
ERROR 23000: Can't write; duplicate key in table 't1'
8171
# check prerequisites-3 success: 1
8172
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
8173
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8174
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
8175
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
8176
WHERE f_int1 IN (2,3);
8177
DELETE FROM t1 WHERE f_charbig = 'delete me';
8178
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8179
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
8180
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
8181
WHERE f_int1 IN (2,3);
8182
DELETE FROM t1 WHERE f_charbig = 'delete me';
8183
# check read via f_int1 success: 1
8184
# check read via f_int2 success: 1
8186
# check multiple-1 success: 1
8187
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
8189
# check multiple-2 success: 1
8190
INSERT INTO t1 SELECT * FROM t0_template
8191
WHERE MOD(f_int1,3) = 0;
8193
# check multiple-3 success: 1
8194
UPDATE t1 SET f_int1 = f_int1 + @max_row
8195
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
8196
AND @max_row_div2 + @max_row_div4;
8198
# check multiple-4 success: 1
8200
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
8201
AND @max_row_div2 + @max_row_div4 + @max_row;
8203
# check multiple-5 success: 1
8204
SELECT COUNT(*) INTO @try_count FROM t0_template
8205
WHERE MOD(f_int1,3) = 0
8206
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
8207
SELECT COUNT(*) INTO @clash_count
8208
FROM t1 INNER JOIN t0_template USING(f_int1)
8209
WHERE MOD(f_int1,3) = 0
8210
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
8211
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
8213
SET f_int1 = @cur_value , f_int2 = @cur_value,
8214
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
8215
f_charbig = '#SINGLE#';
8217
# check single-1 success: 1
8218
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
8220
SET f_int1 = @cur_value , f_int2 = @cur_value,
8221
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
8222
f_charbig = '#SINGLE#';
8224
# check single-2 success: 1
8225
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
8226
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
8227
UPDATE t1 SET f_int1 = @cur_value2
8228
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
8230
# check single-3 success: 1
8231
SET @cur_value1= -1;
8232
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
8233
UPDATE t1 SET f_int1 = @cur_value1
8234
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
8236
# check single-4 success: 1
8237
SELECT MAX(f_int1) INTO @cur_value FROM t1;
8238
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
8240
# check single-5 success: 1
8241
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
8243
# check single-6 success: 1
8244
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
8246
# check single-7 success: 1
8247
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
8248
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
8249
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
8250
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
8251
f_charbig = '#NULL#';
8253
SET f_int1 = NULL , f_int2 = -@max_row,
8254
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
8255
f_charbig = '#NULL#';
8256
# check null success: 1
8258
# check null-1 success: 1
8259
UPDATE t1 SET f_int1 = -@max_row
8260
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
8261
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
8263
# check null-2 success: 1
8264
UPDATE t1 SET f_int1 = NULL
8265
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
8266
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
8268
# check null-3 success: 1
8270
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
8271
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
8273
# check null-4 success: 1
8275
WHERE f_int1 = 0 AND f_int2 = 0
8276
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
8277
AND f_charbig = '#NULL#';
8278
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8279
SELECT f_int1, f_int1, '', '', 'was inserted'
8280
FROM t0_template source_tab
8281
WHERE MOD(f_int1,3) = 0
8282
AND f_int1 BETWEEN @max_row_div2 AND @max_row
8284
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
8285
f_int2 = 2 * @max_row + source_tab.f_int1,
8286
f_charbig = 'was updated';
8288
# check unique-1-a success: 1
8290
# check unique-1-b success: 1
8291
DELETE FROM t1 WHERE f_charbig = 'was inserted';
8292
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8293
f_int2 = CAST(f_char1 AS SIGNED INT),
8294
f_charbig = CONCAT('===',f_char1,'===')
8295
WHERE f_charbig = 'was updated';
8296
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8297
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
8298
FROM t0_template source_tab
8299
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
8301
# check replace success: 1
8303
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
8305
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
8306
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
8307
UPDATE t1 SET f_int2 = f_int1,
8308
f_char1 = CAST(f_int1 AS CHAR),
8309
f_char2 = CAST(f_int1 AS CHAR),
8310
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
8311
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
8313
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8314
SELECT f_int1, f_int1, '', '', 'was inserted'
8315
FROM t0_template source_tab
8316
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
8318
# check transactions-1 success: 1
8321
# check transactions-2 success: 1
8324
# check transactions-3 success: 1
8325
DELETE FROM t1 WHERE f_charbig = 'was inserted';
8329
# check transactions-4 success: 1
8330
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8331
SELECT f_int1, f_int1, '', '', 'was inserted'
8332
FROM t0_template source_tab
8333
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
8335
# check transactions-5 success: 1
8338
Warning 1196 Some non-transactional changed tables couldn't be rolled back
8340
# check transactions-6 success: 1
8341
# INFO: Storage engine used for t1 seems to be not transactional.
8344
# check transactions-7 success: 1
8345
DELETE FROM t1 WHERE f_charbig = 'was inserted';
8347
SET @@session.sql_mode = 'traditional';
8348
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
8349
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8350
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
8351
'', '', 'was inserted' FROM t0_template
8352
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
8353
ERROR 22012: Division by 0
8356
# check transactions-8 success: 1
8357
# INFO: Storage engine used for t1 seems to be unable to revert
8358
# changes made by the failing statement.
8359
SET @@session.sql_mode = '';
8361
DELETE FROM t1 WHERE f_charbig = 'was inserted';
8363
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
8365
# check special-1 success: 1
8366
UPDATE t1 SET f_charbig = '';
8368
# check special-2 success: 1
8369
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
8370
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
8371
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
8372
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8373
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8374
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8375
'just inserted' FROM t0_template
8376
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8377
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
8379
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8380
f_charbig = 'updated by trigger'
8381
WHERE f_int1 = new.f_int1;
8383
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8384
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
8385
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8387
# check trigger-1 success: 1
8389
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8390
f_int2 = CAST(f_char1 AS SIGNED INT),
8391
f_charbig = 'just inserted'
8392
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8394
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8395
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8396
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8397
'just inserted' FROM t0_template
8398
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8399
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
8401
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8402
f_charbig = 'updated by trigger'
8403
WHERE f_int1 = new.f_int1;
8405
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8406
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
8407
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8409
# check trigger-2 success: 1
8411
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8412
f_int2 = CAST(f_char1 AS SIGNED INT),
8413
f_charbig = 'just inserted'
8414
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8416
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8417
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8418
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8419
'just inserted' FROM t0_template
8420
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8421
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
8423
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8424
f_charbig = 'updated by trigger'
8425
WHERE f_int1 = new.f_int1;
8427
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
8428
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8430
# check trigger-3 success: 1
8432
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8433
f_int2 = CAST(f_char1 AS SIGNED INT),
8434
f_charbig = 'just inserted'
8435
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8437
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8438
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8439
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8440
'just inserted' FROM t0_template
8441
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8442
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
8444
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8445
f_charbig = 'updated by trigger'
8446
WHERE f_int1 = - old.f_int1;
8448
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
8449
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8451
# check trigger-4 success: 1
8453
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8454
f_int2 = CAST(f_char1 AS SIGNED INT),
8455
f_charbig = 'just inserted'
8456
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8458
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8459
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8460
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8461
'just inserted' FROM t0_template
8462
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8463
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
8465
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8466
f_charbig = 'updated by trigger'
8467
WHERE f_int1 = new.f_int1;
8469
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
8470
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8472
# check trigger-5 success: 1
8474
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8475
f_int2 = CAST(f_char1 AS SIGNED INT),
8476
f_charbig = 'just inserted'
8477
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8479
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8480
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8481
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8482
'just inserted' FROM t0_template
8483
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8484
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
8486
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8487
f_charbig = 'updated by trigger'
8488
WHERE f_int1 = - old.f_int1;
8490
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
8491
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8493
# check trigger-6 success: 1
8495
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8496
f_int2 = CAST(f_char1 AS SIGNED INT),
8497
f_charbig = 'just inserted'
8498
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8500
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8501
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8502
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8503
'just inserted' FROM t0_template
8504
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8505
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
8507
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8508
f_charbig = 'updated by trigger'
8509
WHERE f_int1 = - old.f_int1;
8512
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8514
# check trigger-7 success: 1
8516
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8517
f_int2 = CAST(f_char1 AS SIGNED INT),
8518
f_charbig = 'just inserted'
8519
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8521
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8522
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8523
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8524
'just inserted' FROM t0_template
8525
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8526
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
8528
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8529
f_charbig = 'updated by trigger'
8530
WHERE f_int1 = - old.f_int1;
8533
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8535
# check trigger-8 success: 1
8537
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8538
f_int2 = CAST(f_char1 AS SIGNED INT),
8539
f_charbig = 'just inserted'
8540
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8542
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8544
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8545
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
8547
SET new.f_int1 = old.f_int1 + @max_row,
8548
new.f_int2 = old.f_int2 - @max_row,
8549
new.f_charbig = '####updated per update trigger####';
8552
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
8553
f_charbig = '####updated per update statement itself####';
8555
# check trigger-9 success: 1
8557
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8558
f_int2 = CAST(f_char1 AS SIGNED INT),
8559
f_charbig = CONCAT('===',f_char1,'===');
8560
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
8562
SET new.f_int1 = new.f_int1 + @max_row,
8563
new.f_int2 = new.f_int2 - @max_row,
8564
new.f_charbig = '####updated per update trigger####';
8567
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
8568
f_charbig = '####updated per update statement itself####';
8570
# check trigger-10 success: 1
8572
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8573
f_int2 = CAST(f_char1 AS SIGNED INT),
8574
f_charbig = CONCAT('===',f_char1,'===');
8575
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
8577
SET new.f_int1 = @my_max1 + @counter,
8578
new.f_int2 = @my_min2 - @counter,
8579
new.f_charbig = '####updated per insert trigger####';
8580
SET @counter = @counter + 1;
8583
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
8584
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8585
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
8586
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
8587
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
8591
# check trigger-11 success: 1
8593
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
8594
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
8595
AND f_charbig = '####updated per insert trigger####';
8596
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
8598
SET new.f_int1 = @my_max1 + @counter,
8599
new.f_int2 = @my_min2 - @counter,
8600
new.f_charbig = '####updated per insert trigger####';
8601
SET @counter = @counter + 1;
8604
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
8605
INSERT INTO t1 (f_char1, f_char2, f_charbig)
8606
SELECT CAST(f_int1 AS CHAR),
8607
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
8608
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
8612
# check trigger-12 success: 1
8614
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
8615
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
8616
AND f_charbig = '####updated per insert trigger####';
8618
Table Op Msg_type Msg_text
8619
test.t1 analyze note The storage engine for the table doesn't support analyze
8620
CHECK TABLE t1 EXTENDED;
8621
Table Op Msg_type Msg_text
8622
test.t1 check note The storage engine for the table doesn't support check
8623
CHECKSUM TABLE t1 EXTENDED;
8625
test.t1 <some_value>
8627
Table Op Msg_type Msg_text
8628
test.t1 optimize note The storage engine for the table doesn't support optimize
8629
# check layout success: 1
8630
REPAIR TABLE t1 EXTENDED;
8631
Table Op Msg_type Msg_text
8632
test.t1 repair note The storage engine for the table doesn't support repair
8633
# check layout success: 1
8636
# check TRUNCATE success: 1
8637
# check layout success: 1
8638
# End usability test (inc/partition_check.inc)
8645
f_charbig VARCHAR(1000)
8646
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
8648
PARTITION BY LIST(MOD(f_int1,4))
8649
(PARTITION part_3 VALUES IN (-3),
8650
PARTITION part_2 VALUES IN (-2),
8651
PARTITION part_1 VALUES IN (-1),
8652
PARTITION part_N VALUES IN (NULL),
8653
PARTITION part0 VALUES IN (0),
8654
PARTITION part1 VALUES IN (1),
8655
PARTITION part2 VALUES IN (2),
8656
PARTITION part3 VALUES IN (3));
8657
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
8658
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
8659
# Start usability test (inc/partition_check.inc)
8661
SHOW CREATE TABLE t1;
8663
t1 CREATE TABLE `t1` (
8664
`f_int1` int(11) DEFAULT NULL,
8665
`f_int2` int(11) DEFAULT NULL,
8666
`f_char1` char(20) DEFAULT NULL,
8667
`f_char2` char(20) DEFAULT NULL,
8668
`f_charbig` varchar(1000) DEFAULT NULL,
8669
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
8670
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
8671
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) ENGINE = MyISAM, PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */
8674
$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD
8675
$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI
8676
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
8677
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
8678
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
8679
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
8680
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD
8681
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI
8682
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD
8683
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI
8684
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD
8685
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI
8686
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD
8687
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI
8688
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD
8689
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI
8690
$MYSQLTEST_VARDIR/master-data/test/t1.frm
8691
$MYSQLTEST_VARDIR/master-data/test/t1.par
8693
# check prerequisites-1 success: 1
8694
# check COUNT(*) success: 1
8695
# check MIN/MAX(f_int1) success: 1
8696
# check MIN/MAX(f_int2) success: 1
8697
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8698
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
8699
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
8700
WHERE f_int1 IN (2,3);
8701
ERROR 23000: Can't write; duplicate key in table 't1'
8702
# check prerequisites-3 success: 1
8703
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
8704
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8705
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
8706
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
8707
WHERE f_int1 IN (2,3);
8708
DELETE FROM t1 WHERE f_charbig = 'delete me';
8709
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8710
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
8711
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
8712
WHERE f_int1 IN (2,3);
8713
DELETE FROM t1 WHERE f_charbig = 'delete me';
8714
# check read via f_int1 success: 1
8715
# check read via f_int2 success: 1
8717
# check multiple-1 success: 1
8718
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
8720
# check multiple-2 success: 1
8721
INSERT INTO t1 SELECT * FROM t0_template
8722
WHERE MOD(f_int1,3) = 0;
8724
# check multiple-3 success: 1
8725
UPDATE t1 SET f_int1 = f_int1 + @max_row
8726
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
8727
AND @max_row_div2 + @max_row_div4;
8729
# check multiple-4 success: 1
8731
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
8732
AND @max_row_div2 + @max_row_div4 + @max_row;
8734
# check multiple-5 success: 1
8735
SELECT COUNT(*) INTO @try_count FROM t0_template
8736
WHERE MOD(f_int1,3) = 0
8737
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
8738
SELECT COUNT(*) INTO @clash_count
8739
FROM t1 INNER JOIN t0_template USING(f_int1)
8740
WHERE MOD(f_int1,3) = 0
8741
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
8742
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
8744
SET f_int1 = @cur_value , f_int2 = @cur_value,
8745
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
8746
f_charbig = '#SINGLE#';
8748
# check single-1 success: 1
8749
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
8751
SET f_int1 = @cur_value , f_int2 = @cur_value,
8752
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
8753
f_charbig = '#SINGLE#';
8755
# check single-2 success: 1
8756
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
8757
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
8758
UPDATE t1 SET f_int1 = @cur_value2
8759
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
8761
# check single-3 success: 1
8762
SET @cur_value1= -1;
8763
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
8764
UPDATE t1 SET f_int1 = @cur_value1
8765
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
8767
# check single-4 success: 1
8768
SELECT MAX(f_int1) INTO @cur_value FROM t1;
8769
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
8771
# check single-5 success: 1
8772
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
8774
# check single-6 success: 1
8775
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
8777
# check single-7 success: 1
8778
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
8779
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
8780
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
8781
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
8782
f_charbig = '#NULL#';
8784
SET f_int1 = NULL , f_int2 = -@max_row,
8785
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
8786
f_charbig = '#NULL#';
8787
# check null success: 1
8789
# check null-1 success: 1
8790
UPDATE t1 SET f_int1 = -@max_row
8791
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
8792
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
8794
# check null-2 success: 1
8795
UPDATE t1 SET f_int1 = NULL
8796
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
8797
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
8799
# check null-3 success: 1
8801
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
8802
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
8804
# check null-4 success: 1
8806
WHERE f_int1 = 0 AND f_int2 = 0
8807
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
8808
AND f_charbig = '#NULL#';
8809
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8810
SELECT f_int1, f_int1, '', '', 'was inserted'
8811
FROM t0_template source_tab
8812
WHERE MOD(f_int1,3) = 0
8813
AND f_int1 BETWEEN @max_row_div2 AND @max_row
8815
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
8816
f_int2 = 2 * @max_row + source_tab.f_int1,
8817
f_charbig = 'was updated';
8819
# check unique-1-a success: 1
8821
# check unique-1-b success: 1
8822
DELETE FROM t1 WHERE f_charbig = 'was inserted';
8823
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8824
f_int2 = CAST(f_char1 AS SIGNED INT),
8825
f_charbig = CONCAT('===',f_char1,'===')
8826
WHERE f_charbig = 'was updated';
8827
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8828
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
8829
FROM t0_template source_tab
8830
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
8832
# check replace success: 1
8834
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
8836
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
8837
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
8838
UPDATE t1 SET f_int2 = f_int1,
8839
f_char1 = CAST(f_int1 AS CHAR),
8840
f_char2 = CAST(f_int1 AS CHAR),
8841
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
8842
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
8844
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8845
SELECT f_int1, f_int1, '', '', 'was inserted'
8846
FROM t0_template source_tab
8847
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
8849
# check transactions-1 success: 1
8852
# check transactions-2 success: 1
8855
# check transactions-3 success: 1
8856
DELETE FROM t1 WHERE f_charbig = 'was inserted';
8860
# check transactions-4 success: 1
8861
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8862
SELECT f_int1, f_int1, '', '', 'was inserted'
8863
FROM t0_template source_tab
8864
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
8866
# check transactions-5 success: 1
8869
Warning 1196 Some non-transactional changed tables couldn't be rolled back
8871
# check transactions-6 success: 1
8872
# INFO: Storage engine used for t1 seems to be not transactional.
8875
# check transactions-7 success: 1
8876
DELETE FROM t1 WHERE f_charbig = 'was inserted';
8878
SET @@session.sql_mode = 'traditional';
8879
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
8880
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
8881
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
8882
'', '', 'was inserted' FROM t0_template
8883
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
8884
ERROR 22012: Division by 0
8887
# check transactions-8 success: 1
8888
# INFO: Storage engine used for t1 seems to be unable to revert
8889
# changes made by the failing statement.
8890
SET @@session.sql_mode = '';
8892
DELETE FROM t1 WHERE f_charbig = 'was inserted';
8894
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
8896
# check special-1 success: 1
8897
UPDATE t1 SET f_charbig = '';
8899
# check special-2 success: 1
8900
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
8901
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
8902
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
8903
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8904
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8905
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8906
'just inserted' FROM t0_template
8907
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8908
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
8910
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8911
f_charbig = 'updated by trigger'
8912
WHERE f_int1 = new.f_int1;
8914
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8915
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
8916
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8918
# check trigger-1 success: 1
8920
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8921
f_int2 = CAST(f_char1 AS SIGNED INT),
8922
f_charbig = 'just inserted'
8923
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8925
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8926
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8927
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8928
'just inserted' FROM t0_template
8929
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8930
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
8932
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8933
f_charbig = 'updated by trigger'
8934
WHERE f_int1 = new.f_int1;
8936
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8937
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
8938
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8940
# check trigger-2 success: 1
8942
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8943
f_int2 = CAST(f_char1 AS SIGNED INT),
8944
f_charbig = 'just inserted'
8945
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8947
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8948
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8949
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8950
'just inserted' FROM t0_template
8951
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8952
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
8954
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8955
f_charbig = 'updated by trigger'
8956
WHERE f_int1 = new.f_int1;
8958
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
8959
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8961
# check trigger-3 success: 1
8963
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8964
f_int2 = CAST(f_char1 AS SIGNED INT),
8965
f_charbig = 'just inserted'
8966
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8968
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8969
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8970
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8971
'just inserted' FROM t0_template
8972
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8973
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
8975
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8976
f_charbig = 'updated by trigger'
8977
WHERE f_int1 = - old.f_int1;
8979
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
8980
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
8982
# check trigger-4 success: 1
8984
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
8985
f_int2 = CAST(f_char1 AS SIGNED INT),
8986
f_charbig = 'just inserted'
8987
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
8989
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8990
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
8991
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
8992
'just inserted' FROM t0_template
8993
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
8994
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
8996
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
8997
f_charbig = 'updated by trigger'
8998
WHERE f_int1 = new.f_int1;
9000
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
9001
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9003
# check trigger-5 success: 1
9005
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9006
f_int2 = CAST(f_char1 AS SIGNED INT),
9007
f_charbig = 'just inserted'
9008
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9010
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9011
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9012
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9013
'just inserted' FROM t0_template
9014
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9015
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
9017
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9018
f_charbig = 'updated by trigger'
9019
WHERE f_int1 = - old.f_int1;
9021
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
9022
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9024
# check trigger-6 success: 1
9026
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9027
f_int2 = CAST(f_char1 AS SIGNED INT),
9028
f_charbig = 'just inserted'
9029
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9031
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9032
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9033
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9034
'just inserted' FROM t0_template
9035
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9036
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
9038
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9039
f_charbig = 'updated by trigger'
9040
WHERE f_int1 = - old.f_int1;
9043
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9045
# check trigger-7 success: 1
9047
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9048
f_int2 = CAST(f_char1 AS SIGNED INT),
9049
f_charbig = 'just inserted'
9050
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9052
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9053
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9054
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9055
'just inserted' FROM t0_template
9056
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9057
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
9059
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9060
f_charbig = 'updated by trigger'
9061
WHERE f_int1 = - old.f_int1;
9064
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9066
# check trigger-8 success: 1
9068
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9069
f_int2 = CAST(f_char1 AS SIGNED INT),
9070
f_charbig = 'just inserted'
9071
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9073
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9075
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9076
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
9078
SET new.f_int1 = old.f_int1 + @max_row,
9079
new.f_int2 = old.f_int2 - @max_row,
9080
new.f_charbig = '####updated per update trigger####';
9083
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
9084
f_charbig = '####updated per update statement itself####';
9086
# check trigger-9 success: 1
9088
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9089
f_int2 = CAST(f_char1 AS SIGNED INT),
9090
f_charbig = CONCAT('===',f_char1,'===');
9091
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
9093
SET new.f_int1 = new.f_int1 + @max_row,
9094
new.f_int2 = new.f_int2 - @max_row,
9095
new.f_charbig = '####updated per update trigger####';
9098
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
9099
f_charbig = '####updated per update statement itself####';
9101
# check trigger-10 success: 1
9103
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9104
f_int2 = CAST(f_char1 AS SIGNED INT),
9105
f_charbig = CONCAT('===',f_char1,'===');
9106
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
9108
SET new.f_int1 = @my_max1 + @counter,
9109
new.f_int2 = @my_min2 - @counter,
9110
new.f_charbig = '####updated per insert trigger####';
9111
SET @counter = @counter + 1;
9114
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
9115
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9116
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
9117
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
9118
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
9122
# check trigger-11 success: 1
9124
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
9125
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
9126
AND f_charbig = '####updated per insert trigger####';
9127
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
9129
SET new.f_int1 = @my_max1 + @counter,
9130
new.f_int2 = @my_min2 - @counter,
9131
new.f_charbig = '####updated per insert trigger####';
9132
SET @counter = @counter + 1;
9135
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
9136
INSERT INTO t1 (f_char1, f_char2, f_charbig)
9137
SELECT CAST(f_int1 AS CHAR),
9138
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
9139
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
9143
# check trigger-12 success: 1
9145
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
9146
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
9147
AND f_charbig = '####updated per insert trigger####';
9149
Table Op Msg_type Msg_text
9150
test.t1 analyze note The storage engine for the table doesn't support analyze
9151
CHECK TABLE t1 EXTENDED;
9152
Table Op Msg_type Msg_text
9153
test.t1 check note The storage engine for the table doesn't support check
9154
CHECKSUM TABLE t1 EXTENDED;
9156
test.t1 <some_value>
9158
Table Op Msg_type Msg_text
9159
test.t1 optimize note The storage engine for the table doesn't support optimize
9160
# check layout success: 1
9161
REPAIR TABLE t1 EXTENDED;
9162
Table Op Msg_type Msg_text
9163
test.t1 repair note The storage engine for the table doesn't support repair
9164
# check layout success: 1
9167
# check TRUNCATE success: 1
9168
# check layout success: 1
9169
# End usability test (inc/partition_check.inc)
9176
f_charbig VARCHAR(1000)
9177
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
9179
PARTITION BY RANGE(f_int1)
9180
(PARTITION parta VALUES LESS THAN (0),
9181
PARTITION partb VALUES LESS THAN (5),
9182
PARTITION partc VALUES LESS THAN (10),
9183
PARTITION partd VALUES LESS THAN (10 + 5),
9184
PARTITION parte VALUES LESS THAN (20),
9185
PARTITION partf VALUES LESS THAN (2147483646));
9186
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
9187
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
9188
# Start usability test (inc/partition_check.inc)
9190
SHOW CREATE TABLE t1;
9192
t1 CREATE TABLE `t1` (
9193
`f_int1` int(11) DEFAULT NULL,
9194
`f_int2` int(11) DEFAULT NULL,
9195
`f_char1` char(20) DEFAULT NULL,
9196
`f_char2` char(20) DEFAULT NULL,
9197
`f_charbig` varchar(1000) DEFAULT NULL,
9198
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
9199
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
9200
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */
9203
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD
9204
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI
9205
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD
9206
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI
9207
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD
9208
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI
9209
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD
9210
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI
9211
$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD
9212
$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI
9213
$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD
9214
$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI
9215
$MYSQLTEST_VARDIR/master-data/test/t1.frm
9216
$MYSQLTEST_VARDIR/master-data/test/t1.par
9218
# check prerequisites-1 success: 1
9219
# check COUNT(*) success: 1
9220
# check MIN/MAX(f_int1) success: 1
9221
# check MIN/MAX(f_int2) success: 1
9222
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9223
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
9224
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
9225
WHERE f_int1 IN (2,3);
9226
ERROR 23000: Can't write; duplicate key in table 't1'
9227
# check prerequisites-3 success: 1
9228
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
9229
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9230
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
9231
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
9232
WHERE f_int1 IN (2,3);
9233
DELETE FROM t1 WHERE f_charbig = 'delete me';
9234
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9235
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
9236
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
9237
WHERE f_int1 IN (2,3);
9238
DELETE FROM t1 WHERE f_charbig = 'delete me';
9239
# check read via f_int1 success: 1
9240
# check read via f_int2 success: 1
9242
# check multiple-1 success: 1
9243
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
9245
# check multiple-2 success: 1
9246
INSERT INTO t1 SELECT * FROM t0_template
9247
WHERE MOD(f_int1,3) = 0;
9249
# check multiple-3 success: 1
9250
UPDATE t1 SET f_int1 = f_int1 + @max_row
9251
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
9252
AND @max_row_div2 + @max_row_div4;
9254
# check multiple-4 success: 1
9256
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
9257
AND @max_row_div2 + @max_row_div4 + @max_row;
9259
# check multiple-5 success: 1
9260
SELECT COUNT(*) INTO @try_count FROM t0_template
9261
WHERE MOD(f_int1,3) = 0
9262
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
9263
SELECT COUNT(*) INTO @clash_count
9264
FROM t1 INNER JOIN t0_template USING(f_int1)
9265
WHERE MOD(f_int1,3) = 0
9266
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
9267
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
9269
SET f_int1 = @cur_value , f_int2 = @cur_value,
9270
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
9271
f_charbig = '#SINGLE#';
9273
# check single-1 success: 1
9274
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
9276
SET f_int1 = @cur_value , f_int2 = @cur_value,
9277
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
9278
f_charbig = '#SINGLE#';
9280
# check single-2 success: 1
9281
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
9282
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
9283
UPDATE t1 SET f_int1 = @cur_value2
9284
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
9286
# check single-3 success: 1
9287
SET @cur_value1= -1;
9288
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
9289
UPDATE t1 SET f_int1 = @cur_value1
9290
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
9292
# check single-4 success: 1
9293
SELECT MAX(f_int1) INTO @cur_value FROM t1;
9294
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
9296
# check single-5 success: 1
9297
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
9299
# check single-6 success: 1
9300
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
9301
ERROR HY000: Table has no partition for value 2147483647
9302
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
9303
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
9304
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
9305
f_charbig = '#NULL#';
9307
SET f_int1 = NULL , f_int2 = -@max_row,
9308
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
9309
f_charbig = '#NULL#';
9310
# check null success: 1
9312
# check null-1 success: 1
9313
UPDATE t1 SET f_int1 = -@max_row
9314
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
9315
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
9317
# check null-2 success: 1
9318
UPDATE t1 SET f_int1 = NULL
9319
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
9320
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
9322
# check null-3 success: 1
9324
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
9325
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
9327
# check null-4 success: 1
9329
WHERE f_int1 = 0 AND f_int2 = 0
9330
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
9331
AND f_charbig = '#NULL#';
9332
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9333
SELECT f_int1, f_int1, '', '', 'was inserted'
9334
FROM t0_template source_tab
9335
WHERE MOD(f_int1,3) = 0
9336
AND f_int1 BETWEEN @max_row_div2 AND @max_row
9338
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
9339
f_int2 = 2 * @max_row + source_tab.f_int1,
9340
f_charbig = 'was updated';
9342
# check unique-1-a success: 1
9344
# check unique-1-b success: 1
9345
DELETE FROM t1 WHERE f_charbig = 'was inserted';
9346
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9347
f_int2 = CAST(f_char1 AS SIGNED INT),
9348
f_charbig = CONCAT('===',f_char1,'===')
9349
WHERE f_charbig = 'was updated';
9350
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9351
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
9352
FROM t0_template source_tab
9353
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
9355
# check replace success: 1
9357
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
9359
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
9360
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
9361
UPDATE t1 SET f_int2 = f_int1,
9362
f_char1 = CAST(f_int1 AS CHAR),
9363
f_char2 = CAST(f_int1 AS CHAR),
9364
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
9365
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
9367
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9368
SELECT f_int1, f_int1, '', '', 'was inserted'
9369
FROM t0_template source_tab
9370
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
9372
# check transactions-1 success: 1
9375
# check transactions-2 success: 1
9378
# check transactions-3 success: 1
9379
DELETE FROM t1 WHERE f_charbig = 'was inserted';
9383
# check transactions-4 success: 1
9384
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9385
SELECT f_int1, f_int1, '', '', 'was inserted'
9386
FROM t0_template source_tab
9387
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
9389
# check transactions-5 success: 1
9392
Warning 1196 Some non-transactional changed tables couldn't be rolled back
9394
# check transactions-6 success: 1
9395
# INFO: Storage engine used for t1 seems to be not transactional.
9398
# check transactions-7 success: 1
9399
DELETE FROM t1 WHERE f_charbig = 'was inserted';
9401
SET @@session.sql_mode = 'traditional';
9402
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
9403
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9404
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
9405
'', '', 'was inserted' FROM t0_template
9406
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
9407
ERROR 22012: Division by 0
9410
# check transactions-8 success: 1
9411
# INFO: Storage engine used for t1 seems to be unable to revert
9412
# changes made by the failing statement.
9413
SET @@session.sql_mode = '';
9415
DELETE FROM t1 WHERE f_charbig = 'was inserted';
9417
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
9419
# check special-1 success: 1
9420
UPDATE t1 SET f_charbig = '';
9422
# check special-2 success: 1
9423
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
9424
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
9425
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
9426
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9427
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9428
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9429
'just inserted' FROM t0_template
9430
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9431
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
9433
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9434
f_charbig = 'updated by trigger'
9435
WHERE f_int1 = new.f_int1;
9437
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9438
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
9439
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9441
# check trigger-1 success: 1
9443
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9444
f_int2 = CAST(f_char1 AS SIGNED INT),
9445
f_charbig = 'just inserted'
9446
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9448
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9449
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9450
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9451
'just inserted' FROM t0_template
9452
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9453
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
9455
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9456
f_charbig = 'updated by trigger'
9457
WHERE f_int1 = new.f_int1;
9459
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9460
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
9461
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9463
# check trigger-2 success: 1
9465
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9466
f_int2 = CAST(f_char1 AS SIGNED INT),
9467
f_charbig = 'just inserted'
9468
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9470
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9471
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9472
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9473
'just inserted' FROM t0_template
9474
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9475
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
9477
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9478
f_charbig = 'updated by trigger'
9479
WHERE f_int1 = new.f_int1;
9481
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
9482
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9484
# check trigger-3 success: 1
9486
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9487
f_int2 = CAST(f_char1 AS SIGNED INT),
9488
f_charbig = 'just inserted'
9489
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9491
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9492
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9493
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9494
'just inserted' FROM t0_template
9495
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9496
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
9498
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9499
f_charbig = 'updated by trigger'
9500
WHERE f_int1 = - old.f_int1;
9502
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
9503
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9505
# check trigger-4 success: 1
9507
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9508
f_int2 = CAST(f_char1 AS SIGNED INT),
9509
f_charbig = 'just inserted'
9510
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9512
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9513
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9514
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9515
'just inserted' FROM t0_template
9516
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9517
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
9519
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9520
f_charbig = 'updated by trigger'
9521
WHERE f_int1 = new.f_int1;
9523
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
9524
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9526
# check trigger-5 success: 1
9528
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9529
f_int2 = CAST(f_char1 AS SIGNED INT),
9530
f_charbig = 'just inserted'
9531
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9533
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9534
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9535
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9536
'just inserted' FROM t0_template
9537
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9538
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
9540
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9541
f_charbig = 'updated by trigger'
9542
WHERE f_int1 = - old.f_int1;
9544
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
9545
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9547
# check trigger-6 success: 1
9549
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9550
f_int2 = CAST(f_char1 AS SIGNED INT),
9551
f_charbig = 'just inserted'
9552
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9554
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9555
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9556
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9557
'just inserted' FROM t0_template
9558
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9559
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
9561
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9562
f_charbig = 'updated by trigger'
9563
WHERE f_int1 = - old.f_int1;
9566
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9568
# check trigger-7 success: 1
9570
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9571
f_int2 = CAST(f_char1 AS SIGNED INT),
9572
f_charbig = 'just inserted'
9573
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9575
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9576
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9577
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9578
'just inserted' FROM t0_template
9579
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9580
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
9582
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9583
f_charbig = 'updated by trigger'
9584
WHERE f_int1 = - old.f_int1;
9587
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
9589
# check trigger-8 success: 1
9591
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9592
f_int2 = CAST(f_char1 AS SIGNED INT),
9593
f_charbig = 'just inserted'
9594
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9596
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9598
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9599
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
9601
SET new.f_int1 = old.f_int1 + @max_row,
9602
new.f_int2 = old.f_int2 - @max_row,
9603
new.f_charbig = '####updated per update trigger####';
9606
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
9607
f_charbig = '####updated per update statement itself####';
9609
# check trigger-9 success: 1
9611
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9612
f_int2 = CAST(f_char1 AS SIGNED INT),
9613
f_charbig = CONCAT('===',f_char1,'===');
9614
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
9616
SET new.f_int1 = new.f_int1 + @max_row,
9617
new.f_int2 = new.f_int2 - @max_row,
9618
new.f_charbig = '####updated per update trigger####';
9621
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
9622
f_charbig = '####updated per update statement itself####';
9624
# check trigger-10 success: 1
9626
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9627
f_int2 = CAST(f_char1 AS SIGNED INT),
9628
f_charbig = CONCAT('===',f_char1,'===');
9629
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
9631
SET new.f_int1 = @my_max1 + @counter,
9632
new.f_int2 = @my_min2 - @counter,
9633
new.f_charbig = '####updated per insert trigger####';
9634
SET @counter = @counter + 1;
9637
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
9638
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9639
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
9640
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
9641
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
9645
# check trigger-11 success: 1
9647
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
9648
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
9649
AND f_charbig = '####updated per insert trigger####';
9650
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
9652
SET new.f_int1 = @my_max1 + @counter,
9653
new.f_int2 = @my_min2 - @counter,
9654
new.f_charbig = '####updated per insert trigger####';
9655
SET @counter = @counter + 1;
9658
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
9659
INSERT INTO t1 (f_char1, f_char2, f_charbig)
9660
SELECT CAST(f_int1 AS CHAR),
9661
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
9662
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
9666
# check trigger-12 success: 1
9668
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
9669
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
9670
AND f_charbig = '####updated per insert trigger####';
9672
Table Op Msg_type Msg_text
9673
test.t1 analyze note The storage engine for the table doesn't support analyze
9674
CHECK TABLE t1 EXTENDED;
9675
Table Op Msg_type Msg_text
9676
test.t1 check note The storage engine for the table doesn't support check
9677
CHECKSUM TABLE t1 EXTENDED;
9679
test.t1 <some_value>
9681
Table Op Msg_type Msg_text
9682
test.t1 optimize note The storage engine for the table doesn't support optimize
9683
# check layout success: 1
9684
REPAIR TABLE t1 EXTENDED;
9685
Table Op Msg_type Msg_text
9686
test.t1 repair note The storage engine for the table doesn't support repair
9687
# check layout success: 1
9690
# check TRUNCATE success: 1
9691
# check layout success: 1
9692
# End usability test (inc/partition_check.inc)
9699
f_charbig VARCHAR(1000)
9700
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
9702
PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
9703
(PARTITION parta VALUES LESS THAN (0),
9704
PARTITION partb VALUES LESS THAN (5),
9705
PARTITION partc VALUES LESS THAN (10),
9706
PARTITION partd VALUES LESS THAN (2147483646));
9707
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
9708
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
9709
# Start usability test (inc/partition_check.inc)
9711
SHOW CREATE TABLE t1;
9713
t1 CREATE TABLE `t1` (
9714
`f_int1` int(11) DEFAULT NULL,
9715
`f_int2` int(11) DEFAULT NULL,
9716
`f_char1` char(20) DEFAULT NULL,
9717
`f_char2` char(20) DEFAULT NULL,
9718
`f_charbig` varchar(1000) DEFAULT NULL,
9719
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
9720
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
9721
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */
9724
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD
9725
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI
9726
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD
9727
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI
9728
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD
9729
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI
9730
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD
9731
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI
9732
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD
9733
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI
9734
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD
9735
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI
9736
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD
9737
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI
9738
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD
9739
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI
9740
$MYSQLTEST_VARDIR/master-data/test/t1.frm
9741
$MYSQLTEST_VARDIR/master-data/test/t1.par
9743
# check prerequisites-1 success: 1
9744
# check COUNT(*) success: 1
9745
# check MIN/MAX(f_int1) success: 1
9746
# check MIN/MAX(f_int2) success: 1
9747
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9748
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
9749
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
9750
WHERE f_int1 IN (2,3);
9751
ERROR 23000: Can't write; duplicate key in table 't1'
9752
# check prerequisites-3 success: 1
9753
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
9754
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9755
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
9756
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
9757
WHERE f_int1 IN (2,3);
9758
DELETE FROM t1 WHERE f_charbig = 'delete me';
9759
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9760
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
9761
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
9762
WHERE f_int1 IN (2,3);
9763
DELETE FROM t1 WHERE f_charbig = 'delete me';
9764
# check read via f_int1 success: 1
9765
# check read via f_int2 success: 1
9767
# check multiple-1 success: 1
9768
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
9770
# check multiple-2 success: 1
9771
INSERT INTO t1 SELECT * FROM t0_template
9772
WHERE MOD(f_int1,3) = 0;
9774
# check multiple-3 success: 1
9775
UPDATE t1 SET f_int1 = f_int1 + @max_row
9776
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
9777
AND @max_row_div2 + @max_row_div4;
9779
# check multiple-4 success: 1
9781
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
9782
AND @max_row_div2 + @max_row_div4 + @max_row;
9784
# check multiple-5 success: 1
9785
SELECT COUNT(*) INTO @try_count FROM t0_template
9786
WHERE MOD(f_int1,3) = 0
9787
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
9788
SELECT COUNT(*) INTO @clash_count
9789
FROM t1 INNER JOIN t0_template USING(f_int1)
9790
WHERE MOD(f_int1,3) = 0
9791
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
9792
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
9794
SET f_int1 = @cur_value , f_int2 = @cur_value,
9795
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
9796
f_charbig = '#SINGLE#';
9798
# check single-1 success: 1
9799
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
9801
SET f_int1 = @cur_value , f_int2 = @cur_value,
9802
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
9803
f_charbig = '#SINGLE#';
9805
# check single-2 success: 1
9806
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
9807
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
9808
UPDATE t1 SET f_int1 = @cur_value2
9809
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
9811
# check single-3 success: 1
9812
SET @cur_value1= -1;
9813
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
9814
UPDATE t1 SET f_int1 = @cur_value1
9815
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
9817
# check single-4 success: 1
9818
SELECT MAX(f_int1) INTO @cur_value FROM t1;
9819
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
9821
# check single-5 success: 1
9822
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
9824
# check single-6 success: 1
9825
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
9827
# check single-7 success: 1
9828
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
9829
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
9830
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
9831
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
9832
f_charbig = '#NULL#';
9834
SET f_int1 = NULL , f_int2 = -@max_row,
9835
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
9836
f_charbig = '#NULL#';
9837
# check null success: 1
9839
# check null-1 success: 1
9840
UPDATE t1 SET f_int1 = -@max_row
9841
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
9842
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
9844
# check null-2 success: 1
9845
UPDATE t1 SET f_int1 = NULL
9846
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
9847
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
9849
# check null-3 success: 1
9851
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
9852
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
9854
# check null-4 success: 1
9856
WHERE f_int1 = 0 AND f_int2 = 0
9857
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
9858
AND f_charbig = '#NULL#';
9859
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9860
SELECT f_int1, f_int1, '', '', 'was inserted'
9861
FROM t0_template source_tab
9862
WHERE MOD(f_int1,3) = 0
9863
AND f_int1 BETWEEN @max_row_div2 AND @max_row
9865
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
9866
f_int2 = 2 * @max_row + source_tab.f_int1,
9867
f_charbig = 'was updated';
9869
# check unique-1-a success: 1
9871
# check unique-1-b success: 1
9872
DELETE FROM t1 WHERE f_charbig = 'was inserted';
9873
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9874
f_int2 = CAST(f_char1 AS SIGNED INT),
9875
f_charbig = CONCAT('===',f_char1,'===')
9876
WHERE f_charbig = 'was updated';
9877
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9878
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
9879
FROM t0_template source_tab
9880
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
9882
# check replace success: 1
9884
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
9886
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
9887
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
9888
UPDATE t1 SET f_int2 = f_int1,
9889
f_char1 = CAST(f_int1 AS CHAR),
9890
f_char2 = CAST(f_int1 AS CHAR),
9891
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
9892
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
9894
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9895
SELECT f_int1, f_int1, '', '', 'was inserted'
9896
FROM t0_template source_tab
9897
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
9899
# check transactions-1 success: 1
9902
# check transactions-2 success: 1
9905
# check transactions-3 success: 1
9906
DELETE FROM t1 WHERE f_charbig = 'was inserted';
9910
# check transactions-4 success: 1
9911
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9912
SELECT f_int1, f_int1, '', '', 'was inserted'
9913
FROM t0_template source_tab
9914
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
9916
# check transactions-5 success: 1
9919
Warning 1196 Some non-transactional changed tables couldn't be rolled back
9921
# check transactions-6 success: 1
9922
# INFO: Storage engine used for t1 seems to be not transactional.
9925
# check transactions-7 success: 1
9926
DELETE FROM t1 WHERE f_charbig = 'was inserted';
9928
SET @@session.sql_mode = 'traditional';
9929
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
9930
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
9931
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
9932
'', '', 'was inserted' FROM t0_template
9933
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
9934
ERROR 22012: Division by 0
9937
# check transactions-8 success: 1
9938
# INFO: Storage engine used for t1 seems to be unable to revert
9939
# changes made by the failing statement.
9940
SET @@session.sql_mode = '';
9942
DELETE FROM t1 WHERE f_charbig = 'was inserted';
9944
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
9946
# check special-1 success: 1
9947
UPDATE t1 SET f_charbig = '';
9949
# check special-2 success: 1
9950
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
9951
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
9952
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
9953
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9954
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9955
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9956
'just inserted' FROM t0_template
9957
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9958
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
9960
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9961
f_charbig = 'updated by trigger'
9962
WHERE f_int1 = new.f_int1;
9964
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9965
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
9966
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9968
# check trigger-1 success: 1
9970
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9971
f_int2 = CAST(f_char1 AS SIGNED INT),
9972
f_charbig = 'just inserted'
9973
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9975
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9976
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9977
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
9978
'just inserted' FROM t0_template
9979
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9980
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
9982
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
9983
f_charbig = 'updated by trigger'
9984
WHERE f_int1 = new.f_int1;
9986
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9987
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
9988
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9990
# check trigger-2 success: 1
9992
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
9993
f_int2 = CAST(f_char1 AS SIGNED INT),
9994
f_charbig = 'just inserted'
9995
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
9997
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
9998
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
9999
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10000
'just inserted' FROM t0_template
10001
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10002
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
10004
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10005
f_charbig = 'updated by trigger'
10006
WHERE f_int1 = new.f_int1;
10008
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
10009
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10011
# check trigger-3 success: 1
10012
DROP TRIGGER trg_1;
10013
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10014
f_int2 = CAST(f_char1 AS SIGNED INT),
10015
f_charbig = 'just inserted'
10016
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10018
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10019
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10020
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10021
'just inserted' FROM t0_template
10022
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10023
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
10025
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10026
f_charbig = 'updated by trigger'
10027
WHERE f_int1 = - old.f_int1;
10029
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
10030
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10032
# check trigger-4 success: 1
10033
DROP TRIGGER trg_1;
10034
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10035
f_int2 = CAST(f_char1 AS SIGNED INT),
10036
f_charbig = 'just inserted'
10037
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10039
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10040
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10041
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10042
'just inserted' FROM t0_template
10043
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10044
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
10046
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10047
f_charbig = 'updated by trigger'
10048
WHERE f_int1 = new.f_int1;
10050
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
10051
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10053
# check trigger-5 success: 1
10054
DROP TRIGGER trg_1;
10055
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10056
f_int2 = CAST(f_char1 AS SIGNED INT),
10057
f_charbig = 'just inserted'
10058
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10060
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10061
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10062
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10063
'just inserted' FROM t0_template
10064
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10065
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
10067
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10068
f_charbig = 'updated by trigger'
10069
WHERE f_int1 = - old.f_int1;
10071
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
10072
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10074
# check trigger-6 success: 1
10075
DROP TRIGGER trg_1;
10076
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10077
f_int2 = CAST(f_char1 AS SIGNED INT),
10078
f_charbig = 'just inserted'
10079
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10081
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10082
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10083
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10084
'just inserted' FROM t0_template
10085
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10086
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
10088
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10089
f_charbig = 'updated by trigger'
10090
WHERE f_int1 = - old.f_int1;
10093
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10095
# check trigger-7 success: 1
10096
DROP TRIGGER trg_1;
10097
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10098
f_int2 = CAST(f_char1 AS SIGNED INT),
10099
f_charbig = 'just inserted'
10100
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10102
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10103
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10104
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10105
'just inserted' FROM t0_template
10106
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10107
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
10109
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10110
f_charbig = 'updated by trigger'
10111
WHERE f_int1 = - old.f_int1;
10114
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10116
# check trigger-8 success: 1
10117
DROP TRIGGER trg_1;
10118
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10119
f_int2 = CAST(f_char1 AS SIGNED INT),
10120
f_charbig = 'just inserted'
10121
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10123
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10125
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10126
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
10128
SET new.f_int1 = old.f_int1 + @max_row,
10129
new.f_int2 = old.f_int2 - @max_row,
10130
new.f_charbig = '####updated per update trigger####';
10133
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
10134
f_charbig = '####updated per update statement itself####';
10136
# check trigger-9 success: 1
10137
DROP TRIGGER trg_2;
10138
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10139
f_int2 = CAST(f_char1 AS SIGNED INT),
10140
f_charbig = CONCAT('===',f_char1,'===');
10141
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
10143
SET new.f_int1 = new.f_int1 + @max_row,
10144
new.f_int2 = new.f_int2 - @max_row,
10145
new.f_charbig = '####updated per update trigger####';
10148
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
10149
f_charbig = '####updated per update statement itself####';
10151
# check trigger-10 success: 1
10152
DROP TRIGGER trg_2;
10153
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10154
f_int2 = CAST(f_char1 AS SIGNED INT),
10155
f_charbig = CONCAT('===',f_char1,'===');
10156
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
10158
SET new.f_int1 = @my_max1 + @counter,
10159
new.f_int2 = @my_min2 - @counter,
10160
new.f_charbig = '####updated per insert trigger####';
10161
SET @counter = @counter + 1;
10164
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
10165
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10166
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
10167
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
10168
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
10170
DROP TRIGGER trg_3;
10172
# check trigger-11 success: 1
10174
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
10175
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
10176
AND f_charbig = '####updated per insert trigger####';
10177
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
10179
SET new.f_int1 = @my_max1 + @counter,
10180
new.f_int2 = @my_min2 - @counter,
10181
new.f_charbig = '####updated per insert trigger####';
10182
SET @counter = @counter + 1;
10185
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
10186
INSERT INTO t1 (f_char1, f_char2, f_charbig)
10187
SELECT CAST(f_int1 AS CHAR),
10188
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
10189
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
10191
DROP TRIGGER trg_3;
10193
# check trigger-12 success: 1
10195
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
10196
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
10197
AND f_charbig = '####updated per insert trigger####';
10199
Table Op Msg_type Msg_text
10200
test.t1 analyze note The storage engine for the table doesn't support analyze
10201
CHECK TABLE t1 EXTENDED;
10202
Table Op Msg_type Msg_text
10203
test.t1 check note The storage engine for the table doesn't support check
10204
CHECKSUM TABLE t1 EXTENDED;
10206
test.t1 <some_value>
10208
Table Op Msg_type Msg_text
10209
test.t1 optimize note The storage engine for the table doesn't support optimize
10210
# check layout success: 1
10211
REPAIR TABLE t1 EXTENDED;
10212
Table Op Msg_type Msg_text
10213
test.t1 repair note The storage engine for the table doesn't support repair
10214
# check layout success: 1
10217
# check TRUNCATE success: 1
10218
# check layout success: 1
10219
# End usability test (inc/partition_check.inc)
10226
f_charbig VARCHAR(1000)
10227
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
10229
PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
10230
(PARTITION part1 VALUES LESS THAN (0)
10231
(SUBPARTITION subpart11, SUBPARTITION subpart12),
10232
PARTITION part2 VALUES LESS THAN (5)
10233
(SUBPARTITION subpart21, SUBPARTITION subpart22),
10234
PARTITION part3 VALUES LESS THAN (10)
10235
(SUBPARTITION subpart31, SUBPARTITION subpart32),
10236
PARTITION part4 VALUES LESS THAN (2147483646)
10237
(SUBPARTITION subpart41, SUBPARTITION subpart42));
10238
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
10239
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
10240
# Start usability test (inc/partition_check.inc)
10242
SHOW CREATE TABLE t1;
10244
t1 CREATE TABLE `t1` (
10245
`f_int1` int(11) DEFAULT NULL,
10246
`f_int2` int(11) DEFAULT NULL,
10247
`f_char1` char(20) DEFAULT NULL,
10248
`f_char2` char(20) DEFAULT NULL,
10249
`f_charbig` varchar(1000) DEFAULT NULL,
10250
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
10251
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
10252
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */
10255
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD
10256
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI
10257
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD
10258
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI
10259
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD
10260
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI
10261
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD
10262
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI
10263
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD
10264
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI
10265
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD
10266
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI
10267
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD
10268
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI
10269
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD
10270
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI
10271
$MYSQLTEST_VARDIR/master-data/test/t1.frm
10272
$MYSQLTEST_VARDIR/master-data/test/t1.par
10274
# check prerequisites-1 success: 1
10275
# check COUNT(*) success: 1
10276
# check MIN/MAX(f_int1) success: 1
10277
# check MIN/MAX(f_int2) success: 1
10278
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10279
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
10280
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
10281
WHERE f_int1 IN (2,3);
10282
ERROR 23000: Can't write; duplicate key in table 't1'
10283
# check prerequisites-3 success: 1
10284
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
10285
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10286
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
10287
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
10288
WHERE f_int1 IN (2,3);
10289
DELETE FROM t1 WHERE f_charbig = 'delete me';
10290
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10291
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
10292
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
10293
WHERE f_int1 IN (2,3);
10294
DELETE FROM t1 WHERE f_charbig = 'delete me';
10295
# check read via f_int1 success: 1
10296
# check read via f_int2 success: 1
10298
# check multiple-1 success: 1
10299
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
10301
# check multiple-2 success: 1
10302
INSERT INTO t1 SELECT * FROM t0_template
10303
WHERE MOD(f_int1,3) = 0;
10305
# check multiple-3 success: 1
10306
UPDATE t1 SET f_int1 = f_int1 + @max_row
10307
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
10308
AND @max_row_div2 + @max_row_div4;
10310
# check multiple-4 success: 1
10312
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
10313
AND @max_row_div2 + @max_row_div4 + @max_row;
10315
# check multiple-5 success: 1
10316
SELECT COUNT(*) INTO @try_count FROM t0_template
10317
WHERE MOD(f_int1,3) = 0
10318
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
10319
SELECT COUNT(*) INTO @clash_count
10320
FROM t1 INNER JOIN t0_template USING(f_int1)
10321
WHERE MOD(f_int1,3) = 0
10322
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
10323
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
10325
SET f_int1 = @cur_value , f_int2 = @cur_value,
10326
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
10327
f_charbig = '#SINGLE#';
10329
# check single-1 success: 1
10330
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
10332
SET f_int1 = @cur_value , f_int2 = @cur_value,
10333
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
10334
f_charbig = '#SINGLE#';
10336
# check single-2 success: 1
10337
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
10338
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
10339
UPDATE t1 SET f_int1 = @cur_value2
10340
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
10342
# check single-3 success: 1
10343
SET @cur_value1= -1;
10344
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
10345
UPDATE t1 SET f_int1 = @cur_value1
10346
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
10348
# check single-4 success: 1
10349
SELECT MAX(f_int1) INTO @cur_value FROM t1;
10350
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
10352
# check single-5 success: 1
10353
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
10355
# check single-6 success: 1
10356
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
10357
ERROR HY000: Table has no partition for value 2147483647
10358
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
10359
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
10360
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
10361
f_charbig = '#NULL#';
10363
SET f_int1 = NULL , f_int2 = -@max_row,
10364
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
10365
f_charbig = '#NULL#';
10366
# check null success: 1
10368
# check null-1 success: 1
10369
UPDATE t1 SET f_int1 = -@max_row
10370
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
10371
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
10373
# check null-2 success: 1
10374
UPDATE t1 SET f_int1 = NULL
10375
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
10376
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
10378
# check null-3 success: 1
10380
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
10381
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
10383
# check null-4 success: 1
10385
WHERE f_int1 = 0 AND f_int2 = 0
10386
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
10387
AND f_charbig = '#NULL#';
10388
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10389
SELECT f_int1, f_int1, '', '', 'was inserted'
10390
FROM t0_template source_tab
10391
WHERE MOD(f_int1,3) = 0
10392
AND f_int1 BETWEEN @max_row_div2 AND @max_row
10394
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
10395
f_int2 = 2 * @max_row + source_tab.f_int1,
10396
f_charbig = 'was updated';
10398
# check unique-1-a success: 1
10400
# check unique-1-b success: 1
10401
DELETE FROM t1 WHERE f_charbig = 'was inserted';
10402
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10403
f_int2 = CAST(f_char1 AS SIGNED INT),
10404
f_charbig = CONCAT('===',f_char1,'===')
10405
WHERE f_charbig = 'was updated';
10406
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10407
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
10408
FROM t0_template source_tab
10409
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
10411
# check replace success: 1
10413
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
10415
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
10416
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
10417
UPDATE t1 SET f_int2 = f_int1,
10418
f_char1 = CAST(f_int1 AS CHAR),
10419
f_char2 = CAST(f_int1 AS CHAR),
10420
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
10421
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
10423
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10424
SELECT f_int1, f_int1, '', '', 'was inserted'
10425
FROM t0_template source_tab
10426
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
10428
# check transactions-1 success: 1
10431
# check transactions-2 success: 1
10434
# check transactions-3 success: 1
10435
DELETE FROM t1 WHERE f_charbig = 'was inserted';
10439
# check transactions-4 success: 1
10440
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10441
SELECT f_int1, f_int1, '', '', 'was inserted'
10442
FROM t0_template source_tab
10443
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
10445
# check transactions-5 success: 1
10448
Warning 1196 Some non-transactional changed tables couldn't be rolled back
10450
# check transactions-6 success: 1
10451
# INFO: Storage engine used for t1 seems to be not transactional.
10454
# check transactions-7 success: 1
10455
DELETE FROM t1 WHERE f_charbig = 'was inserted';
10457
SET @@session.sql_mode = 'traditional';
10458
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
10459
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10460
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
10461
'', '', 'was inserted' FROM t0_template
10462
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
10463
ERROR 22012: Division by 0
10466
# check transactions-8 success: 1
10467
# INFO: Storage engine used for t1 seems to be unable to revert
10468
# changes made by the failing statement.
10469
SET @@session.sql_mode = '';
10471
DELETE FROM t1 WHERE f_charbig = 'was inserted';
10473
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
10475
# check special-1 success: 1
10476
UPDATE t1 SET f_charbig = '';
10478
# check special-2 success: 1
10479
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
10480
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
10481
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
10482
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10483
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10484
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10485
'just inserted' FROM t0_template
10486
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10487
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
10489
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10490
f_charbig = 'updated by trigger'
10491
WHERE f_int1 = new.f_int1;
10493
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10494
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
10495
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10497
# check trigger-1 success: 1
10498
DROP TRIGGER trg_1;
10499
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10500
f_int2 = CAST(f_char1 AS SIGNED INT),
10501
f_charbig = 'just inserted'
10502
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10504
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10505
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10506
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10507
'just inserted' FROM t0_template
10508
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10509
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
10511
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10512
f_charbig = 'updated by trigger'
10513
WHERE f_int1 = new.f_int1;
10515
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10516
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
10517
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10519
# check trigger-2 success: 1
10520
DROP TRIGGER trg_1;
10521
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10522
f_int2 = CAST(f_char1 AS SIGNED INT),
10523
f_charbig = 'just inserted'
10524
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10526
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10527
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10528
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10529
'just inserted' FROM t0_template
10530
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10531
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
10533
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10534
f_charbig = 'updated by trigger'
10535
WHERE f_int1 = new.f_int1;
10537
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
10538
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10540
# check trigger-3 success: 1
10541
DROP TRIGGER trg_1;
10542
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10543
f_int2 = CAST(f_char1 AS SIGNED INT),
10544
f_charbig = 'just inserted'
10545
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10547
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10548
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10549
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10550
'just inserted' FROM t0_template
10551
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10552
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
10554
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10555
f_charbig = 'updated by trigger'
10556
WHERE f_int1 = - old.f_int1;
10558
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
10559
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10561
# check trigger-4 success: 1
10562
DROP TRIGGER trg_1;
10563
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10564
f_int2 = CAST(f_char1 AS SIGNED INT),
10565
f_charbig = 'just inserted'
10566
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10568
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10569
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10570
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10571
'just inserted' FROM t0_template
10572
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10573
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
10575
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10576
f_charbig = 'updated by trigger'
10577
WHERE f_int1 = new.f_int1;
10579
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
10580
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10582
# check trigger-5 success: 1
10583
DROP TRIGGER trg_1;
10584
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10585
f_int2 = CAST(f_char1 AS SIGNED INT),
10586
f_charbig = 'just inserted'
10587
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10589
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10590
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10591
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10592
'just inserted' FROM t0_template
10593
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10594
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
10596
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10597
f_charbig = 'updated by trigger'
10598
WHERE f_int1 = - old.f_int1;
10600
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
10601
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10603
# check trigger-6 success: 1
10604
DROP TRIGGER trg_1;
10605
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10606
f_int2 = CAST(f_char1 AS SIGNED INT),
10607
f_charbig = 'just inserted'
10608
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10610
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10611
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10612
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10613
'just inserted' FROM t0_template
10614
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10615
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
10617
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10618
f_charbig = 'updated by trigger'
10619
WHERE f_int1 = - old.f_int1;
10622
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10624
# check trigger-7 success: 1
10625
DROP TRIGGER trg_1;
10626
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10627
f_int2 = CAST(f_char1 AS SIGNED INT),
10628
f_charbig = 'just inserted'
10629
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10631
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10632
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
10633
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
10634
'just inserted' FROM t0_template
10635
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10636
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
10638
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
10639
f_charbig = 'updated by trigger'
10640
WHERE f_int1 = - old.f_int1;
10643
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
10645
# check trigger-8 success: 1
10646
DROP TRIGGER trg_1;
10647
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10648
f_int2 = CAST(f_char1 AS SIGNED INT),
10649
f_charbig = 'just inserted'
10650
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
10652
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10654
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
10655
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
10657
SET new.f_int1 = old.f_int1 + @max_row,
10658
new.f_int2 = old.f_int2 - @max_row,
10659
new.f_charbig = '####updated per update trigger####';
10662
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
10663
f_charbig = '####updated per update statement itself####';
10665
# check trigger-9 success: 1
10666
DROP TRIGGER trg_2;
10667
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10668
f_int2 = CAST(f_char1 AS SIGNED INT),
10669
f_charbig = CONCAT('===',f_char1,'===');
10670
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
10672
SET new.f_int1 = new.f_int1 + @max_row,
10673
new.f_int2 = new.f_int2 - @max_row,
10674
new.f_charbig = '####updated per update trigger####';
10677
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
10678
f_charbig = '####updated per update statement itself####';
10680
# check trigger-10 success: 1
10681
DROP TRIGGER trg_2;
10682
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10683
f_int2 = CAST(f_char1 AS SIGNED INT),
10684
f_charbig = CONCAT('===',f_char1,'===');
10685
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
10687
SET new.f_int1 = @my_max1 + @counter,
10688
new.f_int2 = @my_min2 - @counter,
10689
new.f_charbig = '####updated per insert trigger####';
10690
SET @counter = @counter + 1;
10693
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
10694
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10695
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
10696
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
10697
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
10699
DROP TRIGGER trg_3;
10701
# check trigger-11 success: 1
10703
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
10704
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
10705
AND f_charbig = '####updated per insert trigger####';
10706
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
10708
SET new.f_int1 = @my_max1 + @counter,
10709
new.f_int2 = @my_min2 - @counter,
10710
new.f_charbig = '####updated per insert trigger####';
10711
SET @counter = @counter + 1;
10714
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
10715
INSERT INTO t1 (f_char1, f_char2, f_charbig)
10716
SELECT CAST(f_int1 AS CHAR),
10717
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
10718
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
10720
DROP TRIGGER trg_3;
10722
# check trigger-12 success: 1
10724
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
10725
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
10726
AND f_charbig = '####updated per insert trigger####';
10728
Table Op Msg_type Msg_text
10729
test.t1 analyze note The storage engine for the table doesn't support analyze
10730
CHECK TABLE t1 EXTENDED;
10731
Table Op Msg_type Msg_text
10732
test.t1 check note The storage engine for the table doesn't support check
10733
CHECKSUM TABLE t1 EXTENDED;
10735
test.t1 <some_value>
10737
Table Op Msg_type Msg_text
10738
test.t1 optimize note The storage engine for the table doesn't support optimize
10739
# check layout success: 1
10740
REPAIR TABLE t1 EXTENDED;
10741
Table Op Msg_type Msg_text
10742
test.t1 repair note The storage engine for the table doesn't support repair
10743
# check layout success: 1
10746
# check TRUNCATE success: 1
10747
# check layout success: 1
10748
# End usability test (inc/partition_check.inc)
10755
f_charbig VARCHAR(1000)
10756
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
10758
PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1)
10759
(PARTITION part1 VALUES IN (0)
10760
(SUBPARTITION sp11,
10761
SUBPARTITION sp12),
10762
PARTITION part2 VALUES IN (1)
10763
(SUBPARTITION sp21,
10764
SUBPARTITION sp22),
10765
PARTITION part3 VALUES IN (2)
10766
(SUBPARTITION sp31,
10767
SUBPARTITION sp32),
10768
PARTITION part4 VALUES IN (NULL)
10769
(SUBPARTITION sp41,
10770
SUBPARTITION sp42));
10771
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
10772
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
10773
# Start usability test (inc/partition_check.inc)
10775
SHOW CREATE TABLE t1;
10777
t1 CREATE TABLE `t1` (
10778
`f_int1` int(11) DEFAULT NULL,
10779
`f_int2` int(11) DEFAULT NULL,
10780
`f_char1` char(20) DEFAULT NULL,
10781
`f_char2` char(20) DEFAULT NULL,
10782
`f_charbig` varchar(1000) DEFAULT NULL,
10783
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
10784
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
10785
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, SUBPARTITION sp12 ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = MyISAM, SUBPARTITION sp22 ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = MyISAM, SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, SUBPARTITION sp42 ENGINE = MyISAM)) */
10788
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD
10789
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI
10790
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD
10791
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI
10792
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD
10793
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI
10794
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD
10795
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI
10796
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD
10797
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI
10798
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD
10799
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI
10800
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD
10801
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI
10802
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD
10803
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI
10804
$MYSQLTEST_VARDIR/master-data/test/t1.frm
10805
$MYSQLTEST_VARDIR/master-data/test/t1.par
10807
# check prerequisites-1 success: 1
10808
# check COUNT(*) success: 1
10809
# check MIN/MAX(f_int1) success: 1
10810
# check MIN/MAX(f_int2) success: 1
10811
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10812
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
10813
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
10814
WHERE f_int1 IN (2,3);
10815
ERROR 23000: Can't write; duplicate key in table 't1'
10816
# check prerequisites-3 success: 1
10817
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
10818
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10819
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
10820
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
10821
WHERE f_int1 IN (2,3);
10822
DELETE FROM t1 WHERE f_charbig = 'delete me';
10823
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10824
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
10825
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
10826
WHERE f_int1 IN (2,3);
10827
DELETE FROM t1 WHERE f_charbig = 'delete me';
10828
# check read via f_int1 success: 1
10829
# check read via f_int2 success: 1
10831
# check multiple-1 success: 1
10832
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
10834
# check multiple-2 success: 1
10835
INSERT INTO t1 SELECT * FROM t0_template
10836
WHERE MOD(f_int1,3) = 0;
10838
# check multiple-3 success: 1
10839
UPDATE t1 SET f_int1 = f_int1 + @max_row
10840
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
10841
AND @max_row_div2 + @max_row_div4;
10843
# check multiple-4 success: 1
10845
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
10846
AND @max_row_div2 + @max_row_div4 + @max_row;
10848
# check multiple-5 success: 1
10849
SELECT COUNT(*) INTO @try_count FROM t0_template
10850
WHERE MOD(f_int1,3) = 0
10851
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
10852
SELECT COUNT(*) INTO @clash_count
10853
FROM t1 INNER JOIN t0_template USING(f_int1)
10854
WHERE MOD(f_int1,3) = 0
10855
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
10856
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
10858
SET f_int1 = @cur_value , f_int2 = @cur_value,
10859
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
10860
f_charbig = '#SINGLE#';
10862
# check single-1 success: 1
10863
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
10865
SET f_int1 = @cur_value , f_int2 = @cur_value,
10866
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
10867
f_charbig = '#SINGLE#';
10869
# check single-2 success: 1
10870
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
10871
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
10872
UPDATE t1 SET f_int1 = @cur_value2
10873
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
10875
# check single-3 success: 1
10876
SET @cur_value1= -1;
10877
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
10878
UPDATE t1 SET f_int1 = @cur_value1
10879
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
10881
# check single-4 success: 1
10882
SELECT MAX(f_int1) INTO @cur_value FROM t1;
10883
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
10885
# check single-5 success: 1
10886
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
10888
# check single-6 success: 1
10889
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
10891
# check single-7 success: 1
10892
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
10893
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
10894
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
10895
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
10896
f_charbig = '#NULL#';
10898
SET f_int1 = NULL , f_int2 = -@max_row,
10899
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
10900
f_charbig = '#NULL#';
10901
# check null success: 1
10903
# check null-1 success: 1
10904
UPDATE t1 SET f_int1 = -@max_row
10905
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
10906
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
10908
# check null-2 success: 1
10909
UPDATE t1 SET f_int1 = NULL
10910
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
10911
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
10913
# check null-3 success: 1
10915
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
10916
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
10918
# check null-4 success: 1
10920
WHERE f_int1 = 0 AND f_int2 = 0
10921
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
10922
AND f_charbig = '#NULL#';
10923
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10924
SELECT f_int1, f_int1, '', '', 'was inserted'
10925
FROM t0_template source_tab
10926
WHERE MOD(f_int1,3) = 0
10927
AND f_int1 BETWEEN @max_row_div2 AND @max_row
10929
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
10930
f_int2 = 2 * @max_row + source_tab.f_int1,
10931
f_charbig = 'was updated';
10933
# check unique-1-a success: 1
10935
# check unique-1-b success: 1
10936
DELETE FROM t1 WHERE f_charbig = 'was inserted';
10937
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
10938
f_int2 = CAST(f_char1 AS SIGNED INT),
10939
f_charbig = CONCAT('===',f_char1,'===')
10940
WHERE f_charbig = 'was updated';
10941
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10942
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
10943
FROM t0_template source_tab
10944
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
10946
# check replace success: 1
10948
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
10950
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
10951
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
10952
UPDATE t1 SET f_int2 = f_int1,
10953
f_char1 = CAST(f_int1 AS CHAR),
10954
f_char2 = CAST(f_int1 AS CHAR),
10955
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
10956
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
10958
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10959
SELECT f_int1, f_int1, '', '', 'was inserted'
10960
FROM t0_template source_tab
10961
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
10963
# check transactions-1 success: 1
10966
# check transactions-2 success: 1
10969
# check transactions-3 success: 1
10970
DELETE FROM t1 WHERE f_charbig = 'was inserted';
10974
# check transactions-4 success: 1
10975
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10976
SELECT f_int1, f_int1, '', '', 'was inserted'
10977
FROM t0_template source_tab
10978
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
10980
# check transactions-5 success: 1
10983
Warning 1196 Some non-transactional changed tables couldn't be rolled back
10985
# check transactions-6 success: 1
10986
# INFO: Storage engine used for t1 seems to be not transactional.
10989
# check transactions-7 success: 1
10990
DELETE FROM t1 WHERE f_charbig = 'was inserted';
10992
SET @@session.sql_mode = 'traditional';
10993
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
10994
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
10995
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
10996
'', '', 'was inserted' FROM t0_template
10997
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
10998
ERROR 22012: Division by 0
11001
# check transactions-8 success: 1
11002
# INFO: Storage engine used for t1 seems to be unable to revert
11003
# changes made by the failing statement.
11004
SET @@session.sql_mode = '';
11006
DELETE FROM t1 WHERE f_charbig = 'was inserted';
11008
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
11010
# check special-1 success: 1
11011
UPDATE t1 SET f_charbig = '';
11013
# check special-2 success: 1
11014
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
11015
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
11016
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
11017
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11018
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11019
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11020
'just inserted' FROM t0_template
11021
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11022
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
11024
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11025
f_charbig = 'updated by trigger'
11026
WHERE f_int1 = new.f_int1;
11028
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11029
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
11030
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11032
# check trigger-1 success: 1
11033
DROP TRIGGER trg_1;
11034
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11035
f_int2 = CAST(f_char1 AS SIGNED INT),
11036
f_charbig = 'just inserted'
11037
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11039
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11040
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11041
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11042
'just inserted' FROM t0_template
11043
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11044
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
11046
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11047
f_charbig = 'updated by trigger'
11048
WHERE f_int1 = new.f_int1;
11050
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11051
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
11052
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11054
# check trigger-2 success: 1
11055
DROP TRIGGER trg_1;
11056
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11057
f_int2 = CAST(f_char1 AS SIGNED INT),
11058
f_charbig = 'just inserted'
11059
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11061
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11062
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11063
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11064
'just inserted' FROM t0_template
11065
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11066
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
11068
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11069
f_charbig = 'updated by trigger'
11070
WHERE f_int1 = new.f_int1;
11072
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
11073
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11075
# check trigger-3 success: 1
11076
DROP TRIGGER trg_1;
11077
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11078
f_int2 = CAST(f_char1 AS SIGNED INT),
11079
f_charbig = 'just inserted'
11080
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11082
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11083
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11084
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11085
'just inserted' FROM t0_template
11086
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11087
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
11089
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11090
f_charbig = 'updated by trigger'
11091
WHERE f_int1 = - old.f_int1;
11093
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
11094
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11096
# check trigger-4 success: 1
11097
DROP TRIGGER trg_1;
11098
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11099
f_int2 = CAST(f_char1 AS SIGNED INT),
11100
f_charbig = 'just inserted'
11101
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11103
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11104
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11105
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11106
'just inserted' FROM t0_template
11107
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11108
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
11110
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11111
f_charbig = 'updated by trigger'
11112
WHERE f_int1 = new.f_int1;
11114
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
11115
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11117
# check trigger-5 success: 1
11118
DROP TRIGGER trg_1;
11119
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11120
f_int2 = CAST(f_char1 AS SIGNED INT),
11121
f_charbig = 'just inserted'
11122
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11124
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11125
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11126
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11127
'just inserted' FROM t0_template
11128
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11129
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
11131
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11132
f_charbig = 'updated by trigger'
11133
WHERE f_int1 = - old.f_int1;
11135
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
11136
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11138
# check trigger-6 success: 1
11139
DROP TRIGGER trg_1;
11140
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11141
f_int2 = CAST(f_char1 AS SIGNED INT),
11142
f_charbig = 'just inserted'
11143
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11145
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11146
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11147
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11148
'just inserted' FROM t0_template
11149
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11150
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
11152
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11153
f_charbig = 'updated by trigger'
11154
WHERE f_int1 = - old.f_int1;
11157
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11159
# check trigger-7 success: 1
11160
DROP TRIGGER trg_1;
11161
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11162
f_int2 = CAST(f_char1 AS SIGNED INT),
11163
f_charbig = 'just inserted'
11164
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11166
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11167
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11168
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11169
'just inserted' FROM t0_template
11170
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11171
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
11173
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11174
f_charbig = 'updated by trigger'
11175
WHERE f_int1 = - old.f_int1;
11178
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11180
# check trigger-8 success: 1
11181
DROP TRIGGER trg_1;
11182
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11183
f_int2 = CAST(f_char1 AS SIGNED INT),
11184
f_charbig = 'just inserted'
11185
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11187
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11189
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11190
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
11192
SET new.f_int1 = old.f_int1 + @max_row,
11193
new.f_int2 = old.f_int2 - @max_row,
11194
new.f_charbig = '####updated per update trigger####';
11197
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
11198
f_charbig = '####updated per update statement itself####';
11200
# check trigger-9 success: 1
11201
DROP TRIGGER trg_2;
11202
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11203
f_int2 = CAST(f_char1 AS SIGNED INT),
11204
f_charbig = CONCAT('===',f_char1,'===');
11205
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
11207
SET new.f_int1 = new.f_int1 + @max_row,
11208
new.f_int2 = new.f_int2 - @max_row,
11209
new.f_charbig = '####updated per update trigger####';
11212
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
11213
f_charbig = '####updated per update statement itself####';
11215
# check trigger-10 success: 1
11216
DROP TRIGGER trg_2;
11217
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11218
f_int2 = CAST(f_char1 AS SIGNED INT),
11219
f_charbig = CONCAT('===',f_char1,'===');
11220
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
11222
SET new.f_int1 = @my_max1 + @counter,
11223
new.f_int2 = @my_min2 - @counter,
11224
new.f_charbig = '####updated per insert trigger####';
11225
SET @counter = @counter + 1;
11228
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
11229
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11230
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
11231
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
11232
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
11234
DROP TRIGGER trg_3;
11236
# check trigger-11 success: 1
11238
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
11239
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
11240
AND f_charbig = '####updated per insert trigger####';
11241
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
11243
SET new.f_int1 = @my_max1 + @counter,
11244
new.f_int2 = @my_min2 - @counter,
11245
new.f_charbig = '####updated per insert trigger####';
11246
SET @counter = @counter + 1;
11249
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
11250
INSERT INTO t1 (f_char1, f_char2, f_charbig)
11251
SELECT CAST(f_int1 AS CHAR),
11252
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
11253
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
11255
DROP TRIGGER trg_3;
11257
# check trigger-12 success: 1
11259
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
11260
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
11261
AND f_charbig = '####updated per insert trigger####';
11263
Table Op Msg_type Msg_text
11264
test.t1 analyze note The storage engine for the table doesn't support analyze
11265
CHECK TABLE t1 EXTENDED;
11266
Table Op Msg_type Msg_text
11267
test.t1 check note The storage engine for the table doesn't support check
11268
CHECKSUM TABLE t1 EXTENDED;
11270
test.t1 <some_value>
11272
Table Op Msg_type Msg_text
11273
test.t1 optimize note The storage engine for the table doesn't support optimize
11274
# check layout success: 1
11275
REPAIR TABLE t1 EXTENDED;
11276
Table Op Msg_type Msg_text
11277
test.t1 repair note The storage engine for the table doesn't support repair
11278
# check layout success: 1
11281
# check TRUNCATE success: 1
11282
# check layout success: 1
11283
# End usability test (inc/partition_check.inc)
11290
f_charbig VARCHAR(1000)
11291
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
11293
PARTITION BY LIST(ABS(MOD(f_int1,2)))
11294
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3
11295
(PARTITION part1 VALUES IN (0),
11296
PARTITION part2 VALUES IN (1),
11297
PARTITION part3 VALUES IN (NULL));
11298
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
11299
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
11300
# Start usability test (inc/partition_check.inc)
11302
SHOW CREATE TABLE t1;
11304
t1 CREATE TABLE `t1` (
11305
`f_int1` int(11) DEFAULT NULL,
11306
`f_int2` int(11) DEFAULT NULL,
11307
`f_char1` char(20) DEFAULT NULL,
11308
`f_char2` char(20) DEFAULT NULL,
11309
`f_charbig` varchar(1000) DEFAULT NULL,
11310
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
11311
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
11312
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */
11315
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD
11316
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI
11317
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD
11318
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI
11319
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD
11320
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI
11321
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD
11322
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI
11323
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD
11324
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI
11325
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD
11326
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI
11327
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD
11328
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI
11329
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD
11330
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI
11331
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD
11332
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI
11333
$MYSQLTEST_VARDIR/master-data/test/t1.frm
11334
$MYSQLTEST_VARDIR/master-data/test/t1.par
11336
# check prerequisites-1 success: 1
11337
# check COUNT(*) success: 1
11338
# check MIN/MAX(f_int1) success: 1
11339
# check MIN/MAX(f_int2) success: 1
11340
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11341
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
11342
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
11343
WHERE f_int1 IN (2,3);
11344
ERROR 23000: Can't write; duplicate key in table 't1'
11345
# check prerequisites-3 success: 1
11346
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
11347
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11348
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
11349
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
11350
WHERE f_int1 IN (2,3);
11351
DELETE FROM t1 WHERE f_charbig = 'delete me';
11352
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11353
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
11354
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
11355
WHERE f_int1 IN (2,3);
11356
DELETE FROM t1 WHERE f_charbig = 'delete me';
11357
# check read via f_int1 success: 1
11358
# check read via f_int2 success: 1
11360
# check multiple-1 success: 1
11361
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
11363
# check multiple-2 success: 1
11364
INSERT INTO t1 SELECT * FROM t0_template
11365
WHERE MOD(f_int1,3) = 0;
11367
# check multiple-3 success: 1
11368
UPDATE t1 SET f_int1 = f_int1 + @max_row
11369
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
11370
AND @max_row_div2 + @max_row_div4;
11372
# check multiple-4 success: 1
11374
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
11375
AND @max_row_div2 + @max_row_div4 + @max_row;
11377
# check multiple-5 success: 1
11378
SELECT COUNT(*) INTO @try_count FROM t0_template
11379
WHERE MOD(f_int1,3) = 0
11380
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
11381
SELECT COUNT(*) INTO @clash_count
11382
FROM t1 INNER JOIN t0_template USING(f_int1)
11383
WHERE MOD(f_int1,3) = 0
11384
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
11385
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
11387
SET f_int1 = @cur_value , f_int2 = @cur_value,
11388
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
11389
f_charbig = '#SINGLE#';
11391
# check single-1 success: 1
11392
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
11394
SET f_int1 = @cur_value , f_int2 = @cur_value,
11395
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
11396
f_charbig = '#SINGLE#';
11398
# check single-2 success: 1
11399
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
11400
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
11401
UPDATE t1 SET f_int1 = @cur_value2
11402
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
11404
# check single-3 success: 1
11405
SET @cur_value1= -1;
11406
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
11407
UPDATE t1 SET f_int1 = @cur_value1
11408
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
11410
# check single-4 success: 1
11411
SELECT MAX(f_int1) INTO @cur_value FROM t1;
11412
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
11414
# check single-5 success: 1
11415
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
11417
# check single-6 success: 1
11418
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
11420
# check single-7 success: 1
11421
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
11422
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
11423
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
11424
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
11425
f_charbig = '#NULL#';
11427
SET f_int1 = NULL , f_int2 = -@max_row,
11428
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
11429
f_charbig = '#NULL#';
11430
# check null success: 1
11432
# check null-1 success: 1
11433
UPDATE t1 SET f_int1 = -@max_row
11434
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
11435
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
11437
# check null-2 success: 1
11438
UPDATE t1 SET f_int1 = NULL
11439
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
11440
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
11442
# check null-3 success: 1
11444
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
11445
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
11447
# check null-4 success: 1
11449
WHERE f_int1 = 0 AND f_int2 = 0
11450
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
11451
AND f_charbig = '#NULL#';
11452
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11453
SELECT f_int1, f_int1, '', '', 'was inserted'
11454
FROM t0_template source_tab
11455
WHERE MOD(f_int1,3) = 0
11456
AND f_int1 BETWEEN @max_row_div2 AND @max_row
11458
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
11459
f_int2 = 2 * @max_row + source_tab.f_int1,
11460
f_charbig = 'was updated';
11462
# check unique-1-a success: 1
11464
# check unique-1-b success: 1
11465
DELETE FROM t1 WHERE f_charbig = 'was inserted';
11466
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11467
f_int2 = CAST(f_char1 AS SIGNED INT),
11468
f_charbig = CONCAT('===',f_char1,'===')
11469
WHERE f_charbig = 'was updated';
11470
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11471
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
11472
FROM t0_template source_tab
11473
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
11475
# check replace success: 1
11477
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
11479
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
11480
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
11481
UPDATE t1 SET f_int2 = f_int1,
11482
f_char1 = CAST(f_int1 AS CHAR),
11483
f_char2 = CAST(f_int1 AS CHAR),
11484
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
11485
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
11487
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11488
SELECT f_int1, f_int1, '', '', 'was inserted'
11489
FROM t0_template source_tab
11490
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
11492
# check transactions-1 success: 1
11495
# check transactions-2 success: 1
11498
# check transactions-3 success: 1
11499
DELETE FROM t1 WHERE f_charbig = 'was inserted';
11503
# check transactions-4 success: 1
11504
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11505
SELECT f_int1, f_int1, '', '', 'was inserted'
11506
FROM t0_template source_tab
11507
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
11509
# check transactions-5 success: 1
11512
Warning 1196 Some non-transactional changed tables couldn't be rolled back
11514
# check transactions-6 success: 1
11515
# INFO: Storage engine used for t1 seems to be not transactional.
11518
# check transactions-7 success: 1
11519
DELETE FROM t1 WHERE f_charbig = 'was inserted';
11521
SET @@session.sql_mode = 'traditional';
11522
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
11523
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11524
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
11525
'', '', 'was inserted' FROM t0_template
11526
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
11527
ERROR 22012: Division by 0
11530
# check transactions-8 success: 1
11531
# INFO: Storage engine used for t1 seems to be unable to revert
11532
# changes made by the failing statement.
11533
SET @@session.sql_mode = '';
11535
DELETE FROM t1 WHERE f_charbig = 'was inserted';
11537
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
11539
# check special-1 success: 1
11540
UPDATE t1 SET f_charbig = '';
11542
# check special-2 success: 1
11543
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
11544
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
11545
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
11546
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11547
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11548
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11549
'just inserted' FROM t0_template
11550
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11551
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
11553
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11554
f_charbig = 'updated by trigger'
11555
WHERE f_int1 = new.f_int1;
11557
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11558
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
11559
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11561
# check trigger-1 success: 1
11562
DROP TRIGGER trg_1;
11563
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11564
f_int2 = CAST(f_char1 AS SIGNED INT),
11565
f_charbig = 'just inserted'
11566
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11568
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11569
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11570
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11571
'just inserted' FROM t0_template
11572
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11573
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
11575
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11576
f_charbig = 'updated by trigger'
11577
WHERE f_int1 = new.f_int1;
11579
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11580
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
11581
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11583
# check trigger-2 success: 1
11584
DROP TRIGGER trg_1;
11585
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11586
f_int2 = CAST(f_char1 AS SIGNED INT),
11587
f_charbig = 'just inserted'
11588
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11590
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11591
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11592
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11593
'just inserted' FROM t0_template
11594
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11595
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
11597
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11598
f_charbig = 'updated by trigger'
11599
WHERE f_int1 = new.f_int1;
11601
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
11602
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11604
# check trigger-3 success: 1
11605
DROP TRIGGER trg_1;
11606
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11607
f_int2 = CAST(f_char1 AS SIGNED INT),
11608
f_charbig = 'just inserted'
11609
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11611
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11612
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11613
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11614
'just inserted' FROM t0_template
11615
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11616
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
11618
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11619
f_charbig = 'updated by trigger'
11620
WHERE f_int1 = - old.f_int1;
11622
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
11623
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11625
# check trigger-4 success: 1
11626
DROP TRIGGER trg_1;
11627
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11628
f_int2 = CAST(f_char1 AS SIGNED INT),
11629
f_charbig = 'just inserted'
11630
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11632
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11633
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11634
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11635
'just inserted' FROM t0_template
11636
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11637
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
11639
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11640
f_charbig = 'updated by trigger'
11641
WHERE f_int1 = new.f_int1;
11643
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
11644
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11646
# check trigger-5 success: 1
11647
DROP TRIGGER trg_1;
11648
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11649
f_int2 = CAST(f_char1 AS SIGNED INT),
11650
f_charbig = 'just inserted'
11651
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11653
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11654
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11655
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11656
'just inserted' FROM t0_template
11657
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11658
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
11660
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11661
f_charbig = 'updated by trigger'
11662
WHERE f_int1 = - old.f_int1;
11664
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
11665
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11667
# check trigger-6 success: 1
11668
DROP TRIGGER trg_1;
11669
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11670
f_int2 = CAST(f_char1 AS SIGNED INT),
11671
f_charbig = 'just inserted'
11672
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11674
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11675
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11676
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11677
'just inserted' FROM t0_template
11678
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11679
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
11681
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11682
f_charbig = 'updated by trigger'
11683
WHERE f_int1 = - old.f_int1;
11686
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11688
# check trigger-7 success: 1
11689
DROP TRIGGER trg_1;
11690
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11691
f_int2 = CAST(f_char1 AS SIGNED INT),
11692
f_charbig = 'just inserted'
11693
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11695
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11696
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
11697
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
11698
'just inserted' FROM t0_template
11699
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11700
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
11702
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
11703
f_charbig = 'updated by trigger'
11704
WHERE f_int1 = - old.f_int1;
11707
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
11709
# check trigger-8 success: 1
11710
DROP TRIGGER trg_1;
11711
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11712
f_int2 = CAST(f_char1 AS SIGNED INT),
11713
f_charbig = 'just inserted'
11714
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
11716
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11718
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
11719
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
11721
SET new.f_int1 = old.f_int1 + @max_row,
11722
new.f_int2 = old.f_int2 - @max_row,
11723
new.f_charbig = '####updated per update trigger####';
11726
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
11727
f_charbig = '####updated per update statement itself####';
11729
# check trigger-9 success: 1
11730
DROP TRIGGER trg_2;
11731
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11732
f_int2 = CAST(f_char1 AS SIGNED INT),
11733
f_charbig = CONCAT('===',f_char1,'===');
11734
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
11736
SET new.f_int1 = new.f_int1 + @max_row,
11737
new.f_int2 = new.f_int2 - @max_row,
11738
new.f_charbig = '####updated per update trigger####';
11741
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
11742
f_charbig = '####updated per update statement itself####';
11744
# check trigger-10 success: 1
11745
DROP TRIGGER trg_2;
11746
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11747
f_int2 = CAST(f_char1 AS SIGNED INT),
11748
f_charbig = CONCAT('===',f_char1,'===');
11749
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
11751
SET new.f_int1 = @my_max1 + @counter,
11752
new.f_int2 = @my_min2 - @counter,
11753
new.f_charbig = '####updated per insert trigger####';
11754
SET @counter = @counter + 1;
11757
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
11758
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11759
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
11760
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
11761
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
11763
DROP TRIGGER trg_3;
11765
# check trigger-11 success: 1
11767
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
11768
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
11769
AND f_charbig = '####updated per insert trigger####';
11770
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
11772
SET new.f_int1 = @my_max1 + @counter,
11773
new.f_int2 = @my_min2 - @counter,
11774
new.f_charbig = '####updated per insert trigger####';
11775
SET @counter = @counter + 1;
11778
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
11779
INSERT INTO t1 (f_char1, f_char2, f_charbig)
11780
SELECT CAST(f_int1 AS CHAR),
11781
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
11782
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
11784
DROP TRIGGER trg_3;
11786
# check trigger-12 success: 1
11788
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
11789
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
11790
AND f_charbig = '####updated per insert trigger####';
11792
Table Op Msg_type Msg_text
11793
test.t1 analyze note The storage engine for the table doesn't support analyze
11794
CHECK TABLE t1 EXTENDED;
11795
Table Op Msg_type Msg_text
11796
test.t1 check note The storage engine for the table doesn't support check
11797
CHECKSUM TABLE t1 EXTENDED;
11799
test.t1 <some_value>
11801
Table Op Msg_type Msg_text
11802
test.t1 optimize note The storage engine for the table doesn't support optimize
11803
# check layout success: 1
11804
REPAIR TABLE t1 EXTENDED;
11805
Table Op Msg_type Msg_text
11806
test.t1 repair note The storage engine for the table doesn't support repair
11807
# check layout success: 1
11810
# check TRUNCATE success: 1
11811
# check layout success: 1
11812
# End usability test (inc/partition_check.inc)
11814
#------------------------------------------------------------------------
11815
# 3 Tables with PRIMARY KEY and/or UNIQUE INDEXes
11816
# The partitioning function contains two columns.
11817
#------------------------------------------------------------------------
11818
# 3.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns
11819
DROP TABLE IF EXISTS t1;
11825
f_charbig VARCHAR(1000)
11826
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
11828
PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2;
11829
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
11830
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
11831
# Start usability test (inc/partition_check.inc)
11833
SHOW CREATE TABLE t1;
11835
t1 CREATE TABLE `t1` (
11836
`f_int1` int(11) DEFAULT NULL,
11837
`f_int2` int(11) DEFAULT NULL,
11838
`f_char1` char(20) DEFAULT NULL,
11839
`f_char2` char(20) DEFAULT NULL,
11840
`f_charbig` varchar(1000) DEFAULT NULL,
11841
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
11842
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
11843
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */
11846
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
11847
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
11848
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
11849
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
11850
$MYSQLTEST_VARDIR/master-data/test/t1.frm
11851
$MYSQLTEST_VARDIR/master-data/test/t1.par
11853
# check prerequisites-1 success: 1
11854
# check COUNT(*) success: 1
11855
# check MIN/MAX(f_int1) success: 1
11856
# check MIN/MAX(f_int2) success: 1
11857
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11858
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
11859
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
11860
WHERE f_int1 IN (2,3);
11861
ERROR 23000: Can't write; duplicate key in table 't1'
11862
# check prerequisites-3 success: 1
11863
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
11864
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11865
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
11866
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
11867
WHERE f_int1 IN (2,3);
11868
DELETE FROM t1 WHERE f_charbig = 'delete me';
11869
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11870
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
11871
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
11872
WHERE f_int1 IN (2,3);
11873
DELETE FROM t1 WHERE f_charbig = 'delete me';
11874
# check read via f_int1 success: 1
11875
# check read via f_int2 success: 1
11877
# check multiple-1 success: 1
11878
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
11880
# check multiple-2 success: 1
11881
INSERT INTO t1 SELECT * FROM t0_template
11882
WHERE MOD(f_int1,3) = 0;
11884
# check multiple-3 success: 1
11885
UPDATE t1 SET f_int1 = f_int1 + @max_row
11886
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
11887
AND @max_row_div2 + @max_row_div4;
11889
# check multiple-4 success: 1
11891
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
11892
AND @max_row_div2 + @max_row_div4 + @max_row;
11894
# check multiple-5 success: 1
11895
SELECT COUNT(*) INTO @try_count FROM t0_template
11896
WHERE MOD(f_int1,3) = 0
11897
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
11898
SELECT COUNT(*) INTO @clash_count
11899
FROM t1 INNER JOIN t0_template USING(f_int1)
11900
WHERE MOD(f_int1,3) = 0
11901
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
11902
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
11904
SET f_int1 = @cur_value , f_int2 = @cur_value,
11905
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
11906
f_charbig = '#SINGLE#';
11908
# check single-1 success: 1
11909
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
11911
SET f_int1 = @cur_value , f_int2 = @cur_value,
11912
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
11913
f_charbig = '#SINGLE#';
11915
# check single-2 success: 1
11916
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
11917
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
11918
UPDATE t1 SET f_int1 = @cur_value2
11919
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
11921
# check single-3 success: 1
11922
SET @cur_value1= -1;
11923
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
11924
UPDATE t1 SET f_int1 = @cur_value1
11925
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
11927
# check single-4 success: 1
11928
SELECT MAX(f_int1) INTO @cur_value FROM t1;
11929
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
11931
# check single-5 success: 1
11932
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
11934
# check single-6 success: 1
11935
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
11937
# check single-7 success: 1
11938
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
11939
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
11940
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
11941
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
11942
f_charbig = '#NULL#';
11944
SET f_int1 = NULL , f_int2 = -@max_row,
11945
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
11946
f_charbig = '#NULL#';
11947
# check null success: 1
11949
# check null-1 success: 1
11950
UPDATE t1 SET f_int1 = -@max_row
11951
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
11952
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
11954
# check null-2 success: 1
11955
UPDATE t1 SET f_int1 = NULL
11956
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
11957
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
11959
# check null-3 success: 1
11961
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
11962
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
11964
# check null-4 success: 1
11966
WHERE f_int1 = 0 AND f_int2 = 0
11967
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
11968
AND f_charbig = '#NULL#';
11969
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11970
SELECT f_int1, f_int1, '', '', 'was inserted'
11971
FROM t0_template source_tab
11972
WHERE MOD(f_int1,3) = 0
11973
AND f_int1 BETWEEN @max_row_div2 AND @max_row
11975
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
11976
f_int2 = 2 * @max_row + source_tab.f_int1,
11977
f_charbig = 'was updated';
11979
# check unique-1-a success: 1
11981
# check unique-1-b success: 1
11982
DELETE FROM t1 WHERE f_charbig = 'was inserted';
11983
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
11984
f_int2 = CAST(f_char1 AS SIGNED INT),
11985
f_charbig = CONCAT('===',f_char1,'===')
11986
WHERE f_charbig = 'was updated';
11987
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
11988
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
11989
FROM t0_template source_tab
11990
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
11992
# check replace success: 1
11994
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
11996
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
11997
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
11998
UPDATE t1 SET f_int2 = f_int1,
11999
f_char1 = CAST(f_int1 AS CHAR),
12000
f_char2 = CAST(f_int1 AS CHAR),
12001
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
12002
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
12004
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12005
SELECT f_int1, f_int1, '', '', 'was inserted'
12006
FROM t0_template source_tab
12007
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
12009
# check transactions-1 success: 1
12012
# check transactions-2 success: 1
12015
# check transactions-3 success: 1
12016
DELETE FROM t1 WHERE f_charbig = 'was inserted';
12020
# check transactions-4 success: 1
12021
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12022
SELECT f_int1, f_int1, '', '', 'was inserted'
12023
FROM t0_template source_tab
12024
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
12026
# check transactions-5 success: 1
12029
Warning 1196 Some non-transactional changed tables couldn't be rolled back
12031
# check transactions-6 success: 1
12032
# INFO: Storage engine used for t1 seems to be not transactional.
12035
# check transactions-7 success: 1
12036
DELETE FROM t1 WHERE f_charbig = 'was inserted';
12038
SET @@session.sql_mode = 'traditional';
12039
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
12040
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12041
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
12042
'', '', 'was inserted' FROM t0_template
12043
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
12044
ERROR 22012: Division by 0
12047
# check transactions-8 success: 1
12048
# INFO: Storage engine used for t1 seems to be unable to revert
12049
# changes made by the failing statement.
12050
SET @@session.sql_mode = '';
12052
DELETE FROM t1 WHERE f_charbig = 'was inserted';
12054
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
12056
# check special-1 success: 1
12057
UPDATE t1 SET f_charbig = '';
12059
# check special-2 success: 1
12060
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
12061
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
12062
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
12063
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12064
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12065
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12066
'just inserted' FROM t0_template
12067
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12068
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
12070
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12071
f_charbig = 'updated by trigger'
12072
WHERE f_int1 = new.f_int1;
12074
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12075
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
12076
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12078
# check trigger-1 success: 1
12079
DROP TRIGGER trg_1;
12080
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12081
f_int2 = CAST(f_char1 AS SIGNED INT),
12082
f_charbig = 'just inserted'
12083
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12085
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12086
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12087
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12088
'just inserted' FROM t0_template
12089
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12090
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
12092
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12093
f_charbig = 'updated by trigger'
12094
WHERE f_int1 = new.f_int1;
12096
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12097
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
12098
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12100
# check trigger-2 success: 1
12101
DROP TRIGGER trg_1;
12102
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12103
f_int2 = CAST(f_char1 AS SIGNED INT),
12104
f_charbig = 'just inserted'
12105
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12107
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12108
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12109
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12110
'just inserted' FROM t0_template
12111
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12112
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
12114
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12115
f_charbig = 'updated by trigger'
12116
WHERE f_int1 = new.f_int1;
12118
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
12119
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12121
# check trigger-3 success: 1
12122
DROP TRIGGER trg_1;
12123
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12124
f_int2 = CAST(f_char1 AS SIGNED INT),
12125
f_charbig = 'just inserted'
12126
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12128
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12129
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12130
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12131
'just inserted' FROM t0_template
12132
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12133
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
12135
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12136
f_charbig = 'updated by trigger'
12137
WHERE f_int1 = - old.f_int1;
12139
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
12140
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12142
# check trigger-4 success: 1
12143
DROP TRIGGER trg_1;
12144
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12145
f_int2 = CAST(f_char1 AS SIGNED INT),
12146
f_charbig = 'just inserted'
12147
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12149
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12150
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12151
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12152
'just inserted' FROM t0_template
12153
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12154
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
12156
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12157
f_charbig = 'updated by trigger'
12158
WHERE f_int1 = new.f_int1;
12160
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
12161
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12163
# check trigger-5 success: 1
12164
DROP TRIGGER trg_1;
12165
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12166
f_int2 = CAST(f_char1 AS SIGNED INT),
12167
f_charbig = 'just inserted'
12168
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12170
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12171
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12172
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12173
'just inserted' FROM t0_template
12174
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12175
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
12177
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12178
f_charbig = 'updated by trigger'
12179
WHERE f_int1 = - old.f_int1;
12181
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
12182
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12184
# check trigger-6 success: 1
12185
DROP TRIGGER trg_1;
12186
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12187
f_int2 = CAST(f_char1 AS SIGNED INT),
12188
f_charbig = 'just inserted'
12189
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12191
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12192
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12193
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12194
'just inserted' FROM t0_template
12195
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12196
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
12198
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12199
f_charbig = 'updated by trigger'
12200
WHERE f_int1 = - old.f_int1;
12203
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12205
# check trigger-7 success: 1
12206
DROP TRIGGER trg_1;
12207
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12208
f_int2 = CAST(f_char1 AS SIGNED INT),
12209
f_charbig = 'just inserted'
12210
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12212
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12213
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12214
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12215
'just inserted' FROM t0_template
12216
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12217
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
12219
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12220
f_charbig = 'updated by trigger'
12221
WHERE f_int1 = - old.f_int1;
12224
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12226
# check trigger-8 success: 1
12227
DROP TRIGGER trg_1;
12228
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12229
f_int2 = CAST(f_char1 AS SIGNED INT),
12230
f_charbig = 'just inserted'
12231
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12233
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12235
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12236
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
12238
SET new.f_int1 = old.f_int1 + @max_row,
12239
new.f_int2 = old.f_int2 - @max_row,
12240
new.f_charbig = '####updated per update trigger####';
12243
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
12244
f_charbig = '####updated per update statement itself####';
12246
# check trigger-9 success: 1
12247
DROP TRIGGER trg_2;
12248
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12249
f_int2 = CAST(f_char1 AS SIGNED INT),
12250
f_charbig = CONCAT('===',f_char1,'===');
12251
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
12253
SET new.f_int1 = new.f_int1 + @max_row,
12254
new.f_int2 = new.f_int2 - @max_row,
12255
new.f_charbig = '####updated per update trigger####';
12258
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
12259
f_charbig = '####updated per update statement itself####';
12261
# check trigger-10 success: 1
12262
DROP TRIGGER trg_2;
12263
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12264
f_int2 = CAST(f_char1 AS SIGNED INT),
12265
f_charbig = CONCAT('===',f_char1,'===');
12266
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
12268
SET new.f_int1 = @my_max1 + @counter,
12269
new.f_int2 = @my_min2 - @counter,
12270
new.f_charbig = '####updated per insert trigger####';
12271
SET @counter = @counter + 1;
12274
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
12275
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12276
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
12277
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
12278
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
12280
DROP TRIGGER trg_3;
12282
# check trigger-11 success: 1
12284
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
12285
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
12286
AND f_charbig = '####updated per insert trigger####';
12287
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
12289
SET new.f_int1 = @my_max1 + @counter,
12290
new.f_int2 = @my_min2 - @counter,
12291
new.f_charbig = '####updated per insert trigger####';
12292
SET @counter = @counter + 1;
12295
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
12296
INSERT INTO t1 (f_char1, f_char2, f_charbig)
12297
SELECT CAST(f_int1 AS CHAR),
12298
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
12299
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
12301
DROP TRIGGER trg_3;
12303
# check trigger-12 success: 1
12305
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
12306
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
12307
AND f_charbig = '####updated per insert trigger####';
12309
Table Op Msg_type Msg_text
12310
test.t1 analyze note The storage engine for the table doesn't support analyze
12311
CHECK TABLE t1 EXTENDED;
12312
Table Op Msg_type Msg_text
12313
test.t1 check note The storage engine for the table doesn't support check
12314
CHECKSUM TABLE t1 EXTENDED;
12316
test.t1 <some_value>
12318
Table Op Msg_type Msg_text
12319
test.t1 optimize note The storage engine for the table doesn't support optimize
12320
# check layout success: 1
12321
REPAIR TABLE t1 EXTENDED;
12322
Table Op Msg_type Msg_text
12323
test.t1 repair note The storage engine for the table doesn't support repair
12324
# check layout success: 1
12327
# check TRUNCATE success: 1
12328
# check layout success: 1
12329
# End usability test (inc/partition_check.inc)
12336
f_charbig VARCHAR(1000)
12337
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
12339
PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5;
12340
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
12341
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
12342
# Start usability test (inc/partition_check.inc)
12344
SHOW CREATE TABLE t1;
12346
t1 CREATE TABLE `t1` (
12347
`f_int1` int(11) DEFAULT NULL,
12348
`f_int2` int(11) DEFAULT NULL,
12349
`f_char1` char(20) DEFAULT NULL,
12350
`f_char2` char(20) DEFAULT NULL,
12351
`f_charbig` varchar(1000) DEFAULT NULL,
12352
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
12353
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
12354
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */
12357
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
12358
$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
12359
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
12360
$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
12361
$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD
12362
$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI
12363
$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD
12364
$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI
12365
$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD
12366
$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI
12367
$MYSQLTEST_VARDIR/master-data/test/t1.frm
12368
$MYSQLTEST_VARDIR/master-data/test/t1.par
12370
# check prerequisites-1 success: 1
12371
# check COUNT(*) success: 1
12372
# check MIN/MAX(f_int1) success: 1
12373
# check MIN/MAX(f_int2) success: 1
12374
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12375
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
12376
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
12377
WHERE f_int1 IN (2,3);
12378
ERROR 23000: Can't write; duplicate key in table 't1'
12379
# check prerequisites-3 success: 1
12380
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
12381
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12382
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
12383
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
12384
WHERE f_int1 IN (2,3);
12385
DELETE FROM t1 WHERE f_charbig = 'delete me';
12386
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12387
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
12388
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
12389
WHERE f_int1 IN (2,3);
12390
DELETE FROM t1 WHERE f_charbig = 'delete me';
12391
# check read via f_int1 success: 1
12392
# check read via f_int2 success: 1
12394
# check multiple-1 success: 1
12395
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
12397
# check multiple-2 success: 1
12398
INSERT INTO t1 SELECT * FROM t0_template
12399
WHERE MOD(f_int1,3) = 0;
12401
# check multiple-3 success: 1
12402
UPDATE t1 SET f_int1 = f_int1 + @max_row
12403
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
12404
AND @max_row_div2 + @max_row_div4;
12406
# check multiple-4 success: 1
12408
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
12409
AND @max_row_div2 + @max_row_div4 + @max_row;
12411
# check multiple-5 success: 1
12412
SELECT COUNT(*) INTO @try_count FROM t0_template
12413
WHERE MOD(f_int1,3) = 0
12414
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
12415
SELECT COUNT(*) INTO @clash_count
12416
FROM t1 INNER JOIN t0_template USING(f_int1)
12417
WHERE MOD(f_int1,3) = 0
12418
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
12419
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
12421
SET f_int1 = @cur_value , f_int2 = @cur_value,
12422
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
12423
f_charbig = '#SINGLE#';
12425
# check single-1 success: 1
12426
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
12428
SET f_int1 = @cur_value , f_int2 = @cur_value,
12429
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
12430
f_charbig = '#SINGLE#';
12432
# check single-2 success: 1
12433
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
12434
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
12435
UPDATE t1 SET f_int1 = @cur_value2
12436
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
12438
# check single-3 success: 1
12439
SET @cur_value1= -1;
12440
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
12441
UPDATE t1 SET f_int1 = @cur_value1
12442
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
12444
# check single-4 success: 1
12445
SELECT MAX(f_int1) INTO @cur_value FROM t1;
12446
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
12448
# check single-5 success: 1
12449
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
12451
# check single-6 success: 1
12452
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
12454
# check single-7 success: 1
12455
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
12456
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
12457
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
12458
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
12459
f_charbig = '#NULL#';
12461
SET f_int1 = NULL , f_int2 = -@max_row,
12462
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
12463
f_charbig = '#NULL#';
12464
# check null success: 1
12466
# check null-1 success: 1
12467
UPDATE t1 SET f_int1 = -@max_row
12468
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
12469
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
12471
# check null-2 success: 1
12472
UPDATE t1 SET f_int1 = NULL
12473
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
12474
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
12476
# check null-3 success: 1
12478
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
12479
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
12481
# check null-4 success: 1
12483
WHERE f_int1 = 0 AND f_int2 = 0
12484
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
12485
AND f_charbig = '#NULL#';
12486
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12487
SELECT f_int1, f_int1, '', '', 'was inserted'
12488
FROM t0_template source_tab
12489
WHERE MOD(f_int1,3) = 0
12490
AND f_int1 BETWEEN @max_row_div2 AND @max_row
12492
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
12493
f_int2 = 2 * @max_row + source_tab.f_int1,
12494
f_charbig = 'was updated';
12496
# check unique-1-a success: 1
12498
# check unique-1-b success: 1
12499
DELETE FROM t1 WHERE f_charbig = 'was inserted';
12500
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12501
f_int2 = CAST(f_char1 AS SIGNED INT),
12502
f_charbig = CONCAT('===',f_char1,'===')
12503
WHERE f_charbig = 'was updated';
12504
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12505
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
12506
FROM t0_template source_tab
12507
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
12509
# check replace success: 1
12511
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
12513
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
12514
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
12515
UPDATE t1 SET f_int2 = f_int1,
12516
f_char1 = CAST(f_int1 AS CHAR),
12517
f_char2 = CAST(f_int1 AS CHAR),
12518
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
12519
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
12521
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12522
SELECT f_int1, f_int1, '', '', 'was inserted'
12523
FROM t0_template source_tab
12524
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
12526
# check transactions-1 success: 1
12529
# check transactions-2 success: 1
12532
# check transactions-3 success: 1
12533
DELETE FROM t1 WHERE f_charbig = 'was inserted';
12537
# check transactions-4 success: 1
12538
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12539
SELECT f_int1, f_int1, '', '', 'was inserted'
12540
FROM t0_template source_tab
12541
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
12543
# check transactions-5 success: 1
12546
Warning 1196 Some non-transactional changed tables couldn't be rolled back
12548
# check transactions-6 success: 1
12549
# INFO: Storage engine used for t1 seems to be not transactional.
12552
# check transactions-7 success: 1
12553
DELETE FROM t1 WHERE f_charbig = 'was inserted';
12555
SET @@session.sql_mode = 'traditional';
12556
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
12557
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12558
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
12559
'', '', 'was inserted' FROM t0_template
12560
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
12561
ERROR 22012: Division by 0
12564
# check transactions-8 success: 1
12565
# INFO: Storage engine used for t1 seems to be unable to revert
12566
# changes made by the failing statement.
12567
SET @@session.sql_mode = '';
12569
DELETE FROM t1 WHERE f_charbig = 'was inserted';
12571
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
12573
# check special-1 success: 1
12574
UPDATE t1 SET f_charbig = '';
12576
# check special-2 success: 1
12577
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
12578
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
12579
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
12580
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12581
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12582
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12583
'just inserted' FROM t0_template
12584
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12585
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
12587
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12588
f_charbig = 'updated by trigger'
12589
WHERE f_int1 = new.f_int1;
12591
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12592
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
12593
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12595
# check trigger-1 success: 1
12596
DROP TRIGGER trg_1;
12597
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12598
f_int2 = CAST(f_char1 AS SIGNED INT),
12599
f_charbig = 'just inserted'
12600
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12602
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12603
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12604
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12605
'just inserted' FROM t0_template
12606
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12607
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
12609
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12610
f_charbig = 'updated by trigger'
12611
WHERE f_int1 = new.f_int1;
12613
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12614
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
12615
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12617
# check trigger-2 success: 1
12618
DROP TRIGGER trg_1;
12619
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12620
f_int2 = CAST(f_char1 AS SIGNED INT),
12621
f_charbig = 'just inserted'
12622
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12624
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12625
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12626
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12627
'just inserted' FROM t0_template
12628
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12629
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
12631
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12632
f_charbig = 'updated by trigger'
12633
WHERE f_int1 = new.f_int1;
12635
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
12636
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12638
# check trigger-3 success: 1
12639
DROP TRIGGER trg_1;
12640
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12641
f_int2 = CAST(f_char1 AS SIGNED INT),
12642
f_charbig = 'just inserted'
12643
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12645
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12646
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12647
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12648
'just inserted' FROM t0_template
12649
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12650
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
12652
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12653
f_charbig = 'updated by trigger'
12654
WHERE f_int1 = - old.f_int1;
12656
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
12657
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12659
# check trigger-4 success: 1
12660
DROP TRIGGER trg_1;
12661
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12662
f_int2 = CAST(f_char1 AS SIGNED INT),
12663
f_charbig = 'just inserted'
12664
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12666
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12667
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12668
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12669
'just inserted' FROM t0_template
12670
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12671
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
12673
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12674
f_charbig = 'updated by trigger'
12675
WHERE f_int1 = new.f_int1;
12677
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
12678
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12680
# check trigger-5 success: 1
12681
DROP TRIGGER trg_1;
12682
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12683
f_int2 = CAST(f_char1 AS SIGNED INT),
12684
f_charbig = 'just inserted'
12685
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12687
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12688
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12689
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12690
'just inserted' FROM t0_template
12691
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12692
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
12694
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12695
f_charbig = 'updated by trigger'
12696
WHERE f_int1 = - old.f_int1;
12698
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
12699
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12701
# check trigger-6 success: 1
12702
DROP TRIGGER trg_1;
12703
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12704
f_int2 = CAST(f_char1 AS SIGNED INT),
12705
f_charbig = 'just inserted'
12706
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12708
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12709
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12710
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12711
'just inserted' FROM t0_template
12712
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12713
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
12715
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12716
f_charbig = 'updated by trigger'
12717
WHERE f_int1 = - old.f_int1;
12720
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12722
# check trigger-7 success: 1
12723
DROP TRIGGER trg_1;
12724
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12725
f_int2 = CAST(f_char1 AS SIGNED INT),
12726
f_charbig = 'just inserted'
12727
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12729
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12730
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
12731
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
12732
'just inserted' FROM t0_template
12733
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12734
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
12736
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
12737
f_charbig = 'updated by trigger'
12738
WHERE f_int1 = - old.f_int1;
12741
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
12743
# check trigger-8 success: 1
12744
DROP TRIGGER trg_1;
12745
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12746
f_int2 = CAST(f_char1 AS SIGNED INT),
12747
f_charbig = 'just inserted'
12748
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
12750
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12752
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
12753
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
12755
SET new.f_int1 = old.f_int1 + @max_row,
12756
new.f_int2 = old.f_int2 - @max_row,
12757
new.f_charbig = '####updated per update trigger####';
12760
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
12761
f_charbig = '####updated per update statement itself####';
12763
# check trigger-9 success: 1
12764
DROP TRIGGER trg_2;
12765
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12766
f_int2 = CAST(f_char1 AS SIGNED INT),
12767
f_charbig = CONCAT('===',f_char1,'===');
12768
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
12770
SET new.f_int1 = new.f_int1 + @max_row,
12771
new.f_int2 = new.f_int2 - @max_row,
12772
new.f_charbig = '####updated per update trigger####';
12775
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
12776
f_charbig = '####updated per update statement itself####';
12778
# check trigger-10 success: 1
12779
DROP TRIGGER trg_2;
12780
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
12781
f_int2 = CAST(f_char1 AS SIGNED INT),
12782
f_charbig = CONCAT('===',f_char1,'===');
12783
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
12785
SET new.f_int1 = @my_max1 + @counter,
12786
new.f_int2 = @my_min2 - @counter,
12787
new.f_charbig = '####updated per insert trigger####';
12788
SET @counter = @counter + 1;
12791
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
12792
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12793
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
12794
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
12795
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
12797
DROP TRIGGER trg_3;
12799
# check trigger-11 success: 1
12801
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
12802
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
12803
AND f_charbig = '####updated per insert trigger####';
12804
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
12806
SET new.f_int1 = @my_max1 + @counter,
12807
new.f_int2 = @my_min2 - @counter,
12808
new.f_charbig = '####updated per insert trigger####';
12809
SET @counter = @counter + 1;
12812
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
12813
INSERT INTO t1 (f_char1, f_char2, f_charbig)
12814
SELECT CAST(f_int1 AS CHAR),
12815
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
12816
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
12818
DROP TRIGGER trg_3;
12820
# check trigger-12 success: 1
12822
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
12823
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
12824
AND f_charbig = '####updated per insert trigger####';
12826
Table Op Msg_type Msg_text
12827
test.t1 analyze note The storage engine for the table doesn't support analyze
12828
CHECK TABLE t1 EXTENDED;
12829
Table Op Msg_type Msg_text
12830
test.t1 check note The storage engine for the table doesn't support check
12831
CHECKSUM TABLE t1 EXTENDED;
12833
test.t1 <some_value>
12835
Table Op Msg_type Msg_text
12836
test.t1 optimize note The storage engine for the table doesn't support optimize
12837
# check layout success: 1
12838
REPAIR TABLE t1 EXTENDED;
12839
Table Op Msg_type Msg_text
12840
test.t1 repair note The storage engine for the table doesn't support repair
12841
# check layout success: 1
12844
# check TRUNCATE success: 1
12845
# check layout success: 1
12846
# End usability test (inc/partition_check.inc)
12853
f_charbig VARCHAR(1000)
12854
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
12856
PARTITION BY LIST(MOD(f_int1 + f_int2,4))
12857
(PARTITION part_3 VALUES IN (-3),
12858
PARTITION part_2 VALUES IN (-2),
12859
PARTITION part_1 VALUES IN (-1),
12860
PARTITION part_N VALUES IN (NULL),
12861
PARTITION part0 VALUES IN (0),
12862
PARTITION part1 VALUES IN (1),
12863
PARTITION part2 VALUES IN (2),
12864
PARTITION part3 VALUES IN (3));
12865
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
12866
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
12867
# Start usability test (inc/partition_check.inc)
12869
SHOW CREATE TABLE t1;
12871
t1 CREATE TABLE `t1` (
12872
`f_int1` int(11) DEFAULT NULL,
12873
`f_int2` int(11) DEFAULT NULL,
12874
`f_char1` char(20) DEFAULT NULL,
12875
`f_char2` char(20) DEFAULT NULL,
12876
`f_charbig` varchar(1000) DEFAULT NULL,
12877
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
12878
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
12879
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) ENGINE = MyISAM, PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */
12882
$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD
12883
$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI
12884
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD
12885
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI
12886
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD
12887
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI
12888
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD
12889
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI
12890
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD
12891
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI
12892
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD
12893
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI
12894
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD
12895
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI
12896
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD
12897
$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI
12898
$MYSQLTEST_VARDIR/master-data/test/t1.frm
12899
$MYSQLTEST_VARDIR/master-data/test/t1.par
12901
# check prerequisites-1 success: 1
12902
# check COUNT(*) success: 1
12903
# check MIN/MAX(f_int1) success: 1
12904
# check MIN/MAX(f_int2) success: 1
12905
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12906
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
12907
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
12908
WHERE f_int1 IN (2,3);
12909
ERROR 23000: Can't write; duplicate key in table 't1'
12910
# check prerequisites-3 success: 1
12911
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
12912
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12913
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
12914
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
12915
WHERE f_int1 IN (2,3);
12916
DELETE FROM t1 WHERE f_charbig = 'delete me';
12917
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
12918
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
12919
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
12920
WHERE f_int1 IN (2,3);
12921
DELETE FROM t1 WHERE f_charbig = 'delete me';
12922
# check read via f_int1 success: 1
12923
# check read via f_int2 success: 1
12925
# check multiple-1 success: 1
12926
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
12928
# check multiple-2 success: 1
12929
INSERT INTO t1 SELECT * FROM t0_template
12930
WHERE MOD(f_int1,3) = 0;
12932
# check multiple-3 success: 1
12933
UPDATE t1 SET f_int1 = f_int1 + @max_row
12934
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
12935
AND @max_row_div2 + @max_row_div4;
12937
# check multiple-4 success: 1
12939
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
12940
AND @max_row_div2 + @max_row_div4 + @max_row;
12942
# check multiple-5 success: 1
12943
SELECT COUNT(*) INTO @try_count FROM t0_template
12944
WHERE MOD(f_int1,3) = 0
12945
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
12946
SELECT COUNT(*) INTO @clash_count
12947
FROM t1 INNER JOIN t0_template USING(f_int1)
12948
WHERE MOD(f_int1,3) = 0
12949
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
12950
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
12952
SET f_int1 = @cur_value , f_int2 = @cur_value,
12953
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
12954
f_charbig = '#SINGLE#';
12956
# check single-1 success: 1
12957
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
12959
SET f_int1 = @cur_value , f_int2 = @cur_value,
12960
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
12961
f_charbig = '#SINGLE#';
12963
# check single-2 success: 1
12964
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
12965
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
12966
UPDATE t1 SET f_int1 = @cur_value2
12967
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
12969
# check single-3 success: 1
12970
SET @cur_value1= -1;
12971
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
12972
UPDATE t1 SET f_int1 = @cur_value1
12973
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
12975
# check single-4 success: 1
12976
SELECT MAX(f_int1) INTO @cur_value FROM t1;
12977
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
12979
# check single-5 success: 1
12980
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
12982
# check single-6 success: 1
12983
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
12985
# check single-7 success: 1
12986
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
12987
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
12988
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
12989
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
12990
f_charbig = '#NULL#';
12992
SET f_int1 = NULL , f_int2 = -@max_row,
12993
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
12994
f_charbig = '#NULL#';
12995
# check null success: 1
12997
# check null-1 success: 1
12998
UPDATE t1 SET f_int1 = -@max_row
12999
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
13000
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
13002
# check null-2 success: 1
13003
UPDATE t1 SET f_int1 = NULL
13004
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
13005
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
13007
# check null-3 success: 1
13009
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
13010
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
13012
# check null-4 success: 1
13014
WHERE f_int1 = 0 AND f_int2 = 0
13015
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
13016
AND f_charbig = '#NULL#';
13017
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13018
SELECT f_int1, f_int1, '', '', 'was inserted'
13019
FROM t0_template source_tab
13020
WHERE MOD(f_int1,3) = 0
13021
AND f_int1 BETWEEN @max_row_div2 AND @max_row
13023
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
13024
f_int2 = 2 * @max_row + source_tab.f_int1,
13025
f_charbig = 'was updated';
13027
# check unique-1-a success: 1
13029
# check unique-1-b success: 1
13030
DELETE FROM t1 WHERE f_charbig = 'was inserted';
13031
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13032
f_int2 = CAST(f_char1 AS SIGNED INT),
13033
f_charbig = CONCAT('===',f_char1,'===')
13034
WHERE f_charbig = 'was updated';
13035
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13036
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
13037
FROM t0_template source_tab
13038
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
13040
# check replace success: 1
13042
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
13044
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
13045
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
13046
UPDATE t1 SET f_int2 = f_int1,
13047
f_char1 = CAST(f_int1 AS CHAR),
13048
f_char2 = CAST(f_int1 AS CHAR),
13049
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
13050
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
13052
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13053
SELECT f_int1, f_int1, '', '', 'was inserted'
13054
FROM t0_template source_tab
13055
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
13057
# check transactions-1 success: 1
13060
# check transactions-2 success: 1
13063
# check transactions-3 success: 1
13064
DELETE FROM t1 WHERE f_charbig = 'was inserted';
13068
# check transactions-4 success: 1
13069
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13070
SELECT f_int1, f_int1, '', '', 'was inserted'
13071
FROM t0_template source_tab
13072
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
13074
# check transactions-5 success: 1
13077
Warning 1196 Some non-transactional changed tables couldn't be rolled back
13079
# check transactions-6 success: 1
13080
# INFO: Storage engine used for t1 seems to be not transactional.
13083
# check transactions-7 success: 1
13084
DELETE FROM t1 WHERE f_charbig = 'was inserted';
13086
SET @@session.sql_mode = 'traditional';
13087
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
13088
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13089
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
13090
'', '', 'was inserted' FROM t0_template
13091
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
13092
ERROR 22012: Division by 0
13095
# check transactions-8 success: 1
13096
# INFO: Storage engine used for t1 seems to be unable to revert
13097
# changes made by the failing statement.
13098
SET @@session.sql_mode = '';
13100
DELETE FROM t1 WHERE f_charbig = 'was inserted';
13102
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
13104
# check special-1 success: 1
13105
UPDATE t1 SET f_charbig = '';
13107
# check special-2 success: 1
13108
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
13109
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
13110
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
13111
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13112
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13113
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13114
'just inserted' FROM t0_template
13115
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13116
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
13118
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13119
f_charbig = 'updated by trigger'
13120
WHERE f_int1 = new.f_int1;
13122
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13123
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
13124
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13126
# check trigger-1 success: 1
13127
DROP TRIGGER trg_1;
13128
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13129
f_int2 = CAST(f_char1 AS SIGNED INT),
13130
f_charbig = 'just inserted'
13131
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13133
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13134
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13135
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13136
'just inserted' FROM t0_template
13137
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13138
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
13140
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13141
f_charbig = 'updated by trigger'
13142
WHERE f_int1 = new.f_int1;
13144
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13145
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
13146
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13148
# check trigger-2 success: 1
13149
DROP TRIGGER trg_1;
13150
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13151
f_int2 = CAST(f_char1 AS SIGNED INT),
13152
f_charbig = 'just inserted'
13153
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13155
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13156
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13157
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13158
'just inserted' FROM t0_template
13159
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13160
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
13162
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13163
f_charbig = 'updated by trigger'
13164
WHERE f_int1 = new.f_int1;
13166
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
13167
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13169
# check trigger-3 success: 1
13170
DROP TRIGGER trg_1;
13171
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13172
f_int2 = CAST(f_char1 AS SIGNED INT),
13173
f_charbig = 'just inserted'
13174
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13176
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13177
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13178
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13179
'just inserted' FROM t0_template
13180
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13181
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
13183
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13184
f_charbig = 'updated by trigger'
13185
WHERE f_int1 = - old.f_int1;
13187
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
13188
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13190
# check trigger-4 success: 1
13191
DROP TRIGGER trg_1;
13192
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13193
f_int2 = CAST(f_char1 AS SIGNED INT),
13194
f_charbig = 'just inserted'
13195
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13197
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13198
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13199
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13200
'just inserted' FROM t0_template
13201
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13202
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
13204
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13205
f_charbig = 'updated by trigger'
13206
WHERE f_int1 = new.f_int1;
13208
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
13209
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13211
# check trigger-5 success: 1
13212
DROP TRIGGER trg_1;
13213
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13214
f_int2 = CAST(f_char1 AS SIGNED INT),
13215
f_charbig = 'just inserted'
13216
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13218
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13219
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13220
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13221
'just inserted' FROM t0_template
13222
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13223
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
13225
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13226
f_charbig = 'updated by trigger'
13227
WHERE f_int1 = - old.f_int1;
13229
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
13230
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13232
# check trigger-6 success: 1
13233
DROP TRIGGER trg_1;
13234
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13235
f_int2 = CAST(f_char1 AS SIGNED INT),
13236
f_charbig = 'just inserted'
13237
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13239
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13240
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13241
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13242
'just inserted' FROM t0_template
13243
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13244
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
13246
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13247
f_charbig = 'updated by trigger'
13248
WHERE f_int1 = - old.f_int1;
13251
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13253
# check trigger-7 success: 1
13254
DROP TRIGGER trg_1;
13255
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13256
f_int2 = CAST(f_char1 AS SIGNED INT),
13257
f_charbig = 'just inserted'
13258
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13260
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13261
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13262
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13263
'just inserted' FROM t0_template
13264
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13265
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
13267
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13268
f_charbig = 'updated by trigger'
13269
WHERE f_int1 = - old.f_int1;
13272
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13274
# check trigger-8 success: 1
13275
DROP TRIGGER trg_1;
13276
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13277
f_int2 = CAST(f_char1 AS SIGNED INT),
13278
f_charbig = 'just inserted'
13279
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13281
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13283
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13284
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
13286
SET new.f_int1 = old.f_int1 + @max_row,
13287
new.f_int2 = old.f_int2 - @max_row,
13288
new.f_charbig = '####updated per update trigger####';
13291
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
13292
f_charbig = '####updated per update statement itself####';
13294
# check trigger-9 success: 1
13295
DROP TRIGGER trg_2;
13296
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13297
f_int2 = CAST(f_char1 AS SIGNED INT),
13298
f_charbig = CONCAT('===',f_char1,'===');
13299
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
13301
SET new.f_int1 = new.f_int1 + @max_row,
13302
new.f_int2 = new.f_int2 - @max_row,
13303
new.f_charbig = '####updated per update trigger####';
13306
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
13307
f_charbig = '####updated per update statement itself####';
13309
# check trigger-10 success: 1
13310
DROP TRIGGER trg_2;
13311
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13312
f_int2 = CAST(f_char1 AS SIGNED INT),
13313
f_charbig = CONCAT('===',f_char1,'===');
13314
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
13316
SET new.f_int1 = @my_max1 + @counter,
13317
new.f_int2 = @my_min2 - @counter,
13318
new.f_charbig = '####updated per insert trigger####';
13319
SET @counter = @counter + 1;
13322
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
13323
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13324
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
13325
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
13326
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
13328
DROP TRIGGER trg_3;
13330
# check trigger-11 success: 1
13332
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
13333
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
13334
AND f_charbig = '####updated per insert trigger####';
13335
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
13337
SET new.f_int1 = @my_max1 + @counter,
13338
new.f_int2 = @my_min2 - @counter,
13339
new.f_charbig = '####updated per insert trigger####';
13340
SET @counter = @counter + 1;
13343
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
13344
INSERT INTO t1 (f_char1, f_char2, f_charbig)
13345
SELECT CAST(f_int1 AS CHAR),
13346
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
13347
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
13349
DROP TRIGGER trg_3;
13351
# check trigger-12 success: 1
13353
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
13354
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
13355
AND f_charbig = '####updated per insert trigger####';
13357
Table Op Msg_type Msg_text
13358
test.t1 analyze note The storage engine for the table doesn't support analyze
13359
CHECK TABLE t1 EXTENDED;
13360
Table Op Msg_type Msg_text
13361
test.t1 check note The storage engine for the table doesn't support check
13362
CHECKSUM TABLE t1 EXTENDED;
13364
test.t1 <some_value>
13366
Table Op Msg_type Msg_text
13367
test.t1 optimize note The storage engine for the table doesn't support optimize
13368
# check layout success: 1
13369
REPAIR TABLE t1 EXTENDED;
13370
Table Op Msg_type Msg_text
13371
test.t1 repair note The storage engine for the table doesn't support repair
13372
# check layout success: 1
13375
# check TRUNCATE success: 1
13376
# check layout success: 1
13377
# End usability test (inc/partition_check.inc)
13384
f_charbig VARCHAR(1000)
13385
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
13387
PARTITION BY RANGE((f_int1 + f_int2) DIV 2)
13388
(PARTITION parta VALUES LESS THAN (0),
13389
PARTITION partb VALUES LESS THAN (5),
13390
PARTITION partc VALUES LESS THAN (10),
13391
PARTITION partd VALUES LESS THAN (10 + 5),
13392
PARTITION parte VALUES LESS THAN (20),
13393
PARTITION partf VALUES LESS THAN (2147483646));
13394
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
13395
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
13396
# Start usability test (inc/partition_check.inc)
13398
SHOW CREATE TABLE t1;
13400
t1 CREATE TABLE `t1` (
13401
`f_int1` int(11) DEFAULT NULL,
13402
`f_int2` int(11) DEFAULT NULL,
13403
`f_char1` char(20) DEFAULT NULL,
13404
`f_char2` char(20) DEFAULT NULL,
13405
`f_charbig` varchar(1000) DEFAULT NULL,
13406
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
13407
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
13408
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */
13411
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD
13412
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI
13413
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD
13414
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI
13415
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD
13416
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI
13417
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD
13418
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI
13419
$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD
13420
$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI
13421
$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD
13422
$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI
13423
$MYSQLTEST_VARDIR/master-data/test/t1.frm
13424
$MYSQLTEST_VARDIR/master-data/test/t1.par
13426
# check prerequisites-1 success: 1
13427
# check COUNT(*) success: 1
13428
# check MIN/MAX(f_int1) success: 1
13429
# check MIN/MAX(f_int2) success: 1
13430
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13431
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
13432
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
13433
WHERE f_int1 IN (2,3);
13434
ERROR 23000: Can't write; duplicate key in table 't1'
13435
# check prerequisites-3 success: 1
13436
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
13437
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13438
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
13439
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
13440
WHERE f_int1 IN (2,3);
13441
DELETE FROM t1 WHERE f_charbig = 'delete me';
13442
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13443
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
13444
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
13445
WHERE f_int1 IN (2,3);
13446
DELETE FROM t1 WHERE f_charbig = 'delete me';
13447
# check read via f_int1 success: 1
13448
# check read via f_int2 success: 1
13450
# check multiple-1 success: 1
13451
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
13453
# check multiple-2 success: 1
13454
INSERT INTO t1 SELECT * FROM t0_template
13455
WHERE MOD(f_int1,3) = 0;
13457
# check multiple-3 success: 1
13458
UPDATE t1 SET f_int1 = f_int1 + @max_row
13459
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
13460
AND @max_row_div2 + @max_row_div4;
13462
# check multiple-4 success: 1
13464
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
13465
AND @max_row_div2 + @max_row_div4 + @max_row;
13467
# check multiple-5 success: 1
13468
SELECT COUNT(*) INTO @try_count FROM t0_template
13469
WHERE MOD(f_int1,3) = 0
13470
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
13471
SELECT COUNT(*) INTO @clash_count
13472
FROM t1 INNER JOIN t0_template USING(f_int1)
13473
WHERE MOD(f_int1,3) = 0
13474
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
13475
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
13477
SET f_int1 = @cur_value , f_int2 = @cur_value,
13478
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
13479
f_charbig = '#SINGLE#';
13481
# check single-1 success: 1
13482
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
13484
SET f_int1 = @cur_value , f_int2 = @cur_value,
13485
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
13486
f_charbig = '#SINGLE#';
13488
# check single-2 success: 1
13489
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
13490
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
13491
UPDATE t1 SET f_int1 = @cur_value2
13492
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
13494
# check single-3 success: 1
13495
SET @cur_value1= -1;
13496
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
13497
UPDATE t1 SET f_int1 = @cur_value1
13498
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
13500
# check single-4 success: 1
13501
SELECT MAX(f_int1) INTO @cur_value FROM t1;
13502
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
13504
# check single-5 success: 1
13505
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
13507
# check single-6 success: 1
13508
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
13509
ERROR HY000: Table has no partition for value 2147483647
13510
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
13511
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
13512
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
13513
f_charbig = '#NULL#';
13515
SET f_int1 = NULL , f_int2 = -@max_row,
13516
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
13517
f_charbig = '#NULL#';
13518
# check null success: 1
13520
# check null-1 success: 1
13521
UPDATE t1 SET f_int1 = -@max_row
13522
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
13523
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
13525
# check null-2 success: 1
13526
UPDATE t1 SET f_int1 = NULL
13527
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
13528
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
13530
# check null-3 success: 1
13532
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
13533
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
13535
# check null-4 success: 1
13537
WHERE f_int1 = 0 AND f_int2 = 0
13538
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
13539
AND f_charbig = '#NULL#';
13540
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13541
SELECT f_int1, f_int1, '', '', 'was inserted'
13542
FROM t0_template source_tab
13543
WHERE MOD(f_int1,3) = 0
13544
AND f_int1 BETWEEN @max_row_div2 AND @max_row
13546
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
13547
f_int2 = 2 * @max_row + source_tab.f_int1,
13548
f_charbig = 'was updated';
13550
# check unique-1-a success: 1
13552
# check unique-1-b success: 1
13553
DELETE FROM t1 WHERE f_charbig = 'was inserted';
13554
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13555
f_int2 = CAST(f_char1 AS SIGNED INT),
13556
f_charbig = CONCAT('===',f_char1,'===')
13557
WHERE f_charbig = 'was updated';
13558
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13559
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
13560
FROM t0_template source_tab
13561
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
13563
# check replace success: 1
13565
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
13567
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
13568
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
13569
UPDATE t1 SET f_int2 = f_int1,
13570
f_char1 = CAST(f_int1 AS CHAR),
13571
f_char2 = CAST(f_int1 AS CHAR),
13572
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
13573
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
13575
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13576
SELECT f_int1, f_int1, '', '', 'was inserted'
13577
FROM t0_template source_tab
13578
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
13580
# check transactions-1 success: 1
13583
# check transactions-2 success: 1
13586
# check transactions-3 success: 1
13587
DELETE FROM t1 WHERE f_charbig = 'was inserted';
13591
# check transactions-4 success: 1
13592
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13593
SELECT f_int1, f_int1, '', '', 'was inserted'
13594
FROM t0_template source_tab
13595
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
13597
# check transactions-5 success: 1
13600
Warning 1196 Some non-transactional changed tables couldn't be rolled back
13602
# check transactions-6 success: 1
13603
# INFO: Storage engine used for t1 seems to be not transactional.
13606
# check transactions-7 success: 1
13607
DELETE FROM t1 WHERE f_charbig = 'was inserted';
13609
SET @@session.sql_mode = 'traditional';
13610
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
13611
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13612
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
13613
'', '', 'was inserted' FROM t0_template
13614
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
13615
ERROR 22012: Division by 0
13618
# check transactions-8 success: 1
13619
# INFO: Storage engine used for t1 seems to be unable to revert
13620
# changes made by the failing statement.
13621
SET @@session.sql_mode = '';
13623
DELETE FROM t1 WHERE f_charbig = 'was inserted';
13625
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
13627
# check special-1 success: 1
13628
UPDATE t1 SET f_charbig = '';
13630
# check special-2 success: 1
13631
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
13632
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
13633
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
13634
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13635
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13636
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13637
'just inserted' FROM t0_template
13638
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13639
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
13641
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13642
f_charbig = 'updated by trigger'
13643
WHERE f_int1 = new.f_int1;
13645
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13646
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
13647
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13649
# check trigger-1 success: 1
13650
DROP TRIGGER trg_1;
13651
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13652
f_int2 = CAST(f_char1 AS SIGNED INT),
13653
f_charbig = 'just inserted'
13654
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13656
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13657
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13658
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13659
'just inserted' FROM t0_template
13660
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13661
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
13663
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13664
f_charbig = 'updated by trigger'
13665
WHERE f_int1 = new.f_int1;
13667
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13668
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
13669
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13671
# check trigger-2 success: 1
13672
DROP TRIGGER trg_1;
13673
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13674
f_int2 = CAST(f_char1 AS SIGNED INT),
13675
f_charbig = 'just inserted'
13676
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13678
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13679
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13680
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13681
'just inserted' FROM t0_template
13682
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13683
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
13685
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13686
f_charbig = 'updated by trigger'
13687
WHERE f_int1 = new.f_int1;
13689
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
13690
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13692
# check trigger-3 success: 1
13693
DROP TRIGGER trg_1;
13694
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13695
f_int2 = CAST(f_char1 AS SIGNED INT),
13696
f_charbig = 'just inserted'
13697
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13699
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13700
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13701
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13702
'just inserted' FROM t0_template
13703
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13704
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
13706
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13707
f_charbig = 'updated by trigger'
13708
WHERE f_int1 = - old.f_int1;
13710
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
13711
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13713
# check trigger-4 success: 1
13714
DROP TRIGGER trg_1;
13715
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13716
f_int2 = CAST(f_char1 AS SIGNED INT),
13717
f_charbig = 'just inserted'
13718
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13720
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13721
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13722
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13723
'just inserted' FROM t0_template
13724
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13725
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
13727
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13728
f_charbig = 'updated by trigger'
13729
WHERE f_int1 = new.f_int1;
13731
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
13732
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13734
# check trigger-5 success: 1
13735
DROP TRIGGER trg_1;
13736
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13737
f_int2 = CAST(f_char1 AS SIGNED INT),
13738
f_charbig = 'just inserted'
13739
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13741
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13742
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13743
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13744
'just inserted' FROM t0_template
13745
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13746
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
13748
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13749
f_charbig = 'updated by trigger'
13750
WHERE f_int1 = - old.f_int1;
13752
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
13753
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13755
# check trigger-6 success: 1
13756
DROP TRIGGER trg_1;
13757
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13758
f_int2 = CAST(f_char1 AS SIGNED INT),
13759
f_charbig = 'just inserted'
13760
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13762
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13763
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13764
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13765
'just inserted' FROM t0_template
13766
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13767
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
13769
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13770
f_charbig = 'updated by trigger'
13771
WHERE f_int1 = - old.f_int1;
13774
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13776
# check trigger-7 success: 1
13777
DROP TRIGGER trg_1;
13778
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13779
f_int2 = CAST(f_char1 AS SIGNED INT),
13780
f_charbig = 'just inserted'
13781
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13783
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13784
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
13785
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
13786
'just inserted' FROM t0_template
13787
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13788
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
13790
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
13791
f_charbig = 'updated by trigger'
13792
WHERE f_int1 = - old.f_int1;
13795
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
13797
# check trigger-8 success: 1
13798
DROP TRIGGER trg_1;
13799
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13800
f_int2 = CAST(f_char1 AS SIGNED INT),
13801
f_charbig = 'just inserted'
13802
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
13804
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13806
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
13807
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
13809
SET new.f_int1 = old.f_int1 + @max_row,
13810
new.f_int2 = old.f_int2 - @max_row,
13811
new.f_charbig = '####updated per update trigger####';
13814
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
13815
f_charbig = '####updated per update statement itself####';
13817
# check trigger-9 success: 1
13818
DROP TRIGGER trg_2;
13819
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13820
f_int2 = CAST(f_char1 AS SIGNED INT),
13821
f_charbig = CONCAT('===',f_char1,'===');
13822
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
13824
SET new.f_int1 = new.f_int1 + @max_row,
13825
new.f_int2 = new.f_int2 - @max_row,
13826
new.f_charbig = '####updated per update trigger####';
13829
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
13830
f_charbig = '####updated per update statement itself####';
13832
# check trigger-10 success: 1
13833
DROP TRIGGER trg_2;
13834
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
13835
f_int2 = CAST(f_char1 AS SIGNED INT),
13836
f_charbig = CONCAT('===',f_char1,'===');
13837
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
13839
SET new.f_int1 = @my_max1 + @counter,
13840
new.f_int2 = @my_min2 - @counter,
13841
new.f_charbig = '####updated per insert trigger####';
13842
SET @counter = @counter + 1;
13845
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
13846
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13847
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
13848
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
13849
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
13851
DROP TRIGGER trg_3;
13853
# check trigger-11 success: 1
13855
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
13856
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
13857
AND f_charbig = '####updated per insert trigger####';
13858
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
13860
SET new.f_int1 = @my_max1 + @counter,
13861
new.f_int2 = @my_min2 - @counter,
13862
new.f_charbig = '####updated per insert trigger####';
13863
SET @counter = @counter + 1;
13866
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
13867
INSERT INTO t1 (f_char1, f_char2, f_charbig)
13868
SELECT CAST(f_int1 AS CHAR),
13869
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
13870
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
13872
DROP TRIGGER trg_3;
13874
# check trigger-12 success: 1
13876
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
13877
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
13878
AND f_charbig = '####updated per insert trigger####';
13880
Table Op Msg_type Msg_text
13881
test.t1 analyze note The storage engine for the table doesn't support analyze
13882
CHECK TABLE t1 EXTENDED;
13883
Table Op Msg_type Msg_text
13884
test.t1 check note The storage engine for the table doesn't support check
13885
CHECKSUM TABLE t1 EXTENDED;
13887
test.t1 <some_value>
13889
Table Op Msg_type Msg_text
13890
test.t1 optimize note The storage engine for the table doesn't support optimize
13891
# check layout success: 1
13892
REPAIR TABLE t1 EXTENDED;
13893
Table Op Msg_type Msg_text
13894
test.t1 repair note The storage engine for the table doesn't support repair
13895
# check layout success: 1
13898
# check TRUNCATE success: 1
13899
# check layout success: 1
13900
# End usability test (inc/partition_check.inc)
13907
f_charbig VARCHAR(1000)
13908
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
13910
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2
13911
(PARTITION parta VALUES LESS THAN (0),
13912
PARTITION partb VALUES LESS THAN (5),
13913
PARTITION partc VALUES LESS THAN (10),
13914
PARTITION partd VALUES LESS THAN (2147483646));
13915
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
13916
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
13917
# Start usability test (inc/partition_check.inc)
13919
SHOW CREATE TABLE t1;
13921
t1 CREATE TABLE `t1` (
13922
`f_int1` int(11) DEFAULT NULL,
13923
`f_int2` int(11) DEFAULT NULL,
13924
`f_char1` char(20) DEFAULT NULL,
13925
`f_char2` char(20) DEFAULT NULL,
13926
`f_charbig` varchar(1000) DEFAULT NULL,
13927
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
13928
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
13929
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */
13932
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD
13933
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI
13934
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD
13935
$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI
13936
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD
13937
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI
13938
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD
13939
$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI
13940
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD
13941
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI
13942
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD
13943
$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI
13944
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD
13945
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI
13946
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD
13947
$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI
13948
$MYSQLTEST_VARDIR/master-data/test/t1.frm
13949
$MYSQLTEST_VARDIR/master-data/test/t1.par
13951
# check prerequisites-1 success: 1
13952
# check COUNT(*) success: 1
13953
# check MIN/MAX(f_int1) success: 1
13954
# check MIN/MAX(f_int2) success: 1
13955
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13956
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
13957
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
13958
WHERE f_int1 IN (2,3);
13959
ERROR 23000: Can't write; duplicate key in table 't1'
13960
# check prerequisites-3 success: 1
13961
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
13962
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13963
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
13964
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
13965
WHERE f_int1 IN (2,3);
13966
DELETE FROM t1 WHERE f_charbig = 'delete me';
13967
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
13968
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
13969
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
13970
WHERE f_int1 IN (2,3);
13971
DELETE FROM t1 WHERE f_charbig = 'delete me';
13972
# check read via f_int1 success: 1
13973
# check read via f_int2 success: 1
13975
# check multiple-1 success: 1
13976
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
13978
# check multiple-2 success: 1
13979
INSERT INTO t1 SELECT * FROM t0_template
13980
WHERE MOD(f_int1,3) = 0;
13982
# check multiple-3 success: 1
13983
UPDATE t1 SET f_int1 = f_int1 + @max_row
13984
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
13985
AND @max_row_div2 + @max_row_div4;
13987
# check multiple-4 success: 1
13989
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
13990
AND @max_row_div2 + @max_row_div4 + @max_row;
13992
# check multiple-5 success: 1
13993
SELECT COUNT(*) INTO @try_count FROM t0_template
13994
WHERE MOD(f_int1,3) = 0
13995
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
13996
SELECT COUNT(*) INTO @clash_count
13997
FROM t1 INNER JOIN t0_template USING(f_int1)
13998
WHERE MOD(f_int1,3) = 0
13999
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
14000
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
14002
SET f_int1 = @cur_value , f_int2 = @cur_value,
14003
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
14004
f_charbig = '#SINGLE#';
14006
# check single-1 success: 1
14007
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
14009
SET f_int1 = @cur_value , f_int2 = @cur_value,
14010
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
14011
f_charbig = '#SINGLE#';
14013
# check single-2 success: 1
14014
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
14015
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
14016
UPDATE t1 SET f_int1 = @cur_value2
14017
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
14019
# check single-3 success: 1
14020
SET @cur_value1= -1;
14021
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
14022
UPDATE t1 SET f_int1 = @cur_value1
14023
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
14025
# check single-4 success: 1
14026
SELECT MAX(f_int1) INTO @cur_value FROM t1;
14027
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
14029
# check single-5 success: 1
14030
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
14032
# check single-6 success: 1
14033
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
14034
ERROR HY000: Table has no partition for value 2147483647
14035
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
14036
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
14037
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
14038
f_charbig = '#NULL#';
14040
SET f_int1 = NULL , f_int2 = -@max_row,
14041
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
14042
f_charbig = '#NULL#';
14043
# check null success: 1
14045
# check null-1 success: 1
14046
UPDATE t1 SET f_int1 = -@max_row
14047
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
14048
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
14050
# check null-2 success: 1
14051
UPDATE t1 SET f_int1 = NULL
14052
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
14053
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
14055
# check null-3 success: 1
14057
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
14058
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
14060
# check null-4 success: 1
14062
WHERE f_int1 = 0 AND f_int2 = 0
14063
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
14064
AND f_charbig = '#NULL#';
14065
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14066
SELECT f_int1, f_int1, '', '', 'was inserted'
14067
FROM t0_template source_tab
14068
WHERE MOD(f_int1,3) = 0
14069
AND f_int1 BETWEEN @max_row_div2 AND @max_row
14071
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
14072
f_int2 = 2 * @max_row + source_tab.f_int1,
14073
f_charbig = 'was updated';
14075
# check unique-1-a success: 1
14077
# check unique-1-b success: 1
14078
DELETE FROM t1 WHERE f_charbig = 'was inserted';
14079
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14080
f_int2 = CAST(f_char1 AS SIGNED INT),
14081
f_charbig = CONCAT('===',f_char1,'===')
14082
WHERE f_charbig = 'was updated';
14083
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14084
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
14085
FROM t0_template source_tab
14086
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
14088
# check replace success: 1
14090
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
14092
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
14093
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
14094
UPDATE t1 SET f_int2 = f_int1,
14095
f_char1 = CAST(f_int1 AS CHAR),
14096
f_char2 = CAST(f_int1 AS CHAR),
14097
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
14098
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
14100
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14101
SELECT f_int1, f_int1, '', '', 'was inserted'
14102
FROM t0_template source_tab
14103
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
14105
# check transactions-1 success: 1
14108
# check transactions-2 success: 1
14111
# check transactions-3 success: 1
14112
DELETE FROM t1 WHERE f_charbig = 'was inserted';
14116
# check transactions-4 success: 1
14117
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14118
SELECT f_int1, f_int1, '', '', 'was inserted'
14119
FROM t0_template source_tab
14120
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
14122
# check transactions-5 success: 1
14125
Warning 1196 Some non-transactional changed tables couldn't be rolled back
14127
# check transactions-6 success: 1
14128
# INFO: Storage engine used for t1 seems to be not transactional.
14131
# check transactions-7 success: 1
14132
DELETE FROM t1 WHERE f_charbig = 'was inserted';
14134
SET @@session.sql_mode = 'traditional';
14135
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
14136
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14137
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
14138
'', '', 'was inserted' FROM t0_template
14139
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
14140
ERROR 22012: Division by 0
14143
# check transactions-8 success: 1
14144
# INFO: Storage engine used for t1 seems to be unable to revert
14145
# changes made by the failing statement.
14146
SET @@session.sql_mode = '';
14148
DELETE FROM t1 WHERE f_charbig = 'was inserted';
14150
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
14152
# check special-1 success: 1
14153
UPDATE t1 SET f_charbig = '';
14155
# check special-2 success: 1
14156
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
14157
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
14158
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
14159
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14160
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14161
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14162
'just inserted' FROM t0_template
14163
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14164
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
14166
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14167
f_charbig = 'updated by trigger'
14168
WHERE f_int1 = new.f_int1;
14170
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14171
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
14172
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14174
# check trigger-1 success: 1
14175
DROP TRIGGER trg_1;
14176
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14177
f_int2 = CAST(f_char1 AS SIGNED INT),
14178
f_charbig = 'just inserted'
14179
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14181
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14182
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14183
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14184
'just inserted' FROM t0_template
14185
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14186
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
14188
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14189
f_charbig = 'updated by trigger'
14190
WHERE f_int1 = new.f_int1;
14192
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14193
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
14194
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14196
# check trigger-2 success: 1
14197
DROP TRIGGER trg_1;
14198
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14199
f_int2 = CAST(f_char1 AS SIGNED INT),
14200
f_charbig = 'just inserted'
14201
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14203
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14204
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14205
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14206
'just inserted' FROM t0_template
14207
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14208
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
14210
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14211
f_charbig = 'updated by trigger'
14212
WHERE f_int1 = new.f_int1;
14214
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
14215
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14217
# check trigger-3 success: 1
14218
DROP TRIGGER trg_1;
14219
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14220
f_int2 = CAST(f_char1 AS SIGNED INT),
14221
f_charbig = 'just inserted'
14222
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14224
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14225
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14226
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14227
'just inserted' FROM t0_template
14228
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14229
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
14231
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14232
f_charbig = 'updated by trigger'
14233
WHERE f_int1 = - old.f_int1;
14235
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
14236
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14238
# check trigger-4 success: 1
14239
DROP TRIGGER trg_1;
14240
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14241
f_int2 = CAST(f_char1 AS SIGNED INT),
14242
f_charbig = 'just inserted'
14243
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14245
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14246
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14247
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14248
'just inserted' FROM t0_template
14249
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14250
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
14252
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14253
f_charbig = 'updated by trigger'
14254
WHERE f_int1 = new.f_int1;
14256
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
14257
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14259
# check trigger-5 success: 1
14260
DROP TRIGGER trg_1;
14261
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14262
f_int2 = CAST(f_char1 AS SIGNED INT),
14263
f_charbig = 'just inserted'
14264
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14266
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14267
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14268
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14269
'just inserted' FROM t0_template
14270
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14271
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
14273
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14274
f_charbig = 'updated by trigger'
14275
WHERE f_int1 = - old.f_int1;
14277
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
14278
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14280
# check trigger-6 success: 1
14281
DROP TRIGGER trg_1;
14282
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14283
f_int2 = CAST(f_char1 AS SIGNED INT),
14284
f_charbig = 'just inserted'
14285
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14287
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14288
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14289
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14290
'just inserted' FROM t0_template
14291
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14292
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
14294
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14295
f_charbig = 'updated by trigger'
14296
WHERE f_int1 = - old.f_int1;
14299
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14301
# check trigger-7 success: 1
14302
DROP TRIGGER trg_1;
14303
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14304
f_int2 = CAST(f_char1 AS SIGNED INT),
14305
f_charbig = 'just inserted'
14306
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14308
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14309
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14310
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14311
'just inserted' FROM t0_template
14312
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14313
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
14315
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14316
f_charbig = 'updated by trigger'
14317
WHERE f_int1 = - old.f_int1;
14320
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14322
# check trigger-8 success: 1
14323
DROP TRIGGER trg_1;
14324
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14325
f_int2 = CAST(f_char1 AS SIGNED INT),
14326
f_charbig = 'just inserted'
14327
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14329
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14331
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14332
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
14334
SET new.f_int1 = old.f_int1 + @max_row,
14335
new.f_int2 = old.f_int2 - @max_row,
14336
new.f_charbig = '####updated per update trigger####';
14339
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
14340
f_charbig = '####updated per update statement itself####';
14342
# check trigger-9 success: 1
14343
DROP TRIGGER trg_2;
14344
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14345
f_int2 = CAST(f_char1 AS SIGNED INT),
14346
f_charbig = CONCAT('===',f_char1,'===');
14347
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
14349
SET new.f_int1 = new.f_int1 + @max_row,
14350
new.f_int2 = new.f_int2 - @max_row,
14351
new.f_charbig = '####updated per update trigger####';
14354
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
14355
f_charbig = '####updated per update statement itself####';
14357
# check trigger-10 success: 1
14358
DROP TRIGGER trg_2;
14359
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14360
f_int2 = CAST(f_char1 AS SIGNED INT),
14361
f_charbig = CONCAT('===',f_char1,'===');
14362
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
14364
SET new.f_int1 = @my_max1 + @counter,
14365
new.f_int2 = @my_min2 - @counter,
14366
new.f_charbig = '####updated per insert trigger####';
14367
SET @counter = @counter + 1;
14370
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
14371
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14372
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
14373
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
14374
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
14376
DROP TRIGGER trg_3;
14378
# check trigger-11 success: 1
14380
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
14381
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
14382
AND f_charbig = '####updated per insert trigger####';
14383
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
14385
SET new.f_int1 = @my_max1 + @counter,
14386
new.f_int2 = @my_min2 - @counter,
14387
new.f_charbig = '####updated per insert trigger####';
14388
SET @counter = @counter + 1;
14391
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
14392
INSERT INTO t1 (f_char1, f_char2, f_charbig)
14393
SELECT CAST(f_int1 AS CHAR),
14394
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
14395
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
14397
DROP TRIGGER trg_3;
14399
# check trigger-12 success: 1
14401
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
14402
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
14403
AND f_charbig = '####updated per insert trigger####';
14405
Table Op Msg_type Msg_text
14406
test.t1 analyze note The storage engine for the table doesn't support analyze
14407
CHECK TABLE t1 EXTENDED;
14408
Table Op Msg_type Msg_text
14409
test.t1 check note The storage engine for the table doesn't support check
14410
CHECKSUM TABLE t1 EXTENDED;
14412
test.t1 <some_value>
14414
Table Op Msg_type Msg_text
14415
test.t1 optimize note The storage engine for the table doesn't support optimize
14416
# check layout success: 1
14417
REPAIR TABLE t1 EXTENDED;
14418
Table Op Msg_type Msg_text
14419
test.t1 repair note The storage engine for the table doesn't support repair
14420
# check layout success: 1
14423
# check TRUNCATE success: 1
14424
# check layout success: 1
14425
# End usability test (inc/partition_check.inc)
14432
f_charbig VARCHAR(1000)
14433
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
14435
PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2)
14436
(PARTITION part1 VALUES LESS THAN (0)
14437
(SUBPARTITION subpart11, SUBPARTITION subpart12),
14438
PARTITION part2 VALUES LESS THAN (5)
14439
(SUBPARTITION subpart21, SUBPARTITION subpart22),
14440
PARTITION part3 VALUES LESS THAN (10)
14441
(SUBPARTITION subpart31, SUBPARTITION subpart32),
14442
PARTITION part4 VALUES LESS THAN (2147483646)
14443
(SUBPARTITION subpart41, SUBPARTITION subpart42));
14444
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
14445
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
14446
# Start usability test (inc/partition_check.inc)
14448
SHOW CREATE TABLE t1;
14450
t1 CREATE TABLE `t1` (
14451
`f_int1` int(11) DEFAULT NULL,
14452
`f_int2` int(11) DEFAULT NULL,
14453
`f_char1` char(20) DEFAULT NULL,
14454
`f_char2` char(20) DEFAULT NULL,
14455
`f_charbig` varchar(1000) DEFAULT NULL,
14456
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
14457
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
14458
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */
14461
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD
14462
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI
14463
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD
14464
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI
14465
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD
14466
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI
14467
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD
14468
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI
14469
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD
14470
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI
14471
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD
14472
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI
14473
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD
14474
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI
14475
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD
14476
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI
14477
$MYSQLTEST_VARDIR/master-data/test/t1.frm
14478
$MYSQLTEST_VARDIR/master-data/test/t1.par
14480
# check prerequisites-1 success: 1
14481
# check COUNT(*) success: 1
14482
# check MIN/MAX(f_int1) success: 1
14483
# check MIN/MAX(f_int2) success: 1
14484
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14485
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
14486
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
14487
WHERE f_int1 IN (2,3);
14488
ERROR 23000: Can't write; duplicate key in table 't1'
14489
# check prerequisites-3 success: 1
14490
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
14491
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14492
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
14493
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
14494
WHERE f_int1 IN (2,3);
14495
DELETE FROM t1 WHERE f_charbig = 'delete me';
14496
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14497
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
14498
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
14499
WHERE f_int1 IN (2,3);
14500
DELETE FROM t1 WHERE f_charbig = 'delete me';
14501
# check read via f_int1 success: 1
14502
# check read via f_int2 success: 1
14504
# check multiple-1 success: 1
14505
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
14507
# check multiple-2 success: 1
14508
INSERT INTO t1 SELECT * FROM t0_template
14509
WHERE MOD(f_int1,3) = 0;
14511
# check multiple-3 success: 1
14512
UPDATE t1 SET f_int1 = f_int1 + @max_row
14513
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
14514
AND @max_row_div2 + @max_row_div4;
14516
# check multiple-4 success: 1
14518
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
14519
AND @max_row_div2 + @max_row_div4 + @max_row;
14521
# check multiple-5 success: 1
14522
SELECT COUNT(*) INTO @try_count FROM t0_template
14523
WHERE MOD(f_int1,3) = 0
14524
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
14525
SELECT COUNT(*) INTO @clash_count
14526
FROM t1 INNER JOIN t0_template USING(f_int1)
14527
WHERE MOD(f_int1,3) = 0
14528
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
14529
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
14531
SET f_int1 = @cur_value , f_int2 = @cur_value,
14532
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
14533
f_charbig = '#SINGLE#';
14535
# check single-1 success: 1
14536
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
14538
SET f_int1 = @cur_value , f_int2 = @cur_value,
14539
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
14540
f_charbig = '#SINGLE#';
14542
# check single-2 success: 1
14543
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
14544
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
14545
UPDATE t1 SET f_int1 = @cur_value2
14546
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
14548
# check single-3 success: 1
14549
SET @cur_value1= -1;
14550
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
14551
UPDATE t1 SET f_int1 = @cur_value1
14552
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
14554
# check single-4 success: 1
14555
SELECT MAX(f_int1) INTO @cur_value FROM t1;
14556
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
14558
# check single-5 success: 1
14559
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
14561
# check single-6 success: 1
14562
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
14563
ERROR HY000: Table has no partition for value 2147483647
14564
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
14565
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
14566
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
14567
f_charbig = '#NULL#';
14569
SET f_int1 = NULL , f_int2 = -@max_row,
14570
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
14571
f_charbig = '#NULL#';
14572
# check null success: 1
14574
# check null-1 success: 1
14575
UPDATE t1 SET f_int1 = -@max_row
14576
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
14577
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
14579
# check null-2 success: 1
14580
UPDATE t1 SET f_int1 = NULL
14581
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
14582
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
14584
# check null-3 success: 1
14586
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
14587
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
14589
# check null-4 success: 1
14591
WHERE f_int1 = 0 AND f_int2 = 0
14592
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
14593
AND f_charbig = '#NULL#';
14594
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14595
SELECT f_int1, f_int1, '', '', 'was inserted'
14596
FROM t0_template source_tab
14597
WHERE MOD(f_int1,3) = 0
14598
AND f_int1 BETWEEN @max_row_div2 AND @max_row
14600
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
14601
f_int2 = 2 * @max_row + source_tab.f_int1,
14602
f_charbig = 'was updated';
14604
# check unique-1-a success: 1
14606
# check unique-1-b success: 1
14607
DELETE FROM t1 WHERE f_charbig = 'was inserted';
14608
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14609
f_int2 = CAST(f_char1 AS SIGNED INT),
14610
f_charbig = CONCAT('===',f_char1,'===')
14611
WHERE f_charbig = 'was updated';
14612
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14613
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
14614
FROM t0_template source_tab
14615
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
14617
# check replace success: 1
14619
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
14621
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
14622
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
14623
UPDATE t1 SET f_int2 = f_int1,
14624
f_char1 = CAST(f_int1 AS CHAR),
14625
f_char2 = CAST(f_int1 AS CHAR),
14626
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
14627
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
14629
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14630
SELECT f_int1, f_int1, '', '', 'was inserted'
14631
FROM t0_template source_tab
14632
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
14634
# check transactions-1 success: 1
14637
# check transactions-2 success: 1
14640
# check transactions-3 success: 1
14641
DELETE FROM t1 WHERE f_charbig = 'was inserted';
14645
# check transactions-4 success: 1
14646
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14647
SELECT f_int1, f_int1, '', '', 'was inserted'
14648
FROM t0_template source_tab
14649
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
14651
# check transactions-5 success: 1
14654
Warning 1196 Some non-transactional changed tables couldn't be rolled back
14656
# check transactions-6 success: 1
14657
# INFO: Storage engine used for t1 seems to be not transactional.
14660
# check transactions-7 success: 1
14661
DELETE FROM t1 WHERE f_charbig = 'was inserted';
14663
SET @@session.sql_mode = 'traditional';
14664
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
14665
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14666
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
14667
'', '', 'was inserted' FROM t0_template
14668
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
14669
ERROR 22012: Division by 0
14672
# check transactions-8 success: 1
14673
# INFO: Storage engine used for t1 seems to be unable to revert
14674
# changes made by the failing statement.
14675
SET @@session.sql_mode = '';
14677
DELETE FROM t1 WHERE f_charbig = 'was inserted';
14679
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
14681
# check special-1 success: 1
14682
UPDATE t1 SET f_charbig = '';
14684
# check special-2 success: 1
14685
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
14686
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
14687
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
14688
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14689
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14690
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14691
'just inserted' FROM t0_template
14692
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14693
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
14695
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14696
f_charbig = 'updated by trigger'
14697
WHERE f_int1 = new.f_int1;
14699
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14700
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
14701
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14703
# check trigger-1 success: 1
14704
DROP TRIGGER trg_1;
14705
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14706
f_int2 = CAST(f_char1 AS SIGNED INT),
14707
f_charbig = 'just inserted'
14708
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14710
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14711
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14712
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14713
'just inserted' FROM t0_template
14714
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14715
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
14717
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14718
f_charbig = 'updated by trigger'
14719
WHERE f_int1 = new.f_int1;
14721
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14722
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
14723
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14725
# check trigger-2 success: 1
14726
DROP TRIGGER trg_1;
14727
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14728
f_int2 = CAST(f_char1 AS SIGNED INT),
14729
f_charbig = 'just inserted'
14730
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14732
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14733
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14734
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14735
'just inserted' FROM t0_template
14736
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14737
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
14739
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14740
f_charbig = 'updated by trigger'
14741
WHERE f_int1 = new.f_int1;
14743
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
14744
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14746
# check trigger-3 success: 1
14747
DROP TRIGGER trg_1;
14748
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14749
f_int2 = CAST(f_char1 AS SIGNED INT),
14750
f_charbig = 'just inserted'
14751
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14753
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14754
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14755
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14756
'just inserted' FROM t0_template
14757
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14758
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
14760
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14761
f_charbig = 'updated by trigger'
14762
WHERE f_int1 = - old.f_int1;
14764
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
14765
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14767
# check trigger-4 success: 1
14768
DROP TRIGGER trg_1;
14769
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14770
f_int2 = CAST(f_char1 AS SIGNED INT),
14771
f_charbig = 'just inserted'
14772
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14774
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14775
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14776
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14777
'just inserted' FROM t0_template
14778
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14779
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
14781
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14782
f_charbig = 'updated by trigger'
14783
WHERE f_int1 = new.f_int1;
14785
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
14786
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14788
# check trigger-5 success: 1
14789
DROP TRIGGER trg_1;
14790
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14791
f_int2 = CAST(f_char1 AS SIGNED INT),
14792
f_charbig = 'just inserted'
14793
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14795
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14796
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14797
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14798
'just inserted' FROM t0_template
14799
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14800
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
14802
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14803
f_charbig = 'updated by trigger'
14804
WHERE f_int1 = - old.f_int1;
14806
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
14807
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14809
# check trigger-6 success: 1
14810
DROP TRIGGER trg_1;
14811
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14812
f_int2 = CAST(f_char1 AS SIGNED INT),
14813
f_charbig = 'just inserted'
14814
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14816
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14817
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14818
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14819
'just inserted' FROM t0_template
14820
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14821
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
14823
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14824
f_charbig = 'updated by trigger'
14825
WHERE f_int1 = - old.f_int1;
14828
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14830
# check trigger-7 success: 1
14831
DROP TRIGGER trg_1;
14832
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14833
f_int2 = CAST(f_char1 AS SIGNED INT),
14834
f_charbig = 'just inserted'
14835
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14837
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14838
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
14839
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
14840
'just inserted' FROM t0_template
14841
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14842
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
14844
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
14845
f_charbig = 'updated by trigger'
14846
WHERE f_int1 = - old.f_int1;
14849
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
14851
# check trigger-8 success: 1
14852
DROP TRIGGER trg_1;
14853
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14854
f_int2 = CAST(f_char1 AS SIGNED INT),
14855
f_charbig = 'just inserted'
14856
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
14858
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14860
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
14861
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
14863
SET new.f_int1 = old.f_int1 + @max_row,
14864
new.f_int2 = old.f_int2 - @max_row,
14865
new.f_charbig = '####updated per update trigger####';
14868
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
14869
f_charbig = '####updated per update statement itself####';
14871
# check trigger-9 success: 1
14872
DROP TRIGGER trg_2;
14873
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14874
f_int2 = CAST(f_char1 AS SIGNED INT),
14875
f_charbig = CONCAT('===',f_char1,'===');
14876
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
14878
SET new.f_int1 = new.f_int1 + @max_row,
14879
new.f_int2 = new.f_int2 - @max_row,
14880
new.f_charbig = '####updated per update trigger####';
14883
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
14884
f_charbig = '####updated per update statement itself####';
14886
# check trigger-10 success: 1
14887
DROP TRIGGER trg_2;
14888
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
14889
f_int2 = CAST(f_char1 AS SIGNED INT),
14890
f_charbig = CONCAT('===',f_char1,'===');
14891
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
14893
SET new.f_int1 = @my_max1 + @counter,
14894
new.f_int2 = @my_min2 - @counter,
14895
new.f_charbig = '####updated per insert trigger####';
14896
SET @counter = @counter + 1;
14899
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
14900
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
14901
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
14902
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
14903
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
14905
DROP TRIGGER trg_3;
14907
# check trigger-11 success: 1
14909
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
14910
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
14911
AND f_charbig = '####updated per insert trigger####';
14912
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
14914
SET new.f_int1 = @my_max1 + @counter,
14915
new.f_int2 = @my_min2 - @counter,
14916
new.f_charbig = '####updated per insert trigger####';
14917
SET @counter = @counter + 1;
14920
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
14921
INSERT INTO t1 (f_char1, f_char2, f_charbig)
14922
SELECT CAST(f_int1 AS CHAR),
14923
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
14924
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
14926
DROP TRIGGER trg_3;
14928
# check trigger-12 success: 1
14930
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
14931
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
14932
AND f_charbig = '####updated per insert trigger####';
14934
Table Op Msg_type Msg_text
14935
test.t1 analyze note The storage engine for the table doesn't support analyze
14936
CHECK TABLE t1 EXTENDED;
14937
Table Op Msg_type Msg_text
14938
test.t1 check note The storage engine for the table doesn't support check
14939
CHECKSUM TABLE t1 EXTENDED;
14941
test.t1 <some_value>
14943
Table Op Msg_type Msg_text
14944
test.t1 optimize note The storage engine for the table doesn't support optimize
14945
# check layout success: 1
14946
REPAIR TABLE t1 EXTENDED;
14947
Table Op Msg_type Msg_text
14948
test.t1 repair note The storage engine for the table doesn't support repair
14949
# check layout success: 1
14952
# check TRUNCATE success: 1
14953
# check layout success: 1
14954
# End usability test (inc/partition_check.inc)
14961
f_charbig VARCHAR(1000)
14962
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
14964
PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1)
14965
(PARTITION part1 VALUES IN (0)
14966
(SUBPARTITION sp11, SUBPARTITION sp12),
14967
PARTITION part2 VALUES IN (1)
14968
(SUBPARTITION sp21, SUBPARTITION sp22),
14969
PARTITION part3 VALUES IN (2)
14970
(SUBPARTITION sp31, SUBPARTITION sp32),
14971
PARTITION part4 VALUES IN (NULL)
14972
(SUBPARTITION sp41, SUBPARTITION sp42));
14973
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
14974
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
14975
# Start usability test (inc/partition_check.inc)
14977
SHOW CREATE TABLE t1;
14979
t1 CREATE TABLE `t1` (
14980
`f_int1` int(11) DEFAULT NULL,
14981
`f_int2` int(11) DEFAULT NULL,
14982
`f_char1` char(20) DEFAULT NULL,
14983
`f_char2` char(20) DEFAULT NULL,
14984
`f_charbig` varchar(1000) DEFAULT NULL,
14985
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
14986
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
14987
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, SUBPARTITION sp12 ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = MyISAM, SUBPARTITION sp22 ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = MyISAM, SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, SUBPARTITION sp42 ENGINE = MyISAM)) */
14990
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD
14991
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI
14992
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD
14993
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI
14994
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD
14995
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI
14996
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD
14997
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI
14998
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD
14999
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI
15000
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD
15001
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI
15002
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD
15003
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI
15004
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD
15005
$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI
15006
$MYSQLTEST_VARDIR/master-data/test/t1.frm
15007
$MYSQLTEST_VARDIR/master-data/test/t1.par
15009
# check prerequisites-1 success: 1
15010
# check COUNT(*) success: 1
15011
# check MIN/MAX(f_int1) success: 1
15012
# check MIN/MAX(f_int2) success: 1
15013
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15014
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
15015
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
15016
WHERE f_int1 IN (2,3);
15017
ERROR 23000: Can't write; duplicate key in table 't1'
15018
# check prerequisites-3 success: 1
15019
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
15020
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15021
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
15022
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
15023
WHERE f_int1 IN (2,3);
15024
DELETE FROM t1 WHERE f_charbig = 'delete me';
15025
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15026
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
15027
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
15028
WHERE f_int1 IN (2,3);
15029
DELETE FROM t1 WHERE f_charbig = 'delete me';
15030
# check read via f_int1 success: 1
15031
# check read via f_int2 success: 1
15033
# check multiple-1 success: 1
15034
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
15036
# check multiple-2 success: 1
15037
INSERT INTO t1 SELECT * FROM t0_template
15038
WHERE MOD(f_int1,3) = 0;
15040
# check multiple-3 success: 1
15041
UPDATE t1 SET f_int1 = f_int1 + @max_row
15042
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
15043
AND @max_row_div2 + @max_row_div4;
15045
# check multiple-4 success: 1
15047
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
15048
AND @max_row_div2 + @max_row_div4 + @max_row;
15050
# check multiple-5 success: 1
15051
SELECT COUNT(*) INTO @try_count FROM t0_template
15052
WHERE MOD(f_int1,3) = 0
15053
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
15054
SELECT COUNT(*) INTO @clash_count
15055
FROM t1 INNER JOIN t0_template USING(f_int1)
15056
WHERE MOD(f_int1,3) = 0
15057
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
15058
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
15060
SET f_int1 = @cur_value , f_int2 = @cur_value,
15061
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
15062
f_charbig = '#SINGLE#';
15064
# check single-1 success: 1
15065
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
15067
SET f_int1 = @cur_value , f_int2 = @cur_value,
15068
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
15069
f_charbig = '#SINGLE#';
15071
# check single-2 success: 1
15072
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
15073
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
15074
UPDATE t1 SET f_int1 = @cur_value2
15075
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
15077
# check single-3 success: 1
15078
SET @cur_value1= -1;
15079
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
15080
UPDATE t1 SET f_int1 = @cur_value1
15081
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
15083
# check single-4 success: 1
15084
SELECT MAX(f_int1) INTO @cur_value FROM t1;
15085
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
15087
# check single-5 success: 1
15088
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
15090
# check single-6 success: 1
15091
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
15093
# check single-7 success: 1
15094
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
15095
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
15096
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
15097
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
15098
f_charbig = '#NULL#';
15100
SET f_int1 = NULL , f_int2 = -@max_row,
15101
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
15102
f_charbig = '#NULL#';
15103
# check null success: 1
15105
# check null-1 success: 1
15106
UPDATE t1 SET f_int1 = -@max_row
15107
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
15108
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
15110
# check null-2 success: 1
15111
UPDATE t1 SET f_int1 = NULL
15112
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
15113
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
15115
# check null-3 success: 1
15117
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
15118
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
15120
# check null-4 success: 1
15122
WHERE f_int1 = 0 AND f_int2 = 0
15123
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
15124
AND f_charbig = '#NULL#';
15125
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15126
SELECT f_int1, f_int1, '', '', 'was inserted'
15127
FROM t0_template source_tab
15128
WHERE MOD(f_int1,3) = 0
15129
AND f_int1 BETWEEN @max_row_div2 AND @max_row
15131
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
15132
f_int2 = 2 * @max_row + source_tab.f_int1,
15133
f_charbig = 'was updated';
15135
# check unique-1-a success: 1
15137
# check unique-1-b success: 1
15138
DELETE FROM t1 WHERE f_charbig = 'was inserted';
15139
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15140
f_int2 = CAST(f_char1 AS SIGNED INT),
15141
f_charbig = CONCAT('===',f_char1,'===')
15142
WHERE f_charbig = 'was updated';
15143
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15144
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
15145
FROM t0_template source_tab
15146
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
15148
# check replace success: 1
15150
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
15152
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
15153
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
15154
UPDATE t1 SET f_int2 = f_int1,
15155
f_char1 = CAST(f_int1 AS CHAR),
15156
f_char2 = CAST(f_int1 AS CHAR),
15157
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
15158
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
15160
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15161
SELECT f_int1, f_int1, '', '', 'was inserted'
15162
FROM t0_template source_tab
15163
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
15165
# check transactions-1 success: 1
15168
# check transactions-2 success: 1
15171
# check transactions-3 success: 1
15172
DELETE FROM t1 WHERE f_charbig = 'was inserted';
15176
# check transactions-4 success: 1
15177
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15178
SELECT f_int1, f_int1, '', '', 'was inserted'
15179
FROM t0_template source_tab
15180
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
15182
# check transactions-5 success: 1
15185
Warning 1196 Some non-transactional changed tables couldn't be rolled back
15187
# check transactions-6 success: 1
15188
# INFO: Storage engine used for t1 seems to be not transactional.
15191
# check transactions-7 success: 1
15192
DELETE FROM t1 WHERE f_charbig = 'was inserted';
15194
SET @@session.sql_mode = 'traditional';
15195
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
15196
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15197
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
15198
'', '', 'was inserted' FROM t0_template
15199
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
15200
ERROR 22012: Division by 0
15203
# check transactions-8 success: 1
15204
# INFO: Storage engine used for t1 seems to be unable to revert
15205
# changes made by the failing statement.
15206
SET @@session.sql_mode = '';
15208
DELETE FROM t1 WHERE f_charbig = 'was inserted';
15210
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
15212
# check special-1 success: 1
15213
UPDATE t1 SET f_charbig = '';
15215
# check special-2 success: 1
15216
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
15217
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
15218
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
15219
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15220
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15221
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15222
'just inserted' FROM t0_template
15223
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15224
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
15226
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15227
f_charbig = 'updated by trigger'
15228
WHERE f_int1 = new.f_int1;
15230
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15231
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
15232
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15234
# check trigger-1 success: 1
15235
DROP TRIGGER trg_1;
15236
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15237
f_int2 = CAST(f_char1 AS SIGNED INT),
15238
f_charbig = 'just inserted'
15239
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15241
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15242
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15243
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15244
'just inserted' FROM t0_template
15245
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15246
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
15248
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15249
f_charbig = 'updated by trigger'
15250
WHERE f_int1 = new.f_int1;
15252
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15253
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
15254
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15256
# check trigger-2 success: 1
15257
DROP TRIGGER trg_1;
15258
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15259
f_int2 = CAST(f_char1 AS SIGNED INT),
15260
f_charbig = 'just inserted'
15261
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15263
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15264
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15265
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15266
'just inserted' FROM t0_template
15267
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15268
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
15270
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15271
f_charbig = 'updated by trigger'
15272
WHERE f_int1 = new.f_int1;
15274
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
15275
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15277
# check trigger-3 success: 1
15278
DROP TRIGGER trg_1;
15279
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15280
f_int2 = CAST(f_char1 AS SIGNED INT),
15281
f_charbig = 'just inserted'
15282
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15284
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15285
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15286
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15287
'just inserted' FROM t0_template
15288
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15289
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
15291
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15292
f_charbig = 'updated by trigger'
15293
WHERE f_int1 = - old.f_int1;
15295
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
15296
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15298
# check trigger-4 success: 1
15299
DROP TRIGGER trg_1;
15300
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15301
f_int2 = CAST(f_char1 AS SIGNED INT),
15302
f_charbig = 'just inserted'
15303
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15305
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15306
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15307
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15308
'just inserted' FROM t0_template
15309
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15310
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
15312
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15313
f_charbig = 'updated by trigger'
15314
WHERE f_int1 = new.f_int1;
15316
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
15317
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15319
# check trigger-5 success: 1
15320
DROP TRIGGER trg_1;
15321
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15322
f_int2 = CAST(f_char1 AS SIGNED INT),
15323
f_charbig = 'just inserted'
15324
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15326
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15327
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15328
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15329
'just inserted' FROM t0_template
15330
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15331
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
15333
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15334
f_charbig = 'updated by trigger'
15335
WHERE f_int1 = - old.f_int1;
15337
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
15338
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15340
# check trigger-6 success: 1
15341
DROP TRIGGER trg_1;
15342
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15343
f_int2 = CAST(f_char1 AS SIGNED INT),
15344
f_charbig = 'just inserted'
15345
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15347
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15348
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15349
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15350
'just inserted' FROM t0_template
15351
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15352
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
15354
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15355
f_charbig = 'updated by trigger'
15356
WHERE f_int1 = - old.f_int1;
15359
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15361
# check trigger-7 success: 1
15362
DROP TRIGGER trg_1;
15363
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15364
f_int2 = CAST(f_char1 AS SIGNED INT),
15365
f_charbig = 'just inserted'
15366
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15368
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15369
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15370
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15371
'just inserted' FROM t0_template
15372
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15373
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
15375
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15376
f_charbig = 'updated by trigger'
15377
WHERE f_int1 = - old.f_int1;
15380
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15382
# check trigger-8 success: 1
15383
DROP TRIGGER trg_1;
15384
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15385
f_int2 = CAST(f_char1 AS SIGNED INT),
15386
f_charbig = 'just inserted'
15387
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15389
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15391
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15392
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
15394
SET new.f_int1 = old.f_int1 + @max_row,
15395
new.f_int2 = old.f_int2 - @max_row,
15396
new.f_charbig = '####updated per update trigger####';
15399
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
15400
f_charbig = '####updated per update statement itself####';
15402
# check trigger-9 success: 1
15403
DROP TRIGGER trg_2;
15404
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15405
f_int2 = CAST(f_char1 AS SIGNED INT),
15406
f_charbig = CONCAT('===',f_char1,'===');
15407
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
15409
SET new.f_int1 = new.f_int1 + @max_row,
15410
new.f_int2 = new.f_int2 - @max_row,
15411
new.f_charbig = '####updated per update trigger####';
15414
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
15415
f_charbig = '####updated per update statement itself####';
15417
# check trigger-10 success: 1
15418
DROP TRIGGER trg_2;
15419
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15420
f_int2 = CAST(f_char1 AS SIGNED INT),
15421
f_charbig = CONCAT('===',f_char1,'===');
15422
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
15424
SET new.f_int1 = @my_max1 + @counter,
15425
new.f_int2 = @my_min2 - @counter,
15426
new.f_charbig = '####updated per insert trigger####';
15427
SET @counter = @counter + 1;
15430
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
15431
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15432
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
15433
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
15434
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
15436
DROP TRIGGER trg_3;
15438
# check trigger-11 success: 1
15440
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
15441
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
15442
AND f_charbig = '####updated per insert trigger####';
15443
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
15445
SET new.f_int1 = @my_max1 + @counter,
15446
new.f_int2 = @my_min2 - @counter,
15447
new.f_charbig = '####updated per insert trigger####';
15448
SET @counter = @counter + 1;
15451
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
15452
INSERT INTO t1 (f_char1, f_char2, f_charbig)
15453
SELECT CAST(f_int1 AS CHAR),
15454
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
15455
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
15457
DROP TRIGGER trg_3;
15459
# check trigger-12 success: 1
15461
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
15462
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
15463
AND f_charbig = '####updated per insert trigger####';
15465
Table Op Msg_type Msg_text
15466
test.t1 analyze note The storage engine for the table doesn't support analyze
15467
CHECK TABLE t1 EXTENDED;
15468
Table Op Msg_type Msg_text
15469
test.t1 check note The storage engine for the table doesn't support check
15470
CHECKSUM TABLE t1 EXTENDED;
15472
test.t1 <some_value>
15474
Table Op Msg_type Msg_text
15475
test.t1 optimize note The storage engine for the table doesn't support optimize
15476
# check layout success: 1
15477
REPAIR TABLE t1 EXTENDED;
15478
Table Op Msg_type Msg_text
15479
test.t1 repair note The storage engine for the table doesn't support repair
15480
# check layout success: 1
15483
# check TRUNCATE success: 1
15484
# check layout success: 1
15485
# End usability test (inc/partition_check.inc)
15492
f_charbig VARCHAR(1000)
15493
, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1)
15495
PARTITION BY LIST(ABS(MOD(f_int1,2)))
15496
SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3
15497
(PARTITION part1 VALUES IN (0),
15498
PARTITION part2 VALUES IN (1),
15499
PARTITION part3 VALUES IN (NULL));
15500
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
15501
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
15502
# Start usability test (inc/partition_check.inc)
15504
SHOW CREATE TABLE t1;
15506
t1 CREATE TABLE `t1` (
15507
`f_int1` int(11) DEFAULT NULL,
15508
`f_int2` int(11) DEFAULT NULL,
15509
`f_char1` char(20) DEFAULT NULL,
15510
`f_char2` char(20) DEFAULT NULL,
15511
`f_charbig` varchar(1000) DEFAULT NULL,
15512
UNIQUE KEY `uidx1` (`f_int1`,`f_int2`),
15513
UNIQUE KEY `uidx2` (`f_int2`,`f_int1`)
15514
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */
15517
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD
15518
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI
15519
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD
15520
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI
15521
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD
15522
$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI
15523
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD
15524
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI
15525
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD
15526
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI
15527
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD
15528
$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI
15529
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD
15530
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI
15531
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD
15532
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI
15533
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD
15534
$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI
15535
$MYSQLTEST_VARDIR/master-data/test/t1.frm
15536
$MYSQLTEST_VARDIR/master-data/test/t1.par
15538
# check prerequisites-1 success: 1
15539
# check COUNT(*) success: 1
15540
# check MIN/MAX(f_int1) success: 1
15541
# check MIN/MAX(f_int2) success: 1
15542
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15543
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
15544
CAST(f_int1 AS CHAR), 'delete me' FROM t0_template
15545
WHERE f_int1 IN (2,3);
15546
ERROR 23000: Can't write; duplicate key in table 't1'
15547
# check prerequisites-3 success: 1
15548
# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE
15549
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15550
SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
15551
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
15552
WHERE f_int1 IN (2,3);
15553
DELETE FROM t1 WHERE f_charbig = 'delete me';
15554
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15555
SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR),
15556
CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template
15557
WHERE f_int1 IN (2,3);
15558
DELETE FROM t1 WHERE f_charbig = 'delete me';
15559
# check read via f_int1 success: 1
15560
# check read via f_int2 success: 1
15562
# check multiple-1 success: 1
15563
DELETE FROM t1 WHERE MOD(f_int1,3) = 0;
15565
# check multiple-2 success: 1
15566
INSERT INTO t1 SELECT * FROM t0_template
15567
WHERE MOD(f_int1,3) = 0;
15569
# check multiple-3 success: 1
15570
UPDATE t1 SET f_int1 = f_int1 + @max_row
15571
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4
15572
AND @max_row_div2 + @max_row_div4;
15574
# check multiple-4 success: 1
15576
WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row
15577
AND @max_row_div2 + @max_row_div4 + @max_row;
15579
# check multiple-5 success: 1
15580
SELECT COUNT(*) INTO @try_count FROM t0_template
15581
WHERE MOD(f_int1,3) = 0
15582
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
15583
SELECT COUNT(*) INTO @clash_count
15584
FROM t1 INNER JOIN t0_template USING(f_int1)
15585
WHERE MOD(f_int1,3) = 0
15586
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
15587
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
15589
SET f_int1 = @cur_value , f_int2 = @cur_value,
15590
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
15591
f_charbig = '#SINGLE#';
15593
# check single-1 success: 1
15594
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
15596
SET f_int1 = @cur_value , f_int2 = @cur_value,
15597
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
15598
f_charbig = '#SINGLE#';
15600
# check single-2 success: 1
15601
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
15602
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
15603
UPDATE t1 SET f_int1 = @cur_value2
15604
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
15606
# check single-3 success: 1
15607
SET @cur_value1= -1;
15608
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
15609
UPDATE t1 SET f_int1 = @cur_value1
15610
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
15612
# check single-4 success: 1
15613
SELECT MAX(f_int1) INTO @cur_value FROM t1;
15614
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
15616
# check single-5 success: 1
15617
DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#';
15619
# check single-6 success: 1
15620
INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##';
15622
# check single-7 success: 1
15623
DELETE FROM t1 WHERE f_charbig = '#2147483647##';
15624
DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0;
15625
INSERT t1 SET f_int1 = 0 , f_int2 = 0,
15626
f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR),
15627
f_charbig = '#NULL#';
15629
SET f_int1 = NULL , f_int2 = -@max_row,
15630
f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR),
15631
f_charbig = '#NULL#';
15632
# check null success: 1
15634
# check null-1 success: 1
15635
UPDATE t1 SET f_int1 = -@max_row
15636
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
15637
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
15639
# check null-2 success: 1
15640
UPDATE t1 SET f_int1 = NULL
15641
WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
15642
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
15644
# check null-3 success: 1
15646
WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR)
15647
AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#';
15649
# check null-4 success: 1
15651
WHERE f_int1 = 0 AND f_int2 = 0
15652
AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR)
15653
AND f_charbig = '#NULL#';
15654
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15655
SELECT f_int1, f_int1, '', '', 'was inserted'
15656
FROM t0_template source_tab
15657
WHERE MOD(f_int1,3) = 0
15658
AND f_int1 BETWEEN @max_row_div2 AND @max_row
15660
UPDATE f_int1 = 2 * @max_row + source_tab.f_int1,
15661
f_int2 = 2 * @max_row + source_tab.f_int1,
15662
f_charbig = 'was updated';
15664
# check unique-1-a success: 1
15666
# check unique-1-b success: 1
15667
DELETE FROM t1 WHERE f_charbig = 'was inserted';
15668
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15669
f_int2 = CAST(f_char1 AS SIGNED INT),
15670
f_charbig = CONCAT('===',f_char1,'===')
15671
WHERE f_charbig = 'was updated';
15672
REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15673
SELECT f_int1, - f_int1, '', '', 'was inserted or replaced'
15674
FROM t0_template source_tab
15675
WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row;
15677
# check replace success: 1
15679
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4;
15681
WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND
15682
f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row;
15683
UPDATE t1 SET f_int2 = f_int1,
15684
f_char1 = CAST(f_int1 AS CHAR),
15685
f_char2 = CAST(f_int1 AS CHAR),
15686
f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===')
15687
WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2;
15689
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15690
SELECT f_int1, f_int1, '', '', 'was inserted'
15691
FROM t0_template source_tab
15692
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
15694
# check transactions-1 success: 1
15697
# check transactions-2 success: 1
15700
# check transactions-3 success: 1
15701
DELETE FROM t1 WHERE f_charbig = 'was inserted';
15705
# check transactions-4 success: 1
15706
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15707
SELECT f_int1, f_int1, '', '', 'was inserted'
15708
FROM t0_template source_tab
15709
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
15711
# check transactions-5 success: 1
15714
Warning 1196 Some non-transactional changed tables couldn't be rolled back
15716
# check transactions-6 success: 1
15717
# INFO: Storage engine used for t1 seems to be not transactional.
15720
# check transactions-7 success: 1
15721
DELETE FROM t1 WHERE f_charbig = 'was inserted';
15723
SET @@session.sql_mode = 'traditional';
15724
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
15725
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15726
SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1,
15727
'', '', 'was inserted' FROM t0_template
15728
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
15729
ERROR 22012: Division by 0
15732
# check transactions-8 success: 1
15733
# INFO: Storage engine used for t1 seems to be unable to revert
15734
# changes made by the failing statement.
15735
SET @@session.sql_mode = '';
15737
DELETE FROM t1 WHERE f_charbig = 'was inserted';
15739
UPDATE t1 SET f_charbig = REPEAT('b', 1000);
15741
# check special-1 success: 1
15742
UPDATE t1 SET f_charbig = '';
15744
# check special-2 success: 1
15745
UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===');
15746
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
15747
SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template
15748
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15749
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15750
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15751
'just inserted' FROM t0_template
15752
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15753
CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW
15755
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15756
f_charbig = 'updated by trigger'
15757
WHERE f_int1 = new.f_int1;
15759
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15760
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
15761
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15763
# check trigger-1 success: 1
15764
DROP TRIGGER trg_1;
15765
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15766
f_int2 = CAST(f_char1 AS SIGNED INT),
15767
f_charbig = 'just inserted'
15768
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15770
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15771
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15772
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15773
'just inserted' FROM t0_template
15774
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15775
CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW
15777
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15778
f_charbig = 'updated by trigger'
15779
WHERE f_int1 = new.f_int1;
15781
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15782
SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template
15783
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15785
# check trigger-2 success: 1
15786
DROP TRIGGER trg_1;
15787
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15788
f_int2 = CAST(f_char1 AS SIGNED INT),
15789
f_charbig = 'just inserted'
15790
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15792
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15793
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15794
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15795
'just inserted' FROM t0_template
15796
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15797
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
15799
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15800
f_charbig = 'updated by trigger'
15801
WHERE f_int1 = new.f_int1;
15803
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
15804
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15806
# check trigger-3 success: 1
15807
DROP TRIGGER trg_1;
15808
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15809
f_int2 = CAST(f_char1 AS SIGNED INT),
15810
f_charbig = 'just inserted'
15811
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15813
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15814
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15815
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15816
'just inserted' FROM t0_template
15817
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15818
CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW
15820
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15821
f_charbig = 'updated by trigger'
15822
WHERE f_int1 = - old.f_int1;
15824
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
15825
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15827
# check trigger-4 success: 1
15828
DROP TRIGGER trg_1;
15829
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15830
f_int2 = CAST(f_char1 AS SIGNED INT),
15831
f_charbig = 'just inserted'
15832
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15834
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15835
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15836
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15837
'just inserted' FROM t0_template
15838
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15839
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
15841
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15842
f_charbig = 'updated by trigger'
15843
WHERE f_int1 = new.f_int1;
15845
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
15846
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15848
# check trigger-5 success: 1
15849
DROP TRIGGER trg_1;
15850
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15851
f_int2 = CAST(f_char1 AS SIGNED INT),
15852
f_charbig = 'just inserted'
15853
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15855
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15856
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15857
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15858
'just inserted' FROM t0_template
15859
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15860
CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW
15862
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15863
f_charbig = 'updated by trigger'
15864
WHERE f_int1 = - old.f_int1;
15866
UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2
15867
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15869
# check trigger-6 success: 1
15870
DROP TRIGGER trg_1;
15871
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15872
f_int2 = CAST(f_char1 AS SIGNED INT),
15873
f_charbig = 'just inserted'
15874
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15876
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15877
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15878
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15879
'just inserted' FROM t0_template
15880
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15881
CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW
15883
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15884
f_charbig = 'updated by trigger'
15885
WHERE f_int1 = - old.f_int1;
15888
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15890
# check trigger-7 success: 1
15891
DROP TRIGGER trg_1;
15892
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15893
f_int2 = CAST(f_char1 AS SIGNED INT),
15894
f_charbig = 'just inserted'
15895
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15897
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15898
INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig)
15899
SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR),
15900
'just inserted' FROM t0_template
15901
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15902
CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW
15904
UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2,
15905
f_charbig = 'updated by trigger'
15906
WHERE f_int1 = - old.f_int1;
15909
WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1));
15911
# check trigger-8 success: 1
15912
DROP TRIGGER trg_1;
15913
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15914
f_int2 = CAST(f_char1 AS SIGNED INT),
15915
f_charbig = 'just inserted'
15916
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT);
15918
WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15920
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1;
15921
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
15923
SET new.f_int1 = old.f_int1 + @max_row,
15924
new.f_int2 = old.f_int2 - @max_row,
15925
new.f_charbig = '####updated per update trigger####';
15928
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
15929
f_charbig = '####updated per update statement itself####';
15931
# check trigger-9 success: 1
15932
DROP TRIGGER trg_2;
15933
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15934
f_int2 = CAST(f_char1 AS SIGNED INT),
15935
f_charbig = CONCAT('===',f_char1,'===');
15936
CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW
15938
SET new.f_int1 = new.f_int1 + @max_row,
15939
new.f_int2 = new.f_int2 - @max_row,
15940
new.f_charbig = '####updated per update trigger####';
15943
SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row,
15944
f_charbig = '####updated per update statement itself####';
15946
# check trigger-10 success: 1
15947
DROP TRIGGER trg_2;
15948
UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
15949
f_int2 = CAST(f_char1 AS SIGNED INT),
15950
f_charbig = CONCAT('===',f_char1,'===');
15951
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
15953
SET new.f_int1 = @my_max1 + @counter,
15954
new.f_int2 = @my_min2 - @counter,
15955
new.f_charbig = '####updated per insert trigger####';
15956
SET @counter = @counter + 1;
15959
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
15960
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
15961
SELECT f_int1, f_int1, CAST(f_int1 AS CHAR),
15962
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
15963
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
15965
DROP TRIGGER trg_3;
15967
# check trigger-11 success: 1
15969
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
15970
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
15971
AND f_charbig = '####updated per insert trigger####';
15972
CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW
15974
SET new.f_int1 = @my_max1 + @counter,
15975
new.f_int2 = @my_min2 - @counter,
15976
new.f_charbig = '####updated per insert trigger####';
15977
SET @counter = @counter + 1;
15980
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
15981
INSERT INTO t1 (f_char1, f_char2, f_charbig)
15982
SELECT CAST(f_int1 AS CHAR),
15983
CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template
15984
WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1
15986
DROP TRIGGER trg_3;
15988
# check trigger-12 success: 1
15990
WHERE f_int1 <> CAST(f_char1 AS SIGNED INT)
15991
AND f_int2 <> CAST(f_char1 AS SIGNED INT)
15992
AND f_charbig = '####updated per insert trigger####';
15994
Table Op Msg_type Msg_text
15995
test.t1 analyze note The storage engine for the table doesn't support analyze
15996
CHECK TABLE t1 EXTENDED;
15997
Table Op Msg_type Msg_text
15998
test.t1 check note The storage engine for the table doesn't support check
15999
CHECKSUM TABLE t1 EXTENDED;
16001
test.t1 <some_value>
16003
Table Op Msg_type Msg_text
16004
test.t1 optimize note The storage engine for the table doesn't support optimize
16005
# check layout success: 1
16006
REPAIR TABLE t1 EXTENDED;
16007
Table Op Msg_type Msg_text
16008
test.t1 repair note The storage engine for the table doesn't support repair
16009
# check layout success: 1
16012
# check TRUNCATE success: 1
16013
# check layout success: 1
16014
# End usability test (inc/partition_check.inc)
16016
DROP VIEW IF EXISTS v1;
16017
DROP TABLE IF EXISTS t1;
16018
DROP TABLE IF EXISTS t0_aux;
16019
DROP TABLE IF EXISTS t0_definition;
16020
DROP TABLE IF EXISTS t0_template;