aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-08-18 19:04:57 +0000
committerdrh <drh@noemail.net>2016-08-18 19:04:57 +0000
commit03181c8c272003b3680096077737f41ba0f1041d (patch)
tree66a0376386bee10efeaef0cbfab4906add1d99ff /src/wherecode.c
parent48cb3a76004bab66c4228bb66c83b15fd05f1663 (diff)
downloadsqlite-03181c8c272003b3680096077737f41ba0f1041d.tar.gz
sqlite-03181c8c272003b3680096077737f41ba0f1041d.zip
Fix a SQL NULL handling bug in the vector IN operator code generation.
FossilOrigin-Name: 936146b12e27784f15a68fe65732c6d92c3a12f3
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index 80de8a7e5..d84ace192 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -499,15 +499,17 @@ static int codeEqualityTerm(
int iMap = 0; /* Index in aiMap[] */
pIn += i;
for(i=iEq;i<pLoop->nLTerm; i++, pIn++){
+ int iOut = iReg;
if( pLoop->aLTerm[i]->pExpr==pX ){
if( eType==IN_INDEX_ROWID ){
assert( nEq==1 && i==iEq );
pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg);
}else{
int iCol = aiMap ? aiMap[iMap++] : 0;
- int iOut = iReg + i - iEq;
+ iOut = iReg + i - iEq;
pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
}
+ sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_PrevIfOpen : OP_NextIfOpen;
@@ -515,7 +517,6 @@ static int codeEqualityTerm(
pIn->eEndLoopOp = OP_Noop;
}
}
- sqlite3VdbeAddOp1(v, OP_IsNull, iReg); VdbeCoverage(v);
}
}else{
pLevel->u.in.nIn = 0;