Index: src/insert.c ================================================================== --- src/insert.c +++ src/insert.c @@ -1446,11 +1446,11 @@ /* 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 ){ + }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 && pUpIdx->pNext!=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 = sAddr.upsertTop2 = sqlite3VdbeMakeLabel(v); sAddr.upsertBtm = sqlite3VdbeMakeLabel(v); @@ -1606,11 +1606,11 @@ int regR; /* Range of registers holding conflicting PK */ int iThisCur; /* Cursor for this UNIQUE index */ int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */ if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */ - if( pUpIdx==pIdx ){ + if( pUpIdx==pIdx && pIdx->pNext!=0 ){ addrUniqueOk = sAddr.upsertBtm; upsertBypass = sqlite3VdbeGoto(v, 0); VdbeComment((v, "Skip upsert subroutine")); sqlite3VdbeResolveLabel(v, sAddr.upsertTop2); }else{ @@ -1816,11 +1816,11 @@ (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur); seenReplace = 1; break; } } - if( pUpIdx==pIdx ){ + if( pUpIdx==pIdx && pIdx->pNext!=0 ){ sqlite3VdbeJumpHere(v, upsertBypass); }else{ sqlite3VdbeResolveLabel(v, addrUniqueOk); } sqlite3ExprCachePop(pParse);