Bug #31337 Migrating BLOB fields from MySQL to MySQL server fail
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;
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.