-C Fix\sthe\squery\soptimizer\sso\sthat\sit\scorrectly\shandles\sconstant\sexpressions\nin\sthe\sON\sclause\sof\sa\sLEFT\sJOIN.\s\sTicket\s#2403.\s(CVS\s4049)
-D 2007-06-08T00:20:48
+C Make\ssure\srowid\scomparisons\sagainst\sNULL\swork\scorrectly.\s\sTicket\s#2404.\s(CVS\s4050)
+D 2007-06-08T08:39:02
F Makefile.in a42354804b50c2708ce72cf79e4daa30f50191b5
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f
F src/vdbemem.c d86c25bbfe8102499ff7505fca44a779c68694d8
F src/vtab.c c5ebebf615b2f29499fbe97a584c4bb342632aa0
-F src/where.c 6a3c44fed90af904ec3baac0b0e41592e9acacbb
+F src/where.c b5e7a9735db4010984b6d5c2febb1fa7ab4b1bd6
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/all.test f0ea4b968d5fe05d85e9cab6fa491ec7e3b9fcc4
F test/where2.test 3249d426b3fc7a106713d784e1628307fc308d2e
F test/where3.test 0a30fe9808b0fa01c46d0fcf4fac0bf6cf75bb30
F test/where4.test f80207a4ea6504f3d0962f3ecebc7db274ea50c0
+F test/where5.test 402d3bbe94edf89d41bc556dc8e621df9768b418
F test/zeroblob.test c5096545085330b7886d2f977272a73d9fa7737e
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P f40218434e549144ddb48303df30e5191d44d3fc
-R 6c0f437e174a3996f6b009b6d1c9018d
+P 46fdd195483787eef209a9b8ad108eba147be6fa
+R e8f6143bfd4596c3133479efdd40f198
U drh
-Z 16d5acbd30bcbeb8aed6b967cb91d898
+Z a9444c898b9b5e55afca76332b67eee3
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
-** $Id: where.c,v 1.251 2007/06/08 00:20:48 drh Exp $
+** $Id: where.c,v 1.252 2007/06/08 08:39:02 drh Exp $
*/
#include "sqliteInt.h"
if( testOp!=OP_Noop ){
sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0);
sqlite3VdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0);
- sqlite3VdbeAddOp(v, testOp, SQLITE_AFF_NUMERIC, brk);
+ sqlite3VdbeAddOp(v, testOp, SQLITE_AFF_NUMERIC|0x100, brk);
}
}else if( pLevel->flags & WHERE_COLUMN_RANGE ){
/* Case 3: The WHERE clause term that refers to the right-most
--- /dev/null
+# 2007 June 8
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this file is testing NULL comparisons in the WHERE clause.
+# See ticket #2404.
+#
+# $Id: where5.test,v 1.1 2007/06/08 08:39:02 drh Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Build some test data
+#
+do_test where5-1.0 {
+ execsql {
+ CREATE TABLE t1(x TEXT);
+ CREATE TABLE t2(x INTEGER);
+ CREATE TABLE t3(x INTEGER PRIMARY KEY);
+ INSERT INTO t1 VALUES(-1);
+ INSERT INTO t1 VALUES(0);
+ INSERT INTO t1 VALUES(1);
+ INSERT INTO t2 SELECT * FROM t1;
+ INSERT INTO t3 SELECT * FROM t2;
+ }
+ execsql {
+ SELECT * FROM t1 WHERE x<0
+ }
+} {-1}
+do_test where5-1.1 {
+ execsql {
+ SELECT * FROM t1 WHERE x<=0
+ }
+} {-1 0}
+do_test where5-1.2 {
+ execsql {
+ SELECT * FROM t1 WHERE x=0
+ }
+} {0}
+do_test where5-1.3 {
+ execsql {
+ SELECT * FROM t1 WHERE x>=0
+ }
+} {0 1}
+do_test where5-1.4 {
+ execsql {
+ SELECT * FROM t1 WHERE x>0
+ }
+} {1}
+do_test where5-1.5 {
+ execsql {
+ SELECT * FROM t1 WHERE x<>0
+ }
+} {-1 1}
+do_test where5-1.6 {
+ execsql {
+ SELECT * FROM t1 WHERE x<NULL
+ }
+} {}
+do_test where5-1.7 {
+ execsql {
+ SELECT * FROM t1 WHERE x<=NULL
+ }
+} {}
+do_test where5-1.8 {
+ execsql {
+ SELECT * FROM t1 WHERE x=NULL
+ }
+} {}
+do_test where5-1.9 {
+ execsql {
+ SELECT * FROM t1 WHERE x>=NULL
+ }
+} {}
+do_test where5-1.10 {
+ execsql {
+ SELECT * FROM t1 WHERE x>NULL
+ }
+} {}
+do_test where5-1.11 {
+ execsql {
+ SELECT * FROM t1 WHERE x!=NULL
+ }
+} {}
+
+do_test where5-2.0 {
+ execsql {
+ SELECT * FROM t2 WHERE x<0
+ }
+} {-1}
+do_test where5-2.1 {
+ execsql {
+ SELECT * FROM t2 WHERE x<=0
+ }
+} {-1 0}
+do_test where5-2.2 {
+ execsql {
+ SELECT * FROM t2 WHERE x=0
+ }
+} {0}
+do_test where5-2.3 {
+ execsql {
+ SELECT * FROM t2 WHERE x>=0
+ }
+} {0 1}
+do_test where5-2.4 {
+ execsql {
+ SELECT * FROM t2 WHERE x>0
+ }
+} {1}
+do_test where5-2.5 {
+ execsql {
+ SELECT * FROM t2 WHERE x<>0
+ }
+} {-1 1}
+do_test where5-2.6 {
+ execsql {
+ SELECT * FROM t2 WHERE x<NULL
+ }
+} {}
+do_test where5-2.7 {
+ execsql {
+ SELECT * FROM t2 WHERE x<=NULL
+ }
+} {}
+do_test where5-2.8 {
+ execsql {
+ SELECT * FROM t2 WHERE x=NULL
+ }
+} {}
+do_test where5-2.9 {
+ execsql {
+ SELECT * FROM t2 WHERE x>=NULL
+ }
+} {}
+do_test where5-2.10 {
+ execsql {
+ SELECT * FROM t2 WHERE x>NULL
+ }
+} {}
+do_test where5-2.11 {
+ execsql {
+ SELECT * FROM t2 WHERE x!=NULL
+ }
+} {}
+
+do_test where5-3.0 {
+ execsql {
+ SELECT * FROM t3 WHERE x<0
+ }
+} {-1}
+do_test where5-3.1 {
+ execsql {
+ SELECT * FROM t3 WHERE x<=0
+ }
+} {-1 0}
+do_test where5-3.2 {
+ execsql {
+ SELECT * FROM t3 WHERE x=0
+ }
+} {0}
+do_test where5-3.3 {
+ execsql {
+ SELECT * FROM t3 WHERE x>=0
+ }
+} {0 1}
+do_test where5-3.4 {
+ execsql {
+ SELECT * FROM t3 WHERE x>0
+ }
+} {1}
+do_test where5-3.5 {
+ execsql {
+ SELECT * FROM t3 WHERE x<>0
+ }
+} {-1 1}
+do_test where5-3.6 {
+ execsql {
+ SELECT * FROM t3 WHERE x<NULL
+ }
+} {}
+do_test where5-3.7 {
+ execsql {
+ SELECT * FROM t3 WHERE x<=NULL
+ }
+} {}
+do_test where5-3.8 {
+ execsql {
+ SELECT * FROM t3 WHERE x=NULL
+ }
+} {}
+do_test where5-3.9 {
+ execsql {
+ SELECT * FROM t3 WHERE x>=NULL
+ }
+} {}
+do_test where5-3.10 {
+ execsql {
+ SELECT * FROM t3 WHERE x>NULL
+ }
+} {}
+do_test where5-3.11 {
+ execsql {
+ SELECT * FROM t3 WHERE x!=NULL
+ }
+} {}
+
+
+finish_test