"sergey" <opium(at)ydk(dot)com(dot)ua> writes:
> ERROR: 40P01: deadlock detected
> DETAIL: Process 10237 waits for ShareLock on transaction 165664; blocked by
> process 10242.
> Process 10242 waits for ShareLock on transaction 165691; blocked by
> process 10237.
> Process 10237: UPDATE test SET y=1;
> Process 10242: UPDATE test SET y=1;
> HINT: See server log for query details.
> LOCATION: DeadLockReport, deadlock.c:944
This is not a bug. Your code is trying to update the same rows in
conflicting orders.
regards, tom lane