Bug #58362 Unselecting Filter Trigger Not Working
Submitted: 21 Nov 2010 16:30 Modified: 11 Jun 2013 5:54
Reporter: Larry D. Wilson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:5.2.30 OS:Any
Assigned to: CPU Architecture:Any

[21 Nov 2010 16:30] Larry D. Wilson
Description:
When creating a model from an existing database, filtering tables and not selecting triggers yields the following error message:

Owner table for trigger `<trigger name>` was not selected.
Please either select the table or deselect triggers owned by that table.

The de-selected triggers are still being evaluated

How to repeat:
Setup the scenario in the test database. Run:
DELIMITER $$

DROP TABLE IF EXISTS `t1_no_trigger`;
$$
CREATE TABLE `t1_no_trigger` (
  `col1` TINYINT UNSIGNED NULL,
  PRIMARY KEY (`col1`)
);
$$
DROP TABLE IF EXISTS `t2_trigger`;
$$
CREATE TABLE `t2_trigger` (
  `col1` TINYINT UNSIGNED NULL,
  PRIMARY KEY (`col1`)
);
$$
DROP TRIGGER IF EXISTS `t2_trigger_bi_fer`
$$
CREATE TRIGGER `t2_trigger_bi_fer`
BEFORE INSERT ON `t2_trigger`
  FOR EACH ROW BEGIN
    SET NEW.`col1` = NEW.`col1` + 1;
  END;
$$

From the Home page, select Create EER Model From Existing Database.

Enter the connection parameters and press Continue.

After the Connect and Fetch are complete, press Continue.

Select the schema you want to process and press Continue.

After the Retrieve Object is complete, press Continue.

Deselect Import MySQL Trigger Objects.

Press "Show Filter" on Table Objects.

Exclude all table objects ( Press >>).

Add `t1_no_trigger` to process (select `t1_no_trigger` and press < )

Press Execute.
[21 Nov 2010 17:45] Valeriy Kravchuk
Thank you for the bug report. Verified as described on Mac OS X.
[21 Nov 2010 20:23] Peter Laursen
The option to temporarily disable TRIGGERS (completely, for a specific user, session or a single statement) should be a server functionality!
[22 Nov 2010 16:12] Larry D. Wilson
Two additional comments:

1) Same behavior is confirmed in Ubuntu Desktop 10.10.

2) And more importantly, this is preventing generation of a model with a subset of ANY tables in our production system, and I have yet to find a work-around (other than a Dia, Visio, or OmniGraffle model).

There is something mroe to this bug than meets the eye. In produciton, even if I have "Import MySQL Triggers" checked, and select only 1 table with a trigger, I still get the same error message:

Owner table for trigger <triggername> was not selected.  

This does not occur in the test I uploaded with only two tables. To repeat this additional behavior, run the following in the same database as the original test:

DELIMITER $$
CREATE TABLE `t3_trigger` (`col1` TINYINT UNSIGNED NULL)
PRIMARY KEY(`col1`)
);
$$
CREATE TRIGGER `t3_trigger_bi_fer`
BEFORE INSERT ON `t3_trigger`
FOR EACH ROW
BEGIN
  SET NEW.`col1` = NEW.`col1` + 1;
END;
$$

Now follow the original steps to create a model, except select only table t3_trigger. It will give you an error that the owner table for t2_trigger_bi_fer was not selected. 

Based on the severity definition, since there is no work-around and we cannot generate a model (too many tables to generate a single model), this should be set to S1 (Critical).
[11 Jun 2013 5:54] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.0.2 release, and here's the changelog entry:

Deselected table objects were still evaluated when executing the "EER
Model From Existing Database" wizard on a database with triggers.

Thank you for the bug report.