Johan De Meersman wrote:
> On Tue, May 18, 2010 at 6:00 PM, Victor Subervi
> <victorsubervi@stripped>wrote:
>
>>
>> So apparently it didn't like my foreign key. Do I need to do something with
>> the table I'm referencing or what?
>> TIA.
>>
>
> Well, quickfix is to convert your tables to innoDB, starting with the
> lowest-level (foreign-key only ones) first - I'm not sure what happens if
> you set a referential constraint from an innodb table to a myisam table.
>
> You can easily convert tables with "alter table *yourtable* engine=innodb;".
> For the tables where you also want to add constraints and/or indices, "alter
> table *yourtable* add constraint *yourconstrainthere* engine=innodb;" does
> the trick in one go.
>
>
Both ends of the key need to be InnoDB. The fields also need to match in
type, nullability, and collation.
For additional details about failed FK attempts, check the error details
in the SHOW INNODB STATUS report.
--
Shawn Green
MySQL Principle Technical Support Engineer
Oracle USA, Inc.
Office: Blountville, TN