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
23215
April 07, 2006 08:35AM
6621
April 09, 2006 01:38PM
7717
April 10, 2006 05:52AM
Re: Foreign Key Error 121
4338
April 17, 2009 09:54AM
4736
April 10, 2006 07:06AM
4532
April 10, 2006 07:48AM
3998
April 10, 2006 06:06PM
5324
April 11, 2006 09:08AM
3942
April 11, 2006 02:49PM
4107
September 17, 2007 05:54PM
6455
September 26, 2007 09:55AM
3668
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.