mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed BUG#1874: Don't call fix_fields() indiscriminately, it resets null_value
for some items, which made aggregates like MIN(), MAX() and SUM() fail.
This commit is contained in:
@ -15,9 +15,9 @@ create table t1 (
|
||||
data int not null
|
||||
);
|
||||
create table t2 (
|
||||
s char(16) not null,
|
||||
i int not null,
|
||||
d double not null
|
||||
s char(16),
|
||||
i int,
|
||||
d double
|
||||
);
|
||||
|
||||
|
||||
@ -921,6 +921,31 @@ drop table t3|
|
||||
drop procedure bug1862|
|
||||
|
||||
|
||||
#
|
||||
# BUG#1874
|
||||
#
|
||||
create procedure bug1874()
|
||||
begin
|
||||
declare x int;
|
||||
declare y double;
|
||||
select max(data) into x from t1;
|
||||
insert into t2 values ("max", x, 0);
|
||||
select min(data) into x from t1;
|
||||
insert into t2 values ("min", x, 0);
|
||||
select sum(data) into x from t1;
|
||||
insert into t2 values ("sum", x, 0);
|
||||
select avg(data) into y from t1;
|
||||
insert into t2 values ("avg", 0, y);
|
||||
end|
|
||||
|
||||
insert into t1 (data) values (3), (1), (5), (9), (4)|
|
||||
call bug1874()|
|
||||
select * from t2|
|
||||
delete from t1|
|
||||
delete from t2|
|
||||
drop procedure bug1874|
|
||||
|
||||
|
||||
#
|
||||
# Some "real" examples
|
||||
#
|
||||
|
Reference in New Issue
Block a user