diff options
author | drh <drh@noemail.net> | 2018-04-17 18:18:05 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-04-17 18:18:05 +0000 |
commit | dedbc508113ebfebd7b80c1e82eabb0dde28023f (patch) | |
tree | 53f57deffa085e004223d2da99b560260eb56279 /src/insert.c | |
parent | 2cc00423a0696c866c49ea6debc68d83f7da17a8 (diff) | |
download | sqlite-dedbc508113ebfebd7b80c1e82eabb0dde28023f.tar.gz sqlite-dedbc508113ebfebd7b80c1e82eabb0dde28023f.zip |
Simplification to the upsert logic.
FossilOrigin-Name: f36d07a5b24cc48e3daa8b18dd34c50d9025c6c0ba019926610538b54f7b66ec
Diffstat (limited to 'src/insert.c')
-rw-r--r-- | src/insert.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/insert.c b/src/insert.c index c5c92d6b7..66cda0b1d 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1440,24 +1440,17 @@ void sqlite3GenerateConstraintChecks( ** in the list. See sqlite3CreateIndex() for where that happens. */ - /* If there is an ON CONFLICT clause without a constraint-target - ** (In other words, one of "ON CONFLICT DO NOTHING" or - ** "ON DUPLICATION KEY UPDATE") then change the overrideError to - ** whichever is appropriate. - */ if( pUpsert ){ if( pUpsert->pUpsertTarget==0 ){ - if( pUpsert->pUpsertSet==0 ){ - /* An ON CONFLICT DO NOTHING clause, without a constraint-target. - ** Make all unique constraint resolution be OE_Ignore */ - overrideError = OE_Ignore; - pUpsert = 0; - }else{ - /* An ON DUPLICATE KEY UPDATE clause. All unique constraints - ** do upsert processing */ - overrideError = OE_Update; - } + /* An ON CONFLICT DO NOTHING clause, without a constraint-target. + ** Make all unique constraint resolution be OE_Ignore */ + assert( pUpsert->pUpsertSet==0 ); + overrideError = OE_Ignore; + pUpsert = 0; }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){ + /* If the constraint-target is on some column other than + ** then ROWID, then we might need to move the UPSERT around + ** so that it occurs in the correct order. */ sAddr.upsertTop = sqlite3VdbeMakeLabel(v); sAddr.upsertBtm = sqlite3VdbeMakeLabel(v); } |