aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/where.c4
-rw-r--r--src/wherecode.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/where.c b/src/where.c
index b93e2260e..d31e0bb09 100644
--- a/src/where.c
+++ b/src/where.c
@@ -5084,8 +5084,10 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
sqlite3VdbeJumpHere(v, pIn->addrInTop+1);
if( pIn->eEndLoopOp!=OP_Noop ){
if( pIn->nPrefix ){
- sqlite3VdbeAddOp3(v, OP_Noop, pLevel->iIdxCur,
+ sqlite3VdbeAddOp4Int(v, OP_NotFound, pLevel->iIdxCur,
+ sqlite3VdbeCurrentAddr(v)+2,
pIn->iBase, pIn->nPrefix);
+ VdbeCoverage(v);
}
sqlite3VdbeAddOp2(v, pIn->eEndLoopOp, pIn->iCur, pIn->addrInTop);
VdbeCoverage(v);
diff --git a/src/wherecode.c b/src/wherecode.c
index 157812247..1c653c9f5 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -592,8 +592,12 @@ static int codeEqualityTerm(
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_PrevIfOpen : OP_NextIfOpen;
- pIn->iBase = iReg - i;
- pIn->nPrefix = i;
+ if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
+ pIn->iBase = iReg - i;
+ pIn->nPrefix = i;
+ }else{
+ pIn->nPrefix = 0;
+ }
}else{
pIn->eEndLoopOp = OP_Noop;
}