Bug #40041 Values missing from sql created by "Copy Insert to Clipboard" option
Submitted: 15 Oct 2008 10:10 Modified: 16 Oct 2008 15:13
Reporter: Joe Beales Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.0.26 (Rev 3296) OS:Windows (XP Pro x64)
Assigned to: Johannes Taxacher CPU Architecture:Any
Tags: clipboard, copy, insert, SQL

[15 Oct 2008 10:10] Joe Beales
Description:
When using the otpion "Copy Insert to Clipboard" the generated SQL is incorrect, it is missing the "S" off "VALUES" and it does not include the data. e.g. it produces something like:
"INSERT INTO `table1` (`table1_id`, `descr`) VALUE ();"

How to repeat:
Create a simple table, for example: one with an auto-incrementing integer key and a varchar column with no default.
Add one or more Standard Inserts to the table.
Right click the table, click "Copy Insert to Clipboard" and then paste into a text editor/MySQL Query Browser.

Suggested fix:
Generated SQL should include the defined values.

Suggested work-around:
Open the Inserts tab of the table configuration section, select the insert statements and either use Crtl-C or right-click and select "Copy" to copy the sql to the clipboard.
[15 Oct 2008 10:17] Valeriy Kravchuk
Thank you for a bug report. Verified just as described.
[15 Oct 2008 10:34] Johannes Taxacher
Hello Joe, 

the missing 'S' is definitely a bug, while the claimed "missing standard-inserts values" is not. 
This Function is not about "Copy Standard Inserts to Clipboard" it's only meant to send a generic insert-statement-skeleton for the selected table into the paste-buffer so that you can easily complete it and use it to put values into your DB.

We'll correct the statement-typo for the next version. Until then you can temporarily fix that yourself by editing the underlying lua script for that funktion by following these steps:

- click the black "Show GRT Shell IDE" icon (in the upper right of WB window)
- doubleclick the file "table_utils.grt.lua" (found under "Standard Modules")
- find and correct the corresponding code in line 71 
- click the save icon (the one on the script-editor-tab, don't use Ctrl+S, as this triggers the save document function, which doesn't include the lua script)
- now either restart WB or click the "Reload GRT plugins" icon on the "GRT Shell"-Tab to the right to load the corrected version of the function into memory
[15 Oct 2008 10:52] Joe Beales
Oh, OK. Misunderstanding on my part then. Will continue to use my suggested work-around then!
At least it wasn't a complete waste of your time, spotting the missing "S".
Best Regards,
Joe
[15 Oct 2008 11:12] Johannes Taxacher
typo fixed (and fix merged to 5.1 as well); will be included in 5.0.27
[16 Oct 2008 15:13] Tony Bedford
An entry was added to the 5.0.27 changelog:

When using the Copy Insert to Clipboard menu item the generated SQL code was incorrect. The “S” was missing from “VALUES” and the data was not included. This resulted in SQL code such as: 

INSERT INTO `table1` (`table1_id`, `descr`) VALUE ();