> > I get above message from the backend while trying to update same raw
> > from different transactions (I guess). Is this normal?
>
> 1=>begin;
> 2=>begin;
> 1=>update t set a = 1 where c = 1;
> 2=>update t set a = 1 where c = 2;
> 1=>update t set a = 2 where c = 2; -- blocked by 2
> 2=>update t set a = 2 where c = 1; --> deadlock
My sessions look like:
begin;
update t set a = 1 where c = 1;
select * from t where c = 1;
end;
So I think there is no possibility of a deadlock. Note that the error
happens with relatively large number of concurrent transactions
running. I don't see the error at # of transactions = 1~32 while I get
errors at 63 (I didn't try 33~62). In each session which raw gets
updated is decided by a random generator, so increasing # of
transactions might also increases the chance of conflicts, or 63 might
hit some threshold of certain resources, I don't know. The interesting
thing is the error never happen if I set the transaction isolation
mode to "serializable."
If I have time, I would do more test cases.
---
Tatsuo Ishii