Re: Detecting if current transaction is modifying the database - Mailing list pgsql-general

From Kevin Grittner
Subject Re: Detecting if current transaction is modifying the database
Date
Msg-id CACjxUsOeVNv_i9hTFpBx5Q+8BoLBHTu5DRTbpObVZRMG4qhVmg@mail.gmail.com
Whole thread Raw
In response to Re: Detecting if current transaction is modifying the database  (Christian Ohler <ohler@shift.com>)
Responses Re: Detecting if current transaction is modifying the database
List pgsql-general
On Fri, Aug 5, 2016 at 4:24 PM, Christian Ohler <ohler@shift.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


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Should a DB vacuum use up a lot of space ?
Next
From: Ioana Danes
Date:
Subject: Corrupted Data ?