Fix to the previous checkin: The colUsed parameter should have high-order bit

set if any of the 64-th or greater columns of the virtual table is used.  The
lower 63 bits of colUsed always show the usage of the first 63 columns of the
virtual table.

FossilOrigin-Name: 90ac8457750ace1d76d7bc957af7877e86e6301bb07361e19beaf5c7b3b6085a
This commit is contained in:
drh
2024-08-03 23:00:17 +00:00
parent 133f930e61
commit 3a799b3e4e
3 changed files with 11 additions and 9 deletions
+4 -1
View File
@@ -1506,9 +1506,12 @@ static sqlite3_index_info *allocateIndexInfo(
/* Ensure that all bits associated with PK columns are set. This is to
** ensure they are available for cases like RIGHT joins or OR loops. */
Index *pPk = sqlite3PrimaryKeyIndex((Table*)pTab);
assert( pPk!=0 );
for(i=0; i<pPk->nKeyCol; i++){
int iCol = pPk->aiColumn[i];
pIdxInfo->colUsed |= (iCol>=BMS ? ALLBITS : MASKBIT(iCol));
assert( iCol>=0 );
if( iCol>=BMS-1 ) iCol = BMS-1;
pIdxInfo->colUsed |= MASKBIT(iCol);
}
}
pHidden->pWC = pWC;