From: | Kevin Grittner <kgrittn(at)gmail(dot)com> |
---|---|
To: | Christian Ohler <ohler(at)shift(dot)com> |
Cc: | Rob Sargent <robjsargent(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Detecting if current transaction is modifying the database |
Date: | 2016-08-08 15:23:02 |
Message-ID: | CACjxUsOeVNv_i9hTFpBx5Q+8BoLBHTu5DRTbpObVZRMG4qhVmg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Aug 5, 2016 at 4:24 PM, Christian Ohler <ohler(at)shift(dot)com> wrote:
Your check for a exclusive self-lock on transactionid should work.
It may be possible to find a way to do it that is less expensive,
so I would definitely encapsulate that in a function; but off-hand
I'm not thinking of a better way.
You might be tempted to use the txid_current() function, but note
that it assigns a transaction ID if there is not yet one assigned.
That has prevented that function from being useful to me in every
case I've considered it so far; I wish we had a function that told
the current transaction ID and just returned NULL if none has yet
been assigned. I'm not sure what the best name would be for such a
function when we already have a function called txid_current()
which does something different from that.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Ioana Danes | 2016-08-08 16:11:41 | Corrupted Data ? |
Previous Message | Adrian Klaver | 2016-08-08 13:53:21 | Re: Should a DB vacuum use up a lot of space ? |