diff options
Diffstat (limited to 'mysql-test/t/win.test')
-rw-r--r-- | mysql-test/t/win.test | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index dfcf00cabf9..614c3638f64 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1879,6 +1879,43 @@ select max(id), rank() over (order by max(id)) from t1 where id < 3; drop table t1; --echo # +--echo # main.win failure post MDEV-12336 +--echo # +create table t(a decimal(35,10), b int); +insert into t values (1, 10), (2, 20), (3, 30); + +prepare stmt from "SELECT (CASE WHEN sum(t.a) over (partition by t.b)=1 THEN 1000 ELSE 300 END) AS a FROM t"; +execute stmt; +drop table t; + +--echo # +--echo # MDEV-12851 case with window functions query crashes server +--echo # + +create table t1(dt datetime); +insert into t1 values ('2017-05-17'), ('2017-05-18'); +select dt, + case when (max(dt) over (order by dt rows between 1 following and 1 following) is null) + then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) + end x, + case when (max(dt) over (order by dt rows between 1 following and 1 following) is not null) + then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) + end x +from t1; + +drop table t1; + +create table t1(i int); +insert into t1 values (null),(1),(2); +select max(i) over (order by i), + max(i) over (order by i) is null, + max(i) over (order by i) is not null +from t1; +drop table t1; + +--echo # --echo # Start of 10.3 tests --echo # |