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

Set the WHERE_UNIQUE flag on loops that can only run once.

FossilOrigin-Name: 510f4d8ecf6eb284f14b91951e7236505bd71203
This commit is contained in:
drh
2013-06-03 15:07:23 +00:00
parent 6186b30901
commit 21f7ff7d22
3 changed files with 13 additions and 7 deletions

View File

@@ -4017,6 +4017,12 @@ static int whereLoopAddBtreeIndex(
pNew->nOut = (double)iRowEst * nInMul * nIn;
}else if( pTerm->eOperator & (WO_EQ) ){
pNew->wsFlags |= WHERE_COLUMN_EQ;
if( iCol<0
|| (pProbe->onError==OE_Abort && nInMul==1
&& pNew->u.btree.nEq==pProbe->nColumn-1)
){
pNew->wsFlags |= WHERE_UNIQUE;
}
pNew->u.btree.nEq++;
pNew->nOut = (double)iRowEst * nInMul;
}else if( pTerm->eOperator & (WO_ISNULL) ){