MySQL Forums
Forum List  »  InnoDB

[Error Code: 1005, SQL State: HY000]
Posted by: Alejandro Barrero
Date: April 27, 2008 11:09AM

ALTER TABLE child ADD CONSTRAINT oneToMany FOREIGN KEY (one_to_many_name_col, one_to_many_primary_key_fk) REFERENCES parent(name, primaryKey) ON DELETE CASCADE
fails with error message: [Error Code: 1005, SQL State: HY000] Can't create table '.\mysql\#sql-a80_327.frm' (errno: 150)

With only the name primary key works fine, but fails with only primaryKey.
The SQL types are correct. one_to_many_name_col and name are VARCHAR(50), one_to_many_primary_key_fk is INTEGER and primaryKey is INTEGER UNSIGNED.

I initially had primaryKey INTEGER (it was failing too), but changed to INTEGER UNSIGNED after reading that the primary key becomes unsigned.

I am using MySQL Server 5.0.

Your help will be greatly appreciated,

Alejandro Barrero

Options: ReplyQuote


Subject
Views
Written By
Posted
[Error Code: 1005, SQL State: HY000]
8778
April 27, 2008 11:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.