Re: Current transaction ID?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Current transaction ID?
Дата
Msg-id 20050615165825.GR9860@surnet.cl
обсуждение исходный текст
Ответ на Re: Current transaction ID?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-general
On Tue, Jun 14, 2005 at 07:41:11PM -0400, Bruce Momjian wrote:
> Steve - DND wrote:
> > Simple question I'm sure, but how can I get the transaction ID that a query
> > is currently running in? I can find all kinds of documentation talking about
> > transaction ids, but nothing about how to get the current one.
>
> You can look at the xmin of a tuple you created or an xmax of a tuple
> you deleted.

Beware -- if you use savepoints, the Xid will change and you will think
it was a different transaction when in fact it was the same one.

You should also know that savepoints are used invisibly sometimes, for
example in EXCEPTION clauses in PL/pgSQL.  (Though you return to the
original transaction when the EXCEPTION block finishes, I think.)

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"Los románticos son seres que mueren de deseos de vida"

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: enebling regular user to create new users ?
Следующее
От: Matt Miller
Дата:
Сообщение: Re: enebling regular user to create new users ?