diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 5fc0defec3a..abb82ecb18d 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -1587,6 +1587,16 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, ancestor = NULL; } + /* Drop the new slots that were used to store the converted tuples. */ + if (relentry->attrmap) + { + if (old_slot) + ExecDropSingleTupleTableSlot(old_slot); + + if (new_slot) + ExecDropSingleTupleTableSlot(new_slot); + } + /* Cleanup */ MemoryContextSwitchTo(old); MemoryContextReset(data->context);