AryaWu/sqlite
0
1# 2021 February 152#3# The author disclaims copyright to this source code. In place of4# a legal notice, here is a blessing:5#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.9#10#***********************************************************************11# This file implements regression tests for SQLite library. The12# focus of this file is testing optimizations associated with "IS NULL"13# and "IS NOT NULL" operators on columns with NOT NULL constraints.14#15 16set testdir [file dirname $argv0]17source $testdir/tester.tcl18set testprefix notnullfault19 20do_execsql_test 1.0 {21 CREATE TABLE t1(a, b);22 CREATE TABLE t2(c, d NOT NULL);23}24faultsim_save_and_close25 26do_faultsim_test 1 -prep {27 faultsim_restore_and_reopen28} -body {29 execsql {30 SELECT * FROM t2 WHERE d NOT NULL31 }32} -test {33 faultsim_test_result {0 {}}34}35 36#-------------------------------------------------------------------------37reset_db38do_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;41}42faultsim_save_and_close43 44do_faultsim_test 2.1 -faults oom-t* -prep {45 faultsim_restore_and_reopen46} -body {47 execsql {48 SELECT dense_rank() OVER win FROM t249 WINDOW win AS (ORDER BY c IS NULL)50 }51} -test {52 faultsim_test_result {0 {}}53}54 55finish_test56 