0525b6f47f
FossilOrigin-Name: 1fbddf01b1c3fff95b05e2f2f709754e2b514296060b4846518791e7161d9ddb
90 lines
2.7 KiB
Plaintext
90 lines
2.7 KiB
Plaintext
# 2019 March 01
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
# This file implements regression tests for SQLite library.
|
|
#
|
|
|
|
####################################################
|
|
# DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED!
|
|
####################################################
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
set testprefix windowerr
|
|
|
|
ifcapable !windowfunc { finish_test ; return }
|
|
do_execsql_test 1.0 {
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1(a INTEGER, b INTEGER);
|
|
INSERT INTO t1 VALUES(1, 1);
|
|
INSERT INTO t1 VALUES(2, 2);
|
|
INSERT INTO t1 VALUES(3, 3);
|
|
INSERT INTO t1 VALUES(4, 4);
|
|
INSERT INTO t1 VALUES(5, 5);
|
|
} {}
|
|
|
|
# PG says ERROR: frame starting offset must not be negative
|
|
do_test 1.1 { catch { execsql {
|
|
SELECT a, sum(b) OVER (
|
|
ORDER BY a ROWS BETWEEN -1 PRECEDING AND 1 FOLLOWING
|
|
) FROM t1 ORDER BY 1
|
|
} } } 1
|
|
|
|
# PG says ERROR: frame ending offset must not be negative
|
|
do_test 1.2 { catch { execsql {
|
|
SELECT a, sum(b) OVER (
|
|
ORDER BY a ROWS BETWEEN 1 PRECEDING AND -1 FOLLOWING
|
|
) FROM t1 ORDER BY 1
|
|
} } } 1
|
|
|
|
# PG says ERROR: invalid preceding or following size in window function
|
|
do_test 1.3 { catch { execsql {
|
|
SELECT a, sum(b) OVER (
|
|
ORDER BY a RANGE BETWEEN -1 PRECEDING AND 1 FOLLOWING
|
|
) FROM t1 ORDER BY 1
|
|
} } } 1
|
|
|
|
# PG says ERROR: invalid preceding or following size in window function
|
|
do_test 1.4 { catch { execsql {
|
|
SELECT a, sum(b) OVER (
|
|
ORDER BY a RANGE BETWEEN 1 PRECEDING AND -1 FOLLOWING
|
|
) FROM t1 ORDER BY 1
|
|
} } } 1
|
|
|
|
# PG says ERROR: frame starting offset must not be negative
|
|
do_test 1.5 { catch { execsql {
|
|
SELECT a, sum(b) OVER (
|
|
ORDER BY a GROUPS BETWEEN -1 PRECEDING AND 1 FOLLOWING
|
|
) FROM t1 ORDER BY 1
|
|
} } } 1
|
|
|
|
# PG says ERROR: frame ending offset must not be negative
|
|
do_test 1.6 { catch { execsql {
|
|
SELECT a, sum(b) OVER (
|
|
ORDER BY a GROUPS BETWEEN 1 PRECEDING AND -1 FOLLOWING
|
|
) FROM t1 ORDER BY 1
|
|
} } } 1
|
|
|
|
# PG says ERROR: RANGE with offset PRECEDING/FOLLOWING requires exactly one ORDER BY column
|
|
do_test 1.7 { catch { execsql {
|
|
SELECT a, sum(b) OVER (
|
|
ORDER BY a,b RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING
|
|
) FROM t1 ORDER BY 1
|
|
} } } 1
|
|
|
|
# PG says ERROR: RANGE with offset PRECEDING/FOLLOWING requires exactly one ORDER BY column
|
|
do_test 1.8 { catch { execsql {
|
|
SELECT a, sum(b) OVER (
|
|
PARTITION BY a RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING
|
|
) FROM t1 ORDER BY 1
|
|
} } } 1
|
|
|
|
finish_test
|