diff options
author | drh <> | 2024-08-03 23:00:17 +0000 |
---|---|---|
committer | drh <> | 2024-08-03 23:00:17 +0000 |
commit | 3a799b3e4e9f485e6efeb08fc508ee6570b6fa3b (patch) | |
tree | 37a533c8181c9d7fd7c3ecb2f1b6bee0ef91df83 /src | |
parent | 133f930e61cc3e43369a44959169abe525b9a822 (diff) | |
download | sqlite-3a799b3e4e9f485e6efeb08fc508ee6570b6fa3b.tar.gz sqlite-3a799b3e4e9f485e6efeb08fc508ee6570b6fa3b.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/where.c b/src/where.c index 35c6f204a..c850121c3 100644 --- a/src/where.c +++ b/src/where.c @@ -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; |