Bug #12012 Bad handling of single backslash in backup data
Submitted: 18 Jul 2005 17:20 Modified: 18 Aug 2005 14:19
Reporter: Chetan Rao Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Administrator Severity:S2 (Serious)
Version:1.0.21 OS:Windows (Windows 2000 SP4)
Assigned to: Vladimir Kolesnikov CPU Architecture:Any

[18 Jul 2005 17:20] Chetan Rao
Description:

MA generates bad backup when a text/varchar field only has a single backslash. 

Here's the relevant dump of the test table from MA: 

-- MySQL Administrator dump 1.4 
-- 
-- ------------------------------------------------------ 
-- Server version 4.1.7-nt 

-- 
-- Table structure for table `projectx`.`slashtest` 
-- 

DROP TABLE IF EXISTS `slashtest`; 
CREATE TABLE `slashtest` ( 
`Id` int(10) unsigned NOT NULL auto_increment, 
`Text` text NOT NULL, 
`Field` varchar(255) NOT NULL default '', 
PRIMARY KEY (`Id`) 
) ENGINE=MyISAM DEFAULT CHARSET=utf8; 

-- 
-- Dumping data for table `projectx`.`slashtest` 
-- 
INSERT INTO `slashtest` (`Id`,`Text`,`Field`) VALUES 
(2,','); 

As you can see, the statement above is syntactically wrong. 

The data was inserted into the table with the following statement originally and it shows up fine in MySQL Query Browser 

insert into slashtest(Text, Field) values('\\','\\'); 

Please Note:
This does NOT happen if you have any other characters besides the backslash in the field.

How to repeat:
Create a table with a text/varchar field and insert a record with only a single backslash as that field's value.

Now, backup that table using MA. 

View the generated SQL file. The insert statement generated is syntactically wrong.

Suggested fix:
Handle fields with a single backslash by escaping them.
[26 Jul 2005 20:36] Manuel Navas
I have the same problem with MA 1.0.21, it was not happening in earlier versions.
[18 Aug 2005 14:19] Vladimir Kolesnikov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html