---
name: "SPI_is_cursor_plan"
section: "3"
platform: "linux"
package: "postgresql"
version: "18.6-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/SPI_is_cursor_plan"
---

# SPI\_is\_cursor\_plan(3)

return true if a statement prepared by SPI\_prepare can be used with SPI\_cursor\_open

## NAME

SPI\_is\_cursor\_plan - return true if a statement prepared by **SPI\_prepare** can be used with **SPI\_cursor\_open**

## SYNOPSIS

```
bool SPI_is_cursor_plan(SPIPlanPtr plan)
```

## DESCRIPTION

**SPI\_is\_cursor\_plan** returns true if a statement prepared by **SPI\_prepare** can be passed as an argument to **SPI\_cursor\_open**, or false if that is not the case. The criteria are that the *plan* represents one single command and that this command returns tuples to the caller; for example, **SELECT** is allowed unless it contains an INTO clause, and **UPDATE** is allowed only if it contains a RETURNING clause.

## ARGUMENTS

SPIPlanPtr *plan*

prepared statement (returned by **SPI\_prepare**)

## RETURN VALUE

true or false to indicate if the *plan* can produce a cursor or not, with *SPI\_result* set to zero. If it is not possible to determine the answer (for example, if the *plan* is NULL or invalid, or if called when not connected to SPI), then *SPI\_result* is set to a suitable error code and false is returned.
