Improvement on check-in [a193749730d6cfba] so that the subroutine call to

the IN operator right-hand side generator from the RIGHT JOIN no-match logic
does not generate unreachable byte code.

FossilOrigin-Name: cc458317bd77046c4328715ae9e3409f3f4cd422a01162cb33405ef3a142b0a3
This commit is contained in:
drh
2022-05-02 14:32:56 +00:00
parent b94182bdc6
commit 3a45d30ea5
5 changed files with 21 additions and 18 deletions
+2 -7
View File
@@ -612,7 +612,7 @@ static int codeEqualityTerm(
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab);
}else{
Expr *pExpr = pTerm->pExpr;
if( pExpr->iTable==0 || !ExprHasProperty(pExpr, EP_Subrtn) ){
if( pExpr->iTable==0 || !ExprHasProperty(pExpr, EP_Subrtn) ){
sqlite3 *db = pParse->db;
pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
if( !db->mallocFailed ){
@@ -622,14 +622,9 @@ static int codeEqualityTerm(
}
sqlite3ExprDelete(db, pX);
}else{
int j1;
sqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn,
pExpr->y.sub.iAddr);
j1 = sqlite3VdbeAddOp0(v, OP_Goto);
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap,&iTab);
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP|IN_INDEX_REUSE_CUR, 0, aiMap,&iTab);
iTab = pExpr->iTable;
sqlite3VdbeJumpHere(v, j1);
}
pX = pExpr;
}