Commit ba7a0375 authored by anozdrin/alik@alik's avatar anozdrin/alik@alik

Fix for BUG#24293: '\Z' token is not handled correctly in views.

If SELECT-part of CREATE VIEW statement contains '\Z',
it is not handled correctly.

The problem was in String::print().
Symbol with code 032 (26) is replaced with '\z',
which is not supported by the lexer.

The fix is to replace the symbol with '\Z'.
parent 7696592b
...@@ -3014,4 +3014,13 @@ i j ...@@ -3014,4 +3014,13 @@ i j
6 3 6 3
DROP VIEW v1, v2; DROP VIEW v1, v2;
DROP TABLE t1; 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. End of 5.0 tests.
...@@ -2960,4 +2960,19 @@ DROP VIEW v1, v2; ...@@ -2960,4 +2960,19 @@ DROP VIEW v1, v2;
DROP TABLE t1; 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. --echo End of 5.0 tests.
...@@ -1033,8 +1033,8 @@ void String::print(String *str) ...@@ -1033,8 +1033,8 @@ void String::print(String *str)
case '\r': case '\r':
str->append(STRING_WITH_LEN("\\r")); str->append(STRING_WITH_LEN("\\r"));
break; break;
case 26: //Ctrl-Z case '\032': // Ctrl-Z
str->append(STRING_WITH_LEN("\\z")); str->append(STRING_WITH_LEN("\\Z"));
break; break;
default: default:
str->append(c); str->append(c);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment