SET @max_row = 20; SET @@session.storage_engine = 'MyISAM'; #------------------------------------------------------------------------ # There are several testcases disabled because of the open bugs # #15890 # The expected results suffer from the following bugs # harmless #17455, #19305 # which cannot be suppressed because of technical reasons. #------------------------------------------------------------------------ #------------------------------------------------------------------------ # 0. Setting of auxiliary variables + Creation of an auxiliary tables # needed in many testcases #------------------------------------------------------------------------ SELECT @max_row DIV 2 INTO @max_row_div2; SELECT @max_row DIV 3 INTO @max_row_div3; SELECT @max_row DIV 4 INTO @max_row_div4; SET @max_int_4 = 2147483647; DROP TABLE IF EXISTS t0_template; CREATE TABLE t0_template ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , PRIMARY KEY(f_int1)) ENGINE = MEMORY; # Logging of <max_row> INSERTs into t0_template suppressed DROP TABLE IF EXISTS t0_definition; CREATE TABLE t0_definition ( state CHAR(3), create_command VARBINARY(5000), file_list VARBINARY(5000), PRIMARY KEY (state) ) ENGINE = MEMORY; DROP TABLE IF EXISTS t0_aux; CREATE TABLE t0_aux ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) ENGINE = MEMORY; SET AUTOCOMMIT= 1; SET @@session.sql_mode= ''; # End of basic preparations needed for all tests #----------------------------------------------- #======================================================================== # Check partitioning methods on just created tables # The tables should be defined without/with PRIMARY KEY and # UNIQUE INDEXes. # Every test round has to check # PARTITION BY HASH/KEY/LIST/RANGE # PARTITION BY RANGE/LIST ... SUBPARTITION BY HASH/KEY ... #======================================================================== #------------------------------------------------------------------------ # 1 Tables without PRIMARY KEY or UNIQUE INDEXes #------------------------------------------------------------------------ # 1.1 The partitioning function contains one column. DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY HASH(f_int1) PARTITIONS 2; INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; SET @aux = 'PARTITION BY RANGE(f_int1) (PARTITION parta VALUES LESS THAN (0) , PARTITION partb VALUES LESS THAN (5) , PARTITION partc VALUES LESS THAN (10) , PARTITION partd VALUES LESS THAN (10 + 5) , PARTITION parte VALUES LESS THAN (20) , PARTITION partf VALUES LESS THAN (2147483646) )'; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1) (PARTITION parta VALUES LESS THAN (0) , PARTITION partb VALUES LESS THAN (5) , PARTITION partc VALUES LESS THAN (10) , PARTITION partd VALUES LESS THAN (10 + 5) , PARTITION parte VALUES LESS THAN (20) , PARTITION partf VALUES LESS THAN (2147483646) ); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) , PARTITION partb VALUES LESS THAN (5) , PARTITION partc VALUES LESS THAN (10) , PARTITION partd VALUES LESS THAN (2147483646) ); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11, SUBPARTITION subpart12), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21, SUBPARTITION subpart22), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31, SUBPARTITION subpart32), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41, SUBPARTITION subpart42)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 , SUBPARTITION sp12 ), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 , SUBPARTITION sp22 ), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31, SUBPARTITION sp32), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 , SUBPARTITION sp42 )); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY LIST(ABS(MOD(f_int1,2))) SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) , PARTITION part2 VALUES IN (1) , PARTITION part3 VALUES IN (NULL) ); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; # 1.1.1 with DATA DIECTORY/INDEX DIRECTORY CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY HASH(f_int1) PARTITIONS 2 (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par $MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p2.MYI # check layout success: 0 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p2.MYI # check layout success: 0 TRUNCATE t1; # check TRUNCATE success: 1 state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p2.MYI # check layout success: 0 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY HASH(f_int1) PARTITIONS 5 (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION p3 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION p4 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION p5 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par $MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD $MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p5.MYI # check layout success: 0 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p5.MYI # check layout success: 0 TRUNCATE t1; # check TRUNCATE success: 1 state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#p5.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p4.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#p5.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p4.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#p5.MYI # check layout success: 0 # End usability test (include/partition_check.inc) DROP TABLE t1; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_N.MYI # check layout success: 0 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_N.MYI # check layout success: 0 TRUNCATE t1; # check TRUNCATE success: 1 state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part_N.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_3.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part_N.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_3.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part_N.MYI # check layout success: 0 # End usability test (include/partition_check.inc) DROP TABLE t1; SET @aux = 'PARTITION BY RANGE(f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partd VALUES LESS THAN (10 + 5) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'')'; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partd VALUES LESS THAN (10 + 5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par $MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD $MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partf.MYI # check layout success: 0 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partf.MYI # check layout success: 0 TRUNCATE t1; # check TRUNCATE success: 1 state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partf.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parte.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partf.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parte.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partf.MYI # check layout success: 0 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par $MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD $MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd#SP#partdsp1.MYI # check layout success: 0 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd#SP#partdsp1.MYI # check layout success: 0 TRUNCATE t1; # check TRUNCATE success: 1 state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#partd#SP#partdsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta#SP#partasp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#parta#SP#partasp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb#SP#partbsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partb#SP#partbsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc#SP#partcsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partc#SP#partcsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd#SP#partdsp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#partd#SP#partdsp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta#SP#partasp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#parta#SP#partasp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb#SP#partbsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partb#SP#partbsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc#SP#partcsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partc#SP#partcsp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd#SP#partdsp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#partd#SP#partdsp1.MYI # check layout success: 0 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1) (PARTITION part1 VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart11, SUBPARTITION subpart12), PARTITION part2 VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart21, SUBPARTITION subpart22), PARTITION part3 VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart31, SUBPARTITION subpart32), PARTITION part4 VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart41, SUBPARTITION subpart42)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#subpart42.MYI # check layout success: 0 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#subpart42.MYI # check layout success: 0 TRUNCATE t1; # check TRUNCATE success: 1 state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#subpart42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#subpart11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#subpart12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#subpart21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#subpart22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#subpart31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#subpart32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#subpart41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#subpart42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#subpart11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#subpart12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#subpart21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#subpart22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#subpart31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#subpart32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#subpart41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#subpart42.MYI # check layout success: 0 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1) (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'), PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'), PARTITION part3 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp31, SUBPARTITION sp32), PARTITION part4 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index')); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#sp42.MYI # check layout success: 0 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#sp42.MYI # check layout success: 0 TRUNCATE t1; # check TRUNCATE success: 1 state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part4#SP#sp42.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#sp11.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#sp12.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#sp21.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#sp22.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#sp31.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#sp32.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#sp41.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part4#SP#sp42.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#sp11.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#sp12.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#sp21.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#sp22.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#sp31.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#sp32.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#sp41.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part4#SP#sp42.MYI # check layout success: 0 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY LIST(ABS(MOD(f_int1,2))) SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD $MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI $MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp2.MYI # check layout success: 0 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp2.MYI # check layout success: 0 TRUNCATE t1; # check TRUNCATE success: 1 state new Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par state old Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ File list /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1#P#part3#SP#part3sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.frm /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/t1.par /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part1#SP#part1sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part2#SP#part2sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp0.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp1.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/t1#P#part3#SP#part3sp2.MYD /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part1#SP#part1sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part2#SP#part2sp2.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp0.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp1.MYI /data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/t1#P#part3#SP#part3sp2.MYI # check layout success: 0 # End usability test (include/partition_check.inc) DROP TABLE t1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY HASH(f_int1) PARTITIONS 2; INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; SET @aux = 'PARTITION BY RANGE(f_int1) (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'', PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partd VALUES LESS THAN (10 + 5), PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'', PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'')'; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1) (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data', PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partd VALUES LESS THAN (10 + 5), PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data', PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data', PARTITION partc VALUES LESS THAN (10), PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1) (PARTITION part1 VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' (SUBPARTITION subpart11, SUBPARTITION subpart12), PARTITION part2 VALUES LESS THAN (5) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart21, SUBPARTITION subpart22), PARTITION part3 VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart31, SUBPARTITION subpart32), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41, SUBPARTITION subpart42)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1) (PARTITION part1 VALUES IN (0) INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data', SUBPARTITION sp12 INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'), PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data', SUBPARTITION sp22 INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'), PARTITION part3 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp31, SUBPARTITION sp32), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index')); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; # 1.2 The partitioning function contains two columns. DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2; INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5; INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY LIST(MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3), PARTITION part_2 VALUES IN (-2), PARTITION part_1 VALUES IN (-1), PARTITION part_N VALUES IN (NULL), PARTITION part0 VALUES IN (0), PARTITION part1 VALUES IN (1), PARTITION part2 VALUES IN (2), PARTITION part3 VALUES IN (3)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0), PARTITION partb VALUES LESS THAN (5), PARTITION partc VALUES LESS THAN (10), PARTITION partd VALUES LESS THAN (10 + 5), PARTITION parte VALUES LESS THAN (20), PARTITION partf VALUES LESS THAN (2147483646)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0), PARTITION partb VALUES LESS THAN (5), PARTITION partc VALUES LESS THAN (10), PARTITION partd VALUES LESS THAN (2147483646)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11, SUBPARTITION subpart12), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21, SUBPARTITION subpart22), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31, SUBPARTITION subpart32), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41, SUBPARTITION subpart42)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11, SUBPARTITION sp12), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21, SUBPARTITION sp22), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31, SUBPARTITION sp32), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41, SUBPARTITION sp42)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) ) PARTITION BY LIST(ABS(MOD(f_int1,2))) SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0), PARTITION part2 VALUES IN (1), PARTITION part3 VALUES IN (NULL)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); # check prerequisites-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'delete me'; # INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; #------------------------------------------------------------------------ # 2 Tables with PRIMARY KEY and/or UNIQUE INDEXes # The partitioning function contains one column. #------------------------------------------------------------------------ # 2.5 PRIMARY KEY + UNIQUE INDEX consisting of two columns DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY HASH(f_int1) PARTITIONS 2; INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; SET @aux = 'PARTITION BY RANGE(f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partd VALUES LESS THAN (10 + 5) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'', PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data'' INDEX DIRECTORY = ''/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'')'; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY RANGE(f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partd VALUES LESS THAN (10 + 5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1) (PARTITION part1 VALUES LESS THAN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart11, SUBPARTITION subpart12), PARTITION part2 VALUES LESS THAN (5) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart21, SUBPARTITION subpart22), PARTITION part3 VALUES LESS THAN (10) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart31, SUBPARTITION subpart32), PARTITION part4 VALUES LESS THAN (2147483646) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION subpart41, SUBPARTITION subpart42)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1) (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'), PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'), PARTITION part3 VALUES IN (2) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp31, SUBPARTITION sp32), PARTITION part4 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index')); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY LIST(ABS(MOD(f_int1,2))) SUBPARTITION BY KEY(f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index', PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index'); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data/' INDEX DIRECTORY='/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index/' /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/data' INDEX DIRECTORY = '/data0/mysql/mysql-5.1-build/mysql-test/var/master-data/test/index' ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; #------------------------------------------------------------------------ # 3 Tables with PRIMARY KEY and/or UNIQUE INDEXes # The partitioning function contains two columns. #------------------------------------------------------------------------ # 3.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2; INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5; INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY LIST(MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3), PARTITION part_2 VALUES IN (-2), PARTITION part_1 VALUES IN (-1), PARTITION part_N VALUES IN (NULL), PARTITION part0 VALUES IN (0), PARTITION part1 VALUES IN (1), PARTITION part2 VALUES IN (2), PARTITION part3 VALUES IN (3)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY RANGE((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0), PARTITION partb VALUES LESS THAN (5), PARTITION partc VALUES LESS THAN (10), PARTITION partd VALUES LESS THAN (10 + 5), PARTITION parte VALUES LESS THAN (20), PARTITION partf VALUES LESS THAN (2147483646)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0), PARTITION partb VALUES LESS THAN (5), PARTITION partc VALUES LESS THAN (10), PARTITION partd VALUES LESS THAN (2147483646)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11, SUBPARTITION subpart12), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21, SUBPARTITION subpart22), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31, SUBPARTITION subpart32), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41, SUBPARTITION subpart42)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) 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)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; ERROR HY000: Table has no partition for value 2147483647 DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11, SUBPARTITION sp12), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21, SUBPARTITION sp22), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31, SUBPARTITION sp32), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41, SUBPARTITION sp42)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) 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)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(20), f_char2 CHAR(20), f_charbig VARCHAR(1000) , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) ) PARTITION BY LIST(ABS(MOD(f_int1,2))) SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0), PARTITION part2 VALUES IN (1), PARTITION part3 VALUES IN (NULL)); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; # Start usability test (include/partition_check.inc) create_command SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) ) 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) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD $MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.par # check prerequisites-1 success: 1 # check COUNT(*) success: 1 # check MIN/MAX(f_int1) success: 1 # check MIN/MAX(f_int2) success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); ERROR 23000: Can't write; duplicate key in table 't1' # check prerequisites-3 success: 1 # INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template WHERE f_int1 IN (2,3); DELETE FROM t1 WHERE f_charbig = 'delete me'; # check read via f_int1 success: 1 # check read via f_int2 success: 1 # check multiple-1 success: 1 DELETE FROM t1 WHERE MOD(f_int1,3) = 0; # check multiple-2 success: 1 INSERT INTO t1 SELECT * FROM t0_template WHERE MOD(f_int1,3) = 0; # check multiple-3 success: 1 UPDATE t1 SET f_int1 = f_int1 + @max_row WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 AND @max_row_div2 + @max_row_div4; # check multiple-4 success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row AND @max_row_div2 + @max_row_div4 + @max_row; # check multiple-5 success: 1 SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-1 success: 1 SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), f_charbig = '#SINGLE#'; # check single-2 success: 1 SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # check single-3 success: 1 SET @cur_value1= -1; SELECT MAX(f_int1) INTO @cur_value2 FROM t1; UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # check single-4 success: 1 SELECT MAX(f_int1) INTO @cur_value FROM t1; DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # check single-5 success: 1 DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; # check single-6 success: 1 INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; # check single-7 success: 1 DELETE FROM t1 WHERE f_charbig = '#2147483647##'; DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; INSERT t1 SET f_int1 = 0 , f_int2 = 0, f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), f_charbig = '#NULL#'; INSERT INTO t1 SET f_int1 = NULL , f_int2 = -@max_row, f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), f_charbig = '#NULL#'; # check null success: 1 # check null-1 success: 1 UPDATE t1 SET f_int1 = -@max_row WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-2 success: 1 UPDATE t1 SET f_int1 = NULL WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-3 success: 1 DELETE FROM t1 WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; # check null-4 success: 1 DELETE FROM t1 WHERE f_int1 = 0 AND f_int2 = 0 AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) AND f_charbig = '#NULL#'; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row ON DUPLICATE KEY UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, f_int2 = 2 * @max_row + source_tab.f_int1, f_charbig = 'was updated'; # check unique-1-a success: 1 # check unique-1-b success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'===') WHERE f_charbig = 'was updated'; REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' FROM t0_template source_tab WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; # check replace success: 1 DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; DELETE FROM t1 WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; UPDATE t1 SET f_int2 = f_int1, f_char1 = CAST(f_int1 AS CHAR), f_char2 = CAST(f_int1 AS CHAR), f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; SET AUTOCOMMIT= 0; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-1 success: 1 COMMIT WORK; # check transactions-2 success: 1 ROLLBACK WORK; # check transactions-3 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; ROLLBACK WORK; # check transactions-4 success: 1 INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, '', '', 'was inserted' FROM t0_template source_tab WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; # check transactions-5 success: 1 ROLLBACK WORK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back # check transactions-6 success: 1 # INFO: Storage engine used for t1 seems to be not transactional. COMMIT; # check transactions-7 success: 1 DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; SET @@session.sql_mode = 'traditional'; SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, '', '', 'was inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; ERROR 22012: Division by 0 COMMIT; # check transactions-8 success: 1 # INFO: Storage engine used for t1 seems to be unable to revert # changes made by the failing statement. SET @@session.sql_mode = ''; SET AUTOCOMMIT= 1; DELETE FROM t1 WHERE f_charbig = 'was inserted'; COMMIT WORK; UPDATE t1 SET f_charbig = REPEAT('b', 1000); # check special-1 success: 1 UPDATE t1 SET f_charbig = ''; # check special-2 success: 1 UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-1 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; # check trigger-2 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-3 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-4 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = new.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-5 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-6 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-7 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW BEGIN UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, f_charbig = 'updated by trigger' WHERE f_int1 = - old.f_int1; END| DELETE FROM t0_aux WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); # check trigger-8 success: 1 DROP TRIGGER trg_1; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = 'just inserted' WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); DELETE FROM t0_aux WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; DELETE FROM t1 WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = old.f_int1 + @max_row, new.f_int2 = old.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-9 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN SET new.f_int1 = new.f_int1 + @max_row, new.f_int2 = new.f_int2 - @max_row, new.f_charbig = '####updated per update trigger####'; END| UPDATE t1 SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, f_charbig = '####updated per update statement itself####'; # check trigger-10 success: 1 DROP TRIGGER trg_2; UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), f_int2 = CAST(f_char1 AS SIGNED INT), f_charbig = CONCAT('===',f_char1,'==='); CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-11 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET new.f_int1 = @my_max1 + @counter, new.f_int2 = @my_min2 - @counter, new.f_charbig = '####updated per insert trigger####'; SET @counter = @counter + 1; END| SET @counter = 1; SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; INSERT INTO t1 (f_char1, f_char2, f_charbig) SELECT CAST(f_int1 AS CHAR), CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 ORDER BY f_int1; DROP TRIGGER trg_3; # check trigger-12 success: 1 DELETE FROM t1 WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) AND f_int2 <> CAST(f_char1 AS SIGNED INT) AND f_charbig = '####updated per insert trigger####'; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK CHECKSUM TABLE t1 EXTENDED; Table Checksum test.t1 <some_value> OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK # check layout success: 1 REPAIR TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 repair status OK # check layout success: 1 TRUNCATE t1; # check TRUNCATE success: 1 # check layout success: 1 # End usability test (include/partition_check.inc) DROP TABLE t1; DROP VIEW IF EXISTS v1; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t0_aux; DROP TABLE IF EXISTS t0_definition; DROP TABLE IF EXISTS t0_template;