diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-12-16 17:59:42 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-12-27 10:49:52 +0100 |
commit | cc28947315887f55814cb8bc4e68d4e2fe6c65e6 (patch) | |
tree | 9eb2b50e32e48a488bda26a1874dc822b692a5d8 | |
parent | 961413d26fda79cba24ab5e71fb2297f4cdfb9fd (diff) | |
download | mariadb-git-cc28947315887f55814cb8bc4e68d4e2fe6c65e6.tar.gz |
MDEV-20632: prerequisite:
Removed hack with with_list
-rw-r--r-- | sql/sql_lex.cc | 1 | ||||
-rw-r--r-- | sql/sql_lex.h | 1 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 37 |
3 files changed, 20 insertions, 19 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7ff3e8f6a75..cf980ac02eb 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1224,7 +1224,6 @@ void LEX::start(THD *thd_arg) set_var_list.empty(); param_list.empty(); view_list.empty(); - with_column_list.empty(); with_persistent_for_clause= FALSE; column_list= NULL; index_list= NULL; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index ad041f20275..3afcce6e3bd 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -3249,7 +3249,6 @@ public: List<Item_func_set_user_var> set_var_list; // in-query assignment list List<Item_param> param_list; List<LEX_CSTRING> view_list; // view list (list of field names in view) - List<LEX_CSTRING> with_column_list; // list of column names in with_list_element List<LEX_STRING> *column_list; // list of column names (in ANALYZE) List<LEX_STRING> *index_list; // list of index names (in ANALYZE) /* diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2bf7295c742..c115d9352aa 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1717,7 +1717,7 @@ End SQL_MODE_ORACLE_SPECIFIC */ %type <lex_str_ptr> query_name -%type <lex_str_list> opt_with_column_list +%type <lex_str_list> opt_with_column_list with_column_list %type <vers_range_unit> opt_history_unit %type <vers_history_point> history_point @@ -14692,22 +14692,16 @@ with_list: with_list_element: query_name opt_with_column_list - { - $2= new List<LEX_CSTRING> (Lex->with_column_list); - if (unlikely($2 == NULL)) - MYSQL_YYABORT; - Lex->with_column_list.empty(); - } AS '(' query_expression ')' { LEX *lex= thd->lex; const char *query_start= lex->sphead ? lex->sphead->m_tmp_query : thd->query(); - const char *spec_start= $5.pos() + 1; - With_element *elem= new With_element($1, *$2, $6); + const char *spec_start= $4.pos() + 1; + With_element *elem= new With_element($1, *$2, $5); if (elem == NULL || Lex->curr_with_clause->add_with_element(elem)) MYSQL_YYABORT; - if (elem->set_unparsed_spec(thd, spec_start, $7.pos(), + if (elem->set_unparsed_spec(thd, spec_start, $6.pos(), spec_start - query_start)) MYSQL_YYABORT; } @@ -14716,22 +14710,31 @@ with_list_element: opt_with_column_list: /* empty */ - { $$= NULL; } + { + if (($$= new (thd->mem_root) List<LEX_CSTRING>) == NULL) + MYSQL_YYABORT; + } | '(' with_column_list ')' - { $$= NULL; } + { $$= $2; } ; - with_column_list: ident { - Lex->with_column_list.push_back((LEX_CSTRING*) - thd->memdup(&$1, sizeof(LEX_CSTRING))); + + $$= new (thd->mem_root) List<LEX_CSTRING>; + if (unlikely($$ == NULL) || + unlikely($$->push_back((LEX_CSTRING*) + thd->memdup(&$1, sizeof(LEX_CSTRING)), + thd->mem_root))) + MYSQL_YYABORT; } | with_column_list ',' ident { - Lex->with_column_list.push_back((LEX_CSTRING*) - thd->memdup(&$3, sizeof(LEX_CSTRING))); + $1->push_back((LEX_CSTRING*) + thd->memdup(&$3, sizeof(LEX_CSTRING)), + thd->mem_root); + $$= $1; } ; |