SPI_IS_CURSOR_PLAN(3)

πŸ“¦ version 14.24, in opensuse-leap 16.0

πŸ’– SPI_IS_CURSOR_PLAN(3) πŸ’–

okay bestie, welcome to the PostgreSQL 14.24 Documentation page for SPI_IS_CURSOR_PLAN(3) β€” it’s literally the vibe check for whether a prepared plan can become a cursor. no cap. ✨

🌸 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 πŸ’…

okay so 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. periodt. πŸ’…

the criteria are iconic and also very specific: the plan has to represent one single command, and that command has to return 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. that’s the whole rule, bestie. πŸŽ€

πŸŽ€ ARGUMENTS πŸŽ€

  • SPIPlanPtr plan β€” the prepared statement (returned by SPI_prepare). this is the plan you’re asking about, bestie. 🫢

πŸ”₯ RETURN VALUE πŸ”₯

true or false to indicate if the plan can produce a cursor or not, with SPI_result set to zero. slay. βœ…

but listen: 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. that’s the drama of it. 😭


mwah πŸ’‹ β€” this little love letter is from PostgreSQL 14.24, dated 2026, and it’s the SPI_IS_CURSOR_PLAN(3) manual page. periodt. πŸ’–

πŸ“¦ where this page comes from