Bug #46041 Problem on the export alter SQL script : error 1025

Submitted: 8 Jul 2009 14:32 Modified: 8 Aug 2009 21:43
Reporter: Papil Mach Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.1.16 OSS OS:Windows (XP SP3)
Assigned to: CPU Architecture:Any
Tags: alter, error 1025, export, foreign key

[8 Jul 2009 14:32] Papil Mach
Description:
I'm using the export "SQL ALTER script".
Everything's okay but one thing.

On one table, I have two foreign keys, and this table has changed (ON CASCADE stuff for a foreign key).

Here's the generation :
--=================================
ALTER TABLE `myschema`.`rss` DROP FOREIGN KEY `USER_RSS_LINK` ;

ALTER TABLE `myschema`.`rss`
  ADD CONSTRAINT `USER_RSS_LINK`
  FOREIGN KEY (`user_idFK` )
  REFERENCES `myschema`.`users` (`user_id` )
  ON DELETE CASCADE
, DROP INDEX `WEBSITE_RSS_LINK`
, DROP PRIMARY KEY
, ADD PRIMARY KEY (`rss_id`, `user_idFK`, `website_idFK`) ;
--=================================

Here's what I have done (it works) :

--=================================
ALTER TABLE `myschema`.`rss` DROP FOREIGN KEY `USER_RSS_LINK` ;
ALTER TABLE `myschema`.`rss` DROP FOREIGN KEY `WEBSITE_RSS_LINK` ;

ALTER TABLE `myschema`.`rss`
  ADD CONSTRAINT `USER_RSS_LINK`
  FOREIGN KEY (`user_idFK` )
  REFERENCES `myschema`.`users` (`user_id` )
  ON DELETE CASCADE
, DROP INDEX `WEBSITE_RSS_LINK`
, DROP PRIMARY KEY
, ADD PRIMARY KEY (`rss_id`, `user_idFK`, `website_idFK`) ;

ALTER TABLE `myschema`.`rss`
  ADD CONSTRAINT `WEBSITE_RSS_LINK`
  FOREIGN KEY (`website_idFK` )
  REFERENCES `myschema`.`websites` (`website_id` );
--=================================

------------------------------------------------
------------------------------------------------

MySQL 5.1.30-community via TCP/IP on localhost.
MySQL Client Version 5.1.11
Mysql Query 1.2.12 to test the sql scripts generated by MySQL workbench. 

How to repeat:
I had other "on cascade" stuff, and the alter script generation has worked on it, so I think that there's a bug when :
  - there is a table with 2 foreign keys (with no "cascade" stuff on it)
  - You generate the "sql CREATE script" : sql-create.sql
  - you add to one of these foreign keys a "on delete cascade" property
  - you generate the "sql ALTER script" with the "sql-create.sql" file
  - create the database with the first sql script
  - alter the database with the alter script
==> Error 1025 

Suggested fix:
Drop all the foreign keys of the table if one of them has changed.
Then alter the table with every foreign key.
[8 Jul 2009 21:43] MySQL Verification Team
Thank you for the bug report. Could you please provide the model file project?. Thanks in advance.
[8 Aug 2009 23: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".

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.