summaryrefslogtreecommitdiff
path: root/mysql-test/main/win.test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-03-17 13:06:41 +0100
committerSergei Golubchik <serg@mariadb.org>2019-03-17 13:06:41 +0100
commitb64fde8f38515dc39e019de26db7624cc0ea7046 (patch)
tree0478ea4c3ddeee290f6d381a47efa4f9aded9c0b /mysql-test/main/win.test
parenta89ee3cd154a67df2231f034fd8339f9225dbe64 (diff)
parent1f020299f816263e347c852eb2a494b5ef1cbf0d (diff)
downloadmariadb-git-b64fde8f38515dc39e019de26db7624cc0ea7046.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'mysql-test/main/win.test')
-rw-r--r--mysql-test/main/win.test14
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test
index 15e96ec7e8e..6ebe1d653cf 100644
--- a/mysql-test/main/win.test
+++ b/mysql-test/main/win.test
@@ -2242,6 +2242,20 @@ drop table t1;
drop view v1;
--echo #
+--echo # MDEV-18431: Select max + row_number giving incorrect result
+--echo #
+
+create table t1 (id int, v int);
+insert into t1 values (1, 1), (1,2), (1,3), (2, 1), (2, 2);
+
+select e.id,
+ (select max(t1.v) from t1 where t1.id=e.id) as a,
+ row_number() over (partition by e.id order by e.v) as b,
+ (select max(t1.v) from t1 where t1.id=e.id) + (row_number() over (partition by e.id order by e.v)) as sum_a_b
+from t1 e;
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #