On 8/21/25 5:47 AM, Chao Li wrote:
While discussing [1], I was reading execUtils.c, then I noticed this redundant local variable assignment in CreateWorkExprContext(). The attached patch fixed that.
Nice spotted but I think your patch reduces readability. How about this?

Andreas
From c0f55c12069bf1b0631954cf2641d43fcdf81859 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <[email protected]>
Date: Thu, 21 Aug 2025 11:35:18 +0800
Subject: [PATCH v2] Remove redundant assignemnt in CreateWorkExprContext

In CreateWorkExprContext(), maxBlockSize is initialized to
ALLOCSET_DEFAULT_MAXSIZE, and it then immediately reassigned,
thus the initialization is a redundant.

Author: Chao Li <[email protected]>
---
 src/backend/executor/execUtils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index cc3c5de71eb..a7955e476f9 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -321,7 +321,7 @@ CreateExprContext(EState *estate)
 ExprContext *
 CreateWorkExprContext(EState *estate)
 {
-	Size		maxBlockSize = ALLOCSET_DEFAULT_MAXSIZE;
+	Size		maxBlockSize;
 
 	maxBlockSize = pg_prevpower2_size_t(work_mem * (Size) 1024 / 16);
 
-- 
2.47.3

Reply via email to