sl@0: # 2007 Sep 12 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # sl@0: # This file is to test that ticket #2643 has been fixed. sl@0: # sl@0: # $Id: tkt2643.test,v 1.1 2007/09/13 17:54:41 drh Exp $ sl@0: # sl@0: sl@0: # The problem in ticket #2643 has to do with the query optimizer sl@0: # making bad assumptions about index cost when data from ANALYZE sl@0: # is available. sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: do_test tkt2643-1.1 { sl@0: execsql { sl@0: CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE, c); sl@0: INSERT INTO t1 VALUES(1,2,3); sl@0: INSERT INTO t1 VALUES(2,3,4); sl@0: ANALYZE; sl@0: } sl@0: db close sl@0: sqlite3 db test.db sl@0: execsql { sl@0: CREATE INDEX i1 ON t1(c); sl@0: SELECT count(*) FROM t1 WHERE c IS NOT NULL sl@0: } sl@0: } {2} sl@0: sl@0: finish_test