Getting the current transaction's xid
| От | David Blasby |
|---|---|
| Тема | Getting the current transaction's xid |
| Дата | |
| Msg-id | 3F202B97.2010904@refractions.net обсуждение исходный текст |
| Ответ на | Re: GiST index on data types that require compression (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: