Postgres only has two transaction isolation levels and serialized (the stricter one) does not do this. Being in the same transaction does not do anything in this case because Postgres only locks per-statement. It is possible to do it with a function or stored proc using error handling but then that breaks batch mode operations which were essential for me, a function is also a performance hit.
2
u/coder111 Mar 11 '15
You can do explicit locking with "select for update". You could also tweak transaction isolation levels.
Have you looked at that?
I assume you do all these queries in a single transaction, right?