60
60
#error Expecting timestamps to be represented as integers, not as floating-point.
61
61
#endif
62
62
63
+ #if PG_VERSION_NUM >= 170000
64
+ #define TUPLE_ACCESS
65
+ #else
66
+ #define TUPLE_ACCESS ->tuple
67
+ #endif
68
+
63
69
PG_MODULE_MAGIC ;
64
70
65
71
/* define a time macro to convert TimestampTz into something more sane,
@@ -622,13 +628,13 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
622
628
rmsg .new_tuple =
623
629
palloc (sizeof (Decoderbufs__DatumMessage * ) * rmsg .n_new_tuple );
624
630
tuple_to_tuple_msg (rmsg .new_tuple , relation ,
625
- & change -> data .tp .newtuple -> tuple , tupdesc );
631
+ & change -> data .tp .newtuple TUPLE_ACCESS , tupdesc );
626
632
627
633
rmsg .n_new_typeinfo = rmsg .n_new_tuple ;
628
634
rmsg .new_typeinfo =
629
635
palloc (sizeof (Decoderbufs__TypeInfo * ) * rmsg .n_new_typeinfo );
630
636
add_metadata_to_msg (rmsg .new_typeinfo , relation ,
631
- & change -> data .tp .newtuple -> tuple , tupdesc );
637
+ & change -> data .tp .newtuple TUPLE_ACCESS , tupdesc );
632
638
}
633
639
break ;
634
640
case REORDER_BUFFER_CHANGE_UPDATE :
@@ -643,7 +649,7 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
643
649
rmsg .old_tuple =
644
650
palloc (sizeof (Decoderbufs__DatumMessage * ) * rmsg .n_old_tuple );
645
651
tuple_to_tuple_msg (rmsg .old_tuple , relation ,
646
- & change -> data .tp .oldtuple -> tuple , tupdesc );
652
+ & change -> data .tp .oldtuple TUPLE_ACCESS , tupdesc );
647
653
}
648
654
if (change -> data .tp .newtuple != NULL ) {
649
655
elog (DEBUG1 , "decoding new tuple information" );
@@ -653,13 +659,13 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
653
659
rmsg .new_tuple =
654
660
palloc (sizeof (Decoderbufs__DatumMessage * ) * rmsg .n_new_tuple );
655
661
tuple_to_tuple_msg (rmsg .new_tuple , relation ,
656
- & change -> data .tp .newtuple -> tuple , tupdesc );
662
+ & change -> data .tp .newtuple TUPLE_ACCESS , tupdesc );
657
663
658
664
rmsg .n_new_typeinfo = rmsg .n_new_tuple ;
659
665
rmsg .new_typeinfo =
660
666
palloc (sizeof (Decoderbufs__TypeInfo * ) * rmsg .n_new_typeinfo );
661
667
add_metadata_to_msg (rmsg .new_typeinfo , relation ,
662
- & change -> data .tp .newtuple -> tuple , tupdesc );
668
+ & change -> data .tp .newtuple TUPLE_ACCESS , tupdesc );
663
669
}
664
670
}
665
671
break ;
@@ -675,7 +681,7 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
675
681
rmsg .old_tuple =
676
682
palloc (sizeof (Decoderbufs__DatumMessage * ) * rmsg .n_old_tuple );
677
683
tuple_to_tuple_msg (rmsg .old_tuple , relation ,
678
- & change -> data .tp .oldtuple -> tuple , tupdesc );
684
+ & change -> data .tp .oldtuple TUPLE_ACCESS , tupdesc );
679
685
} else {
680
686
elog (DEBUG1 , "no information to decode from DELETE because either no PK is present or REPLICA IDENTITY NOTHING or invalid " );
681
687
}
0 commit comments