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

Ignore IS NOT NULL and NOT NULL constraints on NOT NULL columns.

FossilOrigin-Name: e476408e3c5ba5f3ba5e98ff264167c163d72e3f
This commit is contained in:
drh
2013-08-20 17:00:55 +00:00
parent 4044906210
commit d0aa2f3afd
5 changed files with 24 additions and 14 deletions

View File

@@ -4336,13 +4336,11 @@ static int whereLoopAddBtreeIndex(
for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){
int nIn = 0;
if( pTerm->prereqRight & pNew->maskSelf ) continue;
#ifdef SQLITE_ENABLE_STAT3
if( (pTerm->wtFlags & TERM_VNULL)!=0
if( (pTerm->eOperator==WO_ISNULL || (pTerm->wtFlags&TERM_VNULL)!=0)
&& (iCol<0 || pSrc->pTab->aCol[iCol].notNull)
){
continue; /* skip IS NOT NULL constraints on a NOT NULL column */
continue; /* ignore IS [NOT] NULL constraints on NOT NULL columns */
}
#endif
pNew->wsFlags = saved_wsFlags;
pNew->u.btree.nEq = saved_nEq;
pNew->nLTerm = saved_nLTerm;