summaryrefslogtreecommitdiff
path: root/mysql-test/t/win.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-03-28 14:48:54 -0700
committerIgor Babaev <igor@askmonty.org>2017-03-29 08:46:00 -0700
commitf381e73f7da7ae97536cb334b95c1e99dbb7a06f (patch)
treef1391961c8d5498342996c30ac5e23fb09237246 /mysql-test/t/win.test
parentd9bab412e99adce6f9f81c141a42a2d66c77189e (diff)
downloadmariadb-git-f381e73f7da7ae97536cb334b95c1e99dbb7a06f.tar.gz
Fixed bug mdev-11907.
With the current design the function copy_funcs() should ignore the items with window functions from the array **func_ptr.
Diffstat (limited to 'mysql-test/t/win.test')
-rw-r--r--mysql-test/t/win.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index ec083733f77..3cd17ae179d 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -1809,3 +1809,24 @@ select i, row_number() over () from t1 group by 1+2;
select i, rank() over (order by i) rnk from t1 group by 1+2;
drop table t1;
+
+--echo #
+--echo # MDEV-11907: window function as the second operand of division
+--echo #
+
+create table t1 (pk int, c int);
+insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2);
+
+set @sql_mode_save= @@sql_mode;
+set sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
+
+select pk, c, c/count(*) over
+ (partition by c order by pk
+ rows between 1 preceding and 2 following) as CNT
+from t1;
+show warnings;
+
+set sql_mode=@sql_mode_save;
+
+drop table t1;
+