From b66ab7f80b629c6d33d7e4ac01002cbb7676df18 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 19 Dec 2006 15:32:02 +0300 Subject: [PATCH] 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'. mysql-test/r/view.result: Update result file. mysql-test/t/view.test: Add test case for BUG#24293. sql/sql_string.cc: We should replace 032 with \Z, since lexer does not understand \z. --- mysql-test/r/view.result | 9 +++++++++ mysql-test/t/view.test | 15 +++++++++++++++ sql/sql_string.cc | 4 ++-- 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);