Skip to content

Commit cd4171a

Browse files
hughcapetjpechane
authored andcommitted
DBZ-5370 Add PostgreSQL 15 compatibility code
1 parent c9b00aa commit cd4171a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/decoderbufs.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,11 @@ static void pg_decode_begin_txn(LogicalDecodingContext *ctx,
500500
rmsg.has_op = true;
501501
rmsg.transaction_id = txn->xid;
502502
rmsg.has_transaction_id = true;
503+
#if PG_VERSION_NUM >= 150000
504+
rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->xact_time.commit_time);
505+
#else
503506
rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->commit_time);
507+
#endif
504508
rmsg.has_commit_time = true;
505509

506510
/* write msg */
@@ -538,7 +542,11 @@ static void pg_decode_commit_txn(LogicalDecodingContext *ctx,
538542
rmsg.has_op = true;
539543
rmsg.transaction_id = txn->xid;
540544
rmsg.has_transaction_id = true;
545+
#if PG_VERSION_NUM >= 150000
546+
rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->xact_time.commit_time);
547+
#else
541548
rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->commit_time);
549+
#endif
542550
rmsg.has_commit_time = true;
543551

544552
/* write msg */
@@ -590,7 +598,11 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
590598
/* set common fields */
591599
rmsg.transaction_id = txn->xid;
592600
rmsg.has_transaction_id = true;
601+
#if PG_VERSION_NUM >= 150000
602+
rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->xact_time.commit_time);
603+
#else
593604
rmsg.commit_time = TIMESTAMPTZ_TO_USEC_SINCE_EPOCH(txn->commit_time);
605+
#endif
594606
rmsg.has_commit_time = true;
595607
rmsg.table = pstrdup(quote_qualified_identifier(get_namespace_name(get_rel_namespace(RelationGetRelid(relation))),
596608
NameStr(class_form->relname)));

0 commit comments

Comments
 (0)