> Good catch. Look like we also had a real-life serialization issue, this was already mentioned and fixed differently by Andrey in another thread [1]. That thread also has a different serialization-related patch I was reviewing at the same time, and I didn't notice that Andrey sent another email that day.
His patch also handles a similar issue in DO UPDATE / DO NOTHING which my patch didn't address. > I don't think this is quite right though. The details of how heapam uses SI > locks is heapam specific and should live in the heapam code. I also think you > actually need to acquire the predicate lock before ExecOnConflictLockRow()? You are right, and after looking at Andrey's patch I think that it also might have a similar but smaller race window, so I'll still attach this v2 as it tries a different direction. This v2 still only addresses the DO SELECT part. Please also take a look at the patches in the other thread, both for this issue and the other more corner-case issue we were discussing there. [1] https://www.postgresql.org/message-id/[email protected]
v2-0001-Take-SIREAD-lock-on-rows-read-by-ON-CONFLICT-DO-S.patch
Description: Binary data
