question about implementing XA-ish functions

From: Theo Schlossnagle <jesus(at)omniti(dot)com>
To: PostgreSQL-development Development <pgsql-hackers(at)postgresql(dot)org>
Cc: Theo Schlossnagle <jesus(at)omniti(dot)com>
Subject: question about implementing XA-ish functions
Date: 2009-12-18 17:05:37
Message-ID: 434C857F-8228-4E0D-912C-D403CFE5FD06@omniti.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


I'm trying to implement a function that has some XA like properties.

Is it possible to write a postgres extension function that fires when called within a pg transaction... however, the actions it takes need to be later committed or rolled back based on the containing transactions commital or not. Not having looked to deeply into this, I'm wondering if this is possible. Naively, my first hookpoint would be something like:

allocate something in the transactions memory context and register a cleanup.... do my work.

when the transaction memory context is cleaned up, my cleanup handler fires, I detect whether the txn was committed or rolledback and rightly mark my work as committed or rolled back.

Thoughts?

--
Theo Schlossnagle
http://omniti.com/is/theo-schlossnagle
p: +1.443.325.1357 x201 f: +1.410.872.4911

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-12-18 17:07:34 Time to run initdb is mostly figure-out-the-timezone work
Previous Message David E. Wheeler 2009-12-18 16:56:01 Re: PATCH: Add hstore_to_json()