Description:
create table test (varbinary_col varbinary(255) DEFAULT NULL);
insert into test values(0);
insert into test values(_binary 'dddddddddd1');
mysql> select * from test where varbinary_col in (0);
+------------------------------+
| varbinary_col |
+------------------------------+
| 0x30 |
| 0x6464646464646464646431 |
+------------------------------+
2 rows in set, 1 warning (0.00 sec)
expect result is: 0x30
How to repeat:
create table test (varbinary_col varbinary(255) DEFAULT NULL);
insert into test values(0);
insert into test values(_binary 'dddddddddd1');
mysql> select * from test where varbinary_col in (0);
+------------------------------+
| varbinary_col |
+------------------------------+
| 0x30 |
| 0x6464646464646464646431 |
+------------------------------+
2 rows in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+-------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'dddddddddd1' |
+---------+------+-------------------------------------------------+
1 row in set (0.00 sec)
expect result is: 0x30
Suggested fix:
select * from test where varbinary_col in (0);
expect result is: 0x30