diff options
author | drh <> | 2025-04-30 12:48:20 +0000 |
---|---|---|
committer | drh <> | 2025-04-30 12:48:20 +0000 |
commit | 88ed1806a4dae310ea08a9c2e6c5631e87c4fabb (patch) | |
tree | 4f263ccd3f641a744888dc0792df12d211da683b /src/expr.c | |
parent | a20c09c477da10497459093cd6fc92f097378d69 (diff) | |
download | sqlite-88ed1806a4dae310ea08a9c2e6c5631e87c4fabb.tar.gz sqlite-88ed1806a4dae310ea08a9c2e6c5631e87c4fabb.zip |
Fix an issue in Bloom filters on RHS subsqueries to IN operators.
See [forum:/forumpost/792a09cb3df9e69f|forum post 792a09cb3d] for
a description of the problem. Also improve comments related
to [baa83b460c677c21] which was origin of the problem.
FossilOrigin-Name: cdef486e212fe4b26605065d9cff08f608cb80df48ee64e4be63637769bdfacc
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/expr.c b/src/expr.c index dd5ea2038..bf15811bc 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3626,11 +3626,12 @@ void sqlite3CodeRhsOfIN( sqlite3SelectDelete(pParse->db, pCopy); sqlite3DbFree(pParse->db, dest.zAffSdst); if( addrBloom ){ + /* Remember that location of the Bloom filter in the P3 operand + ** of the OP_Once that began this subroutine. tag-202407032019 */ sqlite3VdbeGetOp(v, addrOnce)->p3 = dest.iSDParm2; if( dest.iSDParm2==0 ){ - sqlite3VdbeChangeToNoop(v, addrBloom); - }else{ - sqlite3VdbeGetOp(v, addrOnce)->p3 = dest.iSDParm2; + /* If the Bloom filter won't actually be used, keep it small */ + sqlite3VdbeGetOp(v, addrBloom)->p1 = 10; } } if( rc ){ @@ -4077,7 +4078,7 @@ static void sqlite3ExprCodeIN( if( ExprHasProperty(pExpr, EP_Subrtn) ){ const VdbeOp *pOp = sqlite3VdbeGetOp(v, pExpr->y.sub.iAddr); assert( pOp->opcode==OP_Once || pParse->nErr ); - if( pOp->opcode==OP_Once && pOp->p3>0 ){ + if( pOp->opcode==OP_Once && pOp->p3>0 ){ /* tag-202407032019 */ assert( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ); sqlite3VdbeAddOp4Int(v, OP_Filter, pOp->p3, destIfFalse, rLhs, nVector); VdbeCoverage(v); |