During the committs / replorigin split, the function to query the replication origin of a transaction from user space was lost.
A function to do so is utterly trivial, e.g.
Datum
pg_get_xact_replication_origin(PG_FUNCTION_ARGS)
{
TransactionId xid = PG_GETARG_TRANSACTIONID(0);
TimestampTz ts;
RepOriginId nodeid;
if (TransactionIdGetCommitTsData(xid, &ts, &nodeid))
PG_RETURN_INT32((int32)nodeid);
else
PG_RETURN_NULL();
}
... but it probably makes more sense to extend pg_xact_commit_timestamp with support for returning the origin too.
pg_xact_commit_timestamp() is a scalar function so I don't want to extend it directly because that'll upset existing callers.
pg_xact_commit_timestamp_origin()
(unsure if a "with" or "and" is appropriate or too long).
Attached. Also add 'roident' to pg_last_committed_xact() to make the info available there too. It was already record-returning so I'm not overly concerned about adding a column.