From 403b38ee5091e74df8adb6ee0c644903a82ffcad Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 May 2001 18:00:52 -0600 Subject: [PATCH] fixed bug in count(distinct) sql/item_sum.cc: do not insert into deleted tree in count(distinct) --- sql/item_sum.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 6560fdedfd2..879c27178e5 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -986,9 +986,12 @@ bool Item_sum_count_distinct::add() { // if the tree got too big, convert to MyISAM, otherwise // insert into the tree - if((tree.elements_in_tree > max_elements_in_tree && tree_to_myisam()) - || - !tree_insert(&tree, table->record[0] + rec_offset, 0)) + if(tree.elements_in_tree > max_elements_in_tree) + { + if(tree_to_myisam()) + return 1; + } + else if(!tree_insert(&tree, table->record[0] + rec_offset, 0)) return 1; } else if ((error=table->file->write_row(table->record[0])))