Custom CSS

Thursday, October 25, 2007

Ambiguous MySQL error messages

I got this error message from MySQL the other day:

ERROR 1025 (HY000): Error on rename of './mydatabase/#sql-13c8_8' 
to './mydatabase/mytable' (errno: 150)

It have been nice if MySQL told me I couldn't drop a FK without dropping both the FK constraint and the index (and in that order), but such is life. If you are running a SQL statement like this:

alter table `mytable` drop `mycolumn`;

..then you want to write this instead:

alter table `mytable` drop foreign key `myconstraint`;
alter table `mytable` drop index `myindex`;
alter table `mytable` drop `mycolumn`;
Post a Comment