From af49bcc1bdbd296e56860257ea56e4eb1fd3ac8d Mon Sep 17 00:00:00 2001 From: Henson Choi Date: Sat, 29 Aug 2026 17:32:03 +0900 Subject: [PATCH] Report a non-constant row pattern navigation offset as a syntax error A navigation offset must be a run-time constant, and two guards enforce that one rule -- one rejects an offset holding a navigation operation, the other an offset holding a column reference -- but they reported it in two different classes: DEFINE A AS PREV(price, LAST(price, 1)) > 0 -- 42601 DEFINE A AS PREV(price, price) > 0 -- 0A000 0A000 says PostgreSQL does not implement something, which reads as a promise that it may arrive later. The constant-offset rule is not a gap in what was built but a restriction on what the offset may be, so both guards now report 42601. Only the class changes. The messages, the error positions and the set of rejected queries stay as they are, and since the regression suite does not print SQLSTATE, no expected output moves. The run-time guards on a null or negative offset are left alone. --- src/backend/parser/parse_rpr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/parser/parse_rpr.c b/src/backend/parser/parse_rpr.c index c777c2c8800..e3aa8598f58 100644 --- a/src/backend/parser/parse_rpr.c +++ b/src/backend/parser/parse_rpr.c @@ -574,7 +574,7 @@ define_walker(Node *node, void *context) (void) define_walker((Node *) nav->offset_arg, ctx); if (ctx->has_column_ref) ereport(ERROR, - errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errcode(ERRCODE_SYNTAX_ERROR), errmsg("row pattern navigation offset must be a run-time constant"), parser_errposition(ctx->pstate, exprLocation((Node *) nav->offset_arg))); } @@ -584,7 +584,7 @@ define_walker(Node *node, void *context) (void) define_walker((Node *) nav->compound_offset_arg, ctx); if (ctx->has_column_ref) ereport(ERROR, - errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errcode(ERRCODE_SYNTAX_ERROR), errmsg("row pattern navigation offset must be a run-time constant"), parser_errposition(ctx->pstate, exprLocation((Node *) nav->compound_offset_arg))); }