diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-12-27 18:20:28 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-12-27 18:20:28 +0200 |
commit | 4c25e75ce766440694553e0baf03cc5c6e803fc3 (patch) | |
tree | f75cea6e472054b7a15466ea5e31c862ae9e77cc /mysql-test/main/win.test | |
parent | 4c57ab34d4852387da4ef8eac862045d1458de1e (diff) | |
parent | 808bc919eb94ac888f2014275b443ebdaf733ae5 (diff) | |
download | mariadb-git-4c25e75ce766440694553e0baf03cc5c6e803fc3.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/main/win.test')
-rw-r--r-- | mysql-test/main/win.test | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index c6ddef94d80..32de28511c1 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -2352,6 +2352,81 @@ SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x; drop table t1; --echo # +--echo # MDEV-16579: Wrong result of query using DISTINCT COUNT(*) OVER (*) +--echo # + +CREATE TABLE t1 (i int) ; +INSERT INTO t1 VALUES (1),(0),(1),(2),(0),(1),(2),(1),(2); + +SELECT DISTINCT COUNT(*) OVER (), MOD(MIN(i),2) FROM t1 GROUP BY i ; +drop table t1; + +--echo # +--echo # MDEV-21318: Wrong results with window functions and implicit grouping +--echo # + +CREATE TABLE t1 (a INT); + +--echo # +--echo # With empty const table +--echo # The expected result here is 1, NULL +--echo # + +explain +SELECT row_number() over(), sum(1) FROM t1; +SELECT row_number() over(), sum(1) FROM t1; + +insert into t1 values (2); + +--echo # +--echo # Const table has 1 row, but still impossible where +--echo # The expected result here is 1, NULL +--echo # + +EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1; +SELECT row_number() over(), sum(1) FROM t1 where a=1; + +--echo # +--echo # Impossible HAVING +--echo # Empty result is expected +--echo # + +EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0; +SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0; + +--echo # +--echo # const table has 1 row, no impossible where +--echo # The expected result here is 1, 2 +--echo # + +EXPLAIN SELECT row_number() over(), sum(a) FROM t1 where a=2; +SELECT row_number() over(), sum(a) FROM t1 where a=2; +drop table t1; + +--echo # +--echo # Impossible Where +--echo # + +create table t1(a int); +insert into t1 values (1); + +--echo # +--echo # Expected result is NULL, 0, NULL +--echo # +EXPLAIN SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; +SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; + +--echo # +--echo # Expected result is 1, 0, NULL +--echo # + +EXPLAIN +SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; +SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; + +drop table t1; + +--echo # --echo # End of 10.2 tests --echo # |