Bug #32764 | Forward Engineer fails to create foreign key constraints | ||
---|---|---|---|
Submitted: | 27 Nov 2007 11:43 | Modified: | 15 May 2014 22:33 |
Reporter: | Daniel Haas | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Workbench | Severity: | S2 (Serious) |
Version: | 5.0.9 | OS: | Windows (Vista) |
Assigned to: | CPU Architecture: | Any |
[27 Nov 2007 11:43]
Daniel Haas
[27 Nov 2007 11:48]
Daniel Haas
The example model which shows the error. - Since Vista always crashes on save i had to convert the dump-file to xml.
Attachment: foreign-key-model.xml (text/xml), 49.07 KiB.
[1 Dec 2007 7:39]
Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with a newer version, 5.0.10, and inform about the results.
[2 Jan 2008 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".
[28 Jan 2010 15:13]
Julien MAITAN
I ran into a similar error using 5.2.14 OSS beta Revision 4990 on WinXP Pro Here is ths SQL statement generated with the forward engineering command : SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; CREATE SCHEMA IF NOT EXISTS `sfotelor` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ; -- ----------------------------------------------------- -- Table `sfotelor`.`liste_departement` -- -- --------------------------------------------------- CREATE TABLE IF NOT EXISTS `sfotelor`.`liste_departement` ( `num_dpt` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT , `lib_dpt` MEDIUMTEXT NOT NULL , PRIMARY KEY (`num_dpt`) ) ENGINE = InnoDB AUTO_INCREMENT = 89 DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci; -- ----------------------------------------------------- -- Table `sfotelor`.`liste_canton` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sfotelor`.`liste_canton` ( `num_canton` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT , `lib_canton` MEDIUMTEXT NOT NULL , `num_dpt` BIGINT(20) NOT NULL DEFAULT '0' , PRIMARY KEY (`num_canton`) , INDEX `fk_liste_canton_liste_departement1` (`num_dpt` ASC) , CONSTRAINT `fk_liste_canton_liste_departement1` FOREIGN KEY (`num_dpt` ) REFERENCES `sfotelor`.`liste_departement` (`num_dpt` ) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 88100 DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci; And here is the error log : Executing SQL script in server ERROR: Error 1005: Ne peut cr�er la table 'sfotelor.liste_canton' (Errcode: 150)
[28 Jan 2010 15:33]
Julien MAITAN
I've tried to generate CREATE TABLE script skiping Foreign Key constraints, but checking the option had no effects.
[2 May 2014 18:54]
Wilfredo Gutierrez Ramirez
I installed the last version of MySQL and I have the same issue, and no solutions since 2007??
[15 May 2014 22:33]
Alfredo Kojima
The problem is because your primary key and foreign key types are not identical (in the examples pasted, the PK is UNSIGNED and the FK is not.