Hacker News new | ask | show | jobs
by jeltz 4501 days ago
This does not handle concurrent inserts though unless you rerun the code on unique violation.
1 comments

Correct, but if I write the upsert in that way - I actually understand what I'm doing... :)

If this is standard upsert query in your app, you should turn it into a procedure and parameterize, catch exceptions anyway.

Or you could mess around with transaction isolation.