Bug #65411 Trigger Code disappears
Submitted: 24 May 2012 9:24 Modified: 18 Jul 2012 15:00
Reporter: charl retief Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.40 OS:Linux (Ubuntu 11.04 64bit)
Assigned to: CPU Architecture:Any
Tags: trigger

[24 May 2012 9:24] charl retief
Description:
When using the table editor to create or update a trigger on a table,
the code of the trigger disappears after a successful apply.

To see the trigger code again the table editor has to be closed and reopened.

How to repeat:
1) Select "Alter table.." on an existing table
2) goto the "Tiggers" tab
3) create a new trigger
4) "apply" the changes

5) the trigger code is gone... :(
[24 May 2012 13:12] Rafael Antonio Bedoy Torres
Hello,
Can you please provide your environment details?, you can get the info on your workbench, go to Help -> System Info.

Thanks in advance!!
[28 Jun 2012 3:09] Alfredo Kojima
What did you put as trigger code?
[28 Jun 2012 8:05] charl retief
I have a lot of triggers and it happens with all of them.
Mostly my triggers are used for data audits. Here is an example:

-- Table DDL Statement
CREATE TABLE `new_table` (
	`idnew_table` INT(11) NOT NULL,
	PRIMARY KEY (`idnew_table`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;

-- Trigger DDL Statements
DELIMITER $$

USE `test_db`$$

CREATE
DEFINER=`root`@`localhost`
TRIGGER `test_db`.`audit_new_table`
AFTER UPDATE ON `test_db`.`new_table`
FOR EACH ROW
BEGIN
    IF OLD.`idnew_table` != NEW.`idnew_table`
    THEN
        INSERT INTO `audit`(`name`,`old_value`, `new_value`)
        VALUES('idnew_table', OLD.`idnew_table`, NEW.`idnew_table` );
    END IF;
END$$
[18 Jul 2012 15:00] Philip Olson
This has been fixed as of the soon-to-be-released Workbench 5.2.41, and 
here's the changelog entry:

New or updated trigger content would disappear from the SQL
Editor GUI, as it was required to reopen the table editor to see
the changes.