Re: Fwd: [GENERAL] statement id - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Fwd: [GENERAL] statement id
Date
Msg-id 3E7CF63C.5010801@joeconway.com
Whole thread Raw
In response to Fwd: [GENERAL] statement id  (elein <elein@sbcglobal.net>)
Responses Re: Fwd: [GENERAL] statement id  (elein <elein@sbcglobal.net>)
List pgsql-hackers
elein wrote:
> Is there any way to find out the statement context in a server function?
> Is there anyway to find out the transaction context in a server function?
> 
[...snip...]
> 
> If this were a C function, would it be easier to have this information?
> 

I don't know anything about plpython, but I'd guess the info you're 
looking for is not available to it.

In C, I think (but have not tried) you could use 
GetCurrentTransactionId() to put the current transaction id into a 
global variable, and allocate memory for other globals in 
TopTransactionContext. Then use a change in transaction id to signal a 
need to reallocate/reinitialize your globals.

Not sure if this is what you were looking for, but HTH.

Joe



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: PQescapeBytea on Win32
Next
From: Joe Conway
Date:
Subject: IS OF