MySQL Forums
Forum List  »  InnoDB

Re: Foreign Key Error 121
Posted by: Jim Maher
Date: April 17, 2009 09:54AM

I encountered this problem too, after "simplifying" my naming conventions on an experimental database. Problem occurred many times on many different tables.

Luckily, I found http://forums.mysql.com/read.php?22,33999,249437#msg-249437.

The simplified naming turned out to be the problem. Specifically, two foreign key constraints in two different tables wound up with the same name. Trying to create the second occurence fails.

I actually DID want them to be the same name. It's just a reference check. So, it would be convenient that all checks against table T001 from all other tables would be named something like fk_T001.

But that don't work.

When I renamed the foreign keys to be unique within this database, everything ran fine.

So, I guess the rule is that every foreign key constraint has to be a unique name?


Jim Maher

Options: ReplyQuote


Subject
Views
Written By
Posted
22667
April 07, 2006 08:35AM
6490
April 09, 2006 01:38PM
7544
April 10, 2006 05:52AM
Re: Foreign Key Error 121
4170
April 17, 2009 09:54AM
4530
April 10, 2006 07:06AM
4400
April 10, 2006 07:48AM
3857
April 10, 2006 06:06PM
5148
April 11, 2006 09:08AM
3793
April 11, 2006 02:49PM
3960
September 17, 2007 05:54PM
6267
September 26, 2007 09:55AM
3525
July 07, 2008 06:05AM


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.