Bug #79837 mysqldbexport does not dump BIT fields correctly
Submitted: 4 Jan 2016 17:41 Modified: 4 Aug 2016 20:06
Reporter: Roberto Polli (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Utilities Severity:S2 (Serious)
Version:1.6 OS:Linux
Assigned to: CPU Architecture:Any
Tags: mysqldbexport

[4 Jan 2016 17:41] Roberto Polli
Description:
mysqldbexport is unable to serialize BIT fields in a safe way and is not round-trip-safe.

How to repeat:
1- create table with BIT fields

mysql <<< "
create database if not exists test;
create table test.bit(b bit(1));
insert into test.bit values (0x00), (0x01), (0x00), (0x00);
"

2- dump with mysqldbexport 

mysqldbexport --export=both test --output-file=bit.sql

I expect:

 - BIT fields were dumped as BINARY DATA and serialized

Instead:

 - They are dumped as unsafe byte streams.

Suggested fix:
Treat BIT like BLOBS and serialize them with a proper function.

 - eg. 0x00 should be mapped to b'0' or '0'
[5 Jan 2016 8:14] MySQL Verification Team
Hello Roberto Polli,

Thank you for the report.

Thanks,
Umesh
[5 Jan 2016 10:53] Roberto Polli
Hi Umesh.

I submitted a very simple fix here. The OCA is already signed. 

https://github.com/mysql/mysql-utilities/pull/6

Let me know,
R.
[4 Aug 2016 20:06] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Utilities 1.6.4 release, and here's the changelog entry:

Corrects an issue when exporting tables with bit fields in SQL format,
where bit fields were being exported as strings instead of being encoded,
like b'???'. Export now correctly formats the SQL statements in the output
to properly handle bit fields.

Thank you for the bug report.