generateChangelog produces incorrect values for binary type

Description

We're using 3.5.0-SNAPSHOT right now because we're using a schema with a BINARY(16) column (fixed by https://liquibase.jira.com/browse/CORE-2550#icft=CORE-2550).

It now produces the right schema. However, for the BINARY(16) column, it still produces incorrect values for MySQL:

given this creation:

CREATE DATABASE IF NOT EXISTS `mydb`; CREATE TABLE IF NOT EXISTS `mydb`.`testbinary16` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `col1` BINARY(16) NOT NULL) ENGINE = InnoDB; INSERT INTO mydb.testbinary16 (col1) values (BINARY(1)), (BINARY(0x112233445566778899AABBCCDDEEFF));

generatechangelog produces:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> <changeSet author="sravash (generated)" id="1448461368983-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> <insert tableName="testbinary16"> <column name="id" valueNumeric="1"/> <column name="col1" value="[B@153015e8"/> </insert> <insert tableName="testbinary16"> <column name="id" valueNumeric="2"/> <column name="col1" value="[B@29f4a84b"/> </insert> </changeSet> </databaseChangeLog>

To me this looks like a trivial implementation mistake of performing the .toString to the byte[] instead of returning the right value in the right representation.

I would either expect liquibase to fail to generate a databaseChangeLog for binary types with the correct values, or refuse to do so if it cannot. (https://liquibase.jira.com/browse/CORE-1391#icft=CORE-1391 gives a hint it cannot or could not)

Environment

MySQL 5.5

Activity

Show:

Max Englander September 14, 2017 at 5:18 PM

Hi Nathan,

This is also an issue for me. I'm curious, what aspects of binary data are hard to handle?

Best,
Max

Nathan Voxland March 14, 2016 at 8:21 PM

Binary data gets hard to handle, but I'll look at it more with 4.0.

For now, I changed the generated insert to have a valueComputed of "UNSUPPORTED FOR DIFF: BINARY DATA" so you know it's not supported

Fixed

Details

Reporter

Fix versions

Affects versions

Priority

Created November 25, 2015 at 3:04 PM
Updated February 19, 2020 at 3:03 PM
Resolved March 14, 2016 at 8:21 PM

Flag notifications