Bug #58495 mysqldump doesn't export backslash correctly
Submitted: 25 Nov 2010 14:26 Modified: 25 Nov 2010 15:16
Reporter: Roland Bali Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: mysqldump Command-line Client Severity:S2 (Serious)
Version:5.0, 5.1, 5.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: backslash, Backup, mysqldump, restore

[25 Nov 2010 14:26] Roland Bali
I have a view with a backslash string literal (probably not be a good idea in the first place, but that's beside the point :)).

When doing a backup using mysqldump the exported view isn't exported as it was defined which makes it impossible to restore the backup.

How to repeat:
This is the original view:

CREATE OR REPLACE VIEW v_customer_suggestions(id, name, lft, rgt, external_id, date_created, last_updated, path) AS
SELECT	child.id AS id,
		child.name AS name,
		child.lft AS lft,
		child.rgt AS rgt,
		child.external_id AS external_id,
		child.date_created AS date_created,
		child.last_updated AS last_updated,
		GROUP_CONCAT(parent.name ORDER BY parent.depth SEPARATOR '\\\\') AS path
FROM v_customers_with_depth parent,
     v_customers_with_depth child
WHERE child.lft BETWEEN parent.lft AND parent.rgt
GROUP BY child.id;

When looking at the view exported by mysqldump the '\\\\' part is replaced by '\'.
[25 Nov 2010 15:16] Susanne Ebrecht
Many thanks for writing a bug  report.

I tested on different OS with MySQL 5.0, 5.1 and 5.5.

Verified as described.

You just will get a single backslash out instead of 4 backslashes.
[5 Dec 2010 21:39] Peter Laursen
I wonder if this is a bug with 'mysqldump' or if it is a bug with the server (ie: SHOW CREATE returns wrong) ?
[17 Feb 2011 10:42] Peter Laursen
This is *not* a client/mysqldump bug. SHOW CREATE VIEW returns a single backslash in SEPERATOR.