Bug #63999 SOURCE and \. commands not supported
Submitted: 11 Jan 2012 17:28 Modified: 1 Feb 2018 10:52
Reporter: Kevin Abel Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S4 (Feature request)
Version:5.2.37 OS:Any
Assigned to: CPU Architecture:Any

[11 Jan 2012 17:28] Kevin Abel
Description:
According to MySQL documentation you can use the "SOURCE" or "\." commands (from the mysql client) to executre statements from files. However, these commands are not supported in MySQL workbench and will return a syntax error.

Technically those commands are not SQL syntax, but they are handy when writing scripts that call other scripts.

How to repeat:
Have a file saved at ~/some_other_script.sql with the following:
SELECT * FROM my_other_table;

In the SQL Editor enter the following:
SELECT * FROM my_table;
SOURCE ~/some_other_script.sql

The first line in the Editor will succeed, but the second line will fail with:
"Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SOURCE …"

Suggested fix:
Please implement the mysql client feature that allows the use of the "SOURCE" and/or "\." commands.
[12 Jan 2012 6:50] Valeriy Kravchuk
Thank you for the feature request.
[3 Sep 2012 15:32] Michael McLaughlin
After posting to my blog, an interesting question pointed out that there's no business reason to add this feature in the request. Here's my take on why there's a business need:

While you can run any number of scripts individually and successfully, you can’t create a script to run a series of scripts in a specific order. That leaves us with two options: write down the order during integration testing and hand the list to the DBA to run in stage or production; or consolidate the scripts into one master script.

The former places execution sequence at risk, and the latter diminishes identification of ownership when an error occurs. Once an organization gets beyond a single developer, multiple scripts evolve at every major and point release. 

It’s my take that you should be able to wrap the execution sequence of scripts with a master script (one to bind them together and abstract their relationship sequence). That’s behavior currently doesn’t exist and from my perspective should exist.
[1 Feb 2018 10:52] Mike Lischke
Posted by developer:
 
These commands are features of the command line client (and exist only to overcome its limitations). That doesn't mean every other MySQL has to support them. We have no plans to add support for this kind of file handling, especially as a GUI client like Workbench can handle this way better anyway.
[6 Oct 2022 12:44] MySQL Verification Team
Bug #108694 marked as duplicate of this one.
[8 Oct 2022 14:30] Tom Corcoran
My bug https://bugs.mysql.com/bug.php?id=108681 was closed as duplicate, it details a simple readily available use case:

1. The MySQL documentation references the employee database at  https://dev.mysql.com/doc/employee/en/
2. Download the employee database from https://github.com/datacharmer/test_db
3. In MySQL Workbench open employees.sql https://github.com/datacharmer/test_db/blob/master/employees.sql), you will see source underlined in red.
4. employees.sql is 100% supported and the source command imports the dump files when run from the command line.

I thought this product's development was supported by Oracle? How can a bug like this be open for 10+ years?