Michael Brown <mbrown(at)fensystems(dot)co(dot)uk> writes:
> I believe that Example 38-2 ("Exceptions with UPDATE/INSERT") in the PL/pgSQL
> documentation suffers from a race condition leading to a potential infinite
> loop when running at isolation level SERIALIZABLE.
You're right, it's not designed to work in serializable mode.
regards, tom lane