summaryrefslogtreecommitdiff
path: root/mysql-test/main/win.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/win.test')
-rw-r--r--mysql-test/main/win.test27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test
index 5a547b363b7..a71a9c31085 100644
--- a/mysql-test/main/win.test
+++ b/mysql-test/main/win.test
@@ -2704,6 +2704,33 @@ drop view v1,v2;
drop table t1;
--echo #
+--echo # MDEV-17785: Window functions not working in ONLY_FULL_GROUP_BY mode
+--echo #
+
+CREATE TABLE t1(a VARCHAR(10), b int);
+
+INSERT INTO t1 VALUES
+('Maths', 60),('Maths', 60),
+('Maths', 70),('Maths', 55),
+('Biology', 60), ('Biology', 70);
+
+SET @save_sql_mode= @@sql_mode;
+SET sql_mode = 'ONLY_FULL_GROUP_BY';
+
+SELECT
+ RANK() OVER (PARTITION BY a ORDER BY b) AS rank,
+ a, b FROM t1 ORDER BY a, b DESC;
+
+SET sql_mode= @save_sql_mode;
+DROP TABLE t1;
+
+CREATE TABLE t1(i int,j int);
+INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
+INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
+SELECT i, LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j) FROM t1 GROUP BY i;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #