Bug #62432 | omit ON DEL/UPD RESTRICT in table' SQL, 'cause it's default MySQL action | ||
---|---|---|---|
Submitted: | 14 Sep 2011 8:55 | Modified: | 20 Jan 2012 8:03 |
Reporter: | Max Turkin | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Workbench: SQL Editor | Severity: | S3 (Non-critical) |
Version: | 5.2.34, 5.2.35, 5.2.36 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | restrict, SQL |
[14 Sep 2011 8:55]
Max Turkin
[14 Sep 2011 9:30]
Valeriy Kravchuk
What server version, x.y.z, do you use? I do not see any not matching tables while working with 5.1.57 and 5.2.35 preview release on Windows.
[14 Sep 2011 11:26]
Max Turkin
Server version: 5.1.46-community MySQL Community Server (GPL). Do you mean, next mysql version after 5.1.46 include "ON UPDATE/DELETE RESTRICT" into output of SHOW CREATE TABLE statement?
[3 Oct 2011 14:35]
MySQL Verification Team
Please try version 5.2.35. Thanks.
[4 Nov 2011 0:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[15 Nov 2011 11:54]
Max Turkin
Same behavior confirmed for 5.2.35 CE rev. 7915
[15 Nov 2011 11:56]
Max Turkin
P.S. for previous comment: used mysql server is 5.5.17 MySQL Community Server
[12 Dec 2011 15:58]
Armando Lopez Valencia
Reproduced as described for the reporter. Seems like WB do not writes the "On Delete" options. Ubuntu 11.04x64 WB 5.2.36 rev 8542
[12 Dec 2011 16:30]
Armando Lopez Valencia
Hello Max. Would you mind checking with WB newest version (5.2.36)? Please confirm that now WB behaves as expected. Thanks.
[13 Dec 2011 9:05]
Max Turkin
Bug is still there. I see in SQL code: ... CONSTRAINT `fk_user_account` FOREIGN KEY (`id_account` ) REFERENCES `mydb`.`account` (`id_account` ) !!!!! ON DELETE RESTRICT !!!!! ON UPDATE CASCADE, ... But I think that "ON DELETE RESTRICT" should not be there, because RESTRICT is default MySQL behavior on delete/update.
[14 Dec 2011 7:42]
Valeriy Kravchuk
Verified with 5.2.36 on Windows XP. This is the code Workbench generates: -- ----------------------------------------------------- -- Table `mydb`.`table2` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`table2` ( `idtable2` INT NOT NULL , `table1_idtable1` INT NOT NULL , PRIMARY KEY (`idtable2`, `table1_idtable1`) , INDEX `fk_table2_table1` (`table1_idtable1` ASC) , CONSTRAINT `fk_table2_table1` FOREIGN KEY (`table1_idtable1` ) REFERENCES `mydb`.`table1` (`idtable1` ) ON DELETE RESTRICT ON UPDATE NO ACTION) ENGINE = InnoDB; and this is how table is presented by server (version 5.5.17): mysql> show create table table2\G *************************** 1. row *************************** Table: table2 Create Table: CREATE TABLE `table2` ( `idtable2` int(11) NOT NULL, `table1_idtable1` int(11) NOT NULL, PRIMARY KEY (`idtable2`,`table1_idtable1`), KEY `fk_table2_table1` (`table1_idtable1`), CONSTRAINT `fk_table2_table1` FOREIGN KEY (`table1_idtable1`) REFERENCES `tabl e1` (`idtable1`) ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec)
[20 Jan 2012 8:03]
Philip Olson
Fixed as of 5.2.40: Queries that explicitly set RESTRICT will now synchronize properly with those that do not, because RESTRICT is the default behavior in MySQL.