6060#error Expecting timestamps to be represented as integers, not as floating-point.
6161#endif
6262
63+ #if PG_VERSION_NUM >= 170000
64+ #define TUPLE_ACCESS
65+ #else
66+ #define TUPLE_ACCESS ->tuple
67+ #endif
68+
6369PG_MODULE_MAGIC ;
6470
6571/* define a time macro to convert TimestampTz into something more sane,
@@ -622,13 +628,13 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
622628 rmsg .new_tuple =
623629 palloc (sizeof (Decoderbufs__DatumMessage * ) * rmsg .n_new_tuple );
624630 tuple_to_tuple_msg (rmsg .new_tuple , relation ,
625- & change -> data .tp .newtuple -> tuple , tupdesc );
631+ & change -> data .tp .newtuple TUPLE_ACCESS , tupdesc );
626632
627633 rmsg .n_new_typeinfo = rmsg .n_new_tuple ;
628634 rmsg .new_typeinfo =
629635 palloc (sizeof (Decoderbufs__TypeInfo * ) * rmsg .n_new_typeinfo );
630636 add_metadata_to_msg (rmsg .new_typeinfo , relation ,
631- & change -> data .tp .newtuple -> tuple , tupdesc );
637+ & change -> data .tp .newtuple TUPLE_ACCESS , tupdesc );
632638 }
633639 break ;
634640 case REORDER_BUFFER_CHANGE_UPDATE :
@@ -643,7 +649,7 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
643649 rmsg .old_tuple =
644650 palloc (sizeof (Decoderbufs__DatumMessage * ) * rmsg .n_old_tuple );
645651 tuple_to_tuple_msg (rmsg .old_tuple , relation ,
646- & change -> data .tp .oldtuple -> tuple , tupdesc );
652+ & change -> data .tp .oldtuple TUPLE_ACCESS , tupdesc );
647653 }
648654 if (change -> data .tp .newtuple != NULL ) {
649655 elog (DEBUG1 , "decoding new tuple information" );
@@ -653,13 +659,13 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
653659 rmsg .new_tuple =
654660 palloc (sizeof (Decoderbufs__DatumMessage * ) * rmsg .n_new_tuple );
655661 tuple_to_tuple_msg (rmsg .new_tuple , relation ,
656- & change -> data .tp .newtuple -> tuple , tupdesc );
662+ & change -> data .tp .newtuple TUPLE_ACCESS , tupdesc );
657663
658664 rmsg .n_new_typeinfo = rmsg .n_new_tuple ;
659665 rmsg .new_typeinfo =
660666 palloc (sizeof (Decoderbufs__TypeInfo * ) * rmsg .n_new_typeinfo );
661667 add_metadata_to_msg (rmsg .new_typeinfo , relation ,
662- & change -> data .tp .newtuple -> tuple , tupdesc );
668+ & change -> data .tp .newtuple TUPLE_ACCESS , tupdesc );
663669 }
664670 }
665671 break ;
@@ -675,7 +681,7 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
675681 rmsg .old_tuple =
676682 palloc (sizeof (Decoderbufs__DatumMessage * ) * rmsg .n_old_tuple );
677683 tuple_to_tuple_msg (rmsg .old_tuple , relation ,
678- & change -> data .tp .oldtuple -> tuple , tupdesc );
684+ & change -> data .tp .oldtuple TUPLE_ACCESS , tupdesc );
679685 } else {
680686 elog (DEBUG1 , "no information to decode from DELETE because either no PK is present or REPLICA IDENTITY NOTHING or invalid " );
681687 }
0 commit comments