public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH] Remove dead code in ExecForPortionOfLeftovers()
3+ messages / 3 participants
[nested] [flat]

* [PATCH] Remove dead code in ExecForPortionOfLeftovers()
@ 2026-04-21 12:22  Aleksander Alekseev <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Aleksander Alekseev @ 2026-04-21 12:22 UTC (permalink / raw)
  To: pgsql-hackers

Hi,

While reading 8e72d914c528 I noticed that
ForPortionOfState.fp_leftoverstypcache is not used for anything. I
suggest removing it, as attached.

-- 
Best regards,
Aleksander Alekseev


Attachments:

  [text/x-patch] v1-0001-Remove-unused-ForPortionOfState.fp_leftoverstypca.patch (2.3K, 2-v1-0001-Remove-unused-ForPortionOfState.fp_leftoverstypca.patch)
  download | inline diff:
From 2c7e1f434322ddbb7517b87773ef8c80307d1398 Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <[email protected]>
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 <[email protected]>
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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [PATCH] Remove dead code in ExecForPortionOfLeftovers()
@ 2026-04-22 03:58  Quan Zongliang <[email protected]>
  parent: Aleksander Alekseev <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Quan Zongliang @ 2026-04-22 03:58 UTC (permalink / raw)
  To: Aleksander Alekseev <[email protected]>; pgsql-hackers



On 4/21/26 8:22 PM, Aleksander Alekseev wrote:
> Hi,
> 
> While reading 8e72d914c528 I noticed that
> ForPortionOfState.fp_leftoverstypcache is not used for anything. I
> suggest removing it, as attached.
> 

Agree.
It indeed did not make any reference anywhere.

Quan Zongliang






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [PATCH] Remove dead code in ExecForPortionOfLeftovers()
@ 2026-04-22 04:24  jian he <[email protected]>
  parent: Quan Zongliang <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: jian he @ 2026-04-22 04:24 UTC (permalink / raw)
  To: Quan Zongliang <[email protected]>; +Cc: Aleksander Alekseev <[email protected]>; pgsql-hackers

On Wed, Apr 22, 2026 at 11:58 AM Quan Zongliang <[email protected]> wrote:
>
>
> On 4/21/26 8:22 PM, Aleksander Alekseev wrote:
> > Hi,
> >
> > While reading 8e72d914c528 I noticed that
> > ForPortionOfState.fp_leftoverstypcache is not used for anything. I
> > suggest removing it, as attached.
> >
>
> Agree.
> It indeed did not make any reference anywhere.
>

I raised this issue at [1].
But apparently, it's actually being used for fixing a bug at [2].

[1]: https://www.postgresql.org/message-id/CACJufxHYntqy2fo9CFWDDrqKjcMK8DGRM3kse4YnXYnPYq2Hiw%40mail.gma...
[2]: https://www.postgresql.org/message-id/CA%2BrenyU5%3Dmihx6O8%2BERBmarZcuV1QiWB3X5bZhdptWoRM9G-Aw%40ma...





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-04-22 04:24 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-21 12:22 [PATCH] Remove dead code in ExecForPortionOfLeftovers() Aleksander Alekseev <[email protected]>
2026-04-22 03:58 ` Quan Zongliang <[email protected]>
2026-04-22 04:24   ` jian he <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox