-C Modify\sMakefile.in\sto\sinstall\ssqlite3ext.h.\s(CVS\s3501)
-D 2006-11-01T12:20:17
+C Fix\sa\sbug\sin\sthe\soptimizer\sthat\swas\scausing\sit\sto\smiss\san\sOR\soptimization\nopportunity.\s(CVS\s3502)
+D 2006-11-06T15:10:05
F Makefile.in 8e14898d41a53033ecb687d93c9cd5d109fb9ae3
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 26623176bf1c616aa478da958fac49502491a921
F src/vtab.c aa30e940058ea56a1b7a9a7019ec21d307316fb4
-F src/where.c 1c33e196807bfe1bd021988525cf4728916a4a44
+F src/where.c 6e215af5a7b1eb2fc1b9d6fa653064753a84757f
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4
F test/vtab9.test 87afba55339b0c255e9697fbfb5bfb6120505d9d
F test/vtab_err.test c07f7665dd90bc757f80f05e7951d826eda9bc48
F test/where.test ee7c9a6659b07e1ee61177f6e7ff71565ee2c9df
-F test/where2.test a16476a5913e75cf65b38f2daa6157a6b7791394
+F test/where2.test 61d5b20d9bedc8788a773bbdc5b2ef887725928e
F test/where3.test 3b5ad2c58069e12be2bd86bc5e211a82810521aa
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/lemon.c 4e62a7119a9da4c5178ec095784ca7d44c77ce71
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P dbd0125c62457681689db48e1f0a752767855773
-R b2d3160a61eff3adb50a97d122db9c22
+P 35c8c4781736d45019d8b823b8517c24622d3313
+R 72648fe2d8ddbd1ade2ac2a1d6675f54
U drh
-Z a3a19609508ddd620894806968863c6c
+Z 542e53251a657546cd65151f3319f13c
-35c8c4781736d45019d8b823b8517c24622d3313
\ No newline at end of file
+9bf153b54c6e9ba16914dedd9e2949f32d7550ea
\ No newline at end of file
** 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.231 2006/10/28 00:28:09 drh Exp $
+** $Id: where.c,v 1.232 2006/11/06 15:10:05 drh Exp $
*/
#include "sqliteInt.h"
if( ok ){
ExprList *pList = 0;
Expr *pNew, *pDup;
+ Expr *pLeft = 0;
for(i=sOr.nTerm-1, pOrTerm=sOr.a; i>=0 && ok; i--, pOrTerm++){
if( (pOrTerm->flags & TERM_OR_OK)==0 ) continue;
pDup = sqlite3ExprDup(pOrTerm->pExpr->pRight);
pList = sqlite3ExprListAppend(pList, pDup, 0);
+ pLeft = pOrTerm->pExpr->pLeft;
}
- pDup = sqlite3Expr(TK_COLUMN, 0, 0, 0);
- if( pDup ){
- pDup->iTable = iCursor;
- pDup->iColumn = iColumn;
- }
+ assert( pLeft!=0 );
+ pDup = sqlite3ExprDup(pLeft);
pNew = sqlite3Expr(TK_IN, pDup, 0, 0);
if( pNew ){
int idxNew;
# focus of this file is testing the use of indices in WHERE clauses
# based on recent changes to the optimizer.
#
-# $Id: where2.test,v 1.9 2006/05/11 13:26:26 drh Exp $
+# $Id: where2.test,v 1.10 2006/11/06 15:10:06 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {}
}
+
+# Make sure WHERE clauses of the form A=1 AND (B=2 OR B=3) are optimized
+# when we have an index on A and B.
+#
+ifcapable or_opt {
+ do_test where2-9.1 {
+ execsql {
+ BEGIN;
+ CREATE TABLE t10(a,b,c);
+ INSERT INTO t10 VALUES(1,1,1);
+ INSERT INTO t10 VALUES(1,2,2);
+ INSERT INTO t10 VALUES(1,3,3);
+ }
+ for {set i 4} {$i<=1000} {incr i} {
+ execsql {INSERT INTO t10 VALUES(1,$i,$i)}
+ }
+ execsql {
+ CREATE INDEX i10 ON t10(a,b);
+ COMMIT;
+ SELECT count(*) FROM t10;
+ }
+ } 1000
+ do_test where2-9.2 {
+ count {
+ SELECT * FROM t10 WHERE a=1 AND (b=2 OR b=3)
+ }
+ } {1 2 2 1 3 3 7}
+}
+
finish_test