nocfbot-0026-Remove-the-redundant-zero-check-on-the-RPR-frame-.txt

text/plain

Filename: nocfbot-0026-Remove-the-redundant-zero-check-on-the-RPR-frame-.txt
Type: text/plain
Part: 25
Message: Re: Row pattern recognition
From 3bbf9ceef9aee65cab32ec0d4d668842bb89d0f0 Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Sat, 30 May 2026 19:37:11 +0900
Subject: [PATCH 26/26] Remove the redundant zero check on the RPR frame ending
 offset

update_reduced_frame() guarded the frame offset with "endOffsetValue
!= 0", comparing a Datum directly to zero.  Now that a single-row frame
is rejected, a limited frame always carries a real offset, so the guard
is unnecessary; dropping it leaves a plain DatumGetInt64() and removes
the type-confused Datum-vs-zero comparison.

Per Jian He's review.
---
 src/backend/executor/nodeWindowAgg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index 770ea2e5e1a..667d7b30cc9 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -4399,7 +4399,7 @@ update_reduced_frame(WindowObject winobj, int64 pos)
 	 */
 	hasLimitedFrame = (frameOptions & FRAMEOPTION_ROWS) &&
 		!(frameOptions & FRAMEOPTION_END_UNBOUNDED_FOLLOWING);
-	if (hasLimitedFrame && winstate->endOffsetValue != 0)
+	if (hasLimitedFrame)
 		frameOffset = DatumGetInt64(winstate->endOffsetValue);
 
 	/*
-- 
2.50.1 (Apple Git-155)