From d3590794004c6200dee5178795a8d983f02d4375 Mon Sep 17 00:00:00 2001 From: Henson Choi Date: Tue, 7 Apr 2026 10:50:36 +0900 Subject: [PATCH] Fix RPR documentation: synopsis, grammar, and terminology Remove erroneous comma in PATTERN synopsis. Fix typos in advanced.sgml (">=;" stray semicolon, "with the a row", "For example following"). Correct PREV/NEXT description from "within the window frame" to "within the partition" and add missing "DEFINE clause only" note. Capitalize "Row Pattern Recognition" consistently across SGML files. Fix numerous missing articles and grammar errors in select.sgml: "after a match found" -> "after a match is found", "do not necessarily" -> "does not necessarily", add missing "the" before clause references. --- doc/src/sgml/advanced.sgml | 14 +++++++------- doc/src/sgml/func/func-window.sgml | 14 ++++++++------ doc/src/sgml/ref/select.sgml | 28 ++++++++++++++-------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/doc/src/sgml/advanced.sgml b/doc/src/sgml/advanced.sgml index 0caf9fdaff6..11c2416df51 100644 --- a/doc/src/sgml/advanced.sgml +++ b/doc/src/sgml/advanced.sgml @@ -553,8 +553,8 @@ WHERE pos < 3; - Row pattern common syntax can be used to perform row pattern recognition - in a query. The row pattern common syntax includes two sub + Row Pattern Common Syntax can be used to perform Row Pattern Recognition + in a query. The Row Pattern Common Syntax includes two sub clauses: DEFINE and PATTERN. DEFINE defines row pattern variables along with an expression. The expression must be a @@ -584,12 +584,12 @@ DEFINE Once DEFINE exists, PATTERN can be used. PATTERN defines a sequence of rows that satisfies conditions defined in the DEFINE clause. For example - following PATTERN defines a sequence of rows starting - with the a row satisfying "LOWPRICE", then one or more rows satisfying + the following PATTERN defines a sequence of rows starting + with a row satisfying "LOWPRICE", then one or more rows satisfying "UP" and finally one or more rows satisfying "DOWN". Pattern variables can be followed by quantifiers: "+" means one or more matches, "*" means zero or more matches, "?" means zero or one match, "{n}" (n > 0) means exactly - n matches, "{n,}" (n >=; 0) means at least n matches, "{,m}" (m > 0) means + n matches, "{n,}" (n >= 0) means at least n matches, "{,m}" (m > 0) means at most m matches, and "{n,m}" (0 <= n <= m, 0 < m) means between n and m matches. Patterns can be grouped using parentheses and combined using alternation (the vertical bar "|" for OR). For example, "(UP DOWN)+" @@ -642,7 +642,7 @@ FROM stock - Row pattern recognition internally uses a nondeterministic finite + Row Pattern Recognition internally uses a nondeterministic finite automaton (NFA) to match patterns. For patterns with unbounded quantifiers (e.g., A+ or (A B)+), the NFA may need to track many active matching contexts simultaneously, @@ -676,7 +676,7 @@ FROM stock - When examining query plans for row pattern recognition with + When examining query plans for Row Pattern Recognition with EXPLAIN, the pattern output may include special markers that indicate optimization opportunities. A double quote " marks where pattern absorption can occur, diff --git a/doc/src/sgml/func/func-window.sgml b/doc/src/sgml/func/func-window.sgml index ab80690f7be..d109a2d22bc 100644 --- a/doc/src/sgml/func/func-window.sgml +++ b/doc/src/sgml/func/func-window.sgml @@ -279,9 +279,9 @@ - Row pattern recognition navigation functions are listed in + Row Pattern Recognition navigation functions are listed in . These functions - can be used to describe DEFINE clause of Row pattern recognition. + can be used to describe the DEFINE clause of Row Pattern Recognition. @@ -309,12 +309,13 @@ Returns the column value at the row offset - rows before the current row within the window frame; - returns NULL if the target row is outside the window frame. + rows before the current row within the partition; + returns NULL if the target row is outside the partition. offset defaults to 1 if omitted. offset must be a non-negative integer; an offset of 0 refers to the current row itself. offset must not be NULL. + Can only be used in a DEFINE clause. @@ -328,12 +329,13 @@ Returns the column value at the row offset - rows after the current row within the window frame; - returns NULL if the target row is outside the window frame. + rows after the current row within the partition; + returns NULL if the target row is outside the partition. offset defaults to 1 if omitted. offset must be a non-negative integer; an offset of 0 refers to the current row itself. offset must not be NULL. + Can only be used in a DEFINE clause. diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 5e4ba9d3cc6..5272d6c0bfa 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -1133,34 +1133,34 @@ EXCLUDE NO OTHERS The optional row_pattern_common_syntax - defines the row pattern recognition condition for + defines the Row Pattern Recognition condition for this window. row_pattern_common_syntax - includes following subclauses. + includes the following subclauses. [ { AFTER MATCH SKIP PAST LAST ROW | AFTER MATCH SKIP TO NEXT ROW } ] [ INITIAL | SEEK ] -PATTERN ( pattern_variable_name [ quantifier ] [, ...] ) +PATTERN ( pattern_variable_name [ quantifier ] [ ... ] ) DEFINE definition_variable_name AS expression [, ...] AFTER MATCH SKIP PAST LAST ROW or AFTER MATCH - SKIP TO NEXT ROW controls how to proceed to next row position - after a match found. With AFTER MATCH SKIP PAST LAST - ROW (the default) next row position is next to the last row of - previous match. On the other hand, with AFTER MATCH SKIP TO NEXT - ROW next row position is next to the first row of previous - match. INITIAL or SEEK defines how a - successful pattern matching starts from which row in a - frame. If INITIAL is specified, the match must start + SKIP TO NEXT ROW controls how to proceed to the next row position + after a match is found. With AFTER MATCH SKIP PAST LAST + ROW (the default) the next row position is next to the last row of + the previous match. On the other hand, with AFTER MATCH SKIP TO NEXT + ROW the next row position is next to the first row of the previous + match. INITIAL or SEEK specifies from + which row in the frame pattern matching begins. + If INITIAL is specified, the match must start from the first row in the frame. If SEEK is specified, - the set of matching rows do not necessarily start from the first row. The + the set of matching rows does not necessarily start from the first row. The default is INITIAL. Currently only INITIAL is supported. DEFINE defines definition variables along with a boolean expression. PATTERN defines a sequence of rows that satisfies certain conditions using variables defined - in DEFINE clause (an empty PATTERN() + in the DEFINE clause (an empty PATTERN() is not supported). Each pattern variable can be followed by a quantifier to specify how many times it should match: * (zero or more), @@ -1198,7 +1198,7 @@ DEFINE definition_variable_name AS Note that the maximum number of unique pattern variables - used in PATTERN clause is 251. + used in the PATTERN clause is 251. If this limit is exceeded, an error will be raised. Additionally, the maximum nesting depth of pattern groups (parentheses) is 253 levels. -- 2.50.1 (Apple Git-155)