summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-05-04 17:12:45 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2011-05-04 17:12:45 +0200
commit9baf84e99a6d7edd36c777593a90671d02aacbc9 (patch)
tree4b2a82480afbf07a0e4ba4447dbf4f3a51761bbe /sql/sql_partition.cc
parentc00c350f147173bf20c35c8787cdf0d840653e96 (diff)
parenta32df762d43c29545718e8a78a1721a9a7a1a35f (diff)
downloadmariadb-git-9baf84e99a6d7edd36c777593a90671d02aacbc9.tar.gz
merge 5.0 => 5.1 : Bug#12329653
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index d10f695f535..30bfa9eb35f 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -930,9 +930,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
const char *save_where;
char* db_name;
char db_name_string[FN_REFLEN];
- bool save_use_only_table_context;
- uint8 saved_full_group_by_flag;
- nesting_map saved_allow_sum_func;
DBUG_ENTER("fix_fields_part_func");
if (part_info->fixed)
@@ -999,23 +996,26 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
of interesting side effects, both desirable and undesirable.
*/
- save_use_only_table_context= thd->lex->use_only_table_context;
- thd->lex->use_only_table_context= TRUE;
- thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
- saved_full_group_by_flag= thd->lex->current_select->full_group_by_flag;
- saved_allow_sum_func= thd->lex->allow_sum_func;
- thd->lex->allow_sum_func= 0;
+ {
+ const bool save_use_only_table_context= thd->lex->use_only_table_context;
+ thd->lex->use_only_table_context= TRUE;
+ thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
+ const bool save_agg_field= thd->lex->current_select->non_agg_field_used();
+ const bool save_agg_func= thd->lex->current_select->agg_func_used();
+ const nesting_map saved_allow_sum_func= thd->lex->allow_sum_func;
+ thd->lex->allow_sum_func= 0;
- error= func_expr->fix_fields(thd, (Item**)&func_expr);
-
- /*
- Restore full_group_by_flag and allow_sum_func,
- fix_fields should not affect mysql_select later, see Bug#46923.
- */
- thd->lex->current_select->full_group_by_flag= saved_full_group_by_flag;
- thd->lex->allow_sum_func= saved_allow_sum_func;
+ error= func_expr->fix_fields(thd, (Item**)&func_expr);
- thd->lex->use_only_table_context= save_use_only_table_context;
+ /*
+ Restore agg_field/agg_func and allow_sum_func,
+ fix_fields should not affect mysql_select later, see Bug#46923.
+ */
+ thd->lex->current_select->set_non_agg_field_used(save_agg_field);
+ thd->lex->current_select->set_agg_func_used(save_agg_func);
+ thd->lex->allow_sum_func= saved_allow_sum_func;
+ thd->lex->use_only_table_context= save_use_only_table_context;
+ }
context->table_list= save_table_list;
context->first_name_resolution_table= save_first_table;