Local visibility with logical decoding

Marko Tiikkaja <marko@joh.to>

From: Marko Tiikkaja <marko@joh.to>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-07-20T14:27:30Z
Lists: pgsql-hackers
Hi,

It appears that when logical decoding sends out the data from the output
plugin, it is not guaranteed that the decoded transaction's effects are
visible on the source server.  Is this the way it's supposed to work?

If so, would doing something like this in the output plugin be reasonable?

    TransactionId xid = transaction->xid;
    if (transaction->is_known_as_subxact)
        xid = transaction->toplevel_xid;

    if (TransactionIdIsInProgress(xid))
        XactLockTableWait(xid, NULL, NULL, XLTW_None);


-marko