Skip to content

Commit 105344a

Browse files
Alexander Kukushkinjpechane
Alexander Kukushkin
authored andcommitted
DBZ-955 Fix compilation agains postgres 11
1 parent e2da727 commit 105344a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/decoderbufs.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,14 @@ static void pg_decode_startup(LogicalDecodingContext *ctx,
119119
elog(DEBUG1, "Entering startup callback");
120120

121121
data = palloc(sizeof(DecoderData));
122+
#if PG_VERSION_NUM >= 90600
123+
data->context = AllocSetContextCreate(
124+
ctx->context, "decoderbufs context", ALLOCSET_DEFAULT_SIZES);
125+
#else
122126
data->context = AllocSetContextCreate(
123127
ctx->context, "decoderbufs context", ALLOCSET_DEFAULT_MINSIZE,
124128
ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE);
129+
#endif
125130
data->debug_mode = false;
126131
opt->output_type = OUTPUT_PLUGIN_BINARY_OUTPUT;
127132

@@ -478,7 +483,7 @@ static int valid_attributes_count_from(TupleDesc tupdesc) {
478483
int natt;
479484
int count = 0;
480485
for (natt = 0; natt < tupdesc->natts; natt++) {
481-
Form_pg_attribute attr = tupdesc->attrs[natt];
486+
Form_pg_attribute attr = TupleDescAttr(tupdesc, natt);
482487

483488
/* skip dropped columns and system columns */
484489
if (attr->attisdropped || attr->attnum < 0) {
@@ -506,7 +511,7 @@ static void tuple_to_tuple_msg(Decoderbufs__DatumMessage **tmsg,
506511
bool typisvarlena;
507512
Decoderbufs__DatumMessage datum_msg = DECODERBUFS__DATUM_MESSAGE__INIT;
508513

509-
attr = tupdesc->attrs[natt];
514+
attr = TupleDescAttr(tupdesc, natt);
510515

511516
/* skip dropped columns and system columns */
512517
if (attr->attisdropped || attr->attnum < 0) {
@@ -564,7 +569,7 @@ static void add_metadata_to_msg(Decoderbufs__TypeInfo **tmsg,
564569
Decoderbufs__TypeInfo typeinfo = DECODERBUFS__TYPE_INFO__INIT;
565570
bool not_null;
566571

567-
attr = tupdesc->attrs[natt];
572+
attr = TupleDescAttr(tupdesc, natt);
568573

569574
/* skip dropped columns and system columns */
570575
if (attr->attisdropped || attr->attnum < 0) {

0 commit comments

Comments
 (0)