FOR UPDATE will lock a row to prevent other clients from accessing it, as is well documented.
FOR UPDATE have an effect on pending inserts from concurrent clients as well?
For example, assume two clients, C1 and C2, concurrently doing:
FOR UPDATEverifying that a specific row R does not exist
- Insert the specific row R
What is the expected outcome:
- C1 and C2 both fail fail to lock a row since the row does not exist. C1 and C2 both insert a specific row R.
- Atomicity and isolation (ACID) guarantee that one and only one client will successfully insert a specific row R. The other transaction will see the inserted row and thus not insert a duplicate.