From: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Function to get a txn's replication origin |
Date: | 2018-03-26 08:27:23 |
Message-ID: | CAMsr+YG_oF1694esChGSCJvrvLk9n9HbJvV0NYuS5c3ciuv_xQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all
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.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Add-pg_xact_commit_timestamp_origin.patch | text/x-patch | 13.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Ivanov | 2018-03-26 08:51:42 | Re: new function for tsquery creartion |
Previous Message | Pavan Deolasee | 2018-03-26 07:52:57 | Re: PATCH: Exclude unlogged tables from base backups |