public inbox for [email protected]  
help / color / mirror / Atom feed
From: =?utf-8?B?Y2NhNTUwNw==?= <[email protected]>
To: =?utf-8?B?cGdzcWwtaGFja2Vycw==?= <[email protected]>
Subject: Minor refactor of the code in ExecScanExtended()
Date: Fri, 7 Nov 2025 22:00:15 +0800
Message-ID: <[email protected]> (raw)

Hi,


The current code:


      if (!qual &amp;&amp; !projInfo)
      {
            ResetExprContext(econtext);
            return ExecScanFetch(node, epqstate, accessMtd, recheckMtd);
      }


      ResetExprContext(econtext);


The following format might be simpler:


      ResetExprContext(econtext);


      if (!qual &amp;&amp; !projInfo)
            return ExecScanFetch(node, epqstate, accessMtd, recheckMtd);


Attach a patch to do this.


--
Regards,
ChangAo Chen

Attachments:

  [application/octet-stream] v1-0001-Minor-refactor-of-the-code-in-ExecScanExtended.patch (1.3K, 3-v1-0001-Minor-refactor-of-the-code-in-ExecScanExtended.patch)
  download | inline diff:
From b7a5362fccb82820c6e1b05d4e3d44d64acc2844 Mon Sep 17 00:00:00 2001
From: ChangAo Chen <[email protected]>
Date: Fri, 7 Nov 2025 21:55:38 +0800
Subject: [PATCH v1] Minor refactor of the code in ExecScanExtended()

---
 src/include/executor/execScan.h | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/include/executor/execScan.h b/src/include/executor/execScan.h
index 2003cbc7ed5..53a896439ca 100644
--- a/src/include/executor/execScan.h
+++ b/src/include/executor/execScan.h
@@ -168,21 +168,18 @@ ExecScanExtended(ScanState *node,
 
 	/* interrupt checks are in ExecScanFetch */
 
+	/*
+	 * Reset per-tuple memory context to free any expression evaluation
+	 * storage allocated in the previous tuple cycle.
+	 */
+	ResetExprContext(econtext);
+
 	/*
 	 * If we have neither a qual to check nor a projection to do, just skip
 	 * all the overhead and return the raw scan tuple.
 	 */
 	if (!qual && !projInfo)
-	{
-		ResetExprContext(econtext);
 		return ExecScanFetch(node, epqstate, accessMtd, recheckMtd);
-	}
-
-	/*
-	 * Reset per-tuple memory context to free any expression evaluation
-	 * storage allocated in the previous tuple cycle.
-	 */
-	ResetExprContext(econtext);
 
 	/*
 	 * get a tuple from the access method.  Loop until we obtain a tuple that
-- 
2.51.2



view thread (3+ messages)  latest in thread

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: Minor refactor of the code in ExecScanExtended()
  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