I wrote:
> Your idea of handling the wraparound ambiguity by ignoring
> InvalidTransactionId isn't bad --- I'll take a look at that.
OK, I think this version may actually work, and get the wraparound
case right too. It hasn't failed yet on the pgbench test case anyway.
Matteo, could you try it on your test case?
regards, tom lane