Bug #28103 MySQL Query Browser ON UPDATE/DELETE NO ACTION not set on foreign keys
Submitted: 25 Apr 2007 19:34 Modified: 27 Apr 2007 14:25
Reporter: Emil Ivanov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.2.11 OS:Any
Assigned to: CPU Architecture:Any
Tags: foreign key, no action, on delete, ON UPDATE

[25 Apr 2007 19:34] Emil Ivanov
Description:
When editing a table and adjusting what to do ON DELETE/UPDATE if you select No Action MySQL Query Browser generates SQL without specifying ON DELETE/UPDATE clause instead of putting ON DELETE NO ACTION.

It generates:

ALTER TABLE `dbname`.`table1`
 DROP FOREIGN KEY `FK_table1_table2`;

ALTER TABLE `dbname`.`table1` ADD CONSTRAINT `FK_table1_table2` FOREIGN KEY `FK_table1_table2` (`col_id`)
    REFERENCES `table2` (`col_id`)
    ON DELETE CASCADE;

Should be:

ALTER TABLE `dbname`.`table1`
 DROP FOREIGN KEY `FK_table1_table2`;

ALTER TABLE `dbname`.`table1` ADD CONSTRAINT `FK_table1_table2` FOREIGN KEY `FK_table1_table2` (`col_id`)
    REFERENCES `table2` (`col_id`)
    ON DELETE CASCADE
    ON UPDATE NO ACTION; /* <-- Note this line */

How to repeat:
See above ^
[26 Apr 2007 8:35] Sveta Smirnova
Thank you for the report.

Verified as described on Mac.
[26 Apr 2007 8:37] Valeriy Kravchuk
Thank you for a bug report. Indeed, if you had ON UPDATE CASCADE and set it to "No action" (when ON DELETE CASCADE remains), incorrect SQL is generated.
[27 Apr 2007 14:25] Michael G. Zinner
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html