Bug #19457 LIKE incorrectly succeeds for certain characters
Submitted: 1 May 2006 16:41 Modified: 11 May 2006 14:54
Reporter: Paul DuBois Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Georgi Kodinov CPU Architecture:Any

[1 May 2006 16:41] Paul DuBois
This was originally reported in Bug#16699. I summarize
the issue here.

The following statement incorrectly reports a match:

mysql> select char(196) like '\\\\';
| char(196) like '\\\\' |
|                     1 |

This appears to be version dependent.
- In 4.1, the result in incorrect
- In 5.0, the result is in correct through 5.0.14, correct in 5.0.15 and up

How to repeat:
See above.
[11 May 2006 14:54] Georgi Kodinov
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

There is a change of the character set used by default for the CHAR () function without the USING clause between 4.1 and 5.0.
as described in section 12.3.1 of the Reference manual).
4.1 uses the current character set (latin1 by default), whereas 5.0 and up use the binary charset. 

And since the latin1 defines that char 196 compares as backslash you get the observed effect.