Bug #63145 mysqldbcopy - crashes when copying data containin apostrophe
Submitted: 8 Nov 2011 12:18 Modified: 9 Jul 2012 19:14
Reporter: Parahat Melayev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Utilities Severity:S2 (Serious)
Version:5.2.35 OS:Any (Mac OS X, Windows XP)
Assigned to: CPU Architecture:Any

[8 Nov 2011 12:18] Parahat Melayev
Description:
I have noticed that when copying data between servers mysqldbcopy crashes while copying data that contains apostrophe. 

How to repeat:
Ironbox:~ pmelayev$ mysqldbcopy -v --force --source=root:pwd@host1:3306 --destination=root:passwd@backup:3306 db1:db1
# Source on host1: ... connected.
# Destination on backup: ... connected.
# Copying database db1 renamed as db1
Dropping new object TABLE db1.actors
# Copying TABLE db1.actors
CREATE TABLE `actors` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `actor_type_id` int(11) NOT NULL DEFAULT '0',
  `ulan_id` int(11) NOT NULL DEFAULT '0',
  `preferred_name_id` int(11) NOT NULL DEFAULT '0',
  `qualifyer` varchar(255) DEFAULT NULL,
  `source` text,
  `notes` text,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `deleted` tinyint(4) NOT NULL DEFAULT '0',
  `access_id` int(11) DEFAULT NULL,
  `biography` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`),
  KEY `ac_actor_type_id` (`actor_type_id`),
  KEY `ac_ulan_id` (`ulan_id`),
  KEY `ac_preferred_name_id` (`preferred_name_id`),
  KEY `t_actors_accessid` (`access_id`)
) ENGINE=MyISAM AUTO_INCREMENT=33761 DEFAULT CHARSET=utf8
# Copying data for TABLE db1.actors
ERROR: Problem updating blob field. Error = Query failed. 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's book on Douanier Rousseau (1942), in an 
  article Cooper wrote on the artist' at line 1

Suggested fix:
Escape special characters.
[8 Nov 2011 13:28] Valeriy Kravchuk
Thank you for the bug report. Verified just as described on Windows XP. Just create table like this in any database:

mysql> create table ttext(c1 int, c2 char(100));
Query OK, 0 rows affected (0.17 sec)

mysql> insert into ttext values(1, 'abcd''d ef');
Query OK, 1 row affected (0.00 sec)

mysql> select * from ttext;
+------+-----------+
| c1   | c2        |
+------+-----------+
|    1 | abcd'd ef |
+------+-----------+
1 row in set (0.00 sec)

and try to copy it anywhere...
[9 Jul 2012 19:14] Chuck Bell
Fixed in Release 1.0.4.
[25 Jul 2012 14:10] Fabio Monteverdi
I have noticed that when copying data between servers mysqldbcopy crashes while copying data that contains @