Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1
begin
trg1 INSERT t1 begin
if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
end BEFORE 0000-00-00 00:00:00 root@localhost
trg2 UPDATE t1 begin
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
end BEFORE 0000-00-00 00:00:00 root@localhost
trg3 UPDATE t1
begin
trg3 UPDATE t1 begin
if new.a = -1 then
set @fired:= "Yes";
end if;
...
...
@@ -2055,8 +2053,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW
begin
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin
if new.a > 10 then
set new.a := 10;
set new.a := 11;
...
...
@@ -2069,8 +2066,7 @@ if old.a % 2 = 0 then set new.b := 12; end if;
end */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW
begin
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW begin
if new.a = -1 then
set @fired:= "Yes";
end if;
...
...
@@ -2092,8 +2088,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW
begin
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin
if new.a > 10 then
set @fired:= "No";
end if;
...
...
@@ -2165,24 +2160,21 @@ t1
t2
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1
begin
trg1 INSERT t1 begin
if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
end BEFORE # root@localhost
trg2 UPDATE t1 begin
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
end BEFORE # root@localhost
trg3 UPDATE t1
begin
trg3 UPDATE t1 begin
if new.a = -1 then
set @fired:= "Yes";
end if;
end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost
trg4 INSERT t2
begin
trg4 INSERT t2 begin
if new.a > 10 then
set @fired:= "No";
end if;
...
...
@@ -2210,7 +2202,7 @@ a2
1
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
testref INSERT test1 BEGIN
testref INSERT test1 BEGIN
INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost