1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Fix another problem in lead()/lag(). And some errors that could occur

following OOM faults.

FossilOrigin-Name: fadd4dc119d8df0d871f4d839b7a11070e2ffb8927e84b3e7a94f34196db3de3
This commit is contained in:
dan
2018-06-15 19:01:35 +00:00
parent e0a5e20fa8
commit 6fde1799f8
7 changed files with 146 additions and 15 deletions

51
test/windowfault.test Normal file
View File

@ -0,0 +1,51 @@
# 2018 May 8
#
# 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.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix windowfault
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c, d);
INSERT INTO t1 VALUES(1, 2, 3, 4);
INSERT INTO t1 VALUES(5, 6, 7, 8);
INSERT INTO t1 VALUES(9, 10, 11, 12);
}
faultsim_save_and_close
do_faultsim_test 1 -start 1 -faults oom-* -prep {
faultsim_restore_and_reopen
} -body {
execsql {
SELECT row_number() OVER win,
rank() OVER win,
dense_rank() OVER win,
ntile(2) OVER win,
first_value(d) OVER win,
last_value(d) OVER win,
nth_value(d,2) OVER win,
lead(d) OVER win,
lag(d) OVER win,
max(d) OVER win,
min(d) OVER win
FROM t1
WINDOW win AS (ORDER BY a)
}
} -test {
faultsim_test_result {0 {1 1 1 1 4 4 {} 8 {} 4 4 2 2 2 1 4 8 8 12 4 8 4 3 3 3 2 4 12 8 {} 8 12 4}}
}
finish_test