diff options
Diffstat (limited to 'test/windowerr.test')
-rw-r--r-- | test/windowerr.test | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/test/windowerr.test b/test/windowerr.test index 2dcc0a82d..d517665a9 100644 --- a/test/windowerr.test +++ b/test/windowerr.test @@ -23,48 +23,60 @@ 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" +# 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 t3 ORDER BY 1 + ) FROM t1 ORDER BY 1 } } } 1 -# PG says "ERROR: frame ending offset must not be negative" +# 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 t3 ORDER BY 1 + ) FROM t1 ORDER BY 1 } } } 1 -# PG says "ERROR: invalid preceding or following size in window function" +# 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 t3 ORDER BY 1 + ) FROM t1 ORDER BY 1 } } } 1 -# PG says "ERROR: invalid preceding or following size in window function" +# 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 t3 ORDER BY 1 + ) FROM t1 ORDER BY 1 } } } 1 -# PG says "ERROR: frame starting offset must not be negative" +# 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 t3 ORDER BY 1 + ) FROM t1 ORDER BY 1 } } } 1 -# PG says "ERROR: frame ending offset must not be negative" +# 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 t3 ORDER BY 1 + ) 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 finish_test |