1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Fix to the rowvalue logic that avoids disabling rowvalue inequality

contraints on a virtual table when the virtual table sets the omit flag.
The logic has been incorrect since row-values were added.  However, this
does not come up often as very few virtual tables implement inequality
constraints using the omit flag.  Ticket [f096d191b6641daa]

FossilOrigin-Name: b7810062ec2489e1c5ca6638dbeb0892e4ce376c5c1834a31d1a332ebab8a871
This commit is contained in:
drh
2019-12-05 21:46:23 +00:00
parent 6c903845cd
commit b6c947251b
4 changed files with 92 additions and 10 deletions

View File

@@ -1021,7 +1021,8 @@ static sqlite3_index_info *allocateIndexInfo(
if( op & (WO_LT|WO_LE|WO_GT|WO_GE)
&& sqlite3ExprIsVector(pTerm->pExpr->pRight)
){
if( i<16 ) mNoOmit |= (1 << i);
testcase( j!=i );
if( j<16 ) mNoOmit |= (1 << j);
if( op==WO_LT ) pIdxCons[j].op = WO_LE;
if( op==WO_GT ) pIdxCons[j].op = WO_GE;
}
@@ -3202,7 +3203,14 @@ static int whereLoopAddVirtualOne(
if( iTerm>mxTerm ) mxTerm = iTerm;
testcase( iTerm==15 );
testcase( iTerm==16 );
if( iTerm<16 && pUsage[i].omit ) pNew->u.vtab.omitMask |= 1<<iTerm;
if( iTerm<16 && pUsage[i].omit ){
if( ((1<<i)&mNoOmit)==0 ){
testcase( i!=iTerm );
pNew->u.vtab.omitMask |= 1<<iTerm;
}else{
testcase( i!=iTerm );
}
}
if( (pTerm->eOperator & WO_IN)!=0 ){
/* A virtual table that is constrained by an IN clause may not
** consume the ORDER BY clause because (1) the order of IN terms
@@ -3215,7 +3223,6 @@ static int whereLoopAddVirtualOne(
}
}
}
pNew->u.vtab.omitMask &= ~mNoOmit;
pNew->nLTerm = mxTerm+1;
for(i=0; i<=mxTerm; i++){