nocfbot-0009-define-walker-else.txt
text/plain
Filename: nocfbot-0009-define-walker-else.txt
Type: text/plain
Part: 8
Message:
Re: Row pattern recognition
From f3dda49e5a24347ff23da72f5fe80640291bc34c Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Wed, 17 Jun 2026 20:43:01 +0900
Subject: [PATCH 09/13] Replace a bare block with an else in the RPR DEFINE
clause walker
define_walker() ended its phase handling with a bare braced block for
the DEFINE-body case, following two if blocks that respectively return
and raise an error. Turn it into the else branch of an if / else if /
else chain. No behavior change.
---
src/backend/parser/parse_rpr.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/backend/parser/parse_rpr.c b/src/backend/parser/parse_rpr.c
index 116cd206e39..7c201d55164 100644
--- a/src/backend/parser/parse_rpr.c
+++ b/src/backend/parser/parse_rpr.c
@@ -515,8 +515,7 @@ define_walker(Node *node, void *context)
ctx->nav_count++;
return expression_tree_walker(node, define_walker, ctx);
}
-
- if (ctx->phase == DEFINE_PHASE_NAV_OFFSET)
+ else if (ctx->phase == DEFINE_PHASE_NAV_OFFSET)
{
/*
* A navigation offset must be a run-time constant, so it cannot
@@ -528,13 +527,13 @@ define_walker(Node *node, void *context)
errdetail("A navigation offset must be a run-time constant."),
parser_errposition(ctx->pstate, nav->location));
}
-
- /*
- * PHASE_BODY: this is an outer nav at top level. Walk arg first to
- * collect nesting / column-ref state, then validate and (for compound
- * forms) flatten, then walk offset(s).
- */
+ else
{
+ /*
+ * PHASE_BODY: this is an outer nav at top level. Walk arg first
+ * to collect nesting / column-ref state, then validate and (for
+ * compound forms) flatten, then walk offset(s).
+ */
DefineWalkCtx saved = *ctx;
bool outer_phys = (nav->kind == RPR_NAV_PREV ||
nav->kind == RPR_NAV_NEXT);
--
2.50.1 (Apple Git-155)