diff options
Diffstat (limited to 'mysql-test/t/merge.test')
-rw-r--r-- | mysql-test/t/merge.test | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index df99d6150ab..4e0ca615f99 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -1119,35 +1119,38 @@ UNLOCK TABLES; --echo # --echo # Trigger on parent DELETE FROM t4 WHERE c1 = 4; -CREATE TRIGGER t4_ai AFTER INSERT ON t4 FOR EACH ROW SET @a=1; +CREATE TRIGGER t4_ai1 AFTER INSERT ON t4 FOR EACH ROW SET @a=1; SET @a=0; INSERT INTO t4 VALUES (4); SELECT @a; SELECT * FROM t4 ORDER BY c1; -DROP TRIGGER t4_ai; +DROP TRIGGER t4_ai1; +CHECK TABLE t3; --echo # Trigger on parent under LOCK TABLES LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE; -CREATE TRIGGER t4_ai AFTER INSERT ON t4 FOR EACH ROW SET @a=1; +CREATE TRIGGER t4_ai2 AFTER INSERT ON t4 FOR EACH ROW SET @a=1; SET @a=0; INSERT INTO t4 VALUES (4); SELECT @a; SELECT * FROM t4 ORDER BY c1; -DROP TRIGGER t4_ai; +DROP TRIGGER t4_ai2; UNLOCK TABLES; +CHECK TABLE t3; --echo # --echo # Trigger on child DELETE FROM t4 WHERE c1 = 4; -CREATE TRIGGER t3_ai AFTER INSERT ON t3 FOR EACH ROW SET @a=1; +CREATE TRIGGER t3_ai3 AFTER INSERT ON t3 FOR EACH ROW SET @a=1; SET @a=0; INSERT INTO t4 VALUES (4); SELECT @a; INSERT INTO t3 VALUES (33); SELECT @a; SELECT * FROM t4 ORDER BY c1; -DROP TRIGGER t3_ai; +DROP TRIGGER t3_ai3; +CHECK TABLE t3; --echo # Trigger on child under LOCK TABLES LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE; -CREATE TRIGGER t3_ai AFTER INSERT ON t3 FOR EACH ROW SET @a=1; +CREATE TRIGGER t3_ai4 AFTER INSERT ON t3 FOR EACH ROW SET @a=1; SET @a=0; INSERT INTO t4 VALUES (4); SELECT @a; @@ -1155,29 +1158,47 @@ INSERT INTO t3 VALUES (33); SELECT @a; SELECT * FROM t4 ORDER BY c1; DELETE FROM t4 WHERE c1 = 33; -DROP TRIGGER t3_ai; +DROP TRIGGER t3_ai4; +CHECK TABLE t3; --echo # --echo # Trigger with table use on child DELETE FROM t4 WHERE c1 = 4; -CREATE TRIGGER t3_ai AFTER INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES(22); +CREATE TRIGGER t3_ai5 AFTER INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES(22); +SELECT COUNT(*) FROM t2; INSERT INTO t4 VALUES (4); SELECT * FROM t4 ORDER BY c1; INSERT INTO t3 VALUES (33); SELECT * FROM t4 ORDER BY c1; DELETE FROM t4 WHERE c1 = 22; DELETE FROM t4 WHERE c1 = 33; -DROP TRIGGER t3_ai; +DROP TRIGGER t3_ai5; +UNLOCK TABLES; +CHECK TABLE t2,t3; --echo # Trigger with table use on child under LOCK TABLES LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE; -CREATE TRIGGER t3_ai AFTER INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES(22); +CREATE TRIGGER t3_ai6 AFTER INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES(22); INSERT INTO t4 VALUES (4); SELECT * FROM t4 ORDER BY c1; INSERT INTO t3 VALUES (33); SELECT * FROM t4 ORDER BY c1; -DROP TRIGGER t3_ai; +DROP TRIGGER t3_ai6; +UNLOCK TABLES; +check table t2,t3,t4; DELETE FROM t4 WHERE c1 = 22; DELETE FROM t4 WHERE c1 = 33; +--echo # Trigger with table use on child under different LOCK TABLES +DELETE FROM t4 WHERE c1 = 4; +LOCK TABLES t4 WRITE,t3 WRITE, t2 WRITE, t1 WRITE; +CREATE TRIGGER t3_ai7 AFTER INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES(22); +INSERT INTO t4 VALUES (4); +SELECT * FROM t4 ORDER BY c1; +INSERT INTO t3 VALUES (33); +SELECT * FROM t4 ORDER BY c1; +DROP TRIGGER t3_ai7; UNLOCK TABLES; +check table t2,t3,t4; +DELETE FROM t4 WHERE c1 = 22; +DELETE FROM t4 WHERE c1 = 33; # --echo # --echo # Repair |