From: drh Date: Thu, 27 Aug 2015 19:56:49 +0000 (+0000) Subject: Fix problems in the indexed-expression handling in the optimizer. X-Git-Tag: version-3.9.0~150^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=29d03f6517918b1e67f630e9984d1f8d726df401;p=thirdparty%2Fsqlite.git Fix problems in the indexed-expression handling in the optimizer. FossilOrigin-Name: 03375017691d5b480e73d712c4318632e835060c --- diff --git a/manifest b/manifest index 2b7ae5a002..2a88bdcb4d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Activate\sthe\sability\sto\suse\sexpressions\sin\sindexes\sin\sa\squery.\s\sThere\sare\ssome\ntest\sfailures,\sbut\smostly\sthis\sseems\sto\swork. -D 2015-08-27T18:24:02.056 +C Fix\sproblems\sin\sthe\sindexed-expression\shandling\sin\sthe\soptimizer. +D 2015-08-27T19:56:49.408 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in e2218eb228374422969de7b1680eda6864affcef F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -414,7 +414,7 @@ F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb F src/wal.c 6fb6b68969e4692593c2552c4e7bff5882de2cb8 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 2e14d17f592d176b6dc879c33fbdec4fbccaa2ba -F src/where.c 29851b4a1a93934fef1bde3d0a1e7407efd57543 +F src/where.c fcdded4bf274bf527020436e8895b33d575f18f6 F src/whereInt.h 292d3ac90da4eab1e03ac8452f1add746bcafaa1 F src/wherecode.c 3d9113cc307ffeed58db41fe9f2d807c94787ab5 F src/whereexpr.c 990ed42b5940d4000e7e61887a4bbed412c80488 @@ -1380,7 +1380,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c80e9e8e8cc1e7676d7c782ee0827726875db79e -R ff3e8c131dda72b26dbe6f001a80b515 +P 42f93f582eccd8a778189aa6c113874f995ab751 +R 475d6e7258921a9c57642e7cd0e82c9c U drh -Z 3e34cddbe64a99afb651902a91a49bea +Z 29a0c57d5a3080634424e9023a9fd1e9 diff --git a/manifest.uuid b/manifest.uuid index 62cf69b6e4..d483132b90 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -42f93f582eccd8a778189aa6c113874f995ab751 \ No newline at end of file +03375017691d5b480e73d712c4318632e835060c \ No newline at end of file diff --git a/src/where.c b/src/where.c index ad1eecd920..c78563f1c5 100644 --- a/src/where.c +++ b/src/where.c @@ -180,7 +180,7 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ while( pScan->iEquiv<=pScan->nEquiv ){ iCur = pScan->aiCur[pScan->iEquiv-1]; iColumn = pScan->aiColumn[pScan->iEquiv-1]; - assert( iColumn!=(-2) || pScan->pIdxExpr!=0 ); + if( iColumn==(-2) && pScan->pIdxExpr==0 ) return 0; while( (pWC = pScan->pWC)!=0 ){ for(pTerm=pWC->a+k; knTerm; k++, pTerm++){ if( pTerm->leftCursor==iCur @@ -804,6 +804,7 @@ static sqlite3_index_info *allocateIndexInfo( testcase( pTerm->eOperator & WO_ALL ); if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV|WO_IS))==0 ) continue; if( pTerm->wtFlags & TERM_VNULL ) continue; + if( pTerm->u.leftColumn<(-1) ) continue; nTerm++; } @@ -859,6 +860,7 @@ static sqlite3_index_info *allocateIndexInfo( testcase( pTerm->eOperator & WO_ALL ); if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV|WO_IS))==0 ) continue; if( pTerm->wtFlags & TERM_VNULL ) continue; + if( pTerm->u.leftColumn<(-1) ) continue; pIdxCons[j].iColumn = pTerm->u.leftColumn; pIdxCons[j].iTermOffset = i; op = (u8)pTerm->eOperator & WO_ALL;