1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

Doc: clarify behavior of row-limit arguments in the PLs' SPI wrappers.

plperl, plpython, and pltcl all provide query-execution functions
that are thin wrappers around SPI_execute() or its variants.
The SPI functions document their row-count limit arguments clearly,
as "maximum number of rows to return, or 0 for no limit".  However
the PLs' documentation failed to explain this special behavior of
zero, so that a reader might well assume it means "fetch zero
rows".  Improve that.

Daniel Gustafsson and Tom Lane, per report from Kieran McCusker

Discussion: https://postgr.es/m/CAGgUQ6H6qYScctOhktQ9HLFDDoafBKHyUgJbZ6q_dOApnzNTXg@mail.gmail.com
This commit is contained in:
Tom Lane
2023-05-02 17:55:01 -04:00
parent 08237056f8
commit 6489875ce6
3 changed files with 32 additions and 10 deletions

View File

@@ -341,9 +341,11 @@ $$ LANGUAGE pltcl;
</para>
<para>
The optional <literal>-count</literal> value tells
<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>.
<function>spi_exec</function> to stop
once <replaceable>n</replaceable> rows have been retrieved,
much as if the query included a <literal>LIMIT</literal> clause.
If <replaceable>n</replaceable> is zero, the query is run to
completion, the same as when <literal>-count</literal> is omitted.
</para>
<para>
If the command is a <command>SELECT</command> statement, the values of the