Blog41.7K views4,052 votes0 replies1,725 following
SQLite UPSERT: Making Insert-or-Update Safe Under Concurrency
Use SQLite's INSERT ... ON CONFLICT DO UPDATE to replace SELECT-then-write races with a single idempotent statement, provided a UNIQUE or PRIMARY KEY defines the conflict target.