Hi,

I'm having a problem dropping a foreign key constraint from an Innodb table. I am 
using MySQL 3.23.51 for Win32.  Any help would be greatly appreciated....

 I have a simple set up like the one below:

CREATE TABLE mastertable
(
masterkey INT NOT NULL PRIMARY KEY AUTO_INCREMENT
) TYPE=innodb;

CREATE TABLE othertable
(
otherkey INT NOT NULL PRIMARY KEY AUTO_INCREMENT
masterkey INT NOT NULL,
INDEX (masterkey),
FOREIGN KEY (masterkey) REFERENCES mastertable (masterkey) ON DELETE CASCADE
) TYPE=innodb;

Which works fine and all.  However, if I go to remove a foreign key it won't let me - 
though it does not report any errors:
ALTER TABLE othertable DROP FOREIGN KEY masterkey;

I tried dropping the column entirely (which is what I'm aiming to do in the first 
place) and dropping the index, but Innodb won't let me do either of those because of 
the foreign key constraints.

I've also tried setting the table to a MyISAM type, removing the constraints, index 
and column then setting it back to an Innodb table.  No go there either.  It wants 
that field and index in the table before it will change the type back to Innodb.

So, how does one go about removing the foreign key constraint once it is in place?


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to