Bug #11754 SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0
Submitted: 6 Jul 2005 2:39 Modified: 3 Aug 2005 20:52
Reporter: Carl Longnecker Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.12a and 5.0.7 OS:Windows (windows xp sp2\Linux)
Assigned to: Alexander Barkov CPU Architecture:Any

[6 Jul 2005 2:39] Carl Longnecker
Description:
if you say to mysql:

SET NAMES utf8;
SELECT "A\\" LIKE "A\\";

the return value is 0. (sending SET NAME utf8 first appears to be the default behavior of querybrowser.) if you start the cli and don't SET NAMES utf8; first, the return value is 1.

see discussion at http://www.sitepoint.com/forums/showthread.php?t=277945

How to repeat:
start mysql cli.

say: SELECT "A\\" LIKE "A\\";
returns 1.

say: SET NAMES utf8;
say: SELECT "A\\" LIKE "A\\";
returns 0.

Suggested fix:
unknown.
[6 Jul 2005 2:51] MySQL Verification Team
miguel@hegel:/share/dbs/5.0$ bin/mysql -uroot    
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17 to server version: 5.0.9-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SELECT "A\\" LIKE "A\\";
+------------------+
| "A\\" LIKE "A\\" |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

mysql> SET NAMES utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT "A\\" LIKE "A\\";
+------------------+
| "A\\" LIKE "A\\" |
+------------------+
|                0 |
+------------------+
1 row in set (0.00 sec)

mysql>
[19 Jul 2005 11:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/27298
[22 Jul 2005 11:38] Alexander Barkov
Pushed into 4.1.14 and 5.0.11
[3 Aug 2005 20:52] Mike Hillyer
Documented in 4.1.14 and 5.0.11 changelogs:

<listitem><para>Comparisons like <literal>SELECT "A\\" LIKE "A\\";</literal> fail when using <literal>SET NAMES utf8;</literal>. (Bug #11754)</para></listitem>