aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/select.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c
index 4958ddefe..dc187dfa6 100644
--- a/src/select.c
+++ b/src/select.c
@@ -5272,8 +5272,8 @@ static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
nCol = pTab->nCol;
for(j=0; j<nCol; j++){
Select *pX;
- if( (MASKBIT(j) & pItem->colUsed)!=0 ) continue;
- if( MASKBIT(j)==0 ) break;
+ Bitmask m = j<BMS-1 ? MASKBIT(j) : TOPBIT;
+ if( (m & pItem->colUsed)!=0 ) continue;
for(pX=pSub; pX; pX=pX->pPrior) {
Expr *pY = pX->pEList->a[j].pExpr;
if( pY->op==TK_NULL ) continue;