SPI_is_cursor_plan
SPI_is_cursor_plan — returntrue
if a statement prepared bySPI_prepare
can be used withSPI_cursor_open
Synopsis
bool SPI_is_cursor_plan(SPIPlanPtrplan
)
Description
SPI_is_cursor_plan
returnstrue
if a statement prepared bySPI_prepare
can be passed as an argument toSPI_cursor_open
, orfalse
if that is not the case. The criteria are that theplan
represents one single command and that this command returns tuples to the caller; for example,SELECT
is allowed unless it contains anINTO
clause, andUPDATE
is allowed only if it contains aRETURNING
clause.
Arguments
SPIPlanPtr
plan
prepared statement (returned by
SPI_prepare
)
Return Value
true
orfalse
to indicate if theplan
can produce a cursor or not, withSPI_result
set to zero. If it is not possible to determine the answer (for example, if theplan
isNULL
or invalid, or if called when not connected to SPI), thenSPI_result
is set to a suitable error code andfalse
is returned.