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.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 51754fbd9ee..2479f8ea92a 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1049,9 +1049,10 @@ bool Item_sum_distinct::unique_walk_function(void *element)
void Item_sum_distinct::clear()
{
DBUG_ENTER("Item_sum_distinct::clear");
- DBUG_ASSERT(tree != 0); /* we always have a tree */
+ /* During EXPLAIN there is no tree because it is created during execution. */
+ if (tree != 0)
+ tree->reset();
null_value= 1;
- tree->reset();
is_evaluated= FALSE;
DBUG_VOID_RETURN;
}