Fix for bug#19667 group by a decimal expression yields wrong result
This commit is contained in:
parent
94c9e172d8
commit
00fcdf8c00
@ -1397,3 +1397,14 @@ c1
|
|||||||
9999999999999999999999999999999999999999999999999999999999999999
|
9999999999999999999999999999999999999999999999999999999999999999
|
||||||
9999999999999999999999999999999999999999999999999999999999999999
|
9999999999999999999999999999999999999999999999999999999999999999
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (i int, j int);
|
||||||
|
insert into t1 values (1,1), (1,2), (2,3), (2,4);
|
||||||
|
select i, count(distinct j) from t1 group by i;
|
||||||
|
i count(distinct j)
|
||||||
|
1 2
|
||||||
|
2 2
|
||||||
|
select i+0.0 as i2, count(distinct j) from t1 group by i2;
|
||||||
|
i2 count(distinct j)
|
||||||
|
1.0 2
|
||||||
|
2.0 2
|
||||||
|
drop table t1;
|
||||||
|
@ -1095,3 +1095,12 @@ insert into t1 values(
|
|||||||
insert into t1 values(1e100);
|
insert into t1 values(1e100);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#19667 group by a decimal expression yields wrong result
|
||||||
|
#
|
||||||
|
create table t1 (i int, j int);
|
||||||
|
insert into t1 values (1,1), (1,2), (2,3), (2,4);
|
||||||
|
select i, count(distinct j) from t1 group by i;
|
||||||
|
select i+0.0 as i2, count(distinct j) from t1 group by i2;
|
||||||
|
drop table t1;
|
||||||
|
@ -132,7 +132,7 @@ bool Cached_item_decimal::cmp()
|
|||||||
{
|
{
|
||||||
my_decimal tmp;
|
my_decimal tmp;
|
||||||
my_decimal *ptmp= item->val_decimal(&tmp);
|
my_decimal *ptmp= item->val_decimal(&tmp);
|
||||||
if (null_value != item->null_value || my_decimal_cmp(&value, ptmp) == 0)
|
if (null_value != item->null_value || my_decimal_cmp(&value, ptmp))
|
||||||
{
|
{
|
||||||
null_value= item->null_value;
|
null_value= item->null_value;
|
||||||
my_decimal2decimal(ptmp, &value);
|
my_decimal2decimal(ptmp, &value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user