Bug #38614 Inability to delete foreign key
Submitted: 6 Aug 2008 21:42 Modified: 7 Aug 2008 14:47
Reporter: Jeremy Tinley Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.0.23 OS:Windows (XP Pro SP2)
Assigned to: CPU Architecture:Any
Tags: foreign key

[6 Aug 2008 21:42] Jeremy Tinley
Description:
It appears you can create an un-deletable foreign key.

How to repeat:
Create a new workbench file
Add new table
Switch to Index tab
Create new index of type FOREIGN

Attempt to delete.

You will not be able to delete the FK and it does not show on the Foreign Key tab.

I cannot find a workaround to delete this foreign key.

Suggested fix:
Do not let the user select foreign key from this drop down -OR- allow a user to delete a FOREIGN key with no corresponding entry in the Foreign Key tab.
[6 Aug 2008 22:04] MySQL Verification Team
Thank you for the bug report. Sorry but I wasn't able to repeat following your how  to repeat instructions, could you please provide the project file which presents this behavior?. Thanks in advance.
[7 Aug 2008 0:33] Jeremy Tinley
I have attached a file which demonstrates the problem.

Again, I created a new Workbench file, created one new table, clicked into INDEX tab (not Foreign Key tab), set the index type to be FOREIGN, then attempted to delete the FOREIGN key.
[7 Aug 2008 5:45] Valeriy Kravchuk
Why do you think there is a foreign key as a result? I just see (in forward engineered SQL file) an index created, but no FOREIGN KEY decalration. So, there is no foreign key at all after your actions.
[7 Aug 2008 13:32] Jeremy Tinley
See the attached screenshot.

It needs to be fixed because:

* The index you see cannot be removed.
* It is labeled as FOREIGN when it is really just an INDEX.
* The index type cannot be changed to anything else.  It is "stuck".
* It also creates the following in a forward engineer:

-- -----------------------------------------------------
-- Table `mydb`.`table1`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `table1_id`  NULL ,
  INDEX index0 () )
ENGINE = InnoDB;

This is an invalid SQL create script.
[7 Aug 2008 13:34] Jeremy Tinley
Correction on the above forward engineer.  My original example did not have a column definition for table1_id.  

The result is the same.  INDEX [index name] (columns).  Columns are required for an index.  There are no columns selected.  In fact, if you edit the index0 entry, you cannot select any columns.

CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `table1_id` INT NOT NULL ,
  INDEX index0 () ,
  PRIMARY KEY (`table1_id`) )
ENGINE = InnoDB;
[7 Aug 2008 14:47] Sveta Smirnova
Thank you for the report.

There is verified bug #38064 about very same problem. So I close this report as duplicate. Please follow discussion in bug #38064.