I've two threads countinuously updataing rows in the same table.
There can't be two active transactions updating the same row (my bug apart but I don't think so).
I get "could not serialize access due to read/write dependencies among transactions"
I din't expect to see it, hence there must be something in postgresql theory that I haven't understood well and I'd like a clarification.
Below here a log of commands issued by my threads followed by the error msg from PG server.
thread 0: BEGIN
thread 1: BEGIN
thread 0: UPDATE stato SET dati=$1 WHERE id=0;
thread 0: UPDATE stato SET dati=$1 WHERE id=1;
thread 1: UPDATE stato SET dati=$1 WHERE id=10;
thread 0: UPDATE stato SET dati=$1 WHERE id=2;
thread 1: UPDATE stato SET dati=$1 WHERE id=11;
thread 1: UPDATE stato SET dati=$1 WHERE id=12;
thread 0: UPDATE stato SET dati=$1 WHERE id=3;
thread 1: UPDATE stato SET dati=$1 WHERE id=13;
thread 0: UPDATE stato SET dati=$1 WHERE id=4;
thread 1: UPDATE stato SET dati=$1 WHERE id=14;
thread 0: UPDATE stato SET dati=$1 WHERE id=5;
thread 1: UPDATE stato SET dati=$1 WHERE id=15;
thread 1: UPDATE stato SET dati=$1 WHERE id=16;
thread 0: UPDATE stato SET dati=$1 WHERE id=6;
thread 1: UPDATE stato SET dati=$1 WHERE id=17;
thread 0: UPDATE stato SET dati=$1 WHERE id=7;
thread 1: UPDATE stato SET dati=$1 WHERE id=18;
thread 1: UPDATE stato SET dati=$1 WHERE id=19;
thread 0: UPDATE stato SET dati=$1 WHERE id=8;
thread 0: UPDATE stato SET dati=$1 WHERE id=9;
thread 1: COMMIT
thread 0:UPDATE ERROR
ERROR: could not serialize access due to read/write dependencies among transactions
DETAIL: Reason code: Canceled on identification as a pivot, during conflict out checking.
HINT: The transaction might succeed if retried.
STATEMENT: UPDATE stato SET dati=$1 WHERE id=9;