Bug #43997 Null foreign key on a table results in an 'unserializing GRT data' error
Submitted: 31 Mar 2009 19:23 Modified: 7 Apr 2009 12:46
Reporter: Jerry Liverseidge Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.1.9 OS:Linux (Fedora 10/Windows)
Assigned to: Alfredo Kojima CPU Architecture:Any
Tags: ForeignKey, grt, null

[31 Mar 2009 19:23] Jerry Liverseidge
Description:
When a foreign key is created, a column is selected on the original table, but no column selected on the foreign table, upon opening the workbench file again, the error 'Unserializing GRT data' - 'Inserting null value to not null list' occurs. This error results in Workbench not opening the file at all, making all data inaccessible in the model through workbench.

How to repeat:
Create two tables. The first table (FIRST) should contain one id field of type INT (FIRSTID). The second (SECOND) table should contain an id field of it's own (SECONDID), and a second field for the Foreign Key reference (FIRSTID). 

Create the Foreign Key on the table SECOND and select the FIRSTID column, however, either do not select 'Referenced Column' or it may simply default to null.

Save the workbench file. Close the workbench file (either create a new one, or close the app entirely).

Re-open the workbench file and the error appears.

Suggested fix:
- When selecting a column for reference on the foreign key, the list of available columns on the referenced table may not come up automatically.

- A validation should take place when creating foreign keys to make sure there is no null value.

The workaround is to manually edit the xml file in the mwb file and find all references to <null/> contained within the ForeignKey values, delete them, save the xml file back into the mwb and load.
[31 Mar 2009 23:23] MySQL Verification Team
Thank you for the bug report. Verified on Windows as well.
[2 Apr 2009 2:38] Rodrigo Campos
MySQL-workbench-oss-5.1.9-1_i386.deb

The same problem, on Debian Lenny...
[6 Apr 2009 21:11] Johannes Taxacher
WB doesn't create broken files like described anymore. fix will be in 5.1.10 beta
[7 Apr 2009 12:46] Tony Bedford
An entry was added to the 5.1.10 changelog:

When a foreign key was created, a column was selected in the original table, but no column was selected in the foreign table. If the project was saved and an attempt was made to reload it the following error message was generated:

Unserializing GRT data - Inserting null value to not null list

This error prevented Workbench from opening the project file, resulting in all model data being inaccessible.
[26 Apr 2009 14:15] Graham Christensen
For those with this difficulty, the .mwb file is a zipped file -unzip it to edit the XML.