aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/decode.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2016-03-02 23:42:21 -0800
committerAndres Freund <andres@anarazel.de>2016-03-02 23:42:21 -0800
commit7c17aac69dcae610b08c5965161151cd282f16bc (patch)
tree7a2f467bcac44f83db1299394b0a03ef284e0167 /src/backend/replication/logical/decode.c
parenta9d199f6d3b998929cdb8e8aa61e5cd8db9b220f (diff)
downloadpostgresql-7c17aac69dcae610b08c5965161151cd282f16bc.tar.gz
postgresql-7c17aac69dcae610b08c5965161151cd282f16bc.zip
logical decoding: fix decoding of a commit's commit time.
When adding replication origins in 5aa235042, I somehow managed to set the timestamp of decoded transactions to InvalidXLogRecptr when decoding one made without a replication origin. Fix that, and the wrong type of the new commit_time variable. This didn't trigger a regression test failure because we explicitly don't show commit timestamps in the regression tests, as they obviously are variable. Add a test that checks that a decoded commit's timestamp is within minutes of NOW() from before the commit. Reported-By: Weiping Qu Diagnosed-By: Artur Zakirov Discussion: 56D4197E.9050706@informatik.uni-kl.de, 56D42918.1010108@postgrespro.ru Backpatch: 9.5, where 5aa235042 originates.
Diffstat (limited to 'src/backend/replication/logical/decode.c')
-rw-r--r--src/backend/replication/logical/decode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 88c3a4985a5..56be1ed554b 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -449,7 +449,7 @@ DecodeCommit(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
xl_xact_parsed_commit *parsed, TransactionId xid)
{
XLogRecPtr origin_lsn = InvalidXLogRecPtr;
- XLogRecPtr commit_time = InvalidXLogRecPtr;
+ TimestampTz commit_time = parsed->xact_time;
XLogRecPtr origin_id = XLogRecGetOrigin(buf->record);
int i;