Re: Transaction IDs not the same in same transaction?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Steve V <dndlists(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Transaction IDs not the same in same transaction?
Date: 2005-10-23 01:14:10
Message-ID: 20051023011410.GA76134@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve V 2005-10-23 05:41:48 Re: Transaction IDs not the same in same transaction?
Previous Message Allen Fair 2005-10-22 22:15:59 Re: out of memory for query result