Bug #66082 ERROR 1005: Can't create table (errno: 150) for Many to Many relationships
Submitted: 30 Jul 2012 12:12 Modified: 2 Sep 2012 8:55
Reporter: Yomna Mahmoud Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.37 OS:Windows (XP professional version 2002)
Assigned to: CPU Architecture:Any

[30 Jul 2012 12:12] Yomna Mahmoud
Description:
I faced the same problem, have check all the possible threads online and no matching for my problem. I am using MySQL workbench 5.2 CE. I was trying to create a many to many relationship between 2 tables and the same error appears each time I create the relationship using their tool. 

Note I was designing the code using EER modelling and the error appears during forward engineering.

How to repeat:
Create two tables that have foreign keys referring to other tables (but not part of their primary keys) and they have their own auto-increment primary keys. relate these tables using many to many relationship from the tools provided in the EER diagram ( so that the table in the middle consists of the 2 auto-increment keys). Run forward engineer on the EER model.

Suggested fix:
What I did is that i created the relationship table myself, related it to the first table then ran the SQL command, then I connected it to the second table and then ran the other SQL command. I have not reached the main cause for this issue ( It sometime occurs in many to many relationships and sometimes it does not for the same set of tables).
[30 Jul 2012 12:38] Valeriy Kravchuk
Please, send the .mwb file that demonstrates the problem.
[31 Jul 2012 7:58] Valeriy Kravchuk
What exact version of Workbench, 5.2.x, do you use? 

I was able to forward engineer your .mwb file with 5.1.41 successfully, after I agreed to rename foreign keys that has the same names as indexes (as suggested by that version of Workbench upon opening the .mwb file).
[31 Jul 2012 8:05] Yomna Mahmoud
Version use dis 5.2.37, I haven't received the same suggestions if renaming the foreign keys from this version (although it supposed to be newer).
[1 Aug 2012 7:37] Valeriy Kravchuk
Please, check if upgrade to 5.2.41 and renaming it suggests upon opening the .mwb file solves the problem for you.
[1 Aug 2012 12:33] Yomna Mahmoud
Unfortunately I won't be able to upgrade at the moment in the middle of the project. However I will try ti as soon as I am done. as mentioned earlier I already found a solution that fixed the situation for me, but just reported if the situation occurred for others as well.
[3 Sep 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".