Hi all,
When working on a decoder plugin, I have been pointed that it is
incorrect to write changes in an output plugin while not being in the
memory context where changes are written.
In pg_decode_change@test_decoding.c, we do the following:
old = MemoryContextSwitchTo(data->context);
OutputPluginPrepareWrite(ctx, true);
[...]
MemoryContextSwitchTo(old);
MemoryContextReset(data->context);
OutputPluginWrite(ctx, true);
Wouldn't it be better to call OutputPluginWrite before switching back
to the old context? The attached patch for test_decoding does so.
Comments welcome.
Regards,
--
Michael