Bug #66171 Can not remove a field from a multi-field foreign key in Workbench
Submitted: 2 Aug 2012 23:08 Modified: 7 Sep 2012 8:08
Reporter: Bob Dankert Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.41 OS:Windows (W7)
Assigned to: CPU Architecture:Any
Tags: foreign key, multi field, remove field

[2 Aug 2012 23:08] Bob Dankert
Description:
On a table with a mutli-field foreign key, you can not remove one of those fields when altering a table.  For example, if you have a foreign key with two fields and you want to remove one of those fields, you are unable to un-check the field that you want to remove.  When you try to uncheck the field, the referenced field drop-down opens (drops down) and this causes the check to get re-checked.

How to repeat:
Execute this SQL to create two tables as described:

# Create a test table with two field - both will be used as part of a forign key
CREATE TABLE `test1` (
  `id` int(11) NOT NULL,
  `field1` varchar(45) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `id_field1` (`id`,`field1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

# Create a table with a 2-field foreign key with test1
CREATE TABLE `test2` (
  `id` int(11) NOT NULL,
  `test1_id` int(11) NOT NULL,
  `test1_field1` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `test1_id` (`test1_id`),
  KEY `key_idx` (`test1_id`,`test1_field1`),
  CONSTRAINT `key` FOREIGN KEY (`test1_id`, `test1_field1`) REFERENCES `test1` (`id`, `field1`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Now alter the table test2 and try to remove one of the two fields from the foreign key.  You will not be able to uncheck the field.

Suggested fix:
Either support the ability to remove the field from the foreign key or remove the ability to uncheck those fields which are already selected.  The former functionality would be preferred, but the latter would at least remove the bug.
[3 Aug 2012 17:02] Rafael Antonio Bedoy Torres
Verified, the checkboxes on right part of Foreign Key section are not working
[17 Aug 2012 12:51] Alfredo Kojima
Bug #66384 is a duplicate
[5 Sep 2012 13:00] Alfredo Kojima
Bug #66670 is a duplicate
[7 Sep 2012 8:08] Philip Olson
Fixed as of the upcoming Workbench 5.2.43, and here's the changelog entry:

 On a table with a multiple field foreign key, attempts to remove
 one of these fields would fail. The associated checkboxes can
 now be used with success. 

Thank you for the report.