Posts filed under 'Errors'

MySQL (errno: 150)

Just quick note for anyone getting this error. It took me a little while to figure out.
In my case I was trying to add a foreign key with delete on cascade:

ALTER TABLE table_one
ADD CONSTRAINT name_fk FOREIGN KEY (iTable1ID)
EFERENCES table_two(iTable2ID) ON DELETE CASCADE;

And HeidiSQL was spitting out this error msg:

SQL Error: Can’t create table ‘.\database_name\#sql-72c_fb.frm’ (errno: 150)

How to resolve this error:
Make sure your fields datatype match.
They both should have exactly the same datatype and length.
Eg. INT(4) Unsigned isn’t the same as INT(11)

Also make sure if you have data in the table, the foreign keys will not fail.
Eg. If you have an value in one table and not in the other table, it will fail.

This may be common knowledge to most of you but it might come in handy to someone else.

3 comments January 17th, 2008


Calendar

December 2008
M T W T F S S
« May    
1234567
891011121314
15161718192021
22232425262728
293031  

Posts by Month

Posts by Category