| Bug #107568 | binary data starting with 0x00 are returned as empty string | ||
|---|---|---|---|
| Submitted: | 15 Jun 2022 8:40 | Modified: | 10 Aug 2022 20:25 |
| Reporter: | Rastislav Masaryk | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / Python | Severity: | S1 (Critical) |
| Version: | 8.0.29 | OS: | Windows |
| Assigned to: | CPU Architecture: | Any | |
[15 Jun 2022 9:27]
MySQL Verification Team
Hello Rastislav Masaryk, Thank you for the report and test case. regards, Umesh
[10 Aug 2022 20:25]
Philip Olson
Posted by developer: Fixed as of the upcoming MySQL Connector/Python 8.0.31 release, and here's the proposed changelog entry from the documentation team: Selecting binary data that began with 0x00 would return as an empty string. Thank you for the bug report.

Description: Binary data selected from DB table which are starting with 0x00 are returned as empty string. How to repeat: Prepare table with data CREATE TABLE `bintest` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `data` binary(16) DEFAULT NULL, `text` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO bintest (data, text) VALUES (0x112233445566778899aabbccddeeff00, "good"), (0x11220033445566778899aabbccddeeff, "still good"), (0x00112233445566778899aabbccddeeff, "bad"); In python cursor.execute("SELECT data, text FROM bintest") for (data, text) in cursor: print(f"'{data}': {text}") >>> 'bytearray(b'\x11"3DUfw\x88\x99\xaa\xbb\xcc\xdd\xee\xff\x00')': good >>> 'bytearray(b'\x11"\x003DUfw\x88\x99\xaa\xbb\xcc\xdd\xee\xff')': still good >>> '': bad