From e267e4f1e40bd6919efb4ebef769e60da3a7ac4e Mon Sep 17 00:00:00 2001 From: Henson Choi Date: Fri, 20 Mar 2026 16:59:21 +0900 Subject: [PATCH] Clarify ST_NONE intent in RPSkipTo enum and WindowClause initialization ST_NONE serves as the sentinel value (0) indicating that a WindowClause has no RPR AFTER MATCH clause. This was implicit via palloc0 zero-filling but not documented. Add a comment to the ST_NONE enum value explaining its role as the default for non-RPR windows, and add an explicit assignment in transformWindowDefinitions() to make the intent clear in code. --- src/backend/parser/parse_clause.c | 2 ++ src/include/nodes/parsenodes.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index b30c22933ec..3796a69ac3a 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -2889,6 +2889,8 @@ transformWindowDefinitions(ParseState *pstate, * And prepare the new WindowClause. */ wc = makeNode(WindowClause); + wc->rpSkipTo = ST_NONE; /* ST_NONE marks this as a non-RPR window; + * overridden by transformRPR() if RPR is used */ wc->name = windef->name; wc->refname = windef->refname; diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 432b0573990..c5bf2ce80bf 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -583,7 +583,8 @@ typedef struct SortBy */ typedef enum RPSkipTo { - ST_NONE, /* AFTER MATCH omitted */ + ST_NONE, /* no AFTER MATCH clause; default for non-RPR + * windows */ ST_NEXT_ROW, /* SKIP TO NEXT ROW */ ST_PAST_LAST_ROW, /* SKIP TO PAST LAST ROW */ } RPSkipTo; -- 2.50.1 (Apple Git-155)