Loading mysql-test/r/func_group.result +5 −0 Original line number Diff line number Diff line Loading @@ -256,3 +256,8 @@ bit_and(col) bit_or(col) 18446744073709551614 18446744073709551614 18446744073709551615 18446744073709551615 drop table t1; create table t1 (a int); select avg(2) from t1; avg(2) NULL drop table t1; mysql-test/t/func_group.test +8 −0 Original line number Diff line number Diff line Loading @@ -155,3 +155,11 @@ insert into t1 values (-1), (-2), (-3); select bit_and(col), bit_or(col) from t1; select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col; drop table t1; # # Bug #3376: avg() and an empty table # create table t1 (a int); select avg(2) from t1; drop table t1; sql/item_sum.h +1 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,7 @@ class Item_sum_avg :public Item_sum_num void update_field(); Item *result_item(Field *field) { return new Item_avg_field(this); } void no_rows_in_result() {} const char *func_name() const { return "avg"; } unsigned int size_of() { return sizeof(*this);} }; Loading Loading
mysql-test/r/func_group.result +5 −0 Original line number Diff line number Diff line Loading @@ -256,3 +256,8 @@ bit_and(col) bit_or(col) 18446744073709551614 18446744073709551614 18446744073709551615 18446744073709551615 drop table t1; create table t1 (a int); select avg(2) from t1; avg(2) NULL drop table t1;
mysql-test/t/func_group.test +8 −0 Original line number Diff line number Diff line Loading @@ -155,3 +155,11 @@ insert into t1 values (-1), (-2), (-3); select bit_and(col), bit_or(col) from t1; select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col; drop table t1; # # Bug #3376: avg() and an empty table # create table t1 (a int); select avg(2) from t1; drop table t1;
sql/item_sum.h +1 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,7 @@ class Item_sum_avg :public Item_sum_num void update_field(); Item *result_item(Field *field) { return new Item_avg_field(this); } void no_rows_in_result() {} const char *func_name() const { return "avg"; } unsigned int size_of() { return sizeof(*this);} }; Loading