Skip to content

Fix PostgreSQL 17 compilation #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/decoderbufs.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
#endif

#if PG_VERSION_NUM >= 170000
#define TUPLE_ACCESS
#define TUPLE_ACCESS(x) x
#else
#define TUPLE_ACCESS ->tuple
#define TUPLE_ACCESS(x) &x->tuple
#endif

PG_MODULE_MAGIC;
Expand Down Expand Up @@ -628,13 +628,13 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
rmsg.new_tuple =
palloc(sizeof(Decoderbufs__DatumMessage*) * rmsg.n_new_tuple);
tuple_to_tuple_msg(rmsg.new_tuple, relation,
&change->data.tp.newtuple TUPLE_ACCESS, tupdesc);
TUPLE_ACCESS(change->data.tp.newtuple), tupdesc);

rmsg.n_new_typeinfo = rmsg.n_new_tuple;
rmsg.new_typeinfo =
palloc(sizeof(Decoderbufs__TypeInfo*) * rmsg.n_new_typeinfo);
add_metadata_to_msg(rmsg.new_typeinfo, relation,
&change->data.tp.newtuple TUPLE_ACCESS, tupdesc);
TUPLE_ACCESS(change->data.tp.newtuple), tupdesc);
}
break;
case REORDER_BUFFER_CHANGE_UPDATE:
Expand All @@ -649,7 +649,7 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
rmsg.old_tuple =
palloc(sizeof(Decoderbufs__DatumMessage*) * rmsg.n_old_tuple);
tuple_to_tuple_msg(rmsg.old_tuple, relation,
&change->data.tp.oldtuple TUPLE_ACCESS, tupdesc);
TUPLE_ACCESS(change->data.tp.oldtuple), tupdesc);
}
if (change->data.tp.newtuple != NULL) {
elog(DEBUG1, "decoding new tuple information");
Expand All @@ -659,13 +659,13 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
rmsg.new_tuple =
palloc(sizeof(Decoderbufs__DatumMessage*) * rmsg.n_new_tuple);
tuple_to_tuple_msg(rmsg.new_tuple, relation,
&change->data.tp.newtuple TUPLE_ACCESS, tupdesc);
TUPLE_ACCESS(change->data.tp.newtuple), tupdesc);

rmsg.n_new_typeinfo = rmsg.n_new_tuple;
rmsg.new_typeinfo =
palloc(sizeof(Decoderbufs__TypeInfo*) * rmsg.n_new_typeinfo);
add_metadata_to_msg(rmsg.new_typeinfo, relation,
&change->data.tp.newtuple TUPLE_ACCESS, tupdesc);
TUPLE_ACCESS(change->data.tp.newtuple), tupdesc);
}
}
break;
Expand All @@ -681,7 +681,7 @@ static void pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
rmsg.old_tuple =
palloc(sizeof(Decoderbufs__DatumMessage*) * rmsg.n_old_tuple);
tuple_to_tuple_msg(rmsg.old_tuple, relation,
&change->data.tp.oldtuple TUPLE_ACCESS, tupdesc);
TUPLE_ACCESS(change->data.tp.oldtuple), tupdesc);
} else {
elog(DEBUG1, "no information to decode from DELETE because either no PK is present or REPLICA IDENTITY NOTHING or invalid ");
}
Expand Down