Re: A patch for get origin from commit_ts.

movead.li@highgo.ca <movead.li@highgo.ca>

From: "movead.li@highgo.ca" <movead.li@highgo.ca>
To: michael <michael@paquier.xyz>, petr <petr@2ndquadrant.com>
Cc: simon <simon@2ndquadrant.com>, madankumar1993 <madankumar1993@gmail.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>, craig <craig@2ndquadrant.com>, alvherre <alvherre@2ndquadrant.com>, andres <andres@anarazel.de>, soumyadeep2007 <soumyadeep2007@gmail.com>
Date: 2020-07-04T10:01:28Z
Lists: pgsql-hackers

Attachments

>Thanks.  Movead, please note that the patch is waiting on author?
>Could you send an update if you think that those changes make sense?

I make a patch as Michael Paquier described that use a new function to
return transactionid and origin, and I add a origin version to 
pg_last_committed_xact() too,  now it looks like below:

============================================
postgres=# SELECT txid_current() as txid \gset
postgres=# SELECT * FROM  pg_xact_commit_timestamp_origin(:'txid');
           timestamp                           |   origin 
-------------------------------------+--------
 2020-07-04 17:52:10.199623+08 |      1
(1 row)

postgres=# SELECT * FROM pg_last_committed_xact_with_origin();
 xid  |           timestamp                          | origin 
-----+------------------------------------+--------
 506 | 2020-07-04 17:52:10.199623+08 |      1
(1 row)

postgres=#
============================================

---
Regards,
Highgo Software (Canada/China/Pakistan) 
URL : www.highgo.ca 
EMAIL: mailto:movead(dot)li(at)highgo(dot)ca

Commits

  1. Include replication origins in SQL functions for commit timestamp

  2. Create a script that can renumber manually-assigned OIDs.