diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index f5a23313a10..c8f182ef0d3 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -1831,3 +1831,13 @@ rank() over (order by b) 0 0 drop table t1; +# +# MDEV-9894: Assertion `0' failed in Window_func_runner::setup +# return ER_NOT_SUPPORTED_YET for aggregates that are not yet supported +# as window functions. +# +create table t1 (i int); +insert into t1 values (1),(2); +SELECT MAX(i) OVER (PARTITION BY (i)) FROM t1; +ERROR 42000: This version of MariaDB doesn't yet support 'This aggregate as window function' +drop table t1; diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index fe494b65204..7dc636a13ed 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1113,3 +1113,14 @@ from drop table t1; +--echo # +--echo # MDEV-9894: Assertion `0' failed in Window_func_runner::setup +--echo # return ER_NOT_SUPPORTED_YET for aggregates that are not yet supported +--echo # as window functions. +--echo # +create table t1 (i int); +insert into t1 values (1),(2); +--error ER_NOT_SUPPORTED_YET +SELECT MAX(i) OVER (PARTITION BY (i)) FROM t1; +drop table t1; + diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 56f33937274..3753e2499c3 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -1766,7 +1766,8 @@ bool Window_func_runner::setup(THD *thd) break; } default: - DBUG_ASSERT(0); + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "This aggregate as window function"); + return true; } return false;