summaryrefslogtreecommitdiff
path: root/mysql-test/t/win.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-02-15 22:41:45 -0800
committerIgor Babaev <igor@askmonty.org>2017-02-15 22:41:45 -0800
commit37925c6ccc61bd4d5af4956dbd877c69983c09f3 (patch)
treed565559a0e1b610bd0444c792a73971cd6b87ad5 /mysql-test/t/win.test
parente688d8144411e38253b7ec4e13f67a989da8bb76 (diff)
downloadmariadb-git-37925c6ccc61bd4d5af4956dbd877c69983c09f3.tar.gz
Fixed bug mdev-9924.
Supported queries with window functions when GROUP BY could be optimized away.
Diffstat (limited to 'mysql-test/t/win.test')
-rw-r--r--mysql-test/t/win.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index 0661daba7ef..ec083733f77 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -1793,3 +1793,19 @@ select count(distinct s) from (select sum(d) over(partition by a) as s from t) Z
select count(distinct s) from (select sum(d) as s from t group by a) Z where s > 0;
drop table t;
+
+--echo #
+--echo # MDEV-9924: window function in query with group by optimized away
+--echo #
+
+create table t1 (i int);
+insert into t1 values (2),(3),(1);
+
+select row_number() over () from t1 group by 1+2;
+select max(i), row_number() over () from t1 group by 1+2;
+select rank() over (order by max(i)) from t1 group by 1+2;
+
+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;