]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove incorrect ALWAYS macro associated with empty IN() sets. Ticket #3602. (CVS...
authordanielk1977 <danielk1977@noemail.net>
Sat, 24 Jan 2009 09:56:15 +0000 (09:56 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sat, 24 Jan 2009 09:56:15 +0000 (09:56 +0000)
FossilOrigin-Name: f3c09a0cb8bfc1a112c31b556d8921d5c75c5eef

manifest
manifest.uuid
src/where.c
test/in4.test

index 9961687ba9919d8c53586d50a2c9af44708fb8dc..359c842f7b227e8636d5999b2563c3b4c69ca017 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Optimization:\sWhen\sloading\sa\snew\spage\sinto\sthe\scache,\savoid\sredundant\smemset()\scalls\sto\szero\sit.\s(CVS\s6201)
-D 2009-01-23T16:45:01
+C Remove\sincorrect\sALWAYS\smacro\sassociated\swith\sempty\sIN()\ssets.\sTicket\s#3602.\s(CVS\s6202)
+D 2009-01-24T09:56:15
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 6619a1b72de7ada2bb7be97862913e27c6f5e339
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -207,7 +207,7 @@ F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935
 F src/vdbemem.c 06311d5c46fd703fe95ff81bd0a1b72ba0341311
 F src/vtab.c e39e011d7443a8d574b1b9cde207a35522e6df43
 F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d
-F src/where.c e9a37defa7c0cf413a096991d6ff4ea3fc25381a
+F src/where.c 48249767437bfbacbd3488270449240b9bfd05c4
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
@@ -383,7 +383,7 @@ F test/icu.test f51d0f4407ff8bb1e872f51a0e8b08fdc5a6897e
 F test/in.test d49419c6df515852f477fa513f3317181d46bc92
 F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
 F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
-F test/in4.test 9bfd9226a82ac832046abc93acecf42627ebb45a
+F test/in4.test f795d65cbcb402d3e5c016ada8f9521d6119eca8
 F test/incrblob.test 4b9437bbb38724343dadbbcca6356bc2a9b435d1
 F test/incrblob2.test 5cca1c3cb29064c504b3b0cc3e2cd43e8053cfdf
 F test/incrblob_err.test c577c91d4ed9e8336cdb188b15d6ee2a6fe9604e
@@ -697,7 +697,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 75cc709be46ae2096d2ba3e7ac58de8140f8130c
-R 8b23ab517890ddeec94bfd9db73627da
+P 9c0b9f881367871105965d4268e2f2cde7f4d884
+R 703fcaebc30ee4e59c826e459cd7857d
 U danielk1977
-Z 5750c0351bde53b3891c00b777a3ffd1
+Z 9c10950aed830445208d8addcef66699
index 4db924d03e79e1e748d99c7e5858a326e6d48989..04fb54d5c1f80cd6292747fbdf4e5c8d2d2c7bc3 100644 (file)
@@ -1 +1 @@
-9c0b9f881367871105965d4268e2f2cde7f4d884
\ No newline at end of file
+f3c09a0cb8bfc1a112c31b556d8921d5c75c5eef
\ No newline at end of file
index 9f96de28134ae67a9726db2d1a1fe303863d25b6..63cf60076749aad72fdaeb9f7b9562d933549eaa 100644 (file)
@@ -16,7 +16,7 @@
 ** 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.364 2009/01/14 00:55:10 drh Exp $
+** $Id: where.c,v 1.365 2009/01/24 09:56:15 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -1924,7 +1924,7 @@ static void bestIndex(
         wsFlags |= WHERE_COLUMN_IN;
         if( pExpr->pSelect!=0 ){
           inMultiplier *= 25;
-        }else if( ALWAYS(pExpr->pList) ){
+        }else if( pExpr->pList ){
           inMultiplier *= pExpr->pList->nExpr + 1;
         }
       }
index 312a4e14767da8ef01568d0aad8ffc266fff9c2b..6ec7452bc40a279886f1d8c1cac21823f4c33bc5 100644 (file)
@@ -9,7 +9,7 @@
 #
 #***********************************************************************
 #
-# $Id: in4.test,v 1.2 2008/11/24 15:32:00 shane Exp $
+# $Id: in4.test,v 1.3 2009/01/24 09:56:15 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -89,8 +89,16 @@ do_test in4-2.8 {
   execsql { SELECT b FROM t2 WHERE a IN ('', '0.0.0', '2') }
 } {two}
 
-# add test case from the mailing list 
-# (11/7/08 sqlite crash with "WHERE x in ()" query)
+# The following block of tests test expressions of the form:
+#
+#    <expr> IN ()
+#
+# i.e. IN expressions with a literal empty set. 
+# 
+# This has led to crashes on more than one occasion. Test case in4-3.2 
+# was added in reponse to a bug reported on the mailing list on 11/7/2008.
+# See also tickets #3602 and #185.
+#
 do_test in4-3.1 {
   execsql {
     DROP TABLE IF EXISTS t1;
@@ -114,6 +122,42 @@ do_test in4-3.2 {
     SELECT x FROM t1 WHERE id IN () AND x IN (SELECT x FROM t2 WHERE id=1)
   }
 } {}
+do_test in4-3.3 {
+  execsql {
+    CREATE TABLE t3(x, y, z);
+    CREATE INDEX t3i1 ON t3(x, y);
+    INSERT INTO t3 VALUES(1, 1, 1);
+    INSERT INTO t3 VALUES(10, 10, 10);
+  }
+  execsql { SELECT * FROM t3 WHERE x IN () }
+} {}
+do_test in4-3.4 {
+  execsql { SELECT * FROM t3 WHERE x = 10 AND y IN () }
+} {}
+do_test in4-3.5 {
+  execsql { SELECT * FROM t3 WHERE x IN () AND y = 10 }
+} {}
+do_test in4-3.6 {
+  execsql { SELECT * FROM t3 WHERE x IN () OR x = 10 }
+} {10 10 10}
+do_test in4-3.7 {
+  execsql { SELECT * FROM t3 WHERE y IN () }
+} {}
+do_test in4-3.8 {
+  execsql { SELECT x IN() AS a FROM t3 WHERE a }
+} {}
+do_test in4-3.9 {
+  execsql { SELECT x IN() AS a FROM t3 WHERE NOT a }
+} {0 0}
+do_test in4-3.10 {
+  execsql { SELECT * FROM t3 WHERE oid IN () }
+} {}
+do_test in4-3.11 {
+  execsql { SELECT * FROM t3 WHERE x IN (1, 2) OR y IN ()}
+} {1 1 1}
+do_test in4-3.12 {
+  execsql { SELECT * FROM t3 WHERE x IN (1, 2) AND y IN ()}
+} {}
 
 finish_test