From 9a191e6f099df41bc976728d83ba5f8b3190a5a9 Mon Sep 17 00:00:00 2001 From: Henson Choi Date: Fri, 5 Jun 2026 22:30:14 +0900 Subject: [PATCH 53/68] Restore the error cursor for too many row pattern variables The "too many pattern variables" error came out without a LINE/caret cursor: the check locates the cursor via exprLocation(), which had no T_RPRPatternNode case and fell through to the default returning -1. Add the case alongside T_RPRNavExpr to return the node's token location. Caller and message text are unchanged; only the cursor is restored. Update the existing 241-variable rpr_base regression. --- src/backend/nodes/nodeFuncs.c | 3 +++ src/test/regress/expected/rpr_base.out | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index aecf4e4da0a..6ab227b2b60 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -1452,6 +1452,9 @@ exprLocation(const Node *expr) case T_RPRNavExpr: loc = ((const RPRNavExpr *) expr)->location; break; + case T_RPRPatternNode: + loc = ((const RPRPatternNode *) expr)->location; + break; case T_SubscriptingRef: /* just use container argument's location */ loc = exprLocation((Node *) ((const SubscriptingRef *) expr)->refexpr); diff --git a/src/test/regress/expected/rpr_base.out b/src/test/regress/expected/rpr_base.out index fa6d101f874..f086ecc9a5d 100644 --- a/src/test/regress/expected/rpr_base.out +++ b/src/test/regress/expected/rpr_base.out @@ -6540,6 +6540,8 @@ WINDOW w AS ( V231 AS val > 0, V232 AS val > 0, V233 AS val > 0, V234 AS val > 0, V235 AS val > 0, V236 AS val > 0, V237 AS val > 0, V238 AS val > 0, V239 AS val > 0, V240 AS val > 0 ); ERROR: too many pattern variables +LINE 5: ...V230 V231 V232 V233 V234 V235 V236 V237 V238 V239 V240 V241) + ^ DETAIL: Maximum is 240. -- Expected: ERROR - too many pattern variables (Maximum is 240) -- Test: Pattern nesting at maximum depth (depth 253) -- 2.50.1 (Apple Git-155)