Bug #41865 MTR doesn't handle '\0' in BINARY datatypes correctly
Submitted: 5 Jan 2009 13:43 Modified: 8 Sep 2011 14:37
Reporter: Amit Saha Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:6.0.8, 5.0, 5.1, 6.0 bzr OS:Linux (RHEL, Debian 5.0)
Assigned to: Bjørn Munch CPU Architecture:Any

[5 Jan 2009 13:43] Amit Saha
Description:
The test case under consideration (attached) uses a table which uses BINARY column types. MTR doesn't work well with the padding character- '\0'. (See the attached result file)

I copied the SQL statements into a SQL script file and executed them from the MySQL client. Here is the o/p:

c1      c2      c3
a       e       abcdefg
b       d       abc
c       c       abcdefg
d       b       abc
e       a       abc
c1      c2      c3
a       e       abcdefg
b       d       abc
c       c       abcdefg
d       b       abc
e       a       abc
c1      c2      c3
a\0\0\0\0\0\0\0\0\0     e\0\0\0\0\0\0\0\0\0     abcdefg\0\0\0
b\0\0\0\0\0\0\0\0\0     d\0\0\0\0\0\0\0\0\0     abc\0\0\0\0\0\0\0
c\0\0\0\0\0\0\0\0\0     c\0\0\0\0\0\0\0\0\0     abcdefg\0\0\0
d\0\0\0\0\0\0\0\0\0     b\0\0\0\0\0\0\0\0\0     abc\0\0\0\0\0\0\0
e\0\0\0\0\0\0\0\0\0     a\0\0\0\0\0\0\0\0\0     abc\0\0\0\0\0\0\0
c1      c2      c3
a       e       abcdefg
b       d       abc
c       c       abcdefg
d       b       abc
e       a       abc

The 3rd set of results from the 'SELECT' query is the concerned issue here. As you can see from the (attached) result file, the MTR script doesn't o/p anything when it comes across the first '\0' and simply skips over to the next set of queries, without displaying the rest of the result set.

The issue then is not the server or the SE, but the handling of '\0' by MTR. The '\0' is used as a padding character for BINARY fields:http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html, as you already may be knowing. The behavior with VARBINARY is as expected as it doesn't use the padding character. 

How to repeat:
1. Run the attached test file with MTR
2. Also, run the test's SQL statements using a MySQL client and notice the difference
[5 Jan 2009 13:44] Amit Saha
Test Case

Attachment: in_string_2_unique_constraints_duplicate_update.test (application/octet-stream, text), 2.33 KiB.

[5 Jan 2009 13:44] Amit Saha
Result File

Attachment: in_string_2_unique_constraints_duplicate_update.test (application/octet-stream, text), 2.33 KiB.

[13 Jan 2009 7:47] Sveta Smirnova
Thank you for the report.

Verified as described.
[8 Sep 2011 14:37] Bjørn Munch
Oracle bug closed as "84 Not Feasible to Fix"