diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml index 01f9870773..06d657008e 100644 --- a/doc/src/sgml/plperl.sgml +++ b/doc/src/sgml/plperl.sgml @@ -441,7 +441,7 @@ use strict; - spi_exec_query(query [, max-rows]) + spi_exec_query(query [, limit]) spi_exec_query in PL/Perl @@ -449,9 +449,17 @@ use strict; - spi_exec_query executes an SQL command and -returns the entire row set as a reference to an array of hash -references. You should only use this command when you know + spi_exec_query executes an SQL command and +returns the entire row set as a reference to an array of hash references. +If limit is specified and is greater than zero, +then spi_exec_query retrieves at +most limit rows, much as if the query included +a LIMIT clause. Omitting limit +or specifying it as zero results in no row limit. + + + +You should only use this command when you know that the result set will be relatively small. Here is an example of a query (SELECT command) with the optional maximum number of rows: @@ -643,7 +651,10 @@ $plan = spi_prepare('SELECT * FROM test WHERE id > $1 AND name = $2', by spi_exec_query, or in spi_query_prepared which returns a cursor exactly as spi_query does, which can be later passed to spi_fetchrow. The optional second parameter to spi_exec_prepared is a hash reference of attributes; - the only attribute currently supported is limit, which sets the maximum number of rows returned by a query. + the only attribute currently supported is limit, which + sets the maximum number of rows returned from the query. + Omitting limit or specifying it as zero results in no + row limit. diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml index b92c8662bf..0ca80fb1a1 100644 --- a/doc/src/sgml/plpython.sgml +++ b/doc/src/sgml/plpython.sgml @@ -937,7 +937,7 @@ $$ LANGUAGE plpythonu; - plpy.execute(query [, max-rows]) + plpy.execute(query [, limit]) Calling plpy.execute with a query string and an @@ -945,6 +945,15 @@ $$ LANGUAGE plpythonu; be returned in a result object. + + If limit is specified and is greater than + zero, then plpy.execute retrieves at + most limit rows, much as if the query + included a LIMIT + clause. Omitting limit or specifying it as + zero results in no row limit. + + The result object emulates a list or dictionary object. The result object can be accessed by row number and column name. For example: @@ -1035,7 +1044,7 @@ foo = rv[i]["my_column"] plpy.prepare(query [, argtypes]) - plpy.execute(plan [, arguments [, max-rows]]) + plpy.execute(plan [, arguments [, limit]]) preparing a queryin PL/Python diff --git a/doc/src/sgml/pltcl.sgml b/doc/src/sgml/pltcl.sgml index a01236ce93..4e48ceaddb 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