aboutsummaryrefslogtreecommitdiff
path: root/src/where.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2008-10-25 15:03:20 +0000
committerdrh <drh@noemail.net>2008-10-25 15:03:20 +0000
commit31daa63f3e01561a414b86a4ce047b69b4cc9fea (patch)
tree46a9a4c6fbc56b090549d31f75ab90367e38a782 /src/where.c
parenta2f8c24ca3303040f31389efb3d21c69843e1d92 (diff)
downloadsqlite-31daa63f3e01561a414b86a4ce047b69b4cc9fea.tar.gz
sqlite-31daa63f3e01561a414b86a4ce047b69b4cc9fea.zip
Disable the result-set alias cache when on conditional code branches.
Ticket #3461. The column cache and result set alias cache mechanisms are prone to this kind of error and need to be refactored. This check-in should be considered a temporary fix in advance of a more general redesign of the whole mechanism. (CVS 5841) FossilOrigin-Name: 1fa3bbd8220ce073e91935ea362b6f5d5d6d2859
Diffstat (limited to 'src/where.c')
-rw-r--r--src/where.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/where.c b/src/where.c
index 22a3598cd..d5f8dabd2 100644
--- a/src/where.c
+++ b/src/where.c
@@ -16,7 +16,7 @@
** 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.326 2008/10/11 16:47:36 drh Exp $
+** $Id: where.c,v 1.327 2008/10/25 15:03:21 drh Exp $
*/
#include "sqliteInt.h"
@@ -2349,7 +2349,7 @@ WhereInfo *sqlite3WhereBegin(
*/
notReady = ~(Bitmask)0;
for(i=0, pLevel=pWInfo->a; i<pTabList->nSrc; i++, pLevel++){
- int j;
+ int j, k;
int iCur = pTabItem->iCursor; /* The VDBE cursor for the table */
Index *pIdx; /* The index we will be using */
int nxt; /* Where to jump to continue with the next IN case */
@@ -2716,6 +2716,7 @@ WhereInfo *sqlite3WhereBegin(
/* Insert code to test every subexpression that can be completely
** computed using the current set of tables.
*/
+ k = 0;
for(pTerm=wc.a, j=wc.nTerm; j>0; j--, pTerm++){
Expr *pE;
testcase( pTerm->flags & TERM_VIRTUAL );
@@ -2727,7 +2728,10 @@ WhereInfo *sqlite3WhereBegin(
if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
continue;
}
+ pParse->disableColCache += k;
sqlite3ExprIfFalse(pParse, pE, cont, SQLITE_JUMPIFNULL);
+ pParse->disableColCache -= k;
+ k = 1;
pTerm->flags |= TERM_CODED;
}