Re: Access to transaction status

From: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
To: Christian Plattner <postgresql(at)sioux(dot)ch>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Access to transaction status
Date: 2003-06-19 16:50:18
Message-ID: 20030619165018.GA66196@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 19, 2003 at 05:16:10PM +0200, Christian Plattner wrote:
>
> Do be able to handle all sorts of failures I needed two functions:
>
> - A function to get the current XID
> - A function which I can use later to tell if a given XID
> commited/aborted/whatever

I ran into the same need (Bruce, we discussed this at FOSDEM in Brussels
this February) for libpqxx. My code tries to compensate for the
possibility that the backend connection is lost while waiting for a reply
to a COMMIT. The way I worked around it was to create a special record
at the beginning of the transaction, in a dedicated table that's
effectively a custom transaction log. If the record is still there when
I reconnect, the transaction committed. If not, it didn't.

Obviously this leaves some garbage collection issues, so I'd be really
happy with a way to go back to the server after my connection is lost
and find out whether my transaction committed or not.

Jeroen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Huxton 2003-06-19 18:37:40 Re: SQL question
Previous Message Együd Csaba 2003-06-19 16:36:10 SQL question