[Commits] 7054be6: MDEV-6944: SQL_MODEs related to parsing are not applied during execution of the actual statement under SET STATEMENT .. FOR

sanja at mariadb.com sanja at mariadb.com
Wed Mar 18 01:10:45 EET 2015


revision-id: 7054be616427d9a3c92f321741b3cd120321281f
parent(s): 622611bc6a9371803f349d8cf4de6538ebbcdb37
committer: Oleksandr Byelkin
branch nick: server
timestamp: 2015-03-18 00:10:42 +0100
message:

MDEV-6944: SQL_MODEs related to parsing are not applied during execution of the actual statement under SET STATEMENT .. FOR

Actually fix for MDEV-7012 is fixing it, here is only parsing mode recalculating added and test suite.

---
 mysql-test/r/set_statement.result | 21 +++++++++++++++++++++
 mysql-test/t/set_statement.test   | 21 +++++++++++++++++++++
 sql/sql_yacc.yy                   | 11 ++++++++---
 3 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result
index d05c1e2..c3c62e5 100644
--- a/mysql-test/r/set_statement.result
+++ b/mysql-test/r/set_statement.result
@@ -1245,3 +1245,24 @@ select 'фи';
 фи
 фи
 set character_set_client=@character_set_client_save;
+#
+# MDEV-6944: SQL_MODEs related to parsing are not applied during
+# execution of the actual statement under SET STATEMENT .. FOR
+#
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note	1051	Unknown table 'test.t1'
+SET sql_mode='ANSI_QUOTES';
+SET STATEMENT sql_mode='' FOR CREATE TABLE "t1" (i INT);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"t1" (i INT)' at line 1
+SET sql_mode = '';
+CREATE TABLE "t1" (i INT);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"t1" (i INT)' at line 1
+DROP TABLE IF EXISTS count;
+Warnings:
+Note	1051	Unknown table 'test.count'
+SET STATEMENT sql_mode='IGNORE_SPACE' FOR CREATE TABLE count (i INT);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'count (i INT)' at line 1
+SET sql_mode='IGNORE_SPACE';
+CREATE TABLE count (i INT);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'count (i INT)' at line 1
diff --git a/mysql-test/t/set_statement.test b/mysql-test/t/set_statement.test
index dae80af..29cd54f 100644
--- a/mysql-test/t/set_statement.test
+++ b/mysql-test/t/set_statement.test
@@ -1134,3 +1134,24 @@ set statement character_set_client = latin5 for select 'фи';
 set character_set_client = latin5;
 select 'фи';
 set character_set_client=@character_set_client_save;
+
+
+--echo #
+--echo # MDEV-6944: SQL_MODEs related to parsing are not applied during
+--echo # execution of the actual statement under SET STATEMENT .. FOR
+--echo #
+DROP TABLE IF EXISTS t1;
+SET sql_mode='ANSI_QUOTES';
+--error ER_PARSE_ERROR
+SET STATEMENT sql_mode='' FOR CREATE TABLE "t1" (i INT);
+SET sql_mode = '';
+--error ER_PARSE_ERROR
+CREATE TABLE "t1" (i INT);
+
+
+DROP TABLE IF EXISTS count;
+--error ER_PARSE_ERROR
+SET STATEMENT sql_mode='IGNORE_SPACE' FOR CREATE TABLE count (i INT);
+SET sql_mode='IGNORE_SPACE';
+--error ER_PARSE_ERROR
+CREATE TABLE count (i INT);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 2a48285..85b400b 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -14539,11 +14539,16 @@ set:
           }
           FOR_SYM
           {
-            if (thd->is_main_statement() &&
-                maria_set_statement_variables(thd, TRUE))
+            if (thd->is_main_statement())
             {
-              MYSQL_YYABORT;
+              if (maria_set_statement_variables(thd, TRUE))
+              {
+                MYSQL_YYABORT;
+              }
+              thd->m_parser_state->m_lip.ignore_space=
+                MY_TEST(thd->variables.sql_mode & MODE_IGNORE_SPACE);
             }
+
           }
           verb_clause
 	  {}


More information about the commits mailing list