Skip to content

Commit b27b5da

Browse files
author
D. Richard Hipp
committed
Disable the vector-IN-SELECT optimization if the number of columns is so
large that it would cause the WhereTerm.nChild column to wrap. [bugs:/info/2026-06-04T10:00:49Z|Bug 2026-06-04T10:00:49Z].
1 parent d1ffb45 commit b27b5da

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/whereexpr.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,10 @@ static void transferJoinMarkings(Expr *pDerived, Expr *pBase){
515515
static void markTermAsChild(WhereClause *pWC, int iChild, int iParent){
516516
pWC->a[iChild].iParent = iParent;
517517
pWC->a[iChild].truthProb = pWC->a[iParent].truthProb;
518+
assert( pWC->a[iParent].nChild < UMXV(pWC->a[0].nChild) );
518519
pWC->a[iParent].nChild++;
520+
testcase( pWC->a[iParent].nChild == UMXV(pWC->a[0].nChild) );
521+
519522
}
520523

521524
/*
@@ -1292,6 +1295,7 @@ static void exprAnalyze(
12921295
pList = pExpr->x.pList;
12931296
assert( pList!=0 );
12941297
assert( pList->nExpr==2 );
1298+
assert( pWC->a[idxTerm].nChild==0 );
12951299
for(i=0; i<2; i++){
12961300
Expr *pNewExpr;
12971301
int idxNew;
@@ -1502,8 +1506,11 @@ static void exprAnalyze(
15021506
&& pExpr->x.pSelect->pWin==0
15031507
#endif
15041508
&& pWC->op==TK_AND
1509+
&& pExpr->x.pSelect->pEList->nExpr <= UMXV(pTerm->nChild)
1510+
/* ^-- See bug 2026-06-04T10:00:49Z */
15051511
){
15061512
int i;
1513+
assert( pTerm->nChild==0 );
15071514
for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){
15081515
int idxNew;
15091516
idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL|TERM_SLICE);

0 commit comments

Comments
 (0)