[Commits] a9e3b863ba0: MDEV-25140: JSON_TABLE: Success of query execution depends on the outcome of previous queries
revision-id: a9e3b863ba0fa3cb37abc886b14ba486384debc2 (mariadb-10.5.2-481-ga9e3b863ba0) parent(s): abfe6b886e304cccad31f95b5278fb836638b431 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2021-03-16 17:29:13 +0300 message: MDEV-25140: JSON_TABLE: Success of query execution depends on the outcome of previous queries Do init LEX::json_table when starting parsing. --- mysql-test/suite/json/t/json_table.test | 11 +++++++++++ sql/sql_lex.cc | 2 ++ sql/sql_yacc.yy | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index 7434a8ca8f0..7c7225933bb 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -390,6 +390,17 @@ PREPARE stmt FROM "SELECT * FROM (SELECT * FROM JSON_TABLE(LOAD_FILE('x'), '$' C EXECUTE stmt; EXECUTE stmt; +--echo # +--echo # MDEV-25140: JSON_TABLE: Success of query execution depends on the outcome of previous queries +--echo # +select * from json_table('[]', '$' COLUMNS(x FOR ORDINALITY)) a; +select min(x) from json_table('[]', '$' COLUMNS(x FOR ORDINALITY)) a; + +--error ER_SYNTAX_ERROR +select * from json_table('[]', '$' COLUMNS(x FOR ORDINALITY)); +select min(x) from json_table('[]', '$' COLUMNS(x FOR ORDINALITY)) a; + + --echo # --echo # End of 10.6 tests --echo # diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b176cb04ca8..bdb92f629aa 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1303,6 +1303,8 @@ void LEX::start(THD *thd_arg) frame_bottom_bound= NULL; win_spec= NULL; + json_table= NULL; + vers_conditions.empty(); period_conditions.empty(); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 954b3b1408e..d1d874132cd 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -11696,7 +11696,7 @@ table_function: YYPS->m_mdl_type, 0,0,0, Lex->json_table))) MYSQL_YYABORT; - Lex->json_table= 0; + Lex->json_table= NULL; } ;
participants (1)
-
psergey