From 13a1f8155343fa809d0303466f20682cc32e7d47 Mon Sep 17 00:00:00 2001
From: Greg Burd <greg@burd.me>
Date: Thu, 9 Oct 2025 09:48:35 -0400
Subject: [PATCH v1] Minor fix to avoid maybe-uninitialized warning related to
 notnull_relpos

This moves the initialization of notnull_relpos to after the block that
the seems to be overlooked by the compiler and just before the value is
used in the do/while test.  The code appears safe as is, this change
removes the ambiguity that confuses the compiler triggering the "maybe
unitialized" warning.
---
 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 0698aae37a7..f3f2ac7bc3c 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -3731,7 +3731,6 @@ WinGetFuncArgInPartition(WindowObject winobj, int argno,
 	{
 		null_treatment = true;
 		notnull_offset = 0;
-		notnull_relpos = abs(relpos);
 		forward = relpos > 0 ? 1 : -1;
 	}
 
@@ -3771,6 +3770,7 @@ WinGetFuncArgInPartition(WindowObject winobj, int argno,
 		return datum;
 	}
 
+	notnull_relpos = abs(relpos);
 	myisout = false;
 	datum = 0;
 
-- 
2.49.0

