os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2643.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2643.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,39 @@
     1.4 +# 2007 Sep 12
     1.5 +#
     1.6 +# The author disclaims copyright to this source code. In place of
     1.7 +# a legal notice, here is a blessing:
     1.8 +#
     1.9 +#    May you do good and not evil.
    1.10 +#    May you find forgiveness for yourself and forgive others.
    1.11 +#    May you share freely, never taking more than you give.
    1.12 +#
    1.13 +#***********************************************************************
    1.14 +#
    1.15 +# This file is to test that ticket #2643 has been fixed.
    1.16 +#
    1.17 +# $Id: tkt2643.test,v 1.1 2007/09/13 17:54:41 drh Exp $
    1.18 +#
    1.19 +
    1.20 +# The problem in ticket #2643 has to do with the query optimizer
    1.21 +# making bad assumptions about index cost when data from ANALYZE
    1.22 +# is available.
    1.23 +
    1.24 +set testdir [file dirname $argv0]
    1.25 +source $testdir/tester.tcl
    1.26 +
    1.27 +do_test tkt2643-1.1 {
    1.28 +  execsql {
    1.29 +    CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE, c);
    1.30 +    INSERT INTO t1 VALUES(1,2,3);
    1.31 +    INSERT INTO t1 VALUES(2,3,4);
    1.32 +    ANALYZE;
    1.33 +  }
    1.34 +  db close
    1.35 +  sqlite3 db test.db
    1.36 +  execsql {
    1.37 +    CREATE INDEX i1 ON t1(c);
    1.38 +    SELECT count(*) FROM t1 WHERE c IS NOT NULL
    1.39 +  }
    1.40 +} {2}
    1.41 +
    1.42 +finish_test