diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 630df672cc..85e03efe4e 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -416,6 +416,29 @@ pg_xact_commit_timestamp(PG_FUNCTION_ARGS)
 	PG_RETURN_TIMESTAMPTZ(ts);
 }
 
+/*
+ * SQL-callable wrapper to obtain commit origin of a transaction
+ */
+Datum
+pg_xact_commit_origin(PG_FUNCTION_ARGS)
+{
+	TransactionId 	xid = PG_GETARG_UINT32(0);
+	RepOriginId		nodeid;
+	TimestampTz 	ts;
+	bool			found;
+	char	   		*roname = NULL;
+
+	found = TransactionIdGetCommitTsData(xid, &ts, &nodeid);
+
+	if (!found || (InvalidRepOriginId == nodeid))
+		PG_RETURN_NULL();
+
+	replorigin_by_oid(nodeid, false, &roname);
+
+	PG_RETURN_TEXT_P(cstring_to_text(roname));
+}
+
+
 
 Datum
 pg_last_committed_xact(PG_FUNCTION_ARGS)
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 4bce3ad8de..5e67ace32d 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -5945,6 +5945,12 @@
   prorettype => 'timestamptz', proargtypes => 'xid',
   prosrc => 'pg_xact_commit_timestamp' },
 
+{ oid => '3435', descr => 'get commit origin of a transaction',
+  proname => 'pg_xact_commit_origin', provolatile => 'v',
+  prorettype => 'text', proargtypes => 'xid',
+  prosrc => 'pg_xact_commit_origin' },
+
+
 { oid => '3583',
   descr => 'get transaction Id and commit timestamp of latest transaction commit',
   proname => 'pg_last_committed_xact', provolatile => 'v',
