summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index c33088e0276..a61c5d59d67 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -578,7 +578,14 @@ int Item_sum::set_aggregator(Aggregator::Aggregator_type aggregator)
{
if (aggr)
{
+ /*
+ Dependent subselects may be executed multiple times, making
+ set_aggregator to be called multiple times. The aggregator type
+ will be the same, but it needs to be reset so that it is
+ reevaluated with the new dependent data.
+ */
DBUG_ASSERT(aggregator == aggr->Aggrtype());
+ aggr->clear();
return FALSE;
}
switch (aggregator)