From: drh Date: Thu, 30 May 2013 22:27:09 +0000 (+0000) Subject: Incremental check-in with various NGQP fixes. Many tests still fail. X-Git-Tag: version-3.8.0~130^2~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b0f026dbb0fe56141cb198a2722d42c7be75cb2;p=thirdparty%2Fsqlite.git Incremental check-in with various NGQP fixes. Many tests still fail. FossilOrigin-Name: a51d8c92496436488e1a6eabd85785e8fedf2736 --- diff --git a/manifest b/manifest index b536417138..e2d80171bf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Futher\ssimplifications\sto\sthe\sNGQP.\s\sFix\ssome\stest\scases\sto\suse\nEXPLAIN\sQUERY\sPLAN\srather\sthan\sthe\s(now\sobsolete)\ssqlite_query_plan\nglobal\svariable. -D 2013-05-30T19:29:19.963 +C Incremental\scheck-in\swith\svarious\sNGQP\sfixes.\s\sMany\stests\sstill\sfail. +D 2013-05-30T22:27:09.004 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -289,7 +289,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83 F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73 -F src/where.c 3e9b7b3323f78ec3056c5e3aa3443661bc590054 +F src/where.c 28e0cefe34698b6de4e6f5484cd987ae993c49f2 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6 @@ -1093,7 +1093,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac -P a3b4e261bd7e278f150872cce7b020af5ad8d2ed -R b028bf2657ab598aee5d4698a0488fdc +P ae985db4fa08b5efbef5a834e852f0b05101264b +R 5e6d0ab71af5f0e6d4eac06636af5d1b U drh -Z 3432943259d0f5aa9c669ba0e80caf85 +Z 130160475bcddf72f5447461f586642a diff --git a/manifest.uuid b/manifest.uuid index bdeb520d01..22be55a88a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ae985db4fa08b5efbef5a834e852f0b05101264b \ No newline at end of file +a51d8c92496436488e1a6eabd85785e8fedf2736 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 8ddbd5d72b..5663e68491 100644 --- a/src/where.c +++ b/src/where.c @@ -3183,8 +3183,7 @@ static Bitmask codeOneLoopStart( sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg); sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL); } - }else if( pLoop->wsFlags & (WHERE_COLUMN_RANGE | WHERE_COLUMN_NULL | - WHERE_COLUMN_EQ | WHERE_IDX_ONLY) ){ + }else if( pLoop->wsFlags & WHERE_INDEXED ){ /* Case 4: A scan using an index. ** ** The WHERE clause may contain zero or more equality @@ -3425,7 +3424,8 @@ static Bitmask codeOneLoopStart( pLevel->op = OP_Next; } pLevel->p1 = iIdxCur; - if( pLoop->wsFlags & WHERE_COVER_SCAN ){ + if( (pLoop->wsFlags & (WHERE_COLUMN_EQ | WHERE_COLUMN_RANGE | + WHERE_COLUMN_NULL | WHERE_COLUMN_IN))==0 ){ pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP; }else{ assert( pLevel->p5==0 ); @@ -3875,6 +3875,18 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ */ for(ppPrev=&pWInfo->pLoops, p=*ppPrev; p; ppPrev=&p->pNextLoop, p=*ppPrev){ if( p->iTab!=pTemplate->iTab || p->iSortIdx!=pTemplate->iSortIdx ) continue; + if( p->nTermnTerm + && (p->wsFlags & WHERE_INDEXED)!=0 + && (pTemplate->wsFlags & WHERE_INDEXED)!=0 + && p->u.btree.pIndex==pTemplate->u.btree.pIndex + && p->prereq==pTemplate->prereq + ){ + /* Overwrite an existing WhereLoop with an similar one that uses + ** more terms of the index */ + pNext = p->pNextLoop; + whereLoopClear(db, p); + break; + } if( (p->prereq & pTemplate->prereq)==p->prereq && p->rSetup<=pTemplate->rSetup && p->rRun<=pTemplate->rRun @@ -4590,7 +4602,10 @@ static int wherePathSatisfiesOrderBy( iColumn = -1; revIdx = 0; } - if( pOBExpr->iColumn!=iColumn ) return 0; + if( pOBExpr->iColumn!=iColumn ){ + if( ju.btree.nEq ){ nUsed--; continue; } + return 0; + } if( iColumn>=0 ){ pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[nUsed].pExpr); if( !pColl ) pColl = db->pDfltColl;