summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-12-14 21:03:07 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-12-18 12:54:33 +0530
commitdc1f28e78c22fde6a6446445a6574ab0dd7fcf93 (patch)
tree44493f3c88404faa4925660ca5a8ee1769d52eb4 /mysql-test
parentcc16977aa84edcca540fdef0db8af67479165aef (diff)
downloadmariadb-git-10.2-wf.tar.gz
MDEV-15296: wrong result with window function inside a subquery10.2-wf
Window Functions were treated as a constant in a dependent tables less subquery. Made sure that the behaviour of window functions is same as the aggregate function for dependent tables less subquery. Also propagted Item::with_window_func for few missing cases.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/win.result10
-rw-r--r--mysql-test/t/win.test9
2 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index 79c116b0eeb..7209df49dc8 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -3889,5 +3889,15 @@ SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ());
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
DROP TABLE t1;
#
+# MDEV-15296: wrong result with window function inside a subquery
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT (SELECT SUM(a) OVER (partition BY a)) FROM t1;
+(SELECT SUM(a) OVER (partition BY a))
+1
+2
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index b1a8277c575..9d2c67bf478 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -2554,5 +2554,14 @@ SELECT 1 UNION SELECT a FROM t1 ORDER BY (row_number() over ());
DROP TABLE t1;
--echo #
+--echo # MDEV-15296: wrong result with window function inside a subquery
+--echo #
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT (SELECT SUM(a) OVER (partition BY a)) FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #