Re: Current transaction ID? - Mailing list pgsql-general

From Bruce Momjian
Subject Re: Current transaction ID?
Date
Msg-id 200506150003.j5F03fY12576@candle.pha.pa.us
Whole thread Raw
In response to Re: Current transaction ID?  ("Steve - DND" <postgres@digitalnothing.com>)
Responses Re: Current transaction ID?
Re: Current transaction ID?
List pgsql-general
Steve - DND wrote:
> > > Let's pretend I don't know how to do that. :) Do you have a
> > link to a page
> > > in the manual that describes this process, or can you give me a quick
> > > runthrough of what you're talking about?
> >
> > Every row has an invisible xmin/xmax columns that represent the xid of
> > the row inserted, updated, or deleted.  Why do you need to know the xid
> > is a better question.
>
> Hmm...not quite what I was hoping for. I'm looking to add the ability to my
> auditing scripts to know what happened in a given transaction. Right now,
> it's just table based, so while it still logs all of the changes, it does it
> on a per table basis, not associating changes on two tables as being part of
> the same action.
>
> I can currently guess as to what was changed at one time by using the
> current user that's recorded, and the time at which the changes occurred,
> but it's not foolproof.

Well, you can take the xmin of a row and look for other rows with the
same xmin, either in the same table or in different tables.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: "Steve - DND"
Date:
Subject: Re: Current transaction ID?
Next
From: "Steve - DND"
Date:
Subject: Re: Current transaction ID?