Hi Wayne,

On Feb 19, 2008 4:52 PM, Waynn Lue <[EMAIL PROTECTED]> wrote:
> I'm trying to change the definition of a field and getting 1025 errors
> when I try.  Here's a simplified reproducible test case, on MySQL 5.
>
> CREATE TABLE `Users` (
>  `UserId` int(11) NOT NULL,
>  PRIMARY KEY  (`UserId`)
> ) ENGINE=InnoDB;
>
> CREATE TABLE `Actions` (
>  `ActionId` int(11) NOT NULL auto_increment,
>  `FromUserId` int(11) NOT NULL,
>  `ToUserId` int(11) NOT NULL,
>  PRIMARY KEY  (`ActionId`),
>  KEY `FromUserId` (`FromUserId`),
>  KEY `ToUserId` (`ToUserId`),
>  CONSTRAINT `Actions_ibfk_1` FOREIGN KEY (`FromUserId`) REFERENCES
> `Users` (`UserId`),
>  CONSTRAINT `Actions_ibfk_2` FOREIGN KEY (`ToUserId`) REFERENCES
> `Users` (`UserId`)
> ) ENGINE=InnoDB;
>
> mysql> ALTER TABLE Users MODIFY UserId BIGINT NOT NULL;
> ERROR 1025 (HY000): Error on rename of './test/#sql-1d11_9c0fb' to
> './test/Users' (errno: 150)
>
> This is happening regardless of whether I first do SET
> FOREIGN_KEY_CHECKS=0; or not, and whether I define it as a PK in the
> ALTER TABLE statement.  One way around it would be to drop the FKs
> first, but if there's a lot of data, I'm assuming that will be
> prohibitively slow.  Especially since I'm just going to put it back up
> again.
>
> Anyone have ideas on how to get the ALTER TABLE statement working?

Unfortunately you really can't do what you're trying to do without
dropping the FK and then putting it back :-(

Baron

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to