public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH v5 03/12] Add comma for readability
3+ messages / 3 participants
[nested] [flat]

* [PATCH v5 03/12] Add comma for readability
@ 2019-03-30 00:37 Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Justin Pryzby @ 2019-03-30 00:37 UTC (permalink / raw)

---
 doc/src/sgml/backup.sgml              |  2 +-
 doc/src/sgml/bki.sgml                 |  2 +-
 doc/src/sgml/client-auth.sgml         |  4 ++--
 doc/src/sgml/config.sgml              |  4 ++--
 doc/src/sgml/ddl.sgml                 |  2 +-
 doc/src/sgml/indices.sgml             |  2 +-
 doc/src/sgml/installation.sgml        |  2 +-
 doc/src/sgml/logical-replication.sgml |  2 +-
 doc/src/sgml/monitoring.sgml          |  8 ++++----
 doc/src/sgml/protocol.sgml            |  6 +++---
 doc/src/sgml/ref/create_table.sgml    |  2 +-
 doc/src/sgml/ref/create_table_as.sgml |  2 +-
 doc/src/sgml/ref/pgupgrade.sgml       |  2 +-
 doc/src/sgml/ref/psql-ref.sgml        |  2 +-
 doc/src/sgml/sources.sgml             | 20 ++++++++++----------
 doc/src/sgml/wal.sgml                 |  2 +-
 doc/src/sgml/xoper.sgml               |  2 +-
 17 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 9d4c000..aba0414 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -1024,7 +1024,7 @@ SELECT pg_start_backup('label', true);
      consider during this backup.
     </para>
     <para>
-     As noted above, if the server crashes during the backup it may not be
+     As noted above, if the server crashes during the backup, it may not be
      possible to restart until the <literal>backup_label</literal> file has
      been manually deleted from the <envar>PGDATA</envar> directory.  Note
      that it is very important to never remove the
diff --git a/doc/src/sgml/bki.sgml b/doc/src/sgml/bki.sgml
index aa3d6f8..e27fa76 100644
--- a/doc/src/sgml/bki.sgml
+++ b/doc/src/sgml/bki.sgml
@@ -403,7 +403,7 @@
     8000&mdash;9999.  This minimizes the risk of OID collisions with other
     patches being developed concurrently.  To keep the 8000&mdash;9999
     range free for development purposes, after a patch has been committed
-    to the master git repository its OIDs should be renumbered into
+    to the master git repository, its OIDs should be renumbered into
     available space below that range.  Typically, this will be done
     near the end of each development cycle, moving all OIDs consumed by
     patches committed in that cycle at the same time.  The script
diff --git a/doc/src/sgml/client-auth.sgml b/doc/src/sgml/client-auth.sgml
index 3ed74d8..4a01b1b 100644
--- a/doc/src/sgml/client-auth.sgml
+++ b/doc/src/sgml/client-auth.sgml
@@ -157,7 +157,7 @@ hostnogssenc <replaceable>database</replaceable>  <replaceable>user</replaceable
       </para>
 
       <para>
