Skip to content

Commit 3e53492

Browse files
author
Amit Kapila
committed
Drop the temporary tuple slots allocated by pgoutput.
In pgoutput, when converting the child table's tuple format to match the parent table's, we temporarily create a new slot to store the converted tuple. However, we missed to drop such temporary slots, leading to resource leakage. Reported-by: Bowen Shi Author: Hou Zhijie Reviewed-by: Amit Kapila Backpatch-through: 15 Discussion: https://postgr.es/m/CAM_vCudv8dc3sjWiPkXx5F2b27UV7_YRKRbtSCcE-pv=cVACGA@mail.gmail.com
1 parent 7467939 commit 3e53492

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/backend/replication/pgoutput/pgoutput.c

+10
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,16 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
15541554
ancestor = NULL;
15551555
}
15561556

1557+
/* Drop the new slots that were used to store the converted tuples. */
1558+
if (relentry->attrmap)
1559+
{
1560+
if (old_slot)
1561+
ExecDropSingleTupleTableSlot(old_slot);
1562+
1563+
if (new_slot)
1564+
ExecDropSingleTupleTableSlot(new_slot);
1565+
}
1566+
15571567
MemoryContextSwitchTo(old);
15581568
MemoryContextReset(data->context);
15591569
}

0 commit comments

Comments
 (0)