Search Postgresql Archives

Re: Detecting uncommitted changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane wrote on 28.12.2011 01:41:
Thomas Kellerer<spam_eater@xxxxxxx>  writes:
Tom Lane wrote on 27.12.2011 20:22:
More specifically, look to see if the current transaction has assigned
itself a transaction ID.  I think the easiest place to see this is in
pg_locks --- it will be holding exclusive lock on a TransactionId object
if so.

Thanks for the answer. I came up with the following statement:

select count(*)
from pg_locks
where pid = pg_backend_pid()
and locktype in ('transactionid')

does that look right to you?

No.  You forgot the exclusive-lock condition.

Ah!

So this is it?

select count(*)
from pg_locks
where pid = pg_backend_pid()
and locktype in ('transactionid')
and mode = 'ExclusiveLock'

Thanks for your help

Thomas


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux