Bug #78985 Error formatting SQL query

Submitted: 27 Oct 2015 18:40 Modified: 7 Dec 2015 22:23
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:6.3.3 OS:Any
Assigned to: CPU Architecture:Any

[27 Oct 2015 18:40] Todd Farmer
Description:
I get the following error message via WB:

Error: Error formatting SQL query: empty string given as argument for ! character

This is useless in understanding what went wrong.  It seems to be caused by lack of a default database.  In my case, it's repeatable by opening a SQL file containing something like:

DROP DATABASE IF EXISTS test;
CREATE DATABASE test;
USE test;
CREATE TABLE x (a INT);
INSERT INTO x VALUES (1), (2), (3), (4);
SELECT * FROM x WHERE a % 2 = 0;

Execute the script in full, then put the cursor on the SELECT statement and execute that statement alone.  The referenced error results.

How to repeat:
See above.

Suggested fix:
1.  Clarify why the default database isn't persisted from the USE command in the script.
2.  Provide more useful error message.
[7 Dec 2015 22:23] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.3.6 release, and here's the changelog entry:

The USE statement result was not preserved in the SQL editor, which
sometimes led to unknown errors when executing multiple statements.

Thank you for the bug report.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.