Rollback to savepoint with repeatable read isolation
In PostgreSQL, a REPEATABLE READ transaction uses a fixed snapshot of the database.

So if a concurrent data modification caused a serialization error, then restoring to a savepoint and repeating the actions will always result in the same serialization error. You will still see the same state of the database, and if you update a row that has been modified after the snapshot was taken, that will still be the case.

You actually have to roll back and retry the whole transaction.

This is working as designed.

The SQL standard doesn't describe when exactly serialization errors should be thrown, because it does not deal with the implementation specifics of individual RDBMS. It says:


  The execution of a &lt;rollback statement&gt; may be initiated implicitly by an SQL-implementation when it detects
  the inability to guarantee the serializability of two or more concurrent SQL-transactions. When this error occurs,
  an exception condition is raised: transaction rollback &ndash; serialization failure.


So a database is at liberty to throw a serialization error whenever it thinks fit.