diff options
author | drh <drh@noemail.net> | 2016-08-23 18:30:10 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-08-23 18:30:10 +0000 |
commit | 66860af3dd71fc0242ce5ef89124f3f7deaa0e48 (patch) | |
tree | 14ae041f60b01228432c898e4395cd2e0751788d /src/expr.c | |
parent | abb9d5f18972f48fe9b461c44fc615b2d3366fbe (diff) | |
download | sqlite-66860af3dd71fc0242ce5ef89124f3f7deaa0e48.tar.gz sqlite-66860af3dd71fc0242ce5ef89124f3f7deaa0e48.zip |
Fix a problem with rowvalue UPDATE when the rowvalue is not the left-most and
the RHS is a multi-column subquery.
FossilOrigin-Name: e149e6b93a9afb3d574309c0db60e221e24078f7
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/expr.c b/src/expr.c index 829afc4cd..2e09d0798 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1489,6 +1489,7 @@ ExprList *sqlite3ExprListAppendVector( sqlite3 *db = pParse->db; int n; int i; + int iFirst = pList ? pList->nExpr : 0; if( pColumns==0 ) goto vector_append_error; if( pExpr==0 ) goto vector_append_error; n = sqlite3ExprVectorSize(pExpr); @@ -1501,14 +1502,15 @@ ExprList *sqlite3ExprListAppendVector( Expr *pSubExpr = sqlite3ExprForVectorField(pParse, pExpr, i); pList = sqlite3ExprListAppend(pParse, pList, pSubExpr); if( pList ){ + assert( pList->nExpr==iFirst+i+1 ); pList->a[pList->nExpr-1].zName = pColumns->a[i].zName; pColumns->a[i].zName = 0; } } if( pExpr->op==TK_SELECT ){ - if( pList && pList->a[0].pExpr ){ - assert( pList->a[0].pExpr->op==TK_SELECT_COLUMN ); - pList->a[0].pExpr->pRight = pExpr; + if( pList && pList->a[iFirst].pExpr ){ + assert( pList->a[iFirst].pExpr->op==TK_SELECT_COLUMN ); + pList->a[iFirst].pExpr->pRight = pExpr; pExpr = 0; } } |