Skip to content

Commit

Permalink
Fix an oversight for old minor versions
Browse files Browse the repository at this point in the history
Format 2 (1b0cbac) forgot to consider
the workaround I applied to TupleDescAttr
(5352cc4).  Since I did not test with
old minor versions, this bug was not caught by tests. This was reported
in issue yugabyte#162.
  • Loading branch information
eulerto committed Apr 16, 2020
1 parent b2a0522 commit 538e9a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions wal2json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,11 @@ pg_decode_write_tuple(LogicalDecodingContext *ctx, Relation relation, HeapTuple
bool found = false;
char *type_str;

#if (PG_VERSION_NUM >= 90600 && PG_VERSION_NUM < 90605) || (PG_VERSION_NUM >= 90500 && PG_VERSION_NUM < 90509) || (PG_VERSION_NUM >= 90400 && PG_VERSION_NUM < 90414)
attr = tupdesc->attrs[i];
#else
attr = TupleDescAttr(tupdesc, i);
#endif

/* skip dropped or system columns */
if (attr->attisdropped || attr->attnum < 0)
Expand All @@ -1673,7 +1677,11 @@ pg_decode_write_tuple(LogicalDecodingContext *ctx, Relation relation, HeapTuple
{
Form_pg_attribute iattr;

#if (PG_VERSION_NUM >= 90600 && PG_VERSION_NUM < 90605) || (PG_VERSION_NUM >= 90500 && PG_VERSION_NUM < 90509) || (PG_VERSION_NUM >= 90400 && PG_VERSION_NUM < 90414)
iattr = idxdesc->attrs[j];
#else
iattr = TupleDescAttr(idxdesc, j);
#endif
if (strcmp(NameStr(attr->attname), NameStr(iattr->attname)) == 0)
found = true;
}
Expand Down

0 comments on commit 538e9a7

Please sign in to comment.