Bug #59450 Beautify misformats some functions
Submitted: 12 Jan 2011 16:09 Modified: 10 Mar 2011 16:28
Reporter: Zach Swasey Email Updates:
Status: Closed Impact on me:
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.31 CE OS:Any (Windows 7, Mac OS X)
Assigned to: CPU Architecture:Any
Tags: beautify, functions

[12 Jan 2011 16:09] Zach Swasey
When beautifying a query to make it easier to read (as there is no word wrap in the editor....) I wasn't sure why Workbench was reporting that there was an error in my query. It kept saying that "COUNT" is not a function, when I'm pretty sure that it is. Turns out that beautify was adding spaces after some functions, but not others, so "COUNT(*)" would become "COUNT ( * )", and not work correctly. This also happened with NOW(), but doesn't happen on some functions, like CONCAT(), AVG(), ROUND(), or SUM().

How to repeat:
Put in any query with the COUNT() function and beautify it.
[12 Jan 2011 16:47] Valeriy Kravchuk
Indeed, the following query:

select count(*) from mysql.user

was changed into

            count ( * )
        mysql . user

and syntax error is reported for the query above.
[3 Mar 2011 13:40] Johannes Taxacher
fix confirmed in repository
[10 Mar 2011 16:28] Tony Bedford
An entry has been added to the 5.2.32 changelog: 

        In the SQL Editor, the code beautifier did not process 
        COUNT() correctly. It rendered the function 
        with additional spaces causing a syntax error.