How do I lock on an InnoDB row that doesn’t exist yet?
While the answer above is true in that a SELECT … FOR UPDATE will prevent concurrent sessions / transactions from inserting the same record, that is not the full truth. I am currently fighting with the same problem and have come to the conclusion that the SELECT … FOR UPDATE is nearly useless in that … Read more