Bug #59655 Can't set foreign key on different type fields
Submitted: 21 Jan 2011 12:31 Modified: 28 Jun 2013 0:59
Reporter: Piotr Jasiulewicz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.29 OS:Linux (Ubuntu 10.04)
Assigned to: CPU Architecture:Any
Tags: fields

[21 Jan 2011 12:31] Piotr Jasiulewicz
Description:
When fields are different types WB doesn't let you set up a foreign key. There is no error message or anything.
For instance we want to get a relation on 

TABLE_A:SESSION_ID INT and TABLE_B:SESSION_ID MEDIUMINT

WB will block the checkbox in the foreign keys tab (index columns) on the SESSION_ID field. 
Additionally 

How to repeat:
Create 2 tables with same fields but different values subtypes like int and mediumint ant try to set a foriegn key relation on them.

Suggested fix:
Sometimes WB is used for prestantation purposes so I would imply that instead of some warning it should just accept the field diferences in the same subtupe (int->mediumint) but not in different types (int->>varchar) where it should produce a waring at least.
[21 Jan 2011 12:45] Valeriy Kravchuk
Sounds like a nice feature request: options to control level of check for foreign key constraints.
[21 Jan 2011 13:52] Piotr Jasiulewicz
Found out that if you set two exact types but different lenghts eg:
Table A: FieldA TINYINT
Table B: FeildB TINYINT(3)

WB won't let you set the referentced colum but will let you set the column on the Foreign Keys Tab -> Index Columns

Hope this helps
[28 Jun 2013 0:59] Philip Olson
Fixed as of the upcoming MySQL Workbench 6.0.3 release, and here's the changelog entry:

An error dialog is now generated if an invalid column is chosen from
the foreign key picker when creating the relationship.

Thank you for the bug report.