Bug #37300 Insert statements for table lost
Submitted: 10 Jun 2008 7:40 Modified: 10 Jun 2008 14:56
Reporter: Radboud Platvoet Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S1 (Critical)
Version:5.0.22 OS:Microsoft Windows (XP SP2)
Assigned to: CPU Architecture:Any
Tags: insert, table, workbench
Triage: D2 (Serious)

[10 Jun 2008 7:40] Radboud Platvoet
Description:
When changing the columns for a table all insert statements defined for that table are lost.

Only occurs when the inserts have been created in a different session. That is: WorkBench has been closed between inserts and column changes.

How to repeat:
Open WorkjBench.
Start a new model.
Create a table.
Create some fields/columns (at least three).
Go to the 'Inserts' tab.
Create two rows of insert data for the created fields.
Save model.
Close the WorkBench completely.
1)Start WorkBench.
Open the model.
Open the table for editing.
Go to the 'inserts' tab to verify the inserts are still there.
Go to the 'columns' tab and change the order of the fields. 
Check the 'inserts' tab. (Inserts are gone.)
Close WorkBench (do not save)
2)Start WorkBench.
Open the model.
Open the table for editing.
Go to the inserts tab to verify the inserts are still there.
Go to the 'columns' tab and add a new field. 
Check the 'inserts' tab. (Inserts are gone.)
Close WorkBench (do not save)
3)Start WorkBench.
Open the model.
Open the table for editing.
Go to the inserts tab to verify the inserts are still there.
Go to the 'columns' tab and change the name of one of the fields. 
Check the 'inserts' tab. (Inserts are gone.)

If you change order, add of change the name of a field without closing the WorkBench it adjusts the insert statements appropriately.

Suggested fix:
I guess since WorkBench can handle changing and preserving the insert statements if they have been made in the same session that there is something different in the state of the object instance. Maybe simply a boolean that states that there are inserts that need to be adjusted if the columns are changed. My suggestion is to check the differences in the state of the object instance when changing the table columns without closing the workbench and with closing the workbench.

Good luck!

Interesting is that foreign keys and indexes are not negatively effected. If you change a name of a field that has an index defined on it. That index is appropriately adapted.
[10 Jun 2008 7:52] Radboud Platvoet
Model with one table, some fields and some inserts.

Attachment: test.mwb (application/octet-stream, text), 3.91 KiB.

[10 Jun 2008 10:54] Miguel Solorzano
Thank you for the bug report.
[10 Jun 2008 14:56] Johannes Taxacher
duplicate of http://bugs.mysql.com/bug.php?id=37192