Re: Transaction IDs not the same in same transaction? - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Transaction IDs not the same in same transaction?
Date
Msg-id 20051023011410.GA76134@winnie.fuhr.org
Whole thread Raw
In response to Transaction IDs not the same in same transaction?  (Steve V <dndlists@gmail.com>)
Responses Re: Transaction IDs not the same in same transaction?  (Steve V <dndlists@gmail.com>)
List pgsql-general
On Sat, Oct 22, 2005 at 01:30:32PM -0700, Steve V wrote:
> So I was finally able to get a compiled binary for the code in this
> thread(thanks Magnus):
> http://archives.postgresql.org/pgsql-general/2005-06/msg00709.php
>
> So everything seemed to be fine with my GetCurrentTransactionID()
> function call returning the txn ID for each query I would run(as far
> as I could tell). Then I tried running a txn with multiple queries,
> and instead of just having one txn ID, each query had it's own. Does
> that make any sense? I was under the impression that a regular
> transaction block would have one txn ID assigned to it for its
> duration.

It makes sense if you're running PostgreSQL 8.0 or later and are
using subtransactions, whether explicitly or implicitly.  The example
you posted didn't show the trigger definition or function -- does
the function do any error trapping?  Maybe you need GetTopTransactionId()
instead of GetCurrentTransactionID().

Why do you need the transaction ID at all?  Might the xmin system
column serve your purpose?

--
Michael Fuhr

pgsql-general by date:

Previous
From: Jerry LeVan
Date:
Subject: Ann: PgBrowser-1.1
Next
From: Steve V
Date:
Subject: Re: Transaction IDs not the same in same transaction?