public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: [email protected]
Subject: Remove redundant assignment in CreateWorkExprContext
Date: Thu, 21 Aug 2025 11:47:07 +0800
Message-ID: <[email protected]> (raw)

Hi,

While discussing [1], I was reading execUtils.c, then I noticed this 
redundant local variable assignment in CreateWorkExprContext(). The 
attached patch fixed that.

[1]: 
https://www.postgresql.org/message-id/[email protected]...

Best regards,

--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

From 5b5462398117acd0203e760b7bf18c4ff616cf81 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <[email protected]>
Date: Thu, 21 Aug 2025 11:35:18 +0800
Subject: [PATCH v1] 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 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index fdc65c2b42b..07b67d65b40 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -321,9 +321,7 @@ CreateExprContext(EState *estate)
 ExprContext *
 CreateWorkExprContext(EState *estate)
 {
-	Size		maxBlockSize = ALLOCSET_DEFAULT_MAXSIZE;
-
-	maxBlockSize = pg_prevpower2_size_t(work_mem * (Size) 1024 / 16);
+	Size		maxBlockSize = pg_prevpower2_size_t(work_mem * (Size) 1024 / 16);
 
 	/* But no bigger than ALLOCSET_DEFAULT_MAXSIZE */
 	maxBlockSize = Min(maxBlockSize, ALLOCSET_DEFAULT_MAXSIZE);
-- 
2.39.5 (Apple Git-154)



Attachments:

  [text/plain] v1-0001-Remove-redundant-assignemnt-in-CreateWorkExprCont.patch (1.1K, ../[email protected]/2-v1-0001-Remove-redundant-assignemnt-in-CreateWorkExprCont.patch)
  download | inline diff:
From 5b5462398117acd0203e760b7bf18c4ff616cf81 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <[email protected]>
Date: Thu, 21 Aug 2025 11:35:18 +0800
Subject: [PATCH v1] 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 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index fdc65c2b42b..07b67d65b40 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -321,9 +321,7 @@ CreateExprContext(EState *estate)
 ExprContext *
 CreateWorkExprContext(EState *estate)
 {
-	Size		maxBlockSize = ALLOCSET_DEFAULT_MAXSIZE;
-
-	maxBlockSize = pg_prevpower2_size_t(work_mem * (Size) 1024 / 16);
+	Size		maxBlockSize = pg_prevpower2_size_t(work_mem * (Size) 1024 / 16);
 
 	/* But no bigger than ALLOCSET_DEFAULT_MAXSIZE */
 	maxBlockSize = Min(maxBlockSize, ALLOCSET_DEFAULT_MAXSIZE);
-- 
2.39.5 (Apple Git-154)



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Remove redundant assignment in CreateWorkExprContext
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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