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:
+7
-4
@@ -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
@@ -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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user