Re: Recovering from failed transaction - Mailing list pgsql-general

From Jeff Janes
Subject Re: Recovering from failed transaction
Date
Msg-id CAMkU=1ySYe7GAfSTVRwoJnCmfLb9s31WFph5ARPQ-CVBZq0_RA@mail.gmail.com
Whole thread Raw
In response to Recovering from failed transaction  (Brian Crowell <brian@fluggo.com>)
Responses Re: Recovering from failed transaction  (Brian Crowell <brian@fluggo.com>)
List pgsql-general
On Mon, Mar 10, 2014 at 1:41 PM, Brian Crowell <brian@fluggo.com> wrote:
I feel dumb asking this question, but I can't seem to find the answer online.

I'm running serializable transactions, and so naturally, they will
sometimes fail with the error "could not serialize access due to
concurrent update."

But then I try to issue a ROLLBACK so I can continue using the
connection, and I get error 25P02: "current transaction is aborted,
commands ignored until end of transaction block."

...doesn't "ROLLBACK" end a transaction block? What does Postgres want
here? How can I retry without closing the connection altogether?

What tool are you using to connect to the database?  Perhaps it is confusing the error response to some earlier statement in the stream with the response for the rollback.  Or maybe it is mangling the "ROLLBACK;" into some form the database doesn't recognize.  Look in the postgres log files to see what the events look like from PostgreSQL's perspective.

Cheers,

Jeff

pgsql-general by date:

Previous
From: Brian Crowell
Date:
Subject: Recovering from failed transaction
Next
From: Matthew Chambers
Date:
Subject: bg writer went away after reload