Bug #50334 In SQL Editor Result Set tab cannot be closed
Submitted: 14 Jan 2010 15:17 Modified: 16 Feb 2010 17:19
Reporter: Tony Bedford Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.11 OS:Windows (7)
Assigned to: Sergei Tkachenko CPU Architecture:Any
Tags: Explain SQL, Result Set, sql editor

[14 Jan 2010 15:17] Tony Bedford
Description:
In the SQL Editor there is a behavior where a Result Set cannot be closed. 

This only seems to happen if a query is run, then an explain query is run. After this it is not possible to close the original result set. Also after the normal query is run it generates a results tab Result(1). Then if this query is selected and the explain query is run, a new result tab is created, also called Result(1). I would expect that this tab would be Result(2), not Result(1). Although this second Result(1) tab can be closed, the first Result(1) tab cannot be closed (perhaps because WB thinks it has already deleted Result(1)).

How to repeat:
1. Run Workbench.

2. Double-click a connection to launch the SQL Editor.

3. Enter a query in the SQL Statements area. I connected to the World database, so I entered the simple query SELECT Name FROM Country; Running this query generates a Result Set tab - Result(1).

4. Now highlight the SQL code in the SQL Statements area - in my case the code SELECT Name FROM Country;

5. Now click the "Explain selected SQL icon" in the toolbar. A new Result Set tab ALSO called Result(1) will be created. (I believe this is a bug as it should be Result(2)).

6. Now close the Explain SQL Result Tab - the "second/last" Result(1) tab.

7. Now attempt to close the remaining Result(1) tab using the small close button (X) on the tab - it cannot be closed. The fact that this tab cannot be closed is the main bug that needs to be fixed.

Suggested fix:
1. When Explain selected SQL is clicked, the result tab should be numbered with respect to result tabs already open. For example if there exists a Result(1) tab the next should be Result(2). 
 
2. Because of this numbering confusion, the interface seems to believe it has closed all tabs when the erroneously named Result(1) tab is closed - it therefore can't close any more result tabs. Check the GUI logic and especially how the list of current result tabs is handled. The handler code behind "Explain selected SQL" may be flawed.
[12 Feb 2010 9:19] Sergei Tkachenko
Also see the bug #50865.
[12 Feb 2010 23:08] Johannes Taxacher
fixed in repository
[16 Feb 2010 17:19] Tony Bedford
An entry has been added to the 5.2.16 changelog:

In the SQL Editor a situation occurred where all results tabs could not be closed. Further, results tabs were incorrectly created with the same label.