Bug #41887 Foreign Key Options - incorrect values for each selected constraint
Submitted: 5 Jan 2009 21:09 Modified: 6 Aug 2009 16:57
Reporter: Rick Sanderson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.0.29 OS:Windows (Vista)
Assigned to: Sergei Tkachenko CPU Architecture:Any
Tags: CHECKED, Foreign key options

[5 Jan 2009 21:09] Rick Sanderson
Description:
Similar to Bug#40408, which is marked closed as of 5.0.26.

The values of the "On Update" and "On Delete" fields, in the "Foreign Key Options" pane, do not always refresh for each Foreign Key constraint selected in the table on the left side of the "Foreign Keys" tab of the table editor.

For example, if the currently selected constraint is "SET NULL" for "On Delete", and then a different selection is made for a constraint that has no action specified for "On Delete", the field will remain with the value from the previous selection, giving a false indication that such action is specified in the definition of the newly selected constraint.

Incorrect field values only display when the last selected constraint does not have an action defined (as is constraint_a in the example, below).
 

How to repeat:
Using a table defined with the following:
CONSTRAINT 'constraint_a' FOREIGN KEY ('idX') REFERERENCES X(id),
CONSTRAINT 'constraint_b' FOREIGN KEY ('idY') REFERERENCES Y(id) 
      ON DELETE CASCADE,
CONSTRAINT 'constraint_c' FOREIGN KEY ('idZ') REFERERENCES Z(id) 
      ON DELETE SET NULL;

In the "Foreign Keys" tab of the table editor, select constraint_b, then constraint_a.  "CASCADE" will remain as the value of the "On Delete" field.
Then select constraint_c, then back to constraint_a.  "SET NULL" will now be displayed as the value.

Suggested fix:
The values of the fields of the Foreign Key Options pane need to be refreshed after each selection of a constraint, and must be cleared if the "On Delete" and "On Update" actions for that constraint have not been defined.
[6 Jan 2009 10:39] MySQL Verification Team
Thank you for the bug report. Do you have a test case project to provide and if possible to attach a screen-shot which shows the issue reported?. Thanks in advance.
[6 Jan 2009 13:54] Rick Sanderson
Test Case Project

Attachment: Bug41887.mwb (application/x-zip-compressed, text), 4.66 KiB.

[6 Jan 2009 13:55] Rick Sanderson
Screenshot

Attachment: Bug41887.JPG (image/pjpeg, text), 91.61 KiB.

[6 Jan 2009 14:11] Rick Sanderson
The uploaded project has a table ("main") with 3 foreign keys.  Only two (b and c) have actions defined on those constraints.  So, select constraint_c, then a, then b, then a.  You will see in the Foreign Key Options pane that constraint_a always shows the constraint action from the previous selection.
[12 Jan 2009 13:09] Susanne Ebrecht
Many thanks for writing a bug report.

Verified as described by using Workbench 5.0.29 and Windows XP.
[6 Aug 2009 15:33] Johannes Taxacher
this has been fixed. fix will be included in 5.1.17
[6 Aug 2009 16:57] Tony Bedford
An entry was added to the 5.1.17 changelog:

In the Foreign Keys tab of the Table Editor, the values of the On Update and On Delete fields, in the Foreign Key Options pane, did not always refresh for each Foreign Key constraint selected in the table on the left side.

For example, if the currently selected constraint was SET NULL for On Delete, and then a different selection was made for a constraint that has no action specified for On Delete, the field remained with the value from the previous selection, which gave a false indication that such action was specified in the definition of the newly selected constraint.

Note that incorrect field values were only displayed when the last selected constraint did not have an action defined.