Bug #32920 backslash (\) always being escaped
Submitted: 3 Dec 2007 0:40 Modified: 3 Jan 2008 16:22
Reporter: Dewey Gaedcke Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.0.45 and 5.1.x OS:Any
Assigned to: CPU Architecture:Any
Tags: backslash, escape

[3 Dec 2007 0:40] Dewey Gaedcke
Description:
backslash (\) always being escaped

Run this code:

SET GLOBAL sql_mode='NO_BACKSLASH_ESCAPES';
Select Cast('181:http\c\s\\sx.myspace.com\simages\sno_pic.gif' as Char(100));

-- returns 181:httpcs\sx.myspace.comsimagessno_pic.gif

note the missing slashes
This happens if you try to store the value in an InnoDB Char() field also

How to repeat:
Run this code:

SET GLOBAL sql_mode='NO_BACKSLASH_ESCAPES';
Select Cast('181:http\c\s\\sx.myspace.com\simages\sno_pic.gif' as Char(100));

-- returns 181:httpcs\sx.myspace.comsimagessno_pic.gif

note the missing slashes
This happens if you try to store the value in an InnoDB Char() field also
[3 Dec 2007 0:47] Paul DuBois
If you issued the SELECT in the same connection as the one in which you set the GLOBAL sql_mode value, this is to be expected. Settings to GLOBAL values affect the corresponding SESSION values only for clients that connect thereafter. (The GLOBAL value is used to initialize the SESSION value for clients when they connect, but setting the GLOBAL value within a given connection does not change the SESSION value for that connection.)

If you change the SESSION sql_mode value, you should see different results.
[3 Dec 2007 1:09] Dewey Gaedcke
I understand the session issues.  I have re-connected (same account) AFTER running the code (including "Flush" of everything) and still get the same behavior.  

Please try it yourself.
[3 Dec 2007 16:21] Sveta Smirnova
Thank you for the report.

I can not repeat described behaviour. Please provide output of select @@sql_mode for second connection.
[4 Jan 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".