Always assume that indexed expressions can generate a NULL. Get

indexed expressions working for the case of two or more expressions in
the same index.

FossilOrigin-Name: cc60321a67bf9f169c090b47afb505f589a6925e
This commit is contained in:
drh
2015-08-31 19:38:42 +00:00
parent 390b88a448
commit 8492653c37
4 changed files with 16 additions and 13 deletions
+7 -4
View File
@@ -3126,13 +3126,16 @@ Index *sqlite3CreateIndex(
goto exit_create_index;
}
if( pIndex->aColExpr==0 ){
pIndex->aColExpr = sqlite3ExprListDup(db, pList, 0);
ExprList *pCopy = sqlite3ExprListDup(db, pList, 0);
pIndex->aColExpr = pCopy;
if( !db->mallocFailed ){
assert( pCopy!=0 );
pListItem = &pCopy->a[i];
}
}
j = -2;
pIndex->aiColumn[i] = -2;
if( sqlite3ExprCanBeNull(pList->a[i].pExpr) ){
pIndex->uniqNotNull = 1;
}
pIndex->uniqNotNull = 0;
}else{
j = pCExpr->iColumn;
assert( j<=0x7fff );
+1 -1
View File
@@ -395,7 +395,7 @@ static int indexColumnNotNull(Index *pIdx, int iCol){
return 1;
}else{
assert( j==(-2) );
return !sqlite3ExprCanBeNull(pIdx->aColExpr->a[iCol].pExpr);
return 0; /* Assume an indexed expression can always yield a NULL */
}
}