SPI_IS_CURSOR_PLAN(3)
π¦ SPI_IS_CURSOR_PLAN(3) β can this plan open a cursor, bestie? π¦
okay so this is straight from the PostgreSQL 13.23 documentation, and we're doing a vibe check on SPI_is_cursor_plan π
β¨ NAME β¨
SPI_is_cursor_plan β returns 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. no cap, that's the whole function's main-character job β¨
The criteria are literally 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. periodt.
π ARGUMENTS π
SPIPlanPtr planβ the prepared statement, aka the thing returned bySPI_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. so yeah, sometimes the answer is just "bestie, I literally can't even" π
tiny but important:falsecan mean either "nope, no cursor from this plan" or "couldn't figure it out", andSPI_resultis where the extra tea lives β
okay that's the whole page, mwah π it's from PostgreSQL 13.23 documentation, dated 2025, and it's the SPI_IS_CURSOR_PLAN(3) manual page β slay π¦π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13-docs 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms