max_rows.diff

application/octet-stream

Filename: max_rows.diff
Type: application/octet-stream
Part: 0
Message: Re: plpython does not honour max-rows

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
doc/src/sgml/plperl.sgml 6 1
doc/src/sgml/plpython.sgml 6 1
doc/src/sgml/pltcl.sgml 5 0
diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml
index 6c81ee8fbe..105c24c8f2 100644
--- a/doc/src/sgml/plperl.sgml
+++ b/doc/src/sgml/plperl.sgml
@@ -451,7 +451,12 @@ use strict;
       <para>
        <literal>spi_exec_query</literal> executes an SQL command and
 returns the entire row set as a reference to an array of hash
-references.  <emphasis>You should only use this command when you know
+references.  If <literal>max-rows</literal> is zero then all rows then
+the command is executed for all rows it applies to. If
+<literal>max-rows</literal> is greater than zero, then no more than
+<literal>max-rows</literal> will be retrieved; execution stops when the
+count is reached, much like adding a <literal>LIMIT</literal> clause to
+the query.  <emphasis>You should only use this command when you know
 that the result set will be relatively small.</emphasis>  Here is an
 example of a query (<command>SELECT</command> command) with the
 optional maximum number of rows:
diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml
index e190c90f45..9881c8bf11 100644
--- a/doc/src/sgml/plpython.sgml
+++ b/doc/src/sgml/plpython.sgml
@@ -794,7 +794,12 @@ $$ LANGUAGE plpython3u;
      <para>
       Calling <function>plpy.execute</function> with a query string and an
       optional row limit argument causes that query to be run and the result to
-      be returned in a result object.
+      be returned in a result object.  If <literal>max-rows</literal> is zero
+      then all rows then the command is executed for all rows it applies to.
+      If <literal>max-rows</literal> is greater than zero, then no more than
+      <literal>max-rows</literal> will be retrieved; execution stops when the
+      count is reached, much like adding a <literal>LIMIT</literal> clause to
+      the query.
      </para>
 
      <para>
diff --git a/doc/src/sgml/pltcl.sgml b/doc/src/sgml/pltcl.sgml
index bf56ba6b1c..deaf9f3f4e 100644
--- a/doc/src/sgml/pltcl.sgml
+++ b/doc/src/sgml/pltcl.sgml
@@ -344,6 +344,11 @@ $$ LANGUAGE pltcl;
         <function>spi_exec</function> the maximum number of rows
         to process in the command.  The effect of this is comparable to
         setting up a query as a cursor and then saying <literal>FETCH <replaceable>n</replaceable></literal>.
+        If <literal>-count</literal> is zero then all rows then the command
+        is executed for all rows it applies to.  If <literal>-count</literal>
+        is greater than zero, then no more than <literal>-count</literal>
+        will be retrieved; execution stops when the count is reached, much
+        like adding a <literal>LIMIT</literal> clause to the query.
        </para>
        <para>
         If the command is a <command>SELECT</command> statement, the values of the