Bug #58359 query formatter indentation fails on partially selected query
Submitted: 21 Nov 2010 12:06 Modified: 30 Nov 2010 10:51
Reporter: Giuseppe Maxia Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S1 (Critical)
Version:5.2.30 OS:MacOS (10.5.6, 10.6.5)
Assigned to: Alfredo Kojima CPU Architecture:Any

[21 Nov 2010 12:06] Giuseppe Maxia
Description:
When a query is partially selected, results of the query formatter are unpredictable.
For example, with 'flush privileges':
* when 'privileges' is selected 
  ** beautify, uppercase and lowercase fail with a unhandled exception
  ** 'indent lines' duplicates the keyword (the query becomes 'flush privilegesprivileges'
  ** 'unindent lines' does not unindent

How to repeat:
1. open the query editor
2. write down a query (e.g. 'flush privileges')
3. invoke the query format functions, one at the time
4. select (with your mouse) one keyword (e.g. 'flush')
5. invoke again all the query format options
[21 Nov 2010 18:14] Valeriy Kravchuk
Thank you for the bug report.
[22 Nov 2010 12:49] Johannes Taxacher
this can be considered a duplicate of Bug #58358
[22 Nov 2010 13:07] Giuseppe Maxia
This is not a duplicate. The behavior for partially selected is different from a fully selected query. (See what happens when you do "Indent" on a fully selected query and on a partially selected query)

Anyway, if you fix all the issues, I don't care what you call it.
[26 Nov 2010 16:52] Johannes Taxacher
fix confirmed in repository
[30 Nov 2010 10:51] Tony Bedford
An entry has been added to the 5.2.31 changelog:

In the Query Editor, if a query was partially selected, and then the beautifier run, the results were unpredictable. Problems included exceptions, duplicated tokens, and incorrect indentation.