From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Miroslav Šimulčík <simulcik(dot)miro(at)gmail(dot)com> |
Subject: | Re: rows modified in current transaction |
Date: | 2012-08-30 16:20:50 |
Message-ID: | 201208301820.50716.andres@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thursday, August 30, 2012 06:09:43 PM Andres Freund wrote:
> On Thursday, August 30, 2012 06:06:59 PM Robert Haas wrote:
> > On Thu, Aug 30, 2012 at 10:36 AM, Miroslav Šimulčík
> >
> > <simulcik(dot)miro(at)gmail(dot)com> wrote:
> > > is there any way to check if row have already been modified by the
> > > current transaction? I tried condition txid_current() = xmin, but there
> > > is problem with the savepoints. After every savepoint rows are getting
> > > higher xmin values, but txid_current() remains the same.
> >
> > It sounds like you're looking for a function that will give an array
> > of all XIDs for the current transcation, rather than just the XID of
> > the current sub-transaction. I don't think we currently expose that.
>
> txid_current_snapshot(), txis_visible_in_snapshot() may work.
No, it obviously cannot. No idea what I thought... txid_visible_in_snapshot is
fine, but txid_current_snapshot() obviously will return a snapshot containing
that sees everything the current transaction does.
You possibly could calculate a difference between a txid_current_snapshot()
taken at the beginning of a repeatable read transaction and the current one,
but thats too ugly.
Andres
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-08-30 16:27:00 | Re: pg_operator.oprcode in 9.2rc1 |
Previous Message | Tom Lane | 2012-08-30 16:17:17 | Re: rows modified in current transaction |