summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-12-08 14:28:06 +0200
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-12-08 14:28:06 +0200
commit352ce1b596758403ab9d439b06267fec4d191a58 (patch)
tree843cd564016bb7ea84119c7bbc818afe1b4cd412 /sql/opt_sum.cc
parent9588e1ba53fa91463c4ad5695c46f821aa2ade7b (diff)
downloadmariadb-git-352ce1b596758403ab9d439b06267fec4d191a58.tar.gz
Bug #57954: BIT_AND function returns incorrect results
when semijoin=on When setting the aggregate function as having no rows to report the function no_rows_in_result() was calling Item_sum::reset(). However this function in addition to cleaning up the aggregate value by calling aggregator_clear() was also adding the current value to the aggregate value by calling aggregator_add(). Fixed by making no_rows_in_result() to call aggregator_clear() directly. Renamed Item_sum::reset to Item_sum::reset_and_add() to and added a comment to avoid misinterpretation of what the function does.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index e020c94a3bd..a2f8b9c4447 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -424,7 +424,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
item_sum->aggregator_clear();
}
else
- item_sum->reset();
+ item_sum->reset_and_add();
item_sum->make_const();
recalc_const_item= 1;
break;