- spi_exec_query(query [, max-rows])
+ spi_exec_query(query [, limit])
in PL/Perl
- 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:
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.
- plpy.execute(query [, max-rows])
+ plpy.execute(query [, limit])
Calling plpy.execute with a query string and an
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:
plpy.prepare(query [, argtypes])
- plpy.execute(plan [, arguments [, max-rows]])
+ plpy.execute(plan [, arguments [, limit]])
preparing a queryin PL/Python
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