/ Check-in [e5546f49]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add join tests to the 2.8 branch. (CVS 1850)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | version_2
Files: files | file ages | folders
SHA1:e5546f49c79155ed2695a1d58ca8044e79d60802
User & Date: drh 2004-07-22 16:08:39
Context
2004-07-22
16:32
Bug fix in allocation of expression lists after a malloc() failure. (CVS 1854) check-in: 09494cab user: drh tags: version_2
16:08
Add join tests to the 2.8 branch. (CVS 1850) check-in: e5546f49 user: drh tags: version_2
15:53
Update the version number for release 2.8.15. (CVS 1849) check-in: 9b3c3ca4 user: drh tags: version_2
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added test/join3_28.test.

            1  +# 2002 May 24
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# 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.
           12  +#
           13  +# This file implements tests for joins, including outer joins, where
           14  +# there are a large number of tables involved in the join.
           15  +#
           16  +# $Id: join3_28.test,v 1.1.2.1 2004/07/22 16:08:39 drh Exp $
           17  +
           18  +set testdir [file dirname $argv0]
           19  +source $testdir/tester.tcl
           20  +
           21  +catch {unset result}
           22  +set result {}
           23  +for {set N 1} {$N<=40} {incr N} {
           24  +  lappend result $N
           25  +  do_test join3-1.$N {
           26  +    execsql "CREATE TABLE t${N}(x);"
           27  +    execsql "INSERT INTO t$N VALUES($N)"
           28  +    set sql "SELECT * FROM t1"
           29  +    for {set i 2} {$i<=$N} {incr i} {append sql ", t$i"}
           30  +    execsql $sql
           31  +  } $result
           32  +}
           33  +
           34  +finish_test

Added test/join4_28.test.

            1  +# 2002 May 24
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# 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.
           12  +#
           13  +# This file implements tests for left outer joins containing WHERE
           14  +# clauses that restrict the scope of the left term of the join.
           15  +#
           16  +# $Id: join4_28.test,v 1.1.2.1 2004/07/22 16:08:39 drh Exp $
           17  +
           18  +set testdir [file dirname $argv0]
           19  +source $testdir/tester.tcl
           20  +
           21  +do_test join4-1.1 {
           22  +  execsql {
           23  +    create temp table t1(a integer, b varchar(10));
           24  +    insert into t1 values(1,'one');
           25  +    insert into t1 values(2,'two');
           26  +    insert into t1 values(3,'three');
           27  +    insert into t1 values(4,'four');
           28  +
           29  +    create temp table t2(x integer, y varchar(10), z varchar(10));
           30  +    insert into t2 values(2,'niban','ok');
           31  +    insert into t2 values(4,'yonban','err');
           32  +  }
           33  +  execsql {
           34  +    select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok'
           35  +  }
           36  +} {2 two 2 niban ok}
           37  +do_test join4-1.2 {
           38  +  execsql {
           39  +    select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok'
           40  +  }
           41  +} {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
           42  +do_test join4-1.3 {
           43  +  execsql {
           44  +    create index i2 on t2(z);
           45  +  }
           46  +  execsql {
           47  +    select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok'
           48  +  }
           49  +} {2 two 2 niban ok}
           50  +do_test join4-1.4 {
           51  +  execsql {
           52  +    select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok'
           53  +  }
           54  +} {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
           55  +do_test join4-1.5 {
           56  +  execsql {
           57  +    select * from t1 left outer join t2 on t1.a=t2.x where t2.z>='ok'
           58  +  }
           59  +} {2 two 2 niban ok}
           60  +do_test join4-1.4 {
           61  +  execsql {
           62  +    select * from t1 left outer join t2 on t1.a=t2.x and t2.z>='ok'
           63  +  }
           64  +} {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
           65  +do_test join4-1.6 {
           66  +  execsql {
           67  +    select * from t1 left outer join t2 on t1.a=t2.x where t2.z IN ('ok')
           68  +  }
           69  +} {2 two 2 niban ok}
           70  +do_test join4-1.7 {
           71  +  execsql {
           72  +    select * from t1 left outer join t2 on t1.a=t2.x and t2.z IN ('ok')
           73  +  }
           74  +} {1 one {} {} {} 2 two 2 niban ok 3 three {} {} {} 4 four {} {} {}}
           75  +
           76  +
           77  +finish_test