mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-19 21:43:15 +03:00
Fix a segfault in "ALTER TABLE t1 ADD COLUMN b DEFAULT (-+1)". Also an assert() failure that could occur if SQLITE_ENABLE_STAT4 were not defined.
FossilOrigin-Name: 9fec3e38287067d60874530300fbeb602958c951
This commit is contained in:
@@ -4242,12 +4242,15 @@ static int whereLoopAddBtreeIndex(
|
||||
int nIn = 0;
|
||||
#ifdef SQLITE_ENABLE_STAT4
|
||||
int nRecValid = pBuilder->nRecValid;
|
||||
assert( pNew->nOut==saved_nOut );
|
||||
if( (pTerm->wtFlags & TERM_VNULL)!=0 && pSrc->pTab->aCol[iCol].notNull ){
|
||||
continue; /* skip IS NOT NULL constraints on a NOT NULL column */
|
||||
}
|
||||
#endif
|
||||
if( pTerm->prereqRight & pNew->maskSelf ) continue;
|
||||
|
||||
assert( pNew->nOut==saved_nOut );
|
||||
|
||||
pNew->wsFlags = saved_wsFlags;
|
||||
pNew->u.btree.nEq = saved_nEq;
|
||||
pNew->nLTerm = saved_nLTerm;
|
||||
@@ -4340,9 +4343,9 @@ static int whereLoopAddBtreeIndex(
|
||||
){
|
||||
whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nInMul+nIn);
|
||||
}
|
||||
pNew->nOut = saved_nOut;
|
||||
#ifdef SQLITE_ENABLE_STAT4
|
||||
pBuilder->nRecValid = nRecValid;
|
||||
pNew->nOut = saved_nOut;
|
||||
#endif
|
||||
}
|
||||
pNew->prereq = saved_prereq;
|
||||
|
||||
Reference in New Issue
Block a user