diff options
author | drh <drh@noemail.net> | 2018-04-20 13:18:51 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-04-20 13:18:51 +0000 |
commit | 7fc3aba8623e703cfdb2eade8ec3d1362da38907 (patch) | |
tree | 52282a5e1fb3fdfc8ae4575116ef4e9e0375ffb2 /src/update.c | |
parent | 2ac4e5cca9b882d142fd21c83a0e930f9bbd56da (diff) | |
download | sqlite-7fc3aba8623e703cfdb2eade8ec3d1362da38907.tar.gz sqlite-7fc3aba8623e703cfdb2eade8ec3d1362da38907.zip |
Enhance UPSERT so that the UPDATE uses the same set of cursors as the INSERT.
FossilOrigin-Name: c37f39d18d41ae5ba6c4561d87cbbf71f3b6896b86cc5cff9cdf046b02dc521a
Diffstat (limited to 'src/update.c')
-rw-r--r-- | src/update.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/update.c b/src/update.c index dd08b1668..92164b626 100644 --- a/src/update.c +++ b/src/update.c @@ -211,6 +211,11 @@ void sqlite3Update( } pParse->nTab++; } + if( pUpsert ){ + iDataCur = pUpsert->iDataCur; + iIdxCur = pUpsert->iIdxCur; + pParse->nTab = iBaseCur; + } pTabList->a[0].iCursor = iDataCur; /* Allocate space for aXRef[], aRegIdx[], and aToOpen[]. @@ -476,7 +481,7 @@ void sqlite3Update( } labelBreak = sqlite3VdbeMakeLabel(v); - if( !isView ){ + if( !isView && pUpsert==0 ){ int addrOnce = 0; /* Open every index that needs updating. */ |