diff options
author | drh <drh@noemail.net> | 2011-09-16 22:10:57 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-09-16 22:10:57 +0000 |
commit | dfd2d9f6c90791914743c6e102980df6dd13845a (patch) | |
tree | 99bb81547afaefc147c61b83bb6deb60c0c127f3 /src/expr.c | |
parent | c377f3106b13af0c76be570998ea66b96eb3f313 (diff) | |
download | sqlite-dfd2d9f6c90791914743c6e102980df6dd13845a.tar.gz sqlite-dfd2d9f6c90791914743c6e102980df6dd13845a.zip |
Fix a problem with SQLITE_OMIT_TRACE that was introduced by the recent
OP_Once change.
FossilOrigin-Name: 96be3f7b59b3ed4703b907e29db629df34b2b56f
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/expr.c b/src/expr.c index 6fd08b27f..d024528d7 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1574,11 +1574,10 @@ int sqlite3CodeSubselect( int rMayHaveNull, /* Register that records whether NULLs exist in RHS */ int isRowid /* If true, LHS of IN operator is a rowid */ ){ - int testAddr = 0; /* One-time test address */ + int testAddr = -1; /* One-time test address */ int rReg = 0; /* Register storing resulting */ Vdbe *v = sqlite3GetVdbe(pParse); if( NEVER(v==0) ) return 0; - assert( sqlite3VdbeCurrentAddr(v)>0 ); sqlite3ExprCachePush(pParse); /* This code must be run in its entirety every time it is encountered @@ -1594,13 +1593,12 @@ int sqlite3CodeSubselect( if( !ExprHasAnyProperty(pExpr, EP_VarSelect) && !pParse->pTriggerTab ){ int mem = ++pParse->nMem; testAddr = sqlite3VdbeAddOp1(v, OP_Once, mem); - assert( testAddr>0 || pParse->db->mallocFailed ); } #ifndef SQLITE_OMIT_EXPLAIN if( pParse->explain==2 ){ char *zMsg = sqlite3MPrintf( - pParse->db, "EXECUTE %s%s SUBQUERY %d", testAddr?"":"CORRELATED ", + pParse->db, "EXECUTE %s%s SUBQUERY %d", testAddr>=0?"":"CORRELATED ", pExpr->op==TK_IN?"LIST":"SCALAR", pParse->iNextSelectId ); sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC); @@ -1692,9 +1690,9 @@ int sqlite3CodeSubselect( ** this code only executes once. Because for a non-constant ** expression we need to rerun this code each time. */ - if( testAddr && !sqlite3ExprIsConstant(pE2) ){ + if( testAddr>=0 && !sqlite3ExprIsConstant(pE2) ){ sqlite3VdbeChangeToNoop(v, testAddr); - testAddr = 0; + testAddr = -1; } /* Evaluate the expression and insert it into the temp table */ @@ -1763,7 +1761,7 @@ int sqlite3CodeSubselect( } } - if( testAddr ){ + if( testAddr>=0 ){ sqlite3VdbeJumpHere(v, testAddr); } sqlite3ExprCachePop(pParse, 1); |