Description:
When Creating / Editing a trigger in workbench it isn't including the trigger contents, and so fails, if there is already a trigger there in the same group.
How to repeat:
Right Click > Alter Table > Triggers Tab
Create a new trigger. e.g.
CREATE DEFINER = CURRENT_USER TRIGGER `test`.`test1_BEFORE_INSERT` BEFORE INSERT ON `test1` FOR EACH ROW
BEGIN
select 1 into @var;
END
Click Apply. This should work.
Now close the window and repeat the process to create a second trigger:
CREATE DEFINER = CURRENT_USER TRIGGER `test`.`test1_BEFORE_INSERT_1` BEFORE INSERT ON `test1` FOR EACH ROW
BEGIN
select 2 into @var;
END
When you click apply, it will try and execute:
DROP TRIGGER IF EXISTS `test`.`test1_BEFORE_INSERT_1`;
DELIMITER $$
USE `test`$$
CREATE DEFINER = CURRENT_USER TRIGGER `test`.`test1_BEFORE_INSERT_1` BEFORE INSERT ON `test1` FOR EACH ROW FOLLOWS `test1_BEFORE_INSERT`
$$
DELIMITER ;
And then fails as there is no content to the trigger.
Suggested fix:
Ensure multiple triggers are able to be added.