| Bug #5134 | WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results | ||
|---|---|---|---|
| Submitted: | 21 Aug 2004 0:35 | Modified: | 23 Aug 2004 17:12 |
| Reporter: | Timothy Smith | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 4.0.21 | OS: | Any (any) |
| Assigned to: | Sergei Glukhov | CPU Architecture: | Any |
[21 Aug 2004 0:49]
Timothy Smith
We noticed that this variant doesn't show the bug: mysql> SELECT * FROM test WHERE firstname='john' AND BINARY firstname LIKE 'john'; +-----------+----------+ | firstname | lastname | +-----------+----------+ | john | doe | +-----------+----------+
[21 Aug 2004 1:54]
Timothy Smith
One more funny result: mysql> select * from test where firstname='John' and firstname like binary 'john'; Empty set (0.00 sec) mysql> select * from test where firstname='john' and firstname like binary 'John'; Empty set (0.01 sec)
[23 Aug 2004 12:03]
Sergei Glukhov
ChangeSet 1.1981 04/08/23 Fix for bug #5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results
[23 Aug 2004 14:15]
Sergei Glukhov
Previous fix was wrong. Here is 2nd version. ChangeSet 1.1981 04/08/23 Fix for bug #5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results(2nd version)
[23 Aug 2004 17:12]
Sergei Glukhov
Fixed in 4.0 and 4.1 source tree

Description: mysql> create table test -> ( firstname char(20), -> lastname char(20) -> ); Query OK, 0 rows affected (0.11 sec) mysql> mysql> insert into test values ("John","Doe"),("john","doe"); Query OK, 2 rows affected (0.12 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> select * from test where firstname like binary 'john'; +-----------+----------+ | firstname | lastname | +-----------+----------+ | john | doe | +-----------+----------+ 1 row in set (0.04 sec) mysql> select * from test where firstname like 'john'; +-----------+----------+ | firstname | lastname | +-----------+----------+ | John | Doe | | john | doe | +-----------+----------+ 2 rows in set (0.00 sec) mysql> select * from test where firstname='john' and firstname like binary 'john'; +-----------+----------+ | firstname | lastname | +-----------+----------+ | John | Doe | | john | doe | +-----------+----------+ 2 rows in set (0.01 sec) How to repeat: This is with 4.0.21.