public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andreas Karlsson <[email protected]>
To: Chao Li <[email protected]>
To: [email protected]
Subject: Re: Remove redundant assignment in CreateWorkExprContext
Date: Wed, 14 Jan 2026 08:13:17 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
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
Attachments:
[text/x-patch] v2-0001-Remove-redundant-assignemnt-in-CreateWorkExprCont.patch (974B, ../[email protected]/2-v2-0001-Remove-redundant-assignemnt-in-CreateWorkExprCont.patch)
download | inline diff:
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
view thread (2+ messages)
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], [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