[Commits] 9751b59: Fixed a bug in lexer.

IgorBabaev igor at mariadb.com
Thu Apr 5 21:54:03 EEST 2018


revision-id: 9751b597780f025636e85987cbbe279e3fce772d (mariadb-10.3.5-105-g9751b59)
parent(s): 14956c47ca5e87dbad37248c9db9df56c3f1df82
author: Igor Babaev
committer: Igor Babaev
timestamp: 2018-04-05 11:54:03 -0700
message:

Fixed a bug in lexer.

---
 mysql-test/main/derived.result | 2 +-
 sql/sql_lex.cc                 | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result
index 0ca050a..ebbc08a 100644
--- a/mysql-test/main/derived.result
+++ b/mysql-test/main/derived.result
@@ -225,7 +225,7 @@ ERROR HY000: The target table t1 of the UPDATE is not updatable
 delete from (select * from t1);
 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 '(select * from t1)' at line 1
 insert into  (select * from t1) values (5);
-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 'select * from t1) values (5)' at line 1
+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 '(select * from t1) values (5)' at line 1
 drop table t1;
 create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
 );
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 35eafe3..e037f05 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1397,8 +1397,9 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
       thd->lex->current_select->parsing_place= NO_MATTER;
       break;
     }
-    if (thd->lex->current_select->parsing_place == IN_UPDATE_ON_DUP_KEY ||
-        thd->lex->current_select->parsing_place == IN_PART_FUNC)
+    if (thd->lex->current_select &&
+        (thd->lex->current_select->parsing_place == IN_UPDATE_ON_DUP_KEY ||
+         thd->lex->current_select->parsing_place == IN_PART_FUNC))
       return VALUE_SYM;
     token= lex_one_token(yylval, thd);
     lip->add_digest_token(token, yylval);


More information about the commits mailing list