nocfbot-0013-Move-variables-to-function-scope.txt

text/plain

Filename: nocfbot-0013-Move-variables-to-function-scope.txt
Type: text/plain
Part: 12
Message: Re: Row pattern recognition
From 0e944668568a73c3387636e29dc52bd056907437 Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Fri, 20 Mar 2026 21:40:05 +0900
Subject: [PATCH] Move local variables to function scope in
 row_is_in_reduced_frame

Variables i and num_reduced_rows were declared inside the switch block
before the first case label. Move them to the function top to follow
PostgreSQL coding conventions.
---
 src/backend/executor/nodeWindowAgg.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index 942f071b457..6575cf9dd96 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -3969,6 +3969,8 @@ row_is_in_reduced_frame(WindowObject winobj, int64 pos)
 	WindowAggState *winstate = winobj->winstate;
 	int			state;
 	int			rtn;
+	int64		i;
+	int			num_reduced_rows;
 
 	if (!rpr_is_defined(winstate))
 	{
@@ -3996,9 +3998,6 @@ row_is_in_reduced_frame(WindowObject winobj, int64 pos)
 
 	switch (state)
 	{
-			int64		i;
-			int			num_reduced_rows;
-
 		case RF_FRAME_HEAD:
 			num_reduced_rows = 1;
 			for (i = pos + 1;
-- 
2.50.1 (Apple Git-155)