ON CONFLICT Rollback algorithm in SQLite
Why we use Rollback algorithm in ON CONFLICT clause when Abort algorithm also work same.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pravin MoreRank #1,419 · 1.2K reputationPosted Nov 29, 2011, 11:20 PM EST
hi monika ,
see, there is difference between both because
when we use Rollback, and conflict occure then it ROLLBACKs current transaction
but when we use ABORT,and conflict occure then it rollbacks changes of current sql statment not transaction.
so ABORT undo changes of current sql statement and
ROLLBACk undo changes of current transaction
Thanks,
Pravin.
Monika AroraRank #3,013 · 478 reputationPosted Nov 30, 2011, 12:29 AM EST
Monika AroraRank #3,013 · 478 reputationPosted Nov 30, 2011, 9:35 PM EST
Pravin MoreRank #1,419 · 1.2K reputationPosted Nov 30, 2011, 10:11 PM EST
before starting transaction you have code is 1
then you start transaction and in that
1st you update id to 6
2nd you try to update to NULL and conflict occure so rollback will undo code to 1.(it was before start of transaction)
thats the concept.
if you are not geting result like this then please check transaction
i am assuming that you are going to put 2 update in same transaction i.e update to 6 and update to null.
Thanks,
Pravin.
Monika AroraRank #3,013 · 478 reputationPosted Nov 30, 2011, 11:06 PM EST