Bug #38731 mysql client too greedy on NO_BACKSLASH_ESCAPES
Description:
NO_BACKSLASH_ESCAPES is defined as
Disable the use of the backslash character (“\”)
as an escape character within strings.
The fix for bug #20103 "Escaping with backslash does not work as expected"
was implemented too greedy though in that it not only changes the behavior
of backslashes within strings but in general, so disabling command shortcuts
like \G or \C (which in turn leads to bug #36391 "mysqlbinlog creates invalid charset statements")
How to repeat:
Current behavior:
mysql> SET @@session.sql_mode='NO_BACKSLASH_ESCAPES';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT '\';
+---+
| \ |
+---+
| \ |
+---+
1 row in set (0.00 sec)
mysql> SELECT '\'\G
->
Expected behavior:
mysql> SELECT '\'\G
*************************** 1. row ***************************
\: \
1 row in set (0.00 sec)
Suggested fix:
=== modified file 'client/mysql.cc'
--- client/mysql.cc 2008-07-22 17:41:26 +0000
+++ client/mysql.cc 2008-08-11 20:59:36 +0000
@@ -2042,9 +2042,9 @@ static bool add_line(String &buffer,char
}
#endif
if (!*ml_comment && inchar == '\\' &&
- !(mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES))
+ !(*in_string && (mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)))
{
- // Found possbile one character command like \c
+ // Found possible one character command like \c
if (!(inchar = (uchar) *++pos))
break; // readline adds one '\'
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.057 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.