1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

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
This commit is contained in:
drh
2008-10-25 15:03:20 +00:00
parent a2f8c24ca3
commit 31daa63f3e
6 changed files with 43 additions and 34 deletions

View File

@@ -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;
}