Bug #51594 MySQL Workbench Export Results as CSV adds trailing comma in output
Submitted: 1 Mar 2010 3:46 Modified: 22 Mar 2010 16:28
Reporter: Terry Bailey Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:5.2.15, 5.2.16 OS:Windows (Windows 7)
Assigned to: Alfredo Kojima CPU Architecture:Any
Tags: comma, csv, export, extra comma

[1 Mar 2010 3:46] Terry Bailey
Description:
Exporting a result set using the new CSV export now creates a CSV file, but adds a trailing comma to each line including the heading.

This will cause any import to treat the csv file as if it has another column with no heading or data which will cause some problems for certain functions.  

How to repeat:
1) Run a simple query (SELECT * FROM users;) in the Query Editor
2) Select Query | Export Results and chose the CSV format
3) Specify the recordset and file path and click the Export button.
4) Open the results in notepad or any text editor and you will notice a trailing comma on each line.  

Suggested fix:
Have the export not include a trailing comma on each line
[1 Mar 2010 9:04] Valeriy Kravchuk
Thank you for the bug report. Verified just as described.
[16 Mar 2010 12:14] Alfredo Kojima
All 3 CSV export templates have been fixed.
[22 Mar 2010 14:04] Johannes Taxacher
fixed in repository
[22 Mar 2010 16:28] Tony Bedford
An entry has been added to the 5.2.17 changelog:

Exporting a result set to a CSV file resulted in a file with a trailing comma appended to each line including the heading.