Bug #58356 beautify function fails on CREATE TABLE
Submitted: 21 Nov 2010 10:31 Modified: 25 Nov 2010 11:56
Reporter: Giuseppe Maxia Email Updates:
Status: Closed Impact on me:
Category:MySQL Workbench: SQL Editor Severity:S1 (Critical)
Version:5.2.30 OS:Any
Assigned to: Alfredo Kojima CPU Architecture:Any
Tags: beautifier, sql editor, workbench

[21 Nov 2010 10:31] Giuseppe Maxia
When using the "Beautify query" function on a CREATE TABLE statement, I get an "unhandled exception" message.

This is the trace from the application:

** Message: function call error
Traceback (most recent call last):
  File "/Applications/MySQLWorkbench.app/Contents/PlugIns/sqlide_grt.py", line 155, in enbeautificate
    fmted = p.run()
  File "/Applications/MySQLWorkbench.app/Contents/PlugIns/sql_reformatter.py", line 722, in run
AttributeError: SQLPrettifier_CREATE_TABLE instance has no attribute 'preprocess'

How to repeat:
1. open the SQL editor
2. write down "create table t1 (i int)"
3. invoke the "Beautify query" feature from /edit/format
[21 Nov 2010 10:35] Giuseppe Maxia
Screen shot of the failure

Attachment: bug58356.png (image/png, text), 111.93 KiB.

[21 Nov 2010 11:01] Giuseppe Maxia
The same exception happens on CREATE PROCEDURE. e.g:
create procedure p1() deterministic select 1;

There is no exception on CREATE EVENT/FUNCTION/TRIGGER, but no beautification either.
[21 Nov 2010 11:33] Giuseppe Maxia
Also fails on START/STOP SLAVE
[21 Nov 2010 15:03] Giuseppe Maxia
Also fails sometimes on EXPLAIN.
EXPLAIN SELECT @@server_id

EXPLAIN SELECT (select 1 from t1) as x
[21 Nov 2010 18:19] Valeriy Kravchuk
Thank you for the bug report.
[21 Nov 2010 19:02] Alfredo Kojima
The exception on CREATE TABLE (and others) is a bug, but the reformatter currently only supports SELECT statements and if wasn't for the bug, CREATE TABLE too.
[21 Nov 2010 19:12] Giuseppe Maxia
If the reformatter only supports SELECT statements, please make it refuse other queries with an appropriate message instead of doing what it is doing today.
[24 Nov 2010 15:45] Johannes Taxacher
fix confirmed in repository
[25 Nov 2010 11:56] Tony Bedford
An entry has been added to the 5.2.31 changelog:

In the SQL Editor, when using the Beautify query facility on a CREATE TABLE statement, an unhandled exception was generated.