-       To make use of this option the server must be built with
+       To make use of this option, the server must be built with
        <acronym>SSL</acronym> support. Furthermore,
        <acronym>SSL</acronym> must be enabled
        by setting the <xref linkend="guc-ssl"/> configuration parameter (see
@@ -189,7 +189,7 @@ hostnogssenc <replaceable>database</replaceable>  <replaceable>user</replaceable
       </para>
 
       <para>
-       To make use of this option the server must be built with
+       To make use of this option, the server must be built with
        <acronym>GSSAPI</acronym> support.  Otherwise,
        the <literal>hostgssenc</literal> record is ignored except for logging
        a warning that it cannot match any connections.
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index ff60875..b898214 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -3458,7 +3458,7 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"'  # Windows
         reached. The default is <literal>pause</literal>, which means recovery will
         be paused. <literal>promote</literal> means the recovery process will finish
         and the server will start to accept connections.
-        Finally <literal>shutdown</literal> will stop the server after reaching the
+        Finally, <literal>shutdown</literal> will stop the server after reaching the
         recovery target.
        </para>
        <para>
@@ -4188,7 +4188,7 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
        </para>
        <para>
         The delay occurs once the database in recovery has reached a consistent
-        state, until the standby is promoted or triggered. After that the standby
+        state, until the standby is promoted or triggered. After that, the standby
         will end recovery without further waiting.
        </para>
        <para>
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 98cb89f..093ef05 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3867,7 +3867,7 @@ CREATE INDEX ON measurement (logdate);
     <title>Partition Maintenance</title>
 
     <para>
-      Normally the set of partitions established when initially defining the
+      Normally, the set of partitions established when initially defining the
       table are not intended to remain static.  It is common to
       remove partitions of old data and add partitions for
       new data. One of the most important advantages of partitioning is
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 95c0a19..e940ddb 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -1081,7 +1081,7 @@ SELECT x FROM tab WHERE x = 'key' AND z &lt; 42;
    scan.  Even in the successful case, this approach trades visibility map
    accesses for heap accesses; but since the visibility map is four orders
    of magnitude smaller than the heap it describes, far less physical I/O is
-   needed to access it.  In most situations the visibility map remains
+   needed to access it.  In most situations, the visibility map remains
    cached in memory all the time.
   </para>
 
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 4493862..847e028 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -2527,7 +2527,7 @@ xcodebuild -version -sdk macosx Path
 </programlisting>
     Note that building an extension using a different sysroot version than
     was used to build the core server is not really recommended; in the
-    worst case it could result in hard-to-debug ABI inconsistencies.
+    worst case, it could result in hard-to-debug ABI inconsistencies.
    </para>
 
    <para>
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index f657d1d..a27ff0b 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -201,7 +201,7 @@
 
   <para>
    Subscriptions are dumped by <command>pg_dump</command> if the current user
-   is a superuser.  Otherwise a warning is written and subscriptions are
+   is a superuser.  Otherwise, a warning is written and subscriptions are
    skipped, because non-superusers cannot read all subscription information
    from the <structname>pg_subscription</structname> catalog.
   </para>
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 728db6b..cba36c0 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -2841,7 +2841,7 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
    <structname>pg_stat_user_tables</structname> and
    <structname>pg_stat_sys_tables</structname> views
    contain the same information,
-   but filtered to only show user and system tables respectively.
+   but filtered to only show user and system tables, respectively.
   </para>
 
   <table id="pg-stat-all-indexes-view" xreflabel="pg_stat_all_indexes">
@@ -2908,7 +2908,7 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
    <structname>pg_stat_user_indexes</structname> and
    <structname>pg_stat_sys_indexes</structname> views
    contain the same information,
-   but filtered to only show user and system indexes respectively.
+   but filtered to only show user and system indexes, respectively.
   </para>
 
   <para>
@@ -3018,7 +3018,7 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
    <structname>pg_statio_user_tables</structname> and
    <structname>pg_statio_sys_tables</structname> views
    contain the same information,
-   but filtered to only show user and system tables respectively.
+   but filtered to only show user and system tables, respectively.
   </para>
 
   <table id="pg-statio-all-indexes-view" xreflabel="pg_statio_all_indexes">
@@ -3079,7 +3079,7 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
    <structname>pg_statio_user_indexes</structname> and
    <structname>pg_statio_sys_indexes</structname> views
    contain the same information,
-   but filtered to only show user and system indexes respectively.
+   but filtered to only show user and system indexes, respectively.
   </para>
 
   <table id="pg-statio-all-sequences-view" xreflabel="pg_statio_all_sequences">
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 70f7286..3f907f6 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1449,7 +1449,7 @@ SELECT 1/0;
     <literal>S</literal>, perform an <acronym>SSL</acronym> startup handshake
     (not described here, part of the <acronym>SSL</acronym>
     specification) with the server.  If this is successful, continue
-    with sending the usual StartupMessage.  In this case the
+    with sending the usual StartupMessage.  In this case, the
     StartupMessage and all subsequent data will be
     <acronym>SSL</acronym>-encrypted.  To continue after
     <literal>N</literal>, send the usual StartupMessage and proceed without
@@ -1462,7 +1462,7 @@ SELECT 1/0;
     the server predates the addition of <acronym>SSL</acronym> support
     to <productname>PostgreSQL</productname>.  (Such servers are now very ancient,
     and likely do not exist in the wild anymore.)
-    In this case the connection must
+    In this case, the connection must
     be closed, but the frontend might choose to open a fresh connection
     and proceed without requesting <acronym>SSL</acronym>.
    </para>
@@ -1528,7 +1528,7 @@ SELECT 1/0;
     The frontend should also be prepared to handle an ErrorMessage
     response to GSSENCRequest from the server.  This would only occur if
     the server predates the addition of <acronym>GSSAPI</acronym> encryption
-    support to <productname>PostgreSQL</productname>.  In this case the
+    support to <productname>PostgreSQL</productname>.  In this case, the
     connection must be closed, but the frontend might choose to open a fresh
     connection and proceed without requesting <acronym>GSSAPI</acronym>
     encryption.  Given the length limits specified above, the ErrorMessage
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index 9009add..4f3ff1d 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -1189,7 +1189,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       This clause specifies optional storage parameters for a table or index;
       see <xref linkend="sql-createtable-storage-parameters"
       endterm="sql-createtable-storage-parameters-title"/> for more
-      information.  For backward-compatibility the <literal>WITH</literal>
+      information.  For backward-compatibility, the <literal>WITH</literal>
       clause for a table can also include <literal>OIDS=FALSE</literal> to
       specify that rows of the new table should not contain OIDs (object
       identifiers), <literal>OIDS=TRUE</literal> is not supported anymore.
diff --git a/doc/src/sgml/ref/create_table_as.sgml b/doc/src/sgml/ref/create_table_as.sgml
index b5c4ce6..0880459 100644
--- a/doc/src/sgml/ref/create_table_as.sgml
+++ b/doc/src/sgml/ref/create_table_as.sgml
@@ -142,7 +142,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
       This clause specifies optional storage parameters for the new table;
       see <xref linkend="sql-createtable-storage-parameters"
       endterm="sql-createtable-storage-parameters-title"/> for more
-      information.   For backward-compatibility the <literal>WITH</literal>
+      information.   For backward-compatibility, the <literal>WITH</literal>
       clause for a table can also include <literal>OIDS=FALSE</literal> to
       specify that rows of the new table should contain no OIDs (object
       identifiers), <literal>OIDS=TRUE</literal> is not supported anymore.
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 8288676..6a898d9 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -746,7 +746,7 @@ psql --username=postgres --file=script.sql postgres
    <application>pg_upgrade</application> launches short-lived postmasters in
    the old and new data directories.  Temporary Unix socket files for
    communication with these postmasters are, by default, made in the current
-   working directory.  In some situations the path name for the current
+   working directory.  In some situations, the path name for the current
    directory might be too long to be a valid socket name.  In that case you
    can use the <option>-s</option> option to put the socket files in some
    directory with a shorter path name.  For security, be sure that that
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7789fc6..8076495 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -1056,7 +1056,7 @@ testdb=&gt;
         These operations are not as efficient as the <acronym>SQL</acronym>
         <command>COPY</command> command with a file or program data source or
         destination, because all data must pass through the client/server
-        connection.  For large amounts of data the <acronym>SQL</acronym>
+        connection.  For large amounts of data, the <acronym>SQL</acronym>
         command might be preferable.
         </para>
         </tip>
diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
index b94e7f7..c57f51d 100644
--- a/doc/src/sgml/sources.sgml
+++ b/doc/src/sgml/sources.sgml
@@ -100,7 +100,7 @@ less -x4
    <para>
     There are two required elements for every message: a severity level
     (ranging from <literal>DEBUG</literal> to <literal>PANIC</literal>) and a primary
-    message text.  In addition there are optional elements, the most
+    message text.  In addition, there are optional elements, the most
     common of which is an error identifier code that follows the SQL spec's
     SQLSTATE conventions.
     <function>ereport</function> itself is just a shell function that exists
@@ -473,7 +473,7 @@ Hint:       the addendum
 
    <para>
     Rationale: Messages are not necessarily displayed on terminal-type
-    displays.  In GUI displays or browsers these formatting instructions are
+    displays.  In GUI displays or browsers, these formatting instructions are
     at best ignored.
    </para>
 
@@ -884,7 +884,7 @@ BETTER: unrecognized node type: 42
      features can be used, if a fallback is provided.
     </para>
     <para>
-     For example <literal>_StaticAssert()</literal> and
+     For example, <literal>_StaticAssert()</literal> and
      <literal>__builtin_constant_p</literal> are currently used, even though
      they are from a newer revision of the C standard and a
      <productname>GCC</productname> extension, respectively. If not available, in the first case, 
@@ -897,14 +897,14 @@ BETTER: unrecognized node type: 42
    <simplesect>
     <title>Function-Like Macros and Inline Functions</title>
     <para>
-     Both, macros with arguments and <literal>static inline</literal>
-     functions, may be used. The latter are preferable if there are
+     Both macros with arguments and <literal>static inline</literal>
+     functions may be used. The latter are preferable if there are
      multiple-evaluation hazards when written as a macro, as e.g. the
      case with
 <programlisting>
 #define Max(x, y)       ((x) > (y) ? (x) : (y))
 </programlisting>
-     or when the macro would be very long. In other cases it's only
+     or when the macro would be very long. In other cases, it's only
      possible to use macros, or at least easier.  For example because
      expressions of various types need to be passed to the macro.
     </para>
@@ -936,16 +936,16 @@ MemoryContextSwitchTo(MemoryContext context)
    <simplesect>
     <title>Writing Signal Handlers</title>
     <para>
-     To be suitable to run inside a signal handler code has to be
+     To be suitable to run inside a signal handler, code has to be
      written very carefully. The fundamental problem is that, unless
      blocked, a signal handler can interrupt code at any time. If code
-     inside the signal handler uses the same state as code outside
-     chaos may ensue. As an example consider what happens if a signal
+     inside the signal handler uses the same state as code outside,
+     chaos may ensue. As an example, consider what happens if a signal
      handler tries to acquire a lock that's already held in the
      interrupted code.
     </para>
     <para>
-     Barring special arrangements code in signal handlers may only
+     Barring special arrangements, code in signal handlers may only
      call async-signal safe functions (as defined in POSIX) and access
      variables of type <literal>volatile sig_atomic_t</literal>. A few
      functions in <command>postgres</command> are also deemed signal safe; specifically,
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 4eb8feb..30bde24 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -326,7 +326,7 @@
    before returning a success indication to the client.  The client is
    therefore guaranteed that a transaction reported to be committed will
    be preserved, even in the event of a server crash immediately after.
-   However, for short transactions this delay is a major component of the
+   However, for short transactions, this delay is a major component of the
    total transaction time.  Selecting asynchronous commit mode means that
    the server returns success as soon as the transaction is logically
    completed, before the <acronym>WAL</acronym> records it generated have
diff --git a/doc/src/sgml/xoper.sgml b/doc/src/sgml/xoper.sgml
index 260e43c..55cd3b1 100644
--- a/doc/src/sgml/xoper.sgml
+++ b/doc/src/sgml/xoper.sgml
@@ -375,7 +375,7 @@ table1.column1 OP table2.column2
      Another example is that on machines that meet the <acronym>IEEE</acronym>
      floating-point standard, negative zero and positive zero are different
      values (different bit patterns) but they are defined to compare equal.
-     If a float value might contain negative zero then extra steps are needed
+     If a float value might contain negative zero, then extra steps are needed
      to ensure it generates the same hash value as positive zero.
     </para>
 
-- 
2.7.4


--FkmkrVfFsRoUs1wW
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v5-0004-Consistent-language-must-be-superuser.patch"



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [PATCH v4 5/7] Row pattern recognition patch (docs).
@ 2023-08-09 07:56 Tatsuo Ishii <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Tatsuo Ishii @ 2023-08-09 07:56 UTC (permalink / raw)

---
 doc/src/sgml/advanced.sgml   | 52 ++++++++++++++++++++++++++++++++++
 doc/src/sgml/func.sgml       | 54 ++++++++++++++++++++++++++++++++++++
 doc/src/sgml/ref/select.sgml | 38 +++++++++++++++++++++++--
 3 files changed, 142 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/advanced.sgml b/doc/src/sgml/advanced.sgml
index 755c9f1485..eda3612822 100644
--- a/doc/src/sgml/advanced.sgml
+++ b/doc/src/sgml/advanced.sgml
@@ -537,6 +537,58 @@ WHERE pos &lt; 3;
     <literal>rank</literal> less than 3.
    </para>
 
+   <para>
+    Row pattern common syntax can be used with row pattern common syntax to
+    perform row pattern recognition in a query. Row pattern common syntax
+    includes two sub clauses. <literal>DEFINE</literal> defines definition
+    variables along with an expression. The expression must be a logical
+    expression, which means it must
+    return <literal>TRUE</literal>, <literal>FALSE</literal>
+    or <literal>NULL</literal>. Moreover if the expression comprises a column
+    reference, it must be the argument of <function>rpr</function>. An example
+    of <literal>DEFINE</literal> is as follows.
+
+<programlisting>
+DEFINE
+ LOWPRICE AS price &lt;= 100,
+ UP AS price &gt; PREV(price),
+ DOWN AS price &lt; PREV(price)
+</programlisting>
+
+    Note that <function>PREV</function> returns price column in the previous
+    row if it's called in a context of row pattern recognition. So in the
+    second line means the definition variable "UP" is <literal>TRUE</literal>
+    when price column in the current row is greater than the price column in
+    the previous row. Likewise, "DOWN" is <literal>TRUE</literal> when when
+    price column in the current row is lower than the price column in the
+    previous row.
+   </para>
+   <para>
+    Once <literal>DEFINE</literal> exists, <literal>PATTERN</literal> can be
+    used. <literal>PATTERN</literal> defines a sequence of rows that satisfies
+    certain conditions.  For example following <literal>PATTERN</literal>
+    defines that a row starts with the condition "LOWPRICE", then one or more
+    rows satisfy "UP" and finally one or more rows satisfy "DOWN". If a
+    sequence of rows found, rpr returns the column at the starting row.
+    Example of a <literal>SELECT</literal> using the <literal>DEFINE</literal>
+    and <literal>PATTERN</literal> clause is as follows.
+
+<programlisting>    
+SELECT company, tdate, price, max(price) OVER w FROM stock
+ WINDOW w AS (
+ PARTITION BY company
+ ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
+ AFTER MATCH SKIP PAST LAST ROW
+ INITIAL
+ PATTERN (LOWPRICE UP+ DOWN+)
+ DEFINE
+  LOWPRICE AS price &lt;= 100,
+  UP AS price &gt; PREV(price),
+  DOWN AS price &lt; PREV(price)
+);
+</programlisting>
+   </para>
+
    <para>
     When a query involves multiple window functions, it is possible to write
     out each one with a separate <literal>OVER</literal> clause, but this is
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index be2f54c914..6cda164522 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -21715,6 +21715,7 @@ SELECT count(*) FROM sometable;
         returns <literal>NULL</literal> if there is no such row.
        </para></entry>
       </row>
+
      </tbody>
     </tgroup>
    </table>
@@ -21754,6 +21755,59 @@ SELECT count(*) FROM sometable;
    Other frame specifications can be used to obtain other effects.
   </para>
 
+  <para>
+   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.
+  </para>
+
+   <table id="functions-rpr-navigation-table">
+    <title>Row Pattern Navigation Functions</title>
+    <tgroup cols="1">
+     <thead>
+      <row>
+       <entry role="func_table_entry"><para role="func_signature">
+        Function
+       </para>
+       <para>
+        Description
+       </para></entry>
+      </row>
+     </thead>
+
+     <tbody>
+      <row>
+       <entry role="func_table_entry"><para role="func_signature">
+        <indexterm>
+         <primary>prev</primary>
+        </indexterm>
+        <function>prev</function> ( <parameter>value</parameter> <type>anyelement</type> )
+        <returnvalue>anyelement</returnvalue>
+       </para>
+       <para>
+        Returns the column value at the previous row;
+        returns NULL if there is no previous row in the window frame.
+       </para></entry>
+      </row>
+
+      <row>
+       <entry role="func_table_entry"><para role="func_signature">
+        <indexterm>
+         <primary>next</primary>
+        </indexterm>
+        <function>next</function> ( <parameter>value</parameter> <type>anyelement</type> )
+        <returnvalue>anyelement</returnvalue>
+       </para>
+       <para>
+        Returns the column value at the next row;
+        returns NULL if there is no next row in the window frame.
+       </para></entry>
+      </row>
+
+     </tbody>
+    </tgroup>
+   </table>
+
   <note>
    <para>
     The SQL standard defines a <literal>RESPECT NULLS</literal> or
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index 0ee0cc7e64..8d3becd57a 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -966,8 +966,8 @@ WINDOW <replaceable class="parameter">window_name</replaceable> AS ( <replaceabl
     The <replaceable class="parameter">frame_clause</replaceable> can be one of
 
 <synopsis>
-{ RANGE | ROWS | GROUPS } <replaceable>frame_start</replaceable> [ <replaceable>frame_exclusion</replaceable> ]
-{ RANGE | ROWS | GROUPS } BETWEEN <replaceable>frame_start</replaceable> AND <replaceable>frame_end</replaceable> [ <replaceable>frame_exclusion</replaceable> ]
+{ RANGE | ROWS | GROUPS } <replaceable>frame_start</replaceable> [ <replaceable>frame_exclusion</replaceable> ] [row_pattern_common_syntax]
+{ RANGE | ROWS | GROUPS } BETWEEN <replaceable>frame_start</replaceable> AND <replaceable>frame_end</replaceable> [ <replaceable>frame_exclusion</replaceable> ] [row_pattern_common_syntax]
 </synopsis>
 
     where <replaceable>frame_start</replaceable>
@@ -1074,6 +1074,40 @@ EXCLUDE NO OTHERS
     a given peer group will be in the frame or excluded from it.
    </para>
 
+   <para>
+    The
+    optional <replaceable class="parameter">row_pattern_common_syntax</replaceable>
+    defines the <firstterm>row pattern recognition condition</firstterm> for
+    this
+    window. <replaceable class="parameter">row_pattern_common_syntax</replaceable>
+    includes following subclauses. <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 always next to the last row of previous
+    match. <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. If the variable is not defined in
+    the <literal>DEFINE</literal> clause, it is implicitly assumed
+    following is defined in the <literal>DEFINE</literal> clause.
+
+<synopsis>
+<literal>variable_name</literal> AS TRUE
+</synopsis>
+
+    Note that the maximu number of variables defined
+    in <literal>DEFINE</literal> clause is 26.
+
+<synopsis>
+[ AFTER MATCH SKIP PAST LAST ROW | AFTER MATCH SKIP TO NEXT ROW ]
+PATTERN <replaceable class="parameter">pattern_variable_name</replaceable>[+] [, ...]
+DEFINE <replaceable class="parameter">definition_varible_name</replaceable> AS <replaceable class="parameter">expression</replaceable> [, ...]
+</synopsis>    
+   </para>
+
    <para>
     The purpose of a <literal>WINDOW</literal> clause is to specify the
     behavior of <firstterm>window functions</firstterm> appearing in the query's
-- 
2.25.1


----Next_Part(Wed_Aug__9_17_41_12_2023_134)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="v4-0006-Row-pattern-recognition-patch-tests.patch"



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [PATCH v4 1/4] Make use of pg_popcount() in more places.
@ 2026-01-22 17:16 Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Nathan Bossart @ 2026-01-22 17:16 UTC (permalink / raw)

---
 src/backend/nodes/bitmapset.c | 27 ++++-----------------------
 src/include/lib/radixtree.h   |  4 ++--
 2 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/src/backend/nodes/bitmapset.c b/src/backend/nodes/bitmapset.c
index a4765876c31..23c91fdb6c9 100644
--- a/src/backend/nodes/bitmapset.c
+++ b/src/backend/nodes/bitmapset.c
@@ -553,14 +553,8 @@ bms_member_index(Bitmapset *a, int x)
 	bitnum = BITNUM(x);
 
 	/* count bits in preceding words */
-	for (int i = 0; i < wordnum; i++)
-	{
-		bitmapword	w = a->words[i];
-
-		/* No need to count the bits in a zero word */
-		if (w != 0)
-			result += bmw_popcount(w);
-	}
+	result += pg_popcount((const char *) a->words,
+						  wordnum * sizeof(bitmapword));
 
 	/*
 	 * Now add bits of the last word, but only those before the item. We can
@@ -749,26 +743,13 @@ bms_get_singleton_member(const Bitmapset *a, int *member)
 int
 bms_num_members(const Bitmapset *a)
 {
-	int			result = 0;
-	int			nwords;
-	int			wordnum;
-
 	Assert(bms_is_valid_set(a));
 
 	if (a == NULL)
 		return 0;
 
-	nwords = a->nwords;
-	wordnum = 0;
-	do
-	{
-		bitmapword	w = a->words[wordnum];
-
-		/* No need to count the bits in a zero word */
-		if (w != 0)
-			result += bmw_popcount(w);
-	} while (++wordnum < nwords);
-	return result;
+	return pg_popcount((const char *) a->words,
+					   a->nwords * sizeof(bitmapword));
 }
 
 /*
diff --git a/src/include/lib/radixtree.h b/src/include/lib/radixtree.h
index b223ce10a2d..1425654a67c 100644
--- a/src/include/lib/radixtree.h
+++ b/src/include/lib/radixtree.h
@@ -2725,8 +2725,8 @@ RT_VERIFY_NODE(RT_NODE * node)
 
 				/* RT_DUMP_NODE(node); */
 
-				for (int i = 0; i < RT_BM_IDX(RT_NODE_MAX_SLOTS); i++)
-					cnt += bmw_popcount(n256->isset[i]);
+				cnt += pg_popcount((const char *) n256->isset,
+								   RT_NODE_MAX_SLOTS / BITS_PER_BYTE);
 
 				/*
 				 * Check if the number of used chunk matches, accounting for
-- 
2.50.1 (Apple Git-155)


--u/0bDz5KPuHk2IF+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v4-0002-Remove-unnecessary-32-bit-optimizations-and-align.patch



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-01-22 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-30 00:37 [PATCH v5 03/12] Add comma for readability Justin Pryzby <[email protected]>
2023-08-09 07:56 [PATCH v4 5/7] Row pattern recognition patch (docs). Tatsuo Ishii <[email protected]>
2026-01-22 17:16 [PATCH v4 1/4] Make use of pg_popcount() in more places. Nathan Bossart <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox