diff options
author | drh <drh@noemail.net> | 2019-12-09 18:22:17 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-12-09 18:22:17 +0000 |
commit | 0824d5b9a5a84bb5bd56dac23a48ba305077d268 (patch) | |
tree | 95f838addef326675b97a53882036c3ea3aa1b03 /src/resolve.c | |
parent | 926f796e8feec15f3836aa0a060ed906f8ae04d3 (diff) | |
download | sqlite-0824d5b9a5a84bb5bd56dac23a48ba305077d268.tar.gz sqlite-0824d5b9a5a84bb5bd56dac23a48ba305077d268.zip |
The previous check-in was not quite correct, and introduced a new problem
with the USING clause. Use this version instead.
FossilOrigin-Name: ed28aaa4851202111a502f883ca06359d89b25bba4055c29d7bce2b501cfcc68
Diffstat (limited to 'src/resolve.c')
-rw-r--r-- | src/resolve.c | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/src/resolve.c b/src/resolve.c index 5c01df4f8..e8e735aec 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -566,26 +566,21 @@ static int lookupName( if( pExpr->iColumn>=0 && pMatch!=0 ){ int n = pExpr->iColumn; Table *pTab; - testcase( n==BMS-1 ); - if( n>=BMS ){ - n = BMS-1; - } pTab = pExpr->y.pTab; assert( pTab!=0 ); assert( pMatch->iCursor==pExpr->iTable ); - if( pTab->tabFlags & TF_HasGenerated ){ - Column *pColumn = pTab->aCol + pExpr->iColumn; - if( pColumn->colFlags & COLFLAG_GENERATED ){ - testcase( pTab->nCol==63 ); - testcase( pTab->nCol==64 ); - if( pTab->nCol>=64 ){ - pMatch->colUsed = ALLBITS; - }else{ - pMatch->colUsed = MASKBIT(pTab->nCol)-1; - } - } + if( (pTab->tabFlags & TF_HasGenerated)!=0 + && (pTab->aCol[n].colFlags & COLFLAG_GENERATED)!=0 + ){ + testcase( pTab->nCol==BMS-1 ); + testcase( pTab->nCol==BMS ); + pMatch->colUsed = pTab->nCol>=BMS ? ALLBITS : MASKBIT(pTab->nCol)-1; + }else{ + testcase( n==BMS-1 ); + testcase( n==BMS ); + if( n>=BMS ) n = BMS-1; + pMatch->colUsed |= ((Bitmask)1)<<n; } - pMatch->colUsed |= ((Bitmask)1)<<n; } /* Clean up and return @@ -630,17 +625,12 @@ Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){ p->iColumn = -1; }else{ p->iColumn = (ynVar)iCol; - if( pTab->tabFlags & TF_HasGenerated ){ - Column *pColumn = pTab->aCol + iCol; - if( pColumn->colFlags & COLFLAG_GENERATED ){ - testcase( pTab->nCol==63 ); - testcase( pTab->nCol==64 ); - if( pTab->nCol>=64 ){ - pItem->colUsed = ALLBITS; - }else{ - pItem->colUsed = MASKBIT(pTab->nCol)-1; - } - } + if( (pTab->tabFlags & TF_HasGenerated)!=0 + && (pTab->aCol[iCol].colFlags & COLFLAG_GENERATED)!=0 + ){ + testcase( pTab->nCol==63 ); + testcase( pTab->nCol==64 ); + pItem->colUsed = pTab->nCol>=64 ? ALLBITS : MASKBIT(pTab->nCol)-1; }else{ testcase( iCol==BMS ); testcase( iCol==BMS-1 ); |