summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-11-02 13:13:45 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2022-11-02 13:13:45 +0100
commit0946c99e7d6f7ac9dfcf3e60dae6ae85161d5ef2 (patch)
tree84ecd81520fe74409585317fa2c6fbf8f66da3d6 /sql
parent1a3859fff09986a8ffc7b1b466ef565ce2b0bf42 (diff)
parent3303748fd13399ba39ce4d646153d086c5a09445 (diff)
downloadmariadb-git-0946c99e7d6f7ac9dfcf3e60dae6ae85161d5ef2.tar.gz
Merge branch '10.3' into 10.4mariadb-10.4.27
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 5ec88e5259c..c3c4e52f6e4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1204,6 +1204,15 @@ JOIN::prepare(TABLE_LIST *tables_init,
// simple check that we got usable conds
dbug_print_item(conds);
+ /*
+ It is hack which force creating EXPLAIN object always on runt-time arena
+ (because very top JOIN::prepare executes always with runtime arena, but
+ constant subquery like (SELECT 'x') can be called with statement arena
+ during prepare phase of top SELECT).
+ */
+ if (!(thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_PREPARE))
+ create_explain_query_if_not_exists(thd->lex, thd->mem_root);
+
if (select_lex->handle_derived(thd->lex, DT_PREPARE))
DBUG_RETURN(-1);
@@ -1654,7 +1663,6 @@ bool JOIN::build_explain()
int JOIN::optimize()
{
int res= 0;
- create_explain_query_if_not_exists(thd->lex, thd->mem_root);
join_optimization_state init_state= optimization_state;
if (select_lex->pushdown_select)
{