Bug #54754 "SQL Script has Unsaved Changes" is annoying
Submitted: 23 Jun 2010 21:18 Modified: 29 Jun 2010 13:45
Reporter: Jesse Castleberry Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.24 OS:Windows (Windows 7)
Assigned to: Alfredo Kojima CPU Architecture:Any

[23 Jun 2010 21:18] Jesse Castleberry
Description:
Starting with this version, every time I close WB, for every SQL Editor script tab that I have up, it asks, "SQL Script has Unsaved Changes, would you like to save...".  This is helpful in one way and annoying in another.  On the one hand, I have several times written a script that I would like to keep, then closed WB only to realize that that my script is lost.  On the other hand, it's very annoying, because everytime I double-click on a table to view its data, it brings up a new tab saying "EDIT ...".  I certainly don't want to save all those.  There's got to be a happy medium somewhere.

How to repeat:
Bring up WB, double-click on several different tables.  It'll create a script tab for each table that you "edited".  Now, close WB, and it'll inform you that you have an unsaved script and ask if you want to save it.

Suggested fix:
1. Somehow determine a difference between the scripts that I type in myself and those generated by the system.  If, for instance, there's a script in there that says "EDIT ...", most likely it was generated by the system, and I don't want to save that.  But, something I typed in myself I may want to save.  I'm not sure if there's an easy way to determine that or not, but if you can it'd be great not to be prompted to save these "scripts".

2. Another option would be to add a "perform same action for all subsequent script save prompts" (or something to that affect).  So, when the first prompt comes up, I'll check this check box, answer "No", and all other prompts that would normally come up after that would be answered "No" automatically.

3. yet another possibility would be to add a setting in preferences for the SQL Editor to allow me to turn on or off the prompt to save scripts.  I checked and didn't see such a setting, but having one would be nice.

4. Another possibility is not to even put the "EDIT ..." in a script tab.  Just bring up the data. that's all that I care about anyway.  If you simply bring up the data and don't put up a new tab with "EDIT ..." in it, then I don't have to deal with a script closing that I have to answer a prompt about.
[24 Jun 2010 4:37] Valeriy Kravchuk
Thank you for the problem report and possible solutions suggested.
[24 Jun 2010 19:21] Alfredo Kojima
Set bug #54787 as duplicate
[24 Jun 2010 22:09] Alfredo Kojima
Changed editors to not set dirty status for scripts that are generated
[25 Jun 2010 7:52] Mike Lischke
Fix confirmed in repository.
[29 Jun 2010 13:45] Tony Bedford
An entry has been added to the 5.2.25 changelog:

On exit MySQL Workbench prompted the user to save changes for every query tab that had been opened in the SQL Editor, even where a table had simple been viewed, and no script code had been written by the user.
[1 Jul 2010 15:07] Aaron Kelley
This fix works for the simple case, not asking you to save queries related to tables you just viewed but nothing else.

I often add a little SQL to the automatically generated stuff (an ORDER BY clause for example) and it still asks me to save all of those.  After a typical work day I may have to click "Don't save" 50 times!