diff --git a/src/decoderbufs.c b/src/decoderbufs.c index cf81477..68a549f 100644 --- a/src/decoderbufs.c +++ b/src/decoderbufs.c @@ -500,7 +500,11 @@ static void pg_decode_begin_txn(LogicalDecodingContext *ctx, rmsg.has_op = true; rmsg.transaction_id = txn->xid; rmsg.has_transaction_id = true; +#if PG_VERSION_NUM >= 150000 + rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->xact_time.commit_time); +#else rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->commit_time); +#endif rmsg.has_commit_time = true; /* write msg */ @@ -538,7 +542,11 @@ static void pg_decode_commit_txn(LogicalDecodingContext *ctx, rmsg.has_op = true; rmsg.transaction_id = txn->xid; rmsg.has_transaction_id = true; +#if PG_VERSION_NUM >= 150000 + rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->xact_time.commit_time); +#else rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->commit_time); +#endif rmsg.has_commit_time = true; /* write msg */ @@ -590,7 +598,11 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, /* set common fields */ rmsg.transaction_id = txn->xid; rmsg.has_transaction_id = true; +#if PG_VERSION_NUM >= 150000 + rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->xact_time.commit_time); +#else rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->commit_time); +#endif rmsg.has_commit_time = true; rmsg.table = pstrdup(quote_qualified_identifier(get_namespace_name(get_rel_namespace(RelationGetRelid(relation))), NameStr(class_form->relname)));