stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
INSERT INTO test.t1 VALUES (1,NOW());
CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1//
CREATE PROCEDURE test.p3()
BEGIN
INSERT INTO test.t3 (d) VALUES (NOW());
END//
CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()//
CREATE PROCEDURE test.p2()
BEGIN
INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
END//
INSERT INTO test.t1 VALUES (1+1, NOW());

<End test section 2 (Tiggers & SP)>
-----------------------------------
DROP PROCEDURE test.p2;
DROP PROCEDURE test.p3;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t3_bi_t2;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
