Bug #54829 USE command requires a semicolon
Submitted: 26 Jun 2010 21:33 Modified: 16 Jul 2010 11:12
Reporter: Anders Karlsson Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.24 OS:Windows
Assigned to: Sergei Tkachenko CPU Architecture:Any

[26 Jun 2010 21:33] Anders Karlsson
Description:
The USE command, when used from the mysql commandline, does not require a tailing semicolon, i.e. it is used an an external command. The USE command is also a SQL level command. MySQL Workbench only knows about the USE command in it's SQL Command form, which means that it requires a tariling semicolon. This break compatability with many existing MySQL commandline scripts, where the use command is often not terminated with a semicolon.

How to repeat:
The following script (x.sql) will run nicely from the mysql commandline:
<SCRIPT>
use test
SELECT DATABASE();
</SCRIPT>
shell> i.e. mysql < x.sql
database()
test
shell>

Running the same script through MySQL Workbench will give a syntax error.
[27 Jun 2010 7:10] Valeriy Kravchuk
Thank you for the bug report.
[16 Jul 2010 11:12] Sergei Tkachenko
MySQL CLI tool has its own parser (or rather pre-SQL parser) for its client specific commands including 'use' command. And really internal CLI tool commands don't require delimiter, because every 1st line of new buffer starting from the command known to the client, considered internal command.
Workbench doesn't support that specific set of commands, not even partially.