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

Do not assume an index contains unique entries unless it is declared UNIQUE and NOT NULL is specified for all columns. Fix for [7b4fee9f6c].

FossilOrigin-Name: e3b1f625518edc0e925116668dca5d25c3232b59
This commit is contained in:
dan
2015-04-11 11:44:27 +00:00
parent 4a33507f60
commit 2813bde028
4 changed files with 27 additions and 10 deletions

View File

@@ -4781,7 +4781,7 @@ static int whereLoopAddBtreeIndex(
}else if( eOp & (WO_EQ) ){
pNew->wsFlags |= WHERE_COLUMN_EQ;
if( iCol<0 || (nInMul==0 && pNew->u.btree.nEq==pProbe->nKeyCol-1) ){
if( iCol>=0 && !IsUniqueIndex(pProbe) ){
if( iCol>=0 && pProbe->uniqNotNull==0 ){
pNew->wsFlags |= WHERE_UNQ_WANTED;
}else{
pNew->wsFlags |= WHERE_ONEROW;