Commit 4f93c732 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

MDEV-13189: Window functions crash when using INTERVAL

Interval function makes use of Item_row. Item_row did not correctly mark
with_window_func flag according to its arguments. Fix it by making
Item_row aware of this flag.
parent e3d31477
......@@ -3127,3 +3127,17 @@ NULL 1 0
1 0 1
2 0 1
drop table t1;
#
# MDEV-13189: Window functions crash when using INTERVAL function
#
create table t1(i int);
insert into t1 values (1),(2),(10),(20),(30);
select sum(i) over (order by i), interval(sum(i) over (order by i), 10, 20)
from t1;
sum(i) over (order by i) interval(sum(i) over (order by i), 10, 20)
1 0
3 0
13 1
33 2
63 2
drop table t1;
......@@ -1914,3 +1914,12 @@ select max(i) over (order by i),
max(i) over (order by i) is not null
from t1;
drop table t1;
--echo #
--echo # MDEV-13189: Window functions crash when using INTERVAL function
--echo #
create table t1(i int);
insert into t1 values (1),(2),(10),(20),(30);
select sum(i) over (order by i), interval(sum(i) over (order by i), 10, 20)
from t1;
drop table t1;
......@@ -63,6 +63,7 @@ bool Item_row::fix_fields(THD *thd, Item **ref)
}
maybe_null|= item->maybe_null;
with_sum_func= with_sum_func || item->with_sum_func;
with_window_func = with_window_func || item->with_window_func;
with_field= with_field || item->with_field;
with_subselect|= item->with_subselect;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment