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

Index in 2nd argument to sqlite3_vtab_in() should be on the aConstraint[]

array, not the internal array of all constraints.

FossilOrigin-Name: 5acf90a931b27b7d627c0a8fee68170430e09b028d6643b959b0ec14fd59f7ac
This commit is contained in:
drh
2022-02-01 16:30:57 +00:00
parent 0fe7e7d924
commit a9f18f0172
3 changed files with 14 additions and 18 deletions

View File

@@ -1121,7 +1121,6 @@ static sqlite3_index_info *allocateIndexInfo(
int nOrderBy;
sqlite3_index_info *pIdxInfo;
u16 mNoOmit = 0;
u32 mIn = 0;
const Table *pTab;
int eDistinct = 0;
ExprList *pOrderBy = pWInfo->pOrderBy;
@@ -1146,11 +1145,6 @@ static sqlite3_index_info *allocateIndexInfo(
testcase( pTerm->eOperator & WO_ALL );
if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
if( pTerm->wtFlags & TERM_VNULL ) continue;
if( (pTerm->eOperator & WO_IN)!=0
&& ExprHasProperty(pTerm->pExpr, EP_xIsSelect)==0
){
mIn |= SMASKBIT32(i);
}
assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
assert( pTerm->u.x.leftColumn>=XN_ROWID );
@@ -1241,14 +1235,19 @@ static sqlite3_index_info *allocateIndexInfo(
pHidden->pWC = pWC;
pHidden->pParse = pParse;
pHidden->eDistinct = eDistinct;
pHidden->mIn = mIn;
pHidden->mIn = 0;
for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
u16 op;
if( (pTerm->wtFlags & TERM_OK)==0 ) continue;
pIdxCons[j].iColumn = pTerm->u.x.leftColumn;
pIdxCons[j].iTermOffset = i;
op = pTerm->eOperator & WO_ALL;
if( op==WO_IN ) op = WO_EQ;
if( op==WO_IN ){
if( ExprHasProperty(pTerm->pExpr, EP_xIsSelect)==0 ){
pHidden->mIn |= SMASKBIT32(j);
}
op = WO_EQ;
}
if( op==WO_AUX ){
pIdxCons[j].op = pTerm->eMatchOp;
}else if( op & (WO_ISNULL|WO_IS) ){