1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Ensure an error is returned if the user specifies an unsupported frame type.

FossilOrigin-Name: 0f3f8fcde1a535bcf93e23a68d2411c21785d8c0cac1f9481a06e7225755cdbc
This commit is contained in:
dan
2018-07-06 14:15:49 +00:00
parent 287fa17b78
commit 5d764ac9e6
4 changed files with 44 additions and 14 deletions

View File

@ -221,13 +221,13 @@ do_catchsql_test 9.1 {
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<5)
SELECT x, group_concat(x) OVER (ORDER BY x RANGE 2 PRECEDING)
FROM c;
} {1 {RANGE PRECEDING is only supported with UNBOUNDED}}
} {1 {unsupported window-frame type}}
do_catchsql_test 9.2 {
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<5)
SELECT x, group_concat(x) OVER (ORDER BY x RANGE BETWEEN UNBOUNDED PRECEDING AND 2 FOLLOWING)
FROM c;
} {1 {RANGE FOLLOWING is only supported with UNBOUNDED}}
} {1 {unsupported window-frame type}}
do_catchsql_test 9.3 {
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<5)
@ -249,5 +249,19 @@ do_catchsql_test 9.6 {
SELECT count() OVER (ORDER BY x RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED PRECEDING) FROM c;
} {1 {near "PRECEDING": syntax error}}
foreach {tn frame} {
1 "BETWEEN CURRENT ROW AND 4 PRECEDING"
2 "4 FOLLOWING"
3 "BETWEEN 4 FOLLOWING AND CURRENT ROW"
4 "BETWEEN 4 FOLLOWING AND 2 PRECEDING"
} {
do_catchsql_test 9.7.$tn "
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<5)
SELECT count() OVER (
ORDER BY x ROWS $frame
) FROM c;
" {1 {unsupported window-frame type}}
}
finish_test