summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-11-03 19:17:05 +0100
committerSergei Golubchik <sergii@pisem.net>2011-11-03 19:17:05 +0100
commit0e007344eae972b9be7d88ca43373cb33662ac1c (patch)
tree7b3561cb3ea2ad24d013e847680ec165f406387e /sql/sql_partition.cc
parent3794110f0215f0631107c2694dc0f1675a4bb520 (diff)
parent681476255147dacac7e3674b6cd2ae770fee2208 (diff)
downloadmariadb-git-0e007344eae972b9be7d88ca43373cb33662ac1c.tar.gz
mysql-5.5.18 merge
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc29
1 files changed, 15 insertions, 14 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index c75b20e577e..646d829a51e 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1003,8 +1003,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))
@@ -1029,20 +1027,23 @@ 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;
-
- if (!(error= func_expr->fix_fields(thd, (Item**)&func_expr)))
- func_expr->walk(&Item::vcol_in_partition_func_processor, 0, NULL);
+ {
+ 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;
+ if (!(error= func_expr->fix_fields(thd, (Item**)&func_expr)))
+ func_expr->walk(&Item::vcol_in_partition_func_processor, 0, NULL);
+ /*
+ 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"));