Fix a problem causing the recovery extension to use excessive memory and CPU time...
[sqlite.git] / test / seekscan1.test
blob0e53c1916688e6328429c9191695ae371e9ebb16
1 # 2022 October 7
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 seekscan1
18 do_execsql_test 1.0 {
19   CREATE TABLE t1(a TEXT, b INT, c INT NOT NULL, PRIMARY KEY(a,b,c));
20   WITH RECURSIVE c(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c WHERE x<1997)
21     INSERT INTO t1(a,b,c) SELECT printf('xyz%d',x/10),x/6,x FROM c;
22   INSERT INTO t1 VALUES('abc',234,6);
23   INSERT INTO t1 VALUES('abc',345,7);
24   ANALYZE;
28 do_execsql_test 1.1 {
29   SELECT a,b,c FROM t1 
30   WHERE b IN (234, 345) AND c BETWEEN 6 AND 6.5 AND a='abc' 
31   ORDER BY a, b;
32 } {
33   abc 234 6
36 do_execsql_test 1.2 {
37   SELECT a,b,c FROM t1 
38   WHERE b IN (234, 345) AND c BETWEEN 6 AND 7 AND a='abc' 
39   ORDER BY a, b;
40 } {
41   abc 234 6
42   abc 345 7
45 do_execsql_test 1.3 {
46   SELECT a,b,c FROM t1 
47   WHERE b IN (234, 345) AND c >=6 AND a='abc' 
48   ORDER BY a, b;
49 } {
50   abc 234 6
51   abc 345 7
54 do_execsql_test 1.4 {
55   SELECT a,b,c FROM t1 
56   WHERE b IN (234, 345) AND c<=7 AND a='abc' 
57   ORDER BY a, b;
58 } {
59   abc 234 6
60   abc 345 7
63 do_execsql_test 1.5 {
64   SELECT a,b,c FROM t1 WHERE b IN (235, 345) AND c<=3 AND a='abc' ORDER BY a, b;
68 finish_test