diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/win_orderby.test | |
parent | Initial commit. (diff) | |
download | mariadb-upstream.tar.xz mariadb-upstream.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/win_orderby.test')
-rw-r--r-- | mysql-test/main/win_orderby.test | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/mysql-test/main/win_orderby.test b/mysql-test/main/win_orderby.test new file mode 100644 index 00000000..d0bcddfe --- /dev/null +++ b/mysql-test/main/win_orderby.test @@ -0,0 +1,87 @@ +# +# Tests for window functions and ORDER BY +# + +--disable_warnings +drop table if exists t0,t1; +--enable_warnings + +create table t0(a int primary key); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1( + pk int, + a int, + key(pk) +); + +insert into t1 +select + A.a + B.a* 10 + C.a * 100, + 1 +from t0 A, t0 B, t0 C; + +select + pk, + count(a) over (order by pk rows between 2 preceding and 2 following) as exp +from t1 +where pk between 1 and 30 +order by pk desc +limit 4; + +drop table t0,t1; + + +--echo # +--echo # MDEV-30052: Crash with a query containing nested WINDOW clauses +--echo # + +CREATE TABLE t1 (c INT); +insert into t1 values (1),(2); +UPDATE t1 SET c=1 +WHERE c=2 +ORDER BY + (1 IN (( + SELECT * + FROM (SELECT * FROM t1) AS v1 + GROUP BY c + WINDOW v2 AS (ORDER BY + (SELECT * + FROM t1 + GROUP BY c + WINDOW v3 AS (PARTITION BY c) + ) + ) + )) + ); +drop table t1; + +--echo # +--echo # MDEV-29359: Server crashed with heap-use-after-free in +--echo # Field::is_null(long long) const (Just testcase) +--echo # + +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES (-1),(0),(84); + +SELECT + id IN (SELECT id + FROM t1 + WINDOW w AS (ORDER BY (SELECT 1 + FROM t1 + WHERE + EXISTS ( SELECT id + FROM t1 + GROUP BY id + WINDOW w2 AS (ORDER BY id) + ) + ) + ) + ) as exp +FROM t1; + +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # |