Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
Move the output write outside the memory context, and fix the off by …
Browse files Browse the repository at this point in the history
…1 error in the array iteration
  • Loading branch information
Kris Wehner committed Nov 9, 2016
1 parent ed78a07 commit 87cad11
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pgoutput/output_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static void tuple_to_proto(
{
int natt;
int cp = 0;
int colnum = 0;

for (natt = 0; natt < tupdesc->natts; natt++)
{
Expand All @@ -87,7 +88,7 @@ static void tuple_to_proto(

col = (Common__ColumnPb*)palloc(sizeof(Common__ColumnPb));
common__column_pb__init(col);
cols[natt] = col;
cols[colnum++] = col;

typ = attr->atttypid;
col->name = NameStr(attr->attname);
Expand Down Expand Up @@ -211,5 +212,4 @@ void transicatorOutputChangeProto(

OutputPluginPrepareWrite(ctx, true);
appendBinaryStringInfo(ctx->out, (char*)pack, packSize);
OutputPluginWrite(ctx, true);
}
1 change: 0 additions & 1 deletion pgoutput/output_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,4 @@ void transicatorOutputChangeString(
}

appendStringInfoChar(ctx->out, '}');
OutputPluginWrite(ctx, true);
}
1 change: 1 addition & 0 deletions pgoutput/transicator_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static void outputChange(
/* Switch back to original context and release everything we "palloc"ed */
MemoryContextSwitchTo(oldMemCtx);
MemoryContextReset(state->memCtx);
OutputPluginWrite(ctx, true);
}

void _PG_output_plugin_init(OutputPluginCallbacks *cb) {
Expand Down

0 comments on commit 87cad11

Please sign in to comment.