From 2c7e1f434322ddbb7517b87773ef8c80307d1398 Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <aleksander@tigerdata.com>
Date: Tue, 21 Apr 2026 15:11:13 +0300
Subject: [PATCH v1] Remove unused ForPortionOfState.fp_leftoverstypcache field

Oversight of commit 8e72d914c528.

Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: TODO FIXME
Discussion: TODO FIXME
---
 src/backend/executor/nodeModifyTable.c | 13 -------------
 src/include/nodes/execnodes.h          |  1 -
 2 files changed, 14 deletions(-)

diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 4cb057ca4f9..6ee26d9803f 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -1411,7 +1411,6 @@ ExecForPortionOfLeftovers(ModifyTableContext *context,
 	ForPortionOfExpr *forPortionOf = (ForPortionOfExpr *) node->forPortionOf;
 	AttrNumber	rangeAttno;
 	Datum		oldRange;
-	TypeCacheEntry *typcache;
 	ForPortionOfState *fpoState;
 	TupleTableSlot *oldtupleSlot;
 	TupleTableSlot *leftoverSlot;
@@ -1491,18 +1490,6 @@ ExecForPortionOfLeftovers(ModifyTableContext *context,
 		elog(ERROR, "found a NULL range in a temporal table");
 	oldRange = oldtupleSlot->tts_values[rangeAttno - 1];
 
-	/*
-	 * Get the range's type cache entry. This is worth caching for the whole
-	 * UPDATE/DELETE as range functions do.
-	 */
-
-	typcache = fpoState->fp_leftoverstypcache;
-	if (typcache == NULL)
-	{
-		typcache = lookup_type_cache(forPortionOf->rangeType, 0);
-		fpoState->fp_leftoverstypcache = typcache;
-	}
-
 	/*
 	 * Get the ranges to the left/right of the targeted range. We call a SETOF
 	 * support function and insert as many temporal leftovers as it gives us.
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 13359180d25..db11e7042ea 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -480,7 +480,6 @@ typedef struct ForPortionOfState
 	Oid			fp_rangeType;	/* the type of the FOR PORTION OF expression */
 	int			fp_rangeAttno;	/* the attno of the range column */
 	Datum		fp_targetRange; /* the range/multirange from FOR PORTION OF */
-	TypeCacheEntry *fp_leftoverstypcache;	/* type cache entry of the range */
 	TupleTableSlot *fp_Existing;	/* slot to store old tuple */
 	TupleTableSlot *fp_Leftover;	/* slot to store leftover */
 } ForPortionOfState;
-- 
2.43.0

