diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-03-21 12:13:37 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-03-21 19:47:42 +0100 |
commit | f3994b74327eef37fa6010368f7f8db044cf70f8 (patch) | |
tree | 119fadc19e3476a13cc9df65ede9fd0f446861ba /sql/sql_prepare.cc | |
parent | 2dd4e50d5f74451a5f6bf56d1a36bafffcca878c (diff) | |
download | mariadb-git-f3994b74327eef37fa6010368f7f8db044cf70f8.tar.gz |
MDEV-15492: Subquery crash similar to MDEV-10050
Detection of first execution of PS fixed.
More debug info.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index a3bf9d6c93c..6aa6aacc504 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -3819,6 +3819,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor) Statement stmt_backup; Query_arena *old_stmt_arena; bool error= TRUE; + bool qc_executed= FALSE; char saved_cur_db_name_buf[SAFE_NAME_LEN+1]; LEX_STRING saved_cur_db_name= @@ -3937,6 +3938,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor) thd->lex->sql_command= SQLCOM_SELECT; status_var_increment(thd->status_var.com_stat[SQLCOM_SELECT]); thd->update_stats(); + qc_executed= TRUE; } } @@ -3960,7 +3962,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor) thd->set_statement(&stmt_backup); thd->stmt_arena= old_stmt_arena; - if (state == Query_arena::STMT_PREPARED) + if (state == Query_arena::STMT_PREPARED && !qc_executed) state= Query_arena::STMT_EXECUTED; if (error == 0 && this->lex->sql_command == SQLCOM_CALL) |