summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/view.result9
-rw-r--r--mysql-test/t/view.test15
-rw-r--r--sql/sql_string.cc4
3 files changed, 26 insertions, 2 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 81711f95ae6..caa494c26b3 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3014,4 +3014,13 @@ i j
6 3
DROP VIEW v1, v2;
DROP TABLE t1;
+DROP VIEW IF EXISTS v1;
+CREATE VIEW v1 AS SELECT 'The\ZEnd';
+SELECT * FROM v1;
+TheEnd
+TheEnd
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd`
+DROP VIEW v1;
End of 5.0 tests.
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 8473458ae15..a34a1ba117d 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2960,4 +2960,19 @@ DROP VIEW v1, v2;
DROP TABLE t1;
+#
+# BUG#24293: '\Z' token is not handled correctly in views
+#
+
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+CREATE VIEW v1 AS SELECT 'The\ZEnd';
+SELECT * FROM v1;
+
+SHOW CREATE VIEW v1;
+
+DROP VIEW v1;
+
--echo End of 5.0 tests.
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 85ff1fddc45..10ce72e9b9f 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -1033,8 +1033,8 @@ void String::print(String *str)
case '\r':
str->append(STRING_WITH_LEN("\\r"));
break;
- case 26: //Ctrl-Z
- str->append(STRING_WITH_LEN("\\z"));
+ case '\032': // Ctrl-Z
+ str->append(STRING_WITH_LEN("\\Z"));
break;
default:
str->append(c);