Bug #31337 Migrating BLOB fields from MySQL to MySQL server fail

Submitted: 2 Oct 2007 10:39 Modified: 30 May 2013 11:23
Reporter: Timo A. Hummel Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:1.1.12 OS:Any
Assigned to: CPU Architecture:Any

[2 Oct 2007 10:39] Timo A. Hummel
Description:
When I try to migrate a blob value, the migration toolkit tries to set a default value for the blob column.

Source Table:
+---------------+--------------+------+-----+---------+-------+
| Field         | Type         | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| country       | char(2)      | NO   | PRI |         |       |
| internal_name | varchar(255) | NO   |     |         |       |
| flag          | mediumblob   | NO   |     |         |       |
+---------------+--------------+------+-----+---------+-------+

Migration Toolkit SQL:

DROP TABLE IF EXISTS `mytest`.`countries`;
CREATE TABLE `mytest`.`countries` (
  `country` CHAR(2) NOT NULL DEFAULT '',
  `internal_name` VARCHAR(255) NOT NULL DEFAULT '',
  `flag` MEDIUMBLOB NOT NULL DEFAULT '',
  PRIMARY KEY (`country`)
)
ENGINE = INNODB;

The SQL above fails on the target MySQL server.

How to repeat:
Create the table on MySQL Server A:

+---------------+--------------+------+-----+---------+-------+
| Field         | Type         | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| country       | char(2)      | NO   | PRI |         |       |
| internal_name | varchar(255) | NO   |     |         |       |
| flag          | mediumblob   | NO   |     |         |       |
+---------------+--------------+------+-----+---------+-------+

Migrate the table above to MySQL Server B.

Suggested fix:
The Migration Toolkit should generate the following SQL:

DROP TABLE IF EXISTS `mytest`.`countries`;
CREATE TABLE `mytest`.`countries` (
  `country` CHAR(2) NOT NULL DEFAULT '',
  `internal_name` VARCHAR(255) NOT NULL DEFAULT '',
  `flag` MEDIUMBLOB NOT NULL,
  PRIMARY KEY (`country`)
)
ENGINE = INNODB;

Instead of:

DROP TABLE IF EXISTS `mytest`.`countries`;
CREATE TABLE `mytest`.`countries` (
  `country` CHAR(2) NOT NULL DEFAULT '',
  `internal_name` VARCHAR(255) NOT NULL DEFAULT '',
  `flag` MEDIUMBLOB NOT NULL DEFAULT '',
  PRIMARY KEY (`country`)
)
ENGINE = INNODB;
[2 Oct 2007 11:21] MySQL Verification Team
Thank you for the bug report.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.