On Sun, Nov 13, 2011 at 11:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> While investigating bug #6291 I was somewhat surprised to discover
> $SUBJECT. The cause turns out to be this kluge in alter_table.sql:
>
> select virtualtransaction
> from pg_locks
> where transactionid = txid_current()::integer
...
> that plasters on the appropriate epoch value for an
> assumed-to-be-current-or-recent xid, and returns something that squares
> with the txid_snapshot functions. Then the test could be coded without
> kluges as
That fixes the test, but it doesn't fix the unreasonability of this situation.
We need a function called transactionid_current() so a normal user can write
select virtualtransaction from pg_locks where transactionid = transactionid_current()
and have it "just work".
We need a function whose behaviour matches xid columns in pg_locks and
elsewhere and that doesn't need to have anything to do with txid
datatype.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services