nocfbot-0028-Fix-documentation-synopsis-grammar.txt

text/plain

Filename: nocfbot-0028-Fix-documentation-synopsis-grammar.txt
Type: text/plain
Part: 27
Message: Re: Row pattern recognition
From 9a81f1981cd930fa1e25288a07f350fbace4c9a5 Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Tue, 7 Apr 2026 10:50:36 +0900
Subject: [PATCH 28/40] 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 &lt; 3;
    </para>
 
    <para>
-    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: <literal>DEFINE</literal>
     and <literal>PATTERN</literal>. <literal>DEFINE</literal> defines
     row pattern variables along with an expression. The expression must be a
@@ -584,12 +584,12 @@ DEFINE
     Once <literal>DEFINE</literal> exists, <literal>PATTERN</literal> can be
     used. <literal>PATTERN</literal> defines a sequence of rows that satisfies
     conditions defined in the <literal>DEFINE</literal> clause.  For example
-    following <literal>PATTERN</literal> defines a sequence of rows starting
-    with the a row satisfying "LOWPRICE", then one or more rows satisfying
+    the following <literal>PATTERN</literal> 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 &gt; 0) means exactly
-    n matches, "{n,}" (n &gt;=; 0) means at least n matches, "{,m}" (m &gt; 0) means
+    n matches, "{n,}" (n &gt;= 0) means at least n matches, "{,m}" (m &gt; 0) means
     at most m matches, and "{n,m}" (0 &lt;= n &lt;= m, 0 &lt; 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
    </para>
 
    <para>
-    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., <literal>A+</literal> or <literal>(A B)+</literal>),
     the NFA may need to track many active matching contexts simultaneously,
@@ -676,7 +676,7 @@ FROM stock
    </para>
 
    <para>
-    When examining query plans for row pattern recognition with
+    When examining query plans for Row Pattern Recognition with
     <command>EXPLAIN</command>, the pattern output may include special
     markers that indicate optimization opportunities. A double quote
     <literal>"</literal> 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 @@
   </para>
 
   <para>
-   Row pattern recognition navigation functions are listed in
+   Row Pattern Recognition navigation functions are listed in
    <xref linkend="functions-rpr-navigation-table"/>.  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.
   </para>
 
    <table id="functions-rpr-navigation-table">
@@ -309,12 +309,13 @@
        </para>
        <para>
         Returns the column value at the row <parameter>offset</parameter>
-        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.
         <parameter>offset</parameter> defaults to 1 if omitted.
         <parameter>offset</parameter> must be a non-negative integer;
         an offset of 0 refers to the current row itself.
         <parameter>offset</parameter> must not be NULL.
+        Can only be used in a <literal>DEFINE</literal> clause.
        </para></entry>
       </row>
 
@@ -328,12 +329,13 @@
        </para>
        <para>
         Returns the column value at the row <parameter>offset</parameter>
-        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.
         <parameter>offset</parameter> defaults to 1 if omitted.
         <parameter>offset</parameter> must be a non-negative integer;
         an offset of 0 refers to the current row itself.
         <parameter>offset</parameter> must not be NULL.
+        Can only be used in a <literal>DEFINE</literal> clause.
        </para></entry>
       </row>
 
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
    <para>
     The
     optional <replaceable class="parameter">row_pattern_common_syntax</replaceable>
-    defines the <firstterm>row pattern recognition condition</firstterm> for
+    defines the <firstterm>Row Pattern Recognition condition</firstterm> for
     this
     window. <replaceable class="parameter">row_pattern_common_syntax</replaceable>
-    includes following subclauses.
+    includes the following subclauses.
 
 <synopsis>
 [ { AFTER MATCH SKIP PAST LAST ROW | AFTER MATCH SKIP TO NEXT ROW } ]
 [ INITIAL | SEEK ]
-PATTERN ( <replaceable class="parameter">pattern_variable_name</replaceable> [ <replaceable>quantifier</replaceable> ] [, ...] )
+PATTERN ( <replaceable class="parameter">pattern_variable_name</replaceable> [ <replaceable>quantifier</replaceable> ] [ ... ] )
 DEFINE <replaceable class="parameter">definition_variable_name</replaceable> AS <replaceable class="parameter">expression</replaceable> [, ...]
 </synopsis>
     <literal>AFTER MATCH SKIP PAST LAST ROW</literal> or <literal>AFTER MATCH
-    SKIP TO NEXT ROW</literal> controls how to proceed to next row position
-    after a match found. With <literal>AFTER MATCH SKIP PAST LAST
-    ROW</literal> (the default) next row position is next to the last row of
-    previous match. On the other hand, with <literal>AFTER MATCH SKIP TO NEXT
-    ROW</literal> next row position is next to the first row of previous
-    match. <literal>INITIAL</literal> or <literal>SEEK</literal> defines how a
-    successful pattern matching starts from which row in a
-    frame. If <literal>INITIAL</literal> is specified, the match must start
+    SKIP TO NEXT ROW</literal> controls how to proceed to the next row position
+    after a match is found. With <literal>AFTER MATCH SKIP PAST LAST
+    ROW</literal> (the default) the next row position is next to the last row of
+    the previous match. On the other hand, with <literal>AFTER MATCH SKIP TO NEXT
+    ROW</literal> the next row position is next to the first row of the previous
+    match. <literal>INITIAL</literal> or <literal>SEEK</literal> specifies from
+    which row in the frame pattern matching begins.
+    If <literal>INITIAL</literal> is specified, the match must start
     from the first row in the frame. If <literal>SEEK</literal> 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 <literal>INITIAL</literal>. Currently
     only <literal>INITIAL</literal> is supported. <literal>DEFINE</literal>
     defines definition variables along with a boolean
     expression. <literal>PATTERN</literal> defines a sequence of rows that
     satisfies certain conditions using variables defined
-    in <literal>DEFINE</literal> clause (an empty <literal>PATTERN()</literal>
+    in the <literal>DEFINE</literal> clause (an empty <literal>PATTERN()</literal>
     is not supported). Each pattern variable can be followed by a quantifier
     to specify how many times it should match:
     <literal>*</literal> (zero or more),
@@ -1198,7 +1198,7 @@ DEFINE <replaceable class="parameter">definition_variable_name</replaceable> AS
 
    <para>
     Note that the maximum number of unique pattern variables
-    used in <literal>PATTERN</literal> clause is 251.
+    used in the <literal>PATTERN</literal> 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)