I'm trying to keep a variable around for the duration of a transaction.

Unfortunately, the "SET LOCAL" command doesnt allow me to create my own variable. Also, the "CREATE TEMP TABLE ... ON COMMIT DELETE ROWS" isnt yet implemented.

But, I believe I can implement it using a TEMP table like this:

CREATE TEMP TABLE my_variable (transId xid, value in);

INSERT INTO my_variable ( getTransactionID(), 25);

And I can read from the table with:

SELECT value FROM my_variable WHERE transId = getTransactionID();

The question is, how to write the getTransactionID() function.

I'm comfortable writing "C" extensions to postgresql, but I'm not sure where to actually get the current transaction id. Could someone give me pointers to where I can find this magic value?

dave


---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Reply via email to