diff options
author | Igor Babaev <igor@askmonty.org> | 2017-02-10 17:20:46 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2017-02-10 17:21:45 -0800 |
commit | 559345806216369bad999539018bd3943860a5d5 (patch) | |
tree | cf8caa0141441b493888b639908587a4f184803b /mysql-test | |
parent | 1b4f694adfa257d41b5ddb141e5bcc23e6dfd9c8 (diff) | |
download | mariadb-git-559345806216369bad999539018bd3943860a5d5.tar.gz |
Fixed bug mdev-12015.
Corrected an assertion in JOIN::create_postjoin_aggr_table():
JOIN::join_tab[0] can be the first aggregation table if
the query uses window functions.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/win.result | 11 | ||||
-rw-r--r-- | mysql-test/t/win.test | 15 |
2 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index f693d6641df..b863ee4ddd6 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -2842,3 +2842,14 @@ max(i) min(i) f 16 14 2 20 17 3 drop table t1; +# +# MDEV-12015: window function over select with WHERE +# that is always FALSE +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (3), (1), (2); +SELECT i, ROW_NUMBER() OVER () FROM t1 WHERE 1 = 2; +i ROW_NUMBER() OVER () +SELECT i, COUNT(*) OVER () FROM t1 WHERE 1 = 2; +i COUNT(*) OVER () +DROP TABLE t1; diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index c231c1eeecf..f92334e4079 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1636,3 +1636,18 @@ select max(i), min(i), min(max(i)-min(i)) over (partition by count(i)) f group by b; drop table t1; + +--echo # +--echo # MDEV-12015: window function over select with WHERE +--echo # that is always FALSE +--echo # + +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (3), (1), (2); + +SELECT i, ROW_NUMBER() OVER () FROM t1 WHERE 1 = 2; + +SELECT i, COUNT(*) OVER () FROM t1 WHERE 1 = 2; + +DROP TABLE t1; + |