Bug #56950 formatting errors when exporting SQL insert statements
Submitted: 22 Sep 2010 19:05 Modified: 6 Jan 2011 10:23
Reporter: David Dean Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:up to 5.2.28 OS:Any
Assigned to: Alexander Musienko CPU Architecture:Any

[22 Sep 2010 19:05] David Dean
Description:
If a dataset is selected then export query results to file is run with the SQL INSERT statement option, the resulting file lists 'table' instead of the table name and does not escape the exported values

How to repeat:
Perform a select
Export results - select 'SQL Insert Statements' as file format
Review exported file

Suggested fix:
Replace the 'table' placeholder with the actual table name and escape (or at least place in quotes) the exported values
[23 Sep 2010 3:59] Valeriy Kravchuk
Thank you for the bug report. Verified with 5.2.28 on Mac OS X. This is what's generated:

-- Query: select * from  `test`.`ge`
LIMIT 0, 1000

-- Date: 2010-09-23 06:58

INSERT INTO `table` (c1) VALUES (a);
INSERT INTO `table` (c1) VALUES (b);
INSERT INTO `table` (c1) VALUES (s);
INSERT INTO `table` (c1) VALUES (u);
INSERT INTO `table` (c1) VALUES (ß);
[17 Nov 2010 11:22] Johannes Taxacher
the actual table-name will only be filled in when the "EDIT ..." syntax is used as for a normal select, the resultset that gets exported often comes out of a complex select joining multiple tables.
So therefore, WB will in future version only insert a placeholder `<schema_name>`.`<table_name>` which can be easily replaced in the resulting sql file to suit further needs.
[8 Dec 2010 19:07] Johannes Taxacher
fix confirmed in repository.
A new textfield has been added to the export-dialog (enabled only for insert-style-export) that takes the table name that is used when assembling the insert statements.
[6 Jan 2011 10:23] Tony Bedford
An entry has been added to the 5.2.31 changelog:

If a recordset was exported to an external file using the SQL INSERT statements file format option, the output contained the text 'table' in place of the actual table name.