a fix (Bug #3435: STDDEV|VARIANCE(constant) returns constant if no rows)
This commit is contained in:
parent
575541b9f7
commit
393ed84c9a
@ -648,3 +648,11 @@ select a from t1 having a=1;
|
|||||||
a
|
a
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a int);
|
||||||
|
select variance(2) from t1;
|
||||||
|
variance(2)
|
||||||
|
NULL
|
||||||
|
select stddev(2) from t1;
|
||||||
|
stddev(2)
|
||||||
|
NULL
|
||||||
|
drop table t1;
|
||||||
|
@ -387,3 +387,12 @@ insert into t1 values (1);
|
|||||||
select max(a) as b from t1 having b=1;
|
select max(a) as b from t1 having b=1;
|
||||||
select a from t1 having a=1;
|
select a from t1 having a=1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #3435: variance(const), stddev(const) and an empty table
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (a int);
|
||||||
|
select variance(2) from t1;
|
||||||
|
select stddev(2) from t1;
|
||||||
|
drop table t1;
|
||||||
|
@ -351,6 +351,7 @@ class Item_sum_variance : public Item_sum_num
|
|||||||
void update_field();
|
void update_field();
|
||||||
Item *result_item(Field *field)
|
Item *result_item(Field *field)
|
||||||
{ return new Item_variance_field(this); }
|
{ return new Item_variance_field(this); }
|
||||||
|
void no_rows_in_result() {}
|
||||||
const char *func_name() const { return "variance"; }
|
const char *func_name() const { return "variance"; }
|
||||||
Item *copy_or_same(THD* thd);
|
Item *copy_or_same(THD* thd);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user