From 3cecaef4a337eab8860c52be393d8c2076ce5d90 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Mon, 21 Jan 2013 11:47:45 -0800 Subject: Fixed bug mdev-4063 (bug #56927). This bug could result in returning 0 for the expressions of the form (distinct field) when the system variable max_heap_table_size was set to a small enough number. It happened because the method Unique::walk() did not support the case when more than one pass was needed to merge the trees of distinct values saved in an external file. Backported a fix in grant_lowercase.test from mariadb 5.5. --- sql/item_sum.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/item_sum.cc') diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 92c2ba83f23..debba23438d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1084,7 +1084,7 @@ void Item_sum_distinct::calculate_val_and_count() if (tree) { table->field[0]->set_notnull(); - tree->walk(item_sum_distinct_walk, (void*) this); + tree->walk(table, item_sum_distinct_walk, (void*) this); } is_evaluated= TRUE; } @@ -2583,7 +2583,7 @@ longlong Item_sum_count_distinct::val_int() if (tree->elements == 0) return (longlong) tree->elements_in_tree(); // everything fits in memory count= 0; - tree->walk(count_distinct_walk, (void*) &count); + tree->walk(table, count_distinct_walk, (void*) &count); is_evaluated= TRUE; return (longlong) count; } -- cgit v1.2.1