Skip to content
Permalink
Browse files
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.
  • Loading branch information
cvicentiu committed Jul 5, 2017
1 parent e3d3147 commit 4f93c73
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
@@ -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;
}

0 comments on commit 4f93c73

Please sign in to comment.