Bug #78688 mysqldump with newline in where
Submitted: 3 Oct 2015 15:20 Modified: 8 Nov 2015 14:09
Reporter: Ernesto Carrea Email Updates:
Status: Can't repeat Impact on me:
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version: OS:Linux
Assigned to: CPU Architecture:Any

[3 Oct 2015 15:20] Ernesto Carrea
When using mysqldump with a "where" argument containing a newline, the exported SQL contains a comment with the WHERE clause used. The comment contains the newline and becomes invalid.

How to repeat:

mysqldump --options... --where="col1=val1 \
  AND col2=val2" databasename tablename > dump.sql

dump.sql will contain a line like this:

-- Dumping data for table `tablename`
-- WHERE: col1=val1
  AND col2=val2


In this case, the line "  AND col2=val2" should be part of the comment but it's not.

Suggested fix:
Suppress newlines in the exported comment or add double dashes to every line.
[4 Oct 2015 6:40] Umesh Shastry
Hello Ernesto Carrea,

Thank you for the report.
I cannot repeat this issue with 5.6.26, 5.5.45 builds. Could you please indicate exact MySQL version where you have seen this issue?
If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

[8 Nov 2015 14:09] Ernesto Carrea
I can't reproduce it myself. I guess you can close this bug. Sorry for the inconvenience.