2 #pragma ident "%Z%%M% %I% %E% SMI"
6 # The author disclaims copyright to this source code. In place of
7 # a legal notice, here is a blessing:
9 # May you do good and not evil.
10 # May you find forgiveness for yourself and forgive others.
11 # May you share freely, never taking more than you give.
13 #***********************************************************************
14 # This file implements regression tests for SQLite library.
16 # This file implements tests for left outer joins containing WHERE
17 # clauses that restrict the scope of the left term of the join.
19 # $Id: join4_28.test,v 1.1.2.1 2004/07/22 16:08:39 drh Exp $
21 set testdir [file dirname $argv0]
22 source $testdir/tester.tcl
26 create temp table t1(a integer, b varchar(10));
27 insert into t1 values(1,'one');
28 insert into t1 values(2,'two');
29 insert into t1 values(3,'three');
30 insert into t1 values(4,'four');
32 create temp table t2(x integer, y varchar(10), z varchar(10));
33 insert into t2 values(2,'niban','ok');
34 insert into t2 values(4,'yonban','err');
37 select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok'
42 select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok'
44 } {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
47 create index i2 on t2(z);
50 select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok'
55 select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok'
57 } {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
60 select * from t1 left outer join t2 on t1.a=t2.x where t2.z>='ok'
65 select * from t1 left outer join t2 on t1.a=t2.x and t2.z>='ok'
67 } {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
70 select * from t1 left outer join t2 on t1.a=t2.x where t2.z IN ('ok')
75 select * from t1 left outer join t2 on t1.a=t2.x and t2.z IN ('ok')
77 } {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}