1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

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
This commit is contained in:
drh
2025-04-30 12:48:20 +00:00
parent a20c09c477
commit 88ed1806a4
5 changed files with 35 additions and 16 deletions

View File

@@ -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);