Bug #61606 Relationships displayed incorrectly in MySQL Workbench
Submitted: 23 Jun 2011 11:30 Modified: 24 Jun 2011 10:17
Reporter: Rich Hobbs Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version: 5.2.34, 5.2.33 OS:Any
Assigned to: CPU Architecture:Any
Tags: NOT NULL, optional

[23 Jun 2011 11:30] Rich Hobbs
Description:
Toggling participation of a foreign key in a primary key sets but does not un-set the not null field thus affecting the modality of the relationship.

Running 5.2.33 CE Revision 7508 on Windows XP SP3
(I have also experienced this under Ubuntu as well but am not in a position currently to check the version.)

How to repeat:
Reproduce as follows:
- create table "person" with column "person_id" (INT)
- create table "member" with columns "member_id" (INT) and "person_person_id" (INT)
- create fk in member called "isPerson" referencing "person" with column "person_person_id" referencing "person_id"; this give a one-to-many non-identifying relationship which is mandatory at both ends
- set NN flag on "person_person_id" in "member"
- If you check and uncheck the NN flag of "person_person_id" in "member"; this toggles the mandatory participation of "person" which is to be expected.
- leave the "person_person_id" NN flag unchecked and check the PK flag; this sets the NN flag but leaves the mandatory flag unset the diagram also does not change the modality from 0 which is incorrect.
- uncheck the PK flag; this only changes the PK flag and leaves the NN flag set which is *ok* but the modality remains 0 and the mandatory flag is still unset.

Note: This does not seem to affect generation of SQL; forward engineering when NN is set produces the same output when the person end of the relationship is showing as optional or mandatory but the diagram is not consistent.

Suggested fix:
After the modification of a field all relationships involving that field should recalculate their modality/cardinality.
[24 Jun 2011 10:17] Valeriy Kravchuk
Thank you for the detailed bug report. Verified just as described with 5.2.34 on Windows XP.