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.
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера