diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2011-05-05 08:13:22 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2011-05-05 08:13:22 +0200 |
commit | 6848f6c0d6e8c4bb5aa1ad2d39cd536860bd7e0b (patch) | |
tree | cd172df35bbbc323a22f426774bc859ed6080cb5 /sql/sql_partition.cc | |
parent | 2da8ba6404bbba119d5d90575411978ace0f6ee6 (diff) | |
parent | e257fb3319ea6919de0a3c74c7025d4f9a218fed (diff) | |
download | mariadb-git-6848f6c0d6e8c4bb5aa1ad2d39cd536860bd7e0b.tar.gz |
merge 5.1 => 5.5 : Bug#12329653
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 5c2c0bb95d6..b9bbec63e7d 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1077,8 +1077,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, int error; LEX *old_lex= thd->lex; LEX lex; - uint8 saved_full_group_by_flag; - nesting_map saved_allow_sum_func; DBUG_ENTER("fix_fields_part_func"); if (init_lex_with_single_table(thd, table, &lex)) @@ -1103,19 +1101,22 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, This is a tricky call to prepare for since it can have a large number of interesting side effects, both desirable and undesirable. */ - 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; - - error= func_expr->fix_fields(thd, (Item**)&func_expr); + { + 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; - /* - 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); + /* + 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; + } if (unlikely(error)) { DBUG_PRINT("info", ("Field in partition function not part of table")); |