From 13cc90cfa208c8ca3f9b7ca27b11f977bda92d71 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 25 Feb 2015 00:24:41 +0000 Subject: [PATCH] Remove an always-false conditional from constructAutomaticIndex(). Put an assert() in its place to prove that the conditional is always false. FossilOrigin-Name: 3af300bf6f5bee0b51a4c1ac1dc3879771378bff --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/where.c | 11 +++++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index c6a94d0d59..b8fa723431 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Prevent\spartial\sindexes\son\sthe\stable\son\sthe\sleft\shand\sside\sof\sa\sLEFT\sJOIN\sfrom\sbeing\sincorrectly\squalified\sby\sa\sconstraint\sin\sthe\sON\sclause\sof\sthe\sjoin.\sThis\srelaxes\sthe\srule\sintroduced\sby\sthe\sprevious\scommit\s(as\sthe\spartial\sindexes\son\sthe\stable\son\sthe\srhs\sof\sthe\sLEFT\sJOIN\smay\snow\sbe\squalified\sby\sterms\swithin\sthe\sON\sclause). -D 2015-02-24T20:10:49.082 +C Remove\san\salways-false\sconditional\sfrom\sconstructAutomaticIndex().\s\sPut\san\nassert()\sin\sits\splace\sto\sprove\sthat\sthe\sconditional\sis\salways\sfalse. +D 2015-02-25T00:24:41.524 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6b9e7677829aa94b9f30949656e27312aefb9a46 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -306,7 +306,7 @@ F src/vtab.c 699f2b8d509cfe379c33dde33827875d5b030e01 F src/wal.c 39303f2c9db02a4e422cd8eb2c8760420c6a51fe F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 -F src/where.c 294423cf9a3c46377c3e246338ff2a38365ad922 +F src/where.c a50d5082b0fecd2bcf1725cdd012732d9d1e9d5c F src/whereInt.h d3633e9b592103241b74b0ec76185f3e5b8b62e0 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1239,7 +1239,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 491cfe9b3f87f5fcc579f953745012cea8d64db7 -R ca86a79194d1da36938ef90c0f8f3a89 -U dan -Z 37d3633be74b06dd46fb3d2721885844 +P 1d6fb43a576d335d2717e94d28385178c23c81a1 +R 3a88db56d427fb7fb84c3827bb156d55 +U drh +Z d1736e186e6b8e2f484863856fdaa011 diff --git a/manifest.uuid b/manifest.uuid index cd9fd72c3a..bdbc030145 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d6fb43a576d335d2717e94d28385178c23c81a1 \ No newline at end of file +3af300bf6f5bee0b51a4c1ac1dc3879771378bff \ No newline at end of file diff --git a/src/where.c b/src/where.c index f40b051a56..d01945de7f 100644 --- a/src/where.c +++ b/src/where.c @@ -1612,13 +1612,16 @@ static void constructAutomaticIndex( pLoop = pLevel->pWLoop; idxCols = 0; for(pTerm=pWC->a; pTermpExpr; + assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */ + || pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */ + || pLoop->prereq!=0 ); /* table of a LEFT JOIN */ if( pLoop->prereq==0 && (pTerm->wtFlags & TERM_VIRTUAL)==0 - && (!ExprHasProperty(pTerm->pExpr, EP_FromJoin) - || pTerm->pExpr->iRightJoinTable==pSrc->iCursor) - && sqlite3ExprIsTableConstant(pTerm->pExpr, pSrc->iCursor) ){ + && !ExprHasProperty(pExpr, EP_FromJoin) + && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){ pPartial = sqlite3ExprAnd(pParse->db, pPartial, - sqlite3ExprDup(pParse->db, pTerm->pExpr, 0)); + sqlite3ExprDup(pParse->db, pExpr, 0)); } if( termCanDriveIndex(pTerm, pSrc, notReady) ){ int iCol = pTerm->u.leftColumn; -- 2.47.2