mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-16 23:02:26 +03:00
Do not apply the optimization that omits DISTINCT if all result terms are
part of a UNIQUE index if the index is also a partial index. Fix for the bug reported by [forum:/forumpost/66954e9ece|forum post 66954e9ece]. FossilOrigin-Name: c2f940b02883e165172a4ca21c7095ffbef84ddc5367853dfeca93fda20d6056
This commit is contained in:
@@ -576,6 +576,7 @@ static int isDistinctRedundant(
|
||||
*/
|
||||
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
|
||||
if( !IsUniqueIndex(pIdx) ) continue;
|
||||
if( pIdx->pPartIdxWhere ) continue;
|
||||
for(i=0; i<pIdx->nKeyCol; i++){
|
||||
if( 0==sqlite3WhereFindTerm(pWC, iBase, i, ~(Bitmask)0, WO_EQ, pIdx) ){
|
||||
if( findIndexCol(pParse, pDistinct, iBase, pIdx, i)<0 ) break;
|
||||
|
||||
Reference in New Issue
Block a user