summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2018-01-26 16:59:53 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2018-01-27 11:38:38 +0100
commita0ea3a5822486fa1702d6615f1be30684c3d412f (patch)
tree46726c30bd080cba0152ebd18711e90c740fb70e /sql/sql_select.cc
parent524221e7a34d42214e82dd868348b453f2ef1591 (diff)
downloadmariadb-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_select.cc')
-rw-r--r--sql/sql_select.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b9fe8f3162a..7a6a028ee9c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2462,6 +2462,17 @@ void JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
bool need_tmp_table, bool need_order,
bool distinct)
{
+ /*
+ If there is SELECT in this statemet with the same number it must be the
+ same SELECT
+ */
+ DBUG_ASSERT(select_lex->select_number == UINT_MAX ||
+ select_lex->select_number == INT_MAX ||
+ !output ||
+ !output->get_select(select_lex->select_number) ||
+ output->get_select(select_lex->select_number)->select_lex ==
+ select_lex);
+
if (select_lex->select_number != UINT_MAX &&
select_lex->select_number != INT_MAX /* this is not a UNION's "fake select */ &&
have_query_plan != JOIN::QEP_NOT_PRESENT_YET &&
@@ -24601,6 +24612,11 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
{
explain= new (output->mem_root) Explain_select(output->mem_root,
thd->lex->analyze_stmt);
+ if (!explain)
+ DBUG_RETURN(1); // EoM
+#ifndef DBUG_OFF
+ explain->select_lex= select_lex;
+#endif
join->select_lex->set_explain_type(true);
explain->select_id= join->select_lex->select_number;