Bug #120506 Workbench Editing Triggers Not working When there are multiple triggers
Submitted: 20 May 13:45
Reporter: IGG t Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:8.0.47 OS:Any
Assigned to: CPU Architecture:Any

[20 May 13:45] IGG t
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.