nocfbot-0033-Clarify-that-ExecRPRCleanupDeadContexts-always-fr.txt

text/plain

Filename: nocfbot-0033-Clarify-that-ExecRPRCleanupDeadContexts-always-fr.txt
Type: text/plain
Part: 32
Message: Re: Row pattern recognition
From e95343dc28e3b35344fc142035236249b96986c6 Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Mon, 1 Jun 2026 12:52:45 +0900
Subject: [PATCH 33/38] Clarify that ExecRPRCleanupDeadContexts always frees
 the failed context

The failure statistic is recorded conditionally, but the context is freed
unconditionally.  A stray "else:" comment before the free made it read as
the conditional branch; reword the comment and drop the "else:".  No code
change.  Per Jian He's off-list review.
---
 src/backend/executor/execRPR.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/backend/executor/execRPR.c b/src/backend/executor/execRPR.c
index 34638409f66..16a0f4ae375 100644
--- a/src/backend/executor/execRPR.c
+++ b/src/backend/executor/execRPR.c
@@ -1805,9 +1805,9 @@ ExecRPRCleanupDeadContexts(WindowAggState *winstate, RPRNFAContext *excludeCtx)
 			continue;
 
 		/*
-		 * This is a failed context - count and remove it. Only count if it
-		 * actually processed its start row. Contexts created for
-		 * beyond-partition rows are silently removed.
+		 * Failed context: always removed below.  Only record the failure
+		 * statistic if it actually processed its start row; contexts created
+		 * for beyond-partition rows are removed without being counted.
 		 */
 		if (ctx->lastProcessedRow >= ctx->matchStartRow)
 		{
@@ -1815,7 +1815,6 @@ ExecRPRCleanupDeadContexts(WindowAggState *winstate, RPRNFAContext *excludeCtx)
 
 			ExecRPRRecordContextFailure(winstate, failedLen);
 		}
-		/* else: context was never processed (beyond-partition), just remove */
 
 		ExecRPRFreeContext(winstate, ctx);
 	}
-- 
2.50.1 (Apple Git-155)