Re: Access to transaction status - Mailing list pgsql-hackers

From Jeroen T. Vermeulen
Subject Re: Access to transaction status
Date
Msg-id 20030619165018.GA66196@xs4all.nl
Whole thread Raw
In response to Access to transaction status  ("Christian Plattner" <postgresql@sioux.ch>)
List 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



pgsql-hackers by date:

Previous
From: ivan
Date:
Subject: same new code
Next
From: "Enke, Michael"
Date:
Subject: again: Bug #943: Server-Encoding from EUC_TW to UTF-8 doesn'twork