summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-11-02 13:14:54 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2022-11-02 13:14:54 +0100
commit177d858e38d7fa7e90a7088fcc2f5576eba411a0 (patch)
tree8249761d9853f48cfeb81c77acacce5cb30ac87f /sql/sql_select.cc
parentb4a58581fdae689ec3facbe9c273a4789a869542 (diff)
parent0946c99e7d6f7ac9dfcf3e60dae6ae85161d5ef2 (diff)
downloadmariadb-git-177d858e38d7fa7e90a7088fcc2f5576eba411a0.tar.gz
Merge branch '10.4' into 10.5mariadb-10.5.18
Diffstat (limited to 'sql/sql_select.cc')
-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 3d880365d42..332c8a786c5 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1211,6 +1211,15 @@ JOIN::prepare(TABLE_LIST *tables_init, COND *conds_init, uint og_num,
// 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);
@@ -1661,7 +1670,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)
{