diff --git a/contrib/pg_upgrade/pg_upgrade.c b/contrib/pg_upgrade/pg_upgrade.c index 3b8241b37e..dd1113ecc2 100644 --- a/contrib/pg_upgrade/pg_upgrade.c +++ b/contrib/pg_upgrade/pg_upgrade.c @@ -430,6 +430,13 @@ copy_clog_xlog_xid(void) "\"%s/pg_resetxlog\" -f -e %u \"%s\"", new_cluster.bindir, old_cluster.controldata.chkpnt_nxtepoch, new_cluster.pgdata); + /* must reset commit timestamp limits also */ + exec_prog(UTILITY_LOG_FILE, NULL, true, + "\"%s/pg_resetxlog\" -f -c %u,%u \"%s\"", + new_cluster.bindir, + old_cluster.controldata.chkpnt_nxtxid, + old_cluster.controldata.chkpnt_nxtxid, + new_cluster.pgdata); check_ok(); /* diff --git a/contrib/pg_xlogdump/rmgrdesc.c b/contrib/pg_xlogdump/rmgrdesc.c index 9397198239..180818d68b 100644 --- a/contrib/pg_xlogdump/rmgrdesc.c +++ b/contrib/pg_xlogdump/rmgrdesc.c @@ -10,6 +10,7 @@ #include "access/brin_xlog.h" #include "access/clog.h" +#include "access/commit_ts.h" #include "access/gin.h" #include "access/gist_private.h" #include "access/hash.h" diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index ab8c2637d7..e3713d3b49 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2673,6 +2673,20 @@ include_dir 'conf.d' + + track_commit_timestamp (bool) + + track_commit_timestamp configuration parameter + + + + Record commit time of transactions. This parameter + can only be set in postgresql.conf file or on the server + command line. The default value is off. + + + + diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index baf81ee040..62ec275a9e 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -15938,6 +15938,45 @@ SELECT collation for ('foo' COLLATE "de_DE"); For example 10:20:10,14,15 means xmin=10, xmax=20, xip_list=10, 14, 15. + + + The functions shown in + provide information about transactions that have been already committed. + These functions mainly provide information about when the transactions + were committed. They only provide useful data when + configuration option is enabled + and only for transactions that were committed after it was enabled. + + + + Committed transaction information + + + Name Return Type Description + + + + + + pg_xact_commit_timestamp + pg_xact_commit_timestamp(xid) + + timestamp with time zone + get commit timestamp of a transaction + + + + + pg_last_committed_xact + pg_last_committed_xact() + + xid xid, timestamp timestamp with time zone + get transaction ID and commit timestamp of latest committed transaction + + + +
+ diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml index aba7185f35..59280f01cb 100644 --- a/doc/src/sgml/ref/pg_resetxlog.sgml +++ b/doc/src/sgml/ref/pg_resetxlog.sgml @@ -22,6 +22,7 @@ PostgreSQL documentation pg_resetxlog + xid,xid oid @@ -79,9 +80,12 @@ PostgreSQL documentation The + + + A safe value for the oldest transaction ID for which the commit time can + be retrieved (first part of + + The WAL starting address (