diff options
author | drh <drh@noemail.net> | 2016-08-20 00:07:01 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-08-20 00:07:01 +0000 |
commit | fc7f27b9d2e4083faba332a9a15d182549f68cb2 (patch) | |
tree | dd3863898d7a12319063c734cb3d79567e0cdb3d /src/wherecode.c | |
parent | 8d25cb90cdc01b79eb368299c24846388c4e7866 (diff) | |
download | sqlite-fc7f27b9d2e4083faba332a9a15d182549f68cb2.tar.gz sqlite-fc7f27b9d2e4083faba332a9a15d182549f68cb2.zip |
Change the way TK_SELECT_COLUMN is handled so that the subquery is only
generated once even if part of the vector comparison is used for indexing
and the other part is now. This change also is a pathway to vector assignment
in UPDATE statements.
FossilOrigin-Name: d8feea7dcde83179bff303072426561cfe825e58
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index dd15b5893..2ef9a46b5 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -377,34 +377,7 @@ static int codeEqualityTerm( assert( pLevel->pWLoop->aLTerm[iEq]==pTerm ); assert( iTarget>0 ); if( pX->op==TK_EQ || pX->op==TK_IS ){ - Expr *pRight = pX->pRight; -#ifndef SQLITE_OMIT_SUBQUERY - if( pRight->op==TK_SELECT_COLUMN ){ - /* This case occurs for expressions like "(a, b) == (SELECT ...)". */ - WhereLoop *pLoop = pLevel->pWLoop; - int i; - Expr *pSub = pRight->pLeft; - assert( pSub->op==TK_SELECT ); - for(i=pLoop->nSkip; i<iEq; i++){ - Expr *pExpr = pLoop->aLTerm[i]->pExpr->pRight; - if( pExpr && pExpr->op==TK_SELECT_COLUMN && pExpr->pLeft==pSub ) break; - } - - if( i==iEq ){ - iReg = sqlite3CodeSubselect(pParse, pSub, 0, 0); - for(/*no-op*/; i<pLoop->nLTerm; i++){ - Expr *pExpr = pLoop->aLTerm[i]->pExpr->pRight; - if( pExpr && pExpr->op==TK_SELECT_COLUMN && pExpr->pLeft==pSub ){ - sqlite3VdbeAddOp2(v, OP_Copy, iReg+pExpr->iColumn, iTarget-iEq+i); - } - } - } - iReg = iTarget; - }else -#endif - { - iReg = sqlite3ExprCodeTarget(pParse, pRight, iTarget); - } + iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); }else if( pX->op==TK_ISNULL ){ iReg = iTarget; sqlite3VdbeAddOp2(v, OP_Null, 0, iReg); @@ -1101,11 +1074,7 @@ Bitmask sqlite3WhereCodeOneLoopStart( addrNotFound = pLevel->addrNxt; }else{ Expr *pRight = pTerm->pExpr->pRight; - if( pRight->op==TK_SELECT_COLUMN ){ - codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget); - }else{ - codeExprOrVector(pParse, pRight, iTarget, 1); - } + codeExprOrVector(pParse, pRight, iTarget, 1); } } sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); |