diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-09-29 15:04:20 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-09-29 15:04:20 +0300 |
commit | 742b37a345343c26451b35e97bfb3eb23410a075 (patch) | |
tree | a24a16890184cc48fc78bb0b99627378b5f9efef /sql/item_sum.cc | |
parent | 4e9366df7b097ae38db8ead75a4f4e5d58ad8dca (diff) | |
parent | b2a5e0f28232b56c5c36e65a457d41d819b279bf (diff) | |
download | mariadb-git-742b37a345343c26451b35e97bfb3eb23410a075.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 034c4d2a515..56f744a00fb 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -72,6 +72,7 @@ size_t Item_sum::ram_limitation(THD *thd) bool Item_sum::init_sum_func_check(THD *thd) { SELECT_LEX *curr_sel= thd->lex->current_select; + LEX *lex_s= (curr_sel ? curr_sel->parent_lex : thd->lex); if (curr_sel && curr_sel->name_visibility_map.is_clear_all()) { for (SELECT_LEX *sl= curr_sel; sl; sl= sl->context.outer_select()) @@ -87,9 +88,9 @@ bool Item_sum::init_sum_func_check(THD *thd) return TRUE; } /* Set a reference to the nesting set function if there is any */ - in_sum_func= thd->lex->in_sum_func; + in_sum_func= lex_s->in_sum_func; /* Save a pointer to object to be used in items for nested set functions */ - thd->lex->in_sum_func= this; + lex_s->in_sum_func= this; nest_level= thd->lex->current_select->nest_level; ref_by= 0; aggr_level= -1; @@ -156,6 +157,7 @@ bool Item_sum::init_sum_func_check(THD *thd) bool Item_sum::check_sum_func(THD *thd, Item **ref) { SELECT_LEX *curr_sel= thd->lex->current_select; + LEX *lex_s= curr_sel->parent_lex; nesting_map allow_sum_func(thd->lex->allow_sum_func); allow_sum_func.intersect(curr_sel->name_visibility_map); bool invalid= FALSE; @@ -318,7 +320,7 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref) if (sum_func() == SP_AGGREGATE_FUNC) aggr_sel->set_custom_agg_func_used(true); update_used_tables(); - thd->lex->in_sum_func= in_sum_func; + lex_s->in_sum_func= in_sum_func; return FALSE; } |