From 6489875ce6b16662142bc70e003437b9753c199f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 2 May 2023 17:55:01 -0400 Subject: 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 --- doc/src/sgml/pltcl.sgml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'doc/src/sgml/pltcl.sgml') diff --git a/doc/src/sgml/pltcl.sgml b/doc/src/sgml/pltcl.sgml index bf56ba6b1c..b31f2c1330 100644 --- a/doc/src/sgml/pltcl.sgml +++ b/doc/src/sgml/pltcl.sgml @@ -341,9 +341,11 @@ $$ LANGUAGE pltcl; The optional -count value tells - spi_exec 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 FETCH n. + spi_exec to stop + once n rows have been retrieved, + much as if the query included a LIMIT clause. + If n is zero, the query is run to + completion, the same as when -count is omitted. If the command is a SELECT statement, the values of the -- cgit v1.2.1