Skip to content

Commit c16f746

Browse files
committed
[PGPRO-5113] Added extra conditions for using tuple map (v9.6 - v11)
1 parent 6e155ce commit c16f746

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/partition_filter.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,19 @@ partition_filter_exec(CustomScanState *node)
929929
if (rri_holder->tuple_map ||
930930
(!junkfilter &&
931931
(state->command_type == CMD_INSERT || state->command_type == CMD_UPDATE) &&
932-
(slot->tts_tupleDescriptor->natts > rri->ri_RelationDesc->rd_att->natts /* extra fields */)))
932+
(slot->tts_tupleDescriptor->natts > rri->ri_RelationDesc->rd_att->natts /* extra fields */
933+
#if PG_VERSION_NUM < 120000
934+
/*
935+
* If we have a regular physical tuple 'slot->tts_tuple' and
936+
* it's locally palloc'd => we will use this tuple in
937+
* ExecMaterializeSlot() instead of materialize the slot, so
938+
* need to check number of attributes for this tuple:
939+
*/
940+
|| (slot->tts_tuple && slot->tts_shouldFree &&
941+
HeapTupleHeaderGetNatts(slot->tts_tuple->t_data) >
942+
rri->ri_RelationDesc->rd_att->natts /* extra fields */)
943+
#endif
944+
)))
933945
{
934946
#if PG_VERSION_NUM < 120000
935947
HeapTuple htup_old,

0 commit comments

Comments
 (0)