1
0
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:
dan
2013-08-08 12:21:32 +00:00
parent 6cb8d76ccb
commit ad45ed7414
5 changed files with 21 additions and 11 deletions

View File

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