Bug #8134 Strange behaveor comparing strings which begins with CHAR(31).
Submitted: 25 Jan 2005 15:01 Modified: 3 Feb 2005 21:09
Reporter: Moris Buga Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.8 OS:Linux (Linux)
Assigned to: Jim Winstead CPU Architecture:Any

[25 Jan 2005 15:01] Moris Buga
Description:
Empty string is equal with any string that begins with CHAR(31).

mysql> SELECT '' = CONCAT(CHAR(31),'ABC'), CONCAT(CHAR(31),'ABC') = '';
+-----------------------------+-----------------------------+
| '' = CONCAT(CHAR(31),'ABC') | CONCAT(CHAR(31),'ABC') = '' |
+-----------------------------+-----------------------------+
|                           1 |                           0 |
+-----------------------------+-----------------------------+

Same problem with selects from tables containing empty rows.

How to repeat:
SELECT '' = CONCAT(CHAR(31),'ABC');
[28 Jan 2005 22:42] Jim Winstead
This was a mistake in how string comparisons that require space-padding were done.
[1 Feb 2005 1:50] Jim Winstead
Pushed to 4.1.
[3 Feb 2005 21:09] Paul DuBois
Mentioned in 4.1.10 change notes.