diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-01-26 16:59:53 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-01-27 11:38:38 +0100 |
commit | a0ea3a5822486fa1702d6615f1be30684c3d412f (patch) | |
tree | 46726c30bd080cba0152ebd18711e90c740fb70e /sql/sql_parse.cc | |
parent | 524221e7a34d42214e82dd868348b453f2ef1591 (diff) | |
download | mariadb-git-bb-10.1-MDEV-14857.tar.gz |
MDEV-14857: problem with 10.2.11 server crashing when executing stored procedurebb-10.1-MDEV-14857
Counter for select numbering made stored with the statement (before was global)
So now it does have always accurate value which does not depend on
interruption of statement prepare by errors like lack of table in
a view definition.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 6084c59a257..8d3116cd8b3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6903,7 +6903,12 @@ void THD::reset_for_next_command(bool do_clear_error) clear_error(1); thd->free_list= 0; - thd->select_number= 1; + /* + The same thd->stmt_lex made in lex_start, but during bootstrup this + code executed first + */ + thd->stmt_lex= &main_lex; thd->stmt_lex->current_select_number= 1; + DBUG_PRINT("info", ("Lex %p stmt_lex: %p", thd->lex, thd->stmt_lex)); /* Those two lines below are theoretically unneeded as THD::cleanup_after_query() should take care of this already. @@ -7021,7 +7026,7 @@ mysql_new_select(LEX *lex, bool move_down) if (!(select_lex= new (thd->mem_root) SELECT_LEX())) DBUG_RETURN(1); - select_lex->select_number= ++thd->select_number; + select_lex->select_number= ++thd->stmt_lex->current_select_number; select_lex->parent_lex= lex; /* Used in init_query. */ select_lex->init_query(); select_lex->init_select(); |