Description:
Using the query:
select * from _pfkit_unique where name = 0x746573745F756E69717565;
returns no results, but using the query
select * from _pfkit_unique where name like 0x746573745F756E69717565;
does work. the hex data in question is for the string 'test_unique'
which matches one row in the database.
How to repeat:
Create a table with this format:
mysql> desc _pfkit_unique;
+-------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------+------+-----+---------+-------+
| name | varchar(32) binary | | PRI | | |
| value | bigint(20) unsigned | | | 0 | |
+-------+---------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
Insert a single row so the data looks like this:
mysql> select * from _pfkit_unique;
+-------------+-------+
| name | value |
+-------------+-------+
| test_unique | 2 |
+-------------+-------+
1 row in set (0.00 sec)
Now try the two select statements:
select * from _pfkit_unique where name like 0x746573745F756E69717565;
+-------------+-------+
| name | value |
+-------------+-------+
| test_unique | 2 |
+-------------+-------+
1 row in set (0.01 sec)
mysql> select * from _pfkit_unique where name = 0x746573745F756E69717565;
Empty set (0.00 sec)
As the hex is for the string 'test_unique' then both queries should match the
database row, but only the query using 'like' works. If you us explain
on the second query you get the result:
mysql> explain select * from _pfkit_unique where name = 0x746573745F756E69717565;
+-----------------------------------------------------+
| Comment |
+-----------------------------------------------------+
| Impossible WHERE noticed after reading const tables |
+-----------------------------------------------------+
1 row in set (0.00 sec)