diff options
author | drh <drh@noemail.net> | 2016-11-11 19:08:00 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-11-11 19:08:00 +0000 |
commit | 66adb0a848fc66db518bd3df01abc03ccc71da99 (patch) | |
tree | fb7539128ebb1baf977bb4ad22fa68c6ddb48126 /src/expr.c | |
parent | 4b727f17d605b196e5e0674f058748f2e423d967 (diff) | |
parent | 04cd7aa373d0218a766aa24987a99d16bcdcbac2 (diff) | |
download | sqlite-66adb0a848fc66db518bd3df01abc03ccc71da99.tar.gz sqlite-66adb0a848fc66db518bd3df01abc03ccc71da99.zip |
Avoid storing redundant fields in sorter records when the sort-key
and data have fields in common.
FossilOrigin-Name: b835cf3e507b910b6a3e0f802ce2c40a72d0c227
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c index 0e9c7e783..639bafe0b 100644 --- a/src/expr.c +++ b/src/expr.c @@ -4086,8 +4086,13 @@ int sqlite3ExprCodeExprList( if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR; for(pItem=pList->a, i=0; i<n; i++, pItem++){ Expr *pExpr = pItem->pExpr; - if( (flags & SQLITE_ECEL_REF)!=0 && (j = pList->a[i].u.x.iOrderByCol)>0 ){ - sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); + if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){ + if( flags & SQLITE_ECEL_OMITREF ){ + i--; + n--; + }else{ + sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); + } }else if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstant(pExpr) ){ sqlite3ExprCodeAtInit(pParse, pExpr, target+i, 0); }else{ |