3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16 set testprefix windowfault
20 CREATE TABLE t1(a, b, c, d);
21 INSERT INTO t1 VALUES(1, 2, 3, 4);
22 INSERT INTO t1 VALUES(5, 6, 7, 8);
23 INSERT INTO t1 VALUES(9, 10, 11, 12);
25 faultsim_save_and_close
27 do_faultsim_test 1 -start 1 -faults oom-* -prep {
28 faultsim_restore_and_reopen
31 SELECT row_number() OVER win,
33 dense_rank() OVER win,
35 first_value(d) OVER win,
36 last_value(d) OVER win,
37 nth_value(d,2) OVER win,
43 WINDOW win AS (ORDER BY a)
46 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}}
49 do_faultsim_test 2 -faults oom-* -prep {
50 faultsim_restore_and_reopen
53 SELECT min(d) OVER win, max(d) OVER win
55 WINDOW win AS (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
58 faultsim_test_result {0 {4 12 8 12 12 12}}