Re: ERROR 1005: Can't create table (errno: 150) - Please help
Date: April 15, 2010 07:10AM
I faced this issue and found a solution to it.
If you are trying to alter a table, then take care of NOT NULL and UNSIGNED attributes.
Ex: Consider a table
SALES (name:VARCHAR, quantity:INTEGER)
Assume that you already have 100 elements into this
When you add a new entry into this, say componentid:INTEGER, MySQL gives 1005 error if NOT NULL condition is mentioned. Because existing 100 rows in the table do not have 'componentid' feild and when the field is being added to SALES, the 100 row's value should be set to NULL which is ruled out by NOT NULL condition mentioned in ALTER TABLE and MySQL gives the error saying it cannot create the table.
I removed NOT NULL condition, and it worked for me.
Edited 1 time(s). Last edit at 04/15/2010 07:13AM by Vishwanath Savakar.