From b753a11c7f04af8dce5b9baf023da2a3f210bb70 Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Sun, 28 Jun 2026 13:28:13 +0900
Subject: [PATCH] Restore funcname guard in WinCheckAndInitializeNullTreatment

This unreachable-branch removal is unrelated to row pattern recognition;
revert it to keep the RPR diff minimal.
---
 src/backend/executor/nodeWindowAgg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index b1a86fb3a14..047287a6366 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -4936,11 +4936,12 @@ WinCheckAndInitializeNullTreatment(WindowObject winobj,
 	{
 		const char *funcname = get_func_name(fcinfo->flinfo->fn_oid);
 
-		/* the executing function's name always resolves; stay safe regardless */
+		if (!funcname)
+			elog(ERROR, "could not get function name");
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("function %s does not allow RESPECT/IGNORE NULLS",
-						funcname ? funcname : "?")));
+						funcname)));
 	}
 	else if (winobj->ignore_nulls == PARSER_IGNORE_NULLS)
 		winobj->ignore_nulls = IGNORE_NULLS;
-- 
2.50.1 (Apple Git-155)

