Loading sql/item_sum.cc +3 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,9 @@ Item_sum::Item_sum(THD *thd, Item_sum *item): void Item_sum::mark_as_sum_func() { current_thd->lex->current_select->with_sum_func= 1; SELECT_LEX *cur_select= current_thd->lex->current_select; cur_select->n_sum_items++; cur_select->with_sum_func= 1; with_sum_func= 1; } Loading sql/sql_lex.cc +4 −4 Original line number Diff line number Diff line Loading @@ -1521,8 +1521,8 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) */ Query_arena *arena= thd->stmt_arena; return (ref_pointer_array= (Item **)arena->alloc(sizeof(Item*) * (item_list.elements + (Item **)arena->alloc(sizeof(Item*) * (n_child_sum_items + item_list.elements + select_n_having_items + order_group_num)*5)) == 0; } Loading sql/sql_lex.h +7 −1 Original line number Diff line number Diff line Loading @@ -548,6 +548,12 @@ class st_select_lex: public st_select_lex_node bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ /* TRUE when having fix field called in processing of this SELECT */ bool having_fix_field; /* Number of Item_sum-derived objects in this SELECT */ uint n_sum_items; /* Number of Item_sum-derived objects in children and descendant SELECTs */ uint n_child_sum_items; /* explicit LIMIT clause was used */ bool explicit_limit; /* Loading Loading @@ -640,7 +646,7 @@ class st_select_lex: public st_select_lex_node bool test_limit(); friend void lex_start(THD *thd, uchar *buf, uint length); st_select_lex() {} st_select_lex() : n_sum_items(0), n_child_sum_items(0) {} void make_empty_select() { init_query(); Loading sql/sql_yacc.yy +2 −0 Original line number Diff line number Diff line Loading @@ -8927,8 +8927,10 @@ subselect_end: { LEX *lex=Lex; lex->pop_context(); SELECT_LEX *child= lex->current_select; lex->current_select = lex->current_select->return_after_parsing(); lex->nest_level--; lex->current_select->n_child_sum_items += child->n_sum_items; }; /************************************************************************** Loading Loading
sql/item_sum.cc +3 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,9 @@ Item_sum::Item_sum(THD *thd, Item_sum *item): void Item_sum::mark_as_sum_func() { current_thd->lex->current_select->with_sum_func= 1; SELECT_LEX *cur_select= current_thd->lex->current_select; cur_select->n_sum_items++; cur_select->with_sum_func= 1; with_sum_func= 1; } Loading
sql/sql_lex.cc +4 −4 Original line number Diff line number Diff line Loading @@ -1521,8 +1521,8 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) */ Query_arena *arena= thd->stmt_arena; return (ref_pointer_array= (Item **)arena->alloc(sizeof(Item*) * (item_list.elements + (Item **)arena->alloc(sizeof(Item*) * (n_child_sum_items + item_list.elements + select_n_having_items + order_group_num)*5)) == 0; } Loading
sql/sql_lex.h +7 −1 Original line number Diff line number Diff line Loading @@ -548,6 +548,12 @@ class st_select_lex: public st_select_lex_node bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ /* TRUE when having fix field called in processing of this SELECT */ bool having_fix_field; /* Number of Item_sum-derived objects in this SELECT */ uint n_sum_items; /* Number of Item_sum-derived objects in children and descendant SELECTs */ uint n_child_sum_items; /* explicit LIMIT clause was used */ bool explicit_limit; /* Loading Loading @@ -640,7 +646,7 @@ class st_select_lex: public st_select_lex_node bool test_limit(); friend void lex_start(THD *thd, uchar *buf, uint length); st_select_lex() {} st_select_lex() : n_sum_items(0), n_child_sum_items(0) {} void make_empty_select() { init_query(); Loading
sql/sql_yacc.yy +2 −0 Original line number Diff line number Diff line Loading @@ -8927,8 +8927,10 @@ subselect_end: { LEX *lex=Lex; lex->pop_context(); SELECT_LEX *child= lex->current_select; lex->current_select = lex->current_select->return_after_parsing(); lex->nest_level--; lex->current_select->n_child_sum_items += child->n_sum_items; }; /************************************************************************** Loading