summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-04-21 15:33:50 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-04-21 15:33:50 +0300
commit620c55e708b9ea94ef8ba309267a6f2f32ed8104 (patch)
tree434f8bbb36626d16e8438b82da1618bd8313f6a2 /sql/sql_select.cc
parentfdec842fd7f82b6ed9aec54f82ac50b5eea925b3 (diff)
parentaec856073df12e95b68667587bfd8e469b60e7d4 (diff)
downloadmariadb-git-620c55e708b9ea94ef8ba309267a6f2f32ed8104.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c7243e44e83..192c3285ba6 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3837,12 +3837,9 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
tab->join= this;
DBUG_ASSERT(tab > tab->join->join_tab || !top_join_tab_count ||
!tables_list);
+ tab->table= table;
if (tab > join_tab)
(tab - 1)->next_select= sub_select_postjoin_aggr;
- if (!(tab->aggr= new (thd->mem_root) AGGR_OP(tab)))
- goto err;
- tab->table= table;
- table->reginfo.join_tab= tab;
/* if group or order on first table, sort first */
if ((group_list && simple_group) ||
@@ -3891,12 +3888,15 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
order= NULL;
}
}
-
+ if (!(tab->aggr= new (thd->mem_root) AGGR_OP(tab)))
+ goto err;
+ table->reginfo.join_tab= tab;
DBUG_RETURN(false);
err:
if (table != NULL)
free_tmp_table(thd, table);
+ tab->table= NULL;
DBUG_RETURN(true);
}
@@ -14065,6 +14065,7 @@ void JOIN::cleanup(bool full)
if (curr_tab->aggr)
{
free_tmp_table(thd, curr_tab->table);
+ curr_tab->table= NULL;
delete curr_tab->tmp_table_param;
curr_tab->tmp_table_param= NULL;
curr_tab->aggr= NULL;