Re: Recovering from failed transaction

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Brian Crowell <brian(at)fluggo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Recovering from failed transaction
Date: 2014-03-10 21:16:12
Message-ID: CAMkU=1ySYe7GAfSTVRwoJnCmfLb9s31WFph5ARPQ-CVBZq0_RA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 10, 2014 at 1:41 PM, Brian Crowell <brian(at)fluggo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Chambers 2014-03-10 21:30:22 bg writer went away after reload
Previous Message Brian Crowell 2014-03-10 20:41:35 Recovering from failed transaction