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 #***********************************************************************
12 set testdir [file dirname $argv0]
13 source $testdir/tester.tcl
14 set testprefix pushdown
17 CREATE TABLE t1(a, b, c);
18 INSERT INTO t1 VALUES(1, 'b1', 'c1');
19 INSERT INTO t1 VALUES(2, 'b2', 'c2');
20 INSERT INTO t1 VALUES(3, 'b3', 'c3');
21 INSERT INTO t1 VALUES(4, 'b4', 'c4');
22 CREATE INDEX i1 ON t1(a, c);
33 execsql { SELECT * FROM t1 WHERE a=2 AND f(b) AND f(c) }
39 execsql { SELECT * FROM t1 WHERE a=3 AND f(c) AND f(b) }
45 CREATE INDEX i1 ON t1(a, b);
49 execsql { SELECT * FROM t1 WHERE a=2 AND f(b) AND f(c) }
55 execsql { SELECT * FROM t1 WHERE a=3 AND f(c) AND f(b) }
59 #-----------------------------------------------
62 CREATE TABLE u1(a, b, c);
63 CREATE TABLE u2(x, y, z);
65 INSERT INTO u1 VALUES('a1', 'b1', 'c1');
66 INSERT INTO u2 VALUES('a1', 'b1', 'c1');
72 SELECT * FROM u1 WHERE f('one')=123 AND 123=(
73 SELECT x FROM u2 WHERE x=a AND f('two')
82 SELECT * FROM u1 WHERE 123=(
83 SELECT x FROM u2 WHERE x=a AND f('two')