summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2013-10-04 09:51:07 -0700
committerIgor Babaev <igor@askmonty.org>2013-10-04 09:51:07 -0700
commitec226e553aa56718ed9939e333fe36b3499ac9be (patch)
treea28d2707dd67c7bf3ed8ccb6434777ea3794223e /sql/item.cc
parent00816a964f42f65877c9f8982443b2522d09687d (diff)
downloadmariadb-git-ec226e553aa56718ed9939e333fe36b3499ac9be.tar.gz
Fixed bug mdev-5078.
For aggregated fields from views/derived tables the possible adjustment of thd->lex->in_sum_func->max_arg_level in the function Item_field::fix_fields must be done before we leave the function.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 9738a068d88..803c9fee576 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4746,6 +4746,11 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
goto mark_non_agg_field;
}
+ if (thd->lex->in_sum_func &&
+ thd->lex->in_sum_func->nest_level ==
+ thd->lex->current_select->nest_level)
+ set_if_bigger(thd->lex->in_sum_func->max_arg_level,
+ thd->lex->current_select->nest_level);
/*
if it is not expression from merged VIEW we will set this field.
@@ -4762,11 +4767,6 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
return FALSE;
set_field(from_field);
- if (thd->lex->in_sum_func &&
- thd->lex->in_sum_func->nest_level ==
- thd->lex->current_select->nest_level)
- set_if_bigger(thd->lex->in_sum_func->max_arg_level,
- thd->lex->current_select->nest_level);
}
else if (thd->mark_used_columns != MARK_COLUMNS_NONE)
{