Adjust the new truncation behavior of sqlite_dbpage(N,null) such that it causes
[sqlite.git] / test / notnullfault.test
blob0db8e4adbd42d9a54ef9e8285b103e3a15b144e7
1 # 2021 February 15
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.  The
12 # focus of this file is testing optimizations associated with "IS NULL"
13 # and "IS NOT NULL" operators on columns with NOT NULL constraints.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 set testprefix notnullfault
20 do_execsql_test 1.0 {
21   CREATE TABLE t1(a, b);
22   CREATE TABLE t2(c, d NOT NULL);
24 faultsim_save_and_close
26 do_faultsim_test 1 -prep {
27   faultsim_restore_and_reopen
28 } -body {
29   execsql {
30     SELECT * FROM t2 WHERE d NOT NULL
31   }
32 } -test {
33   faultsim_test_result {0 {}}
36 #-------------------------------------------------------------------------
37 reset_db
38 do_execsql_test 2.0 {
39   CREATE TABLE t1(a, b, c); 
40   CREATE TABLE t2(a, b, c, PRIMARY KEY(a, b, c)) WITHOUT ROWID;
42 faultsim_save_and_close
44 do_faultsim_test 2.1 -faults oom-t* -prep {
45   faultsim_restore_and_reopen
46 } -body {
47   execsql {
48     SELECT dense_rank() OVER win FROM t2
49     WINDOW win AS (ORDER BY c IS NULL)
50   }
51 } -test {
52   faultsim_test_result {0 {}}
55 finish_test