From: drh Date: Thu, 14 May 2015 13:18:47 +0000 (+0000) Subject: Add testcase() macros. Get transitive WHERE clause constraints on IS operators X-Git-Tag: version-3.8.11~262^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee14587c3953f85e31ff38268ac91f268792b470;p=thirdparty%2Fsqlite.git Add testcase() macros. Get transitive WHERE clause constraints on IS operators working again. FossilOrigin-Name: d195d4a65d7184e34a2a08c3ac3db7f6c8c1c21c --- diff --git a/manifest b/manifest index 438ec23110..6fdcf36695 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C A\snew\simplementation\sof\sindexing\swith\sthe\sIS\soperator\sthat\sworks\scorrectly\nwhen\sthe\sIS\soperator\sis\sin\sthe\sWHERE\sclause\sand\sthe\soperands\sare\sfrom\s\nopposite\ssides\sof\sa\sLEFT\sJOIN. -D 2015-05-14T01:05:25.274 +C Add\stestcase()\smacros.\s\sGet\stransitive\sWHERE\sclause\sconstraints\son\sIS\soperators\nworking\sagain. +D 2015-05-14T13:18:47.128 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in edfc69769e613a6359c42c06ea1d42c3bece1736 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -307,7 +307,7 @@ F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb F src/wal.c ce2cb2d06faab54d1bce3e739bec79e063dd9113 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 -F src/where.c 64afb483fe8bede1e31e6c66bc532530a4600543 +F src/where.c cabecc4a0f647f552b7467a86ff3c2e48487399d F src/whereInt.h a6f5a762bc1b4b1c76e1cea79976b437ac35a435 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1258,7 +1258,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 95b1f9bf14e490c6c6bba9ea78aeab712a44aab5 -R 6e0cd1da1bcd5d739d5d402ab5201f6c +P 4541688b3f56f5cd3d5b299594b58c577ad633bb +R 201c526060c4a057a45ebf1fee55c845 U drh -Z 3608a708c2f560b3e002545b6da23dda +Z 9f199a1ff5417af5f644d4d006d00b95 diff --git a/manifest.uuid b/manifest.uuid index 2dcd8f7064..ccbe8e23d7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4541688b3f56f5cd3d5b299594b58c577ad633bb \ No newline at end of file +d195d4a65d7184e34a2a08c3ac3db7f6c8c1c21c \ No newline at end of file diff --git a/src/where.c b/src/where.c index 3c96f93a7e..4792b13e60 100644 --- a/src/where.c +++ b/src/where.c @@ -1280,7 +1280,7 @@ static void exprAnalyze( markTermAsChild(pWC, idxNew, idxTerm); pTerm = &pWC->a[idxTerm]; pTerm->wtFlags |= TERM_COPIED; - if( pExpr->op==TK_EQ + if( (op==TK_EQ || op==TK_IS) && !ExprHasProperty(pExpr, EP_FromJoin) && OptimizationEnabled(db, SQLITE_Transitive) ){ @@ -1904,8 +1904,9 @@ static sqlite3_index_info *allocateIndexInfo( assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); testcase( pTerm->eOperator & WO_IN ); testcase( pTerm->eOperator & WO_ISNULL ); + testcase( pTerm->eOperator & WO_IS ); testcase( pTerm->eOperator & WO_ALL ); - if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV))==0 ) continue; + if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV|WO_IS))==0 ) continue; if( pTerm->wtFlags & TERM_VNULL ) continue; nTerm++; } @@ -1956,6 +1957,7 @@ static sqlite3_index_info *allocateIndexInfo( if( pTerm->leftCursor != pSrc->iCursor ) continue; assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); testcase( pTerm->eOperator & WO_IN ); + testcase( pTerm->eOperator & WO_IS ); testcase( pTerm->eOperator & WO_ISNULL ); testcase( pTerm->eOperator & WO_ALL ); if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV|WO_IS))==0 ) continue; @@ -4107,7 +4109,8 @@ static Bitmask codeOneLoopStart( Expr *pE, *pEAlt; WhereTerm *pAlt; if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; - if( (pTerm->eOperator&(WO_EQUIV|WO_EQ|WO_IS))<=WO_EQUIV ) continue; + if( (pTerm->eOperator & WO_EQUIV)==0 ) continue; + if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue; if( pTerm->leftCursor!=iCur ) continue; if( pLevel->iLeftJoin ) continue; pE = pTerm->pExpr; @@ -4731,7 +4734,7 @@ static int whereLoopAddBtreeIndex( assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 ); if( pNew->wsFlags & WHERE_BTM_LIMIT ){ opMask = WO_LT|WO_LE; - }else if( pProbe->tnum<=0 || (pSrc->jointype & JT_LEFT)!=0 ){ + }else if( /*pProbe->tnum<=0 ||*/ (pSrc->jointype & JT_LEFT)!=0 ){ opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE; }else{ opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS;