Bug #60817 foreign key with CHAR type
Submitted: 9 Apr 2011 14:30 Modified: 10 Apr 2011 14:33
Reporter: Adrian Munteanu Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.33 CE OS:Windows (7 64 bit)
Assigned to: CPU Architecture:Any
Tags: foreign key, with CHAR type

[9 Apr 2011 14:30] Adrian Munteanu
Description:
Foreign keys cannot be made between CHAR column type

How to repeat:
A table `users` that has `id` INT and `phone` CHAR(10)
A table `users_p` that has `userid` INT, `number` CHAR(10) and eventually a name
The table `users_p` should store data about each users' contact list
for example:
user: id=1, phone=1234567890
user: id=2, phone=1111111111
user_p: userid=1, number=1111111111, name='MyFriend'
This should represent that user 1 has in his phone list the number 1111111111 as 'MyFriend'

Suggested fix:
the condition for foreign keys should be column type equallity
[10 Apr 2011 10:12] Valeriy Kravchuk
Please, send .mwb file that demonstrates the problem.

Foreign key can reference only primary key or unique key. Is your CHAR(10) column defined this way in the user table?
[10 Apr 2011 14:33] Adrian Munteanu
My fault! Excuse me for this mistake.