SPI_CURSOR_OPEN_WITH_PARAMLIST(3pg15)
β¨ NAME β¨
SPI_cursor_open_with_paramlist β set up a cursor using parameters. This is the SPI_CURSOR_OPEN_WITH_PARAMLIST(3pg15) page, bestie, and weβre getting into it π
π SYNOPSIS π
Portal SPI_cursor_open_with_paramlist(const char *name,
SPIPlanPtr plan,
ParamListInfo params,
bool read_only)
Thatβs the whole shape of it β no cap β¨
πΈ DESCRIPTION πΈ
Okay so SPI_cursor_open_with_paramlist sets up a cursor (internally, a portal) that will execute a statement prepared by SPI_prepare. Literally iconic behavior.
This function is equivalent to SPI_cursor_open except that information about the parameter values to be passed to the query is presented differently. The ParamListInfo representation can be convenient for passing down values that are already available in that format. It also supports use of dynamic parameter sets via hook functions specified in ParamListInfo. Itβs giving βI already have my params in exactly this format, slay.β
The passed-in parameter data will be copied into the cursorβs portal, so it can be freed while the cursor still exists. Translation: you donβt have to keep that parameter data alive forever β the cursor has its own copy, periodt.
π¦ ARGUMENTS π¦
const char * nameβ name for portal, orNULLto let the system select a name. Let the system cook πSPIPlanPtr planβ prepared statement (returned bySPI_prepare). Your prepared-statement main character.ParamListInfo paramsβ data structure containing parameter types and values;NULLif none. No params? Just passNULL, bestie.bool read_onlyβtruefor read-only execution. Read-only mode: engaged π
π RETURN VALUE π
Pointer to portal containing the cursor. You get a portal, you get a cursor, everybody wins.
Note there is no error return convention; any error will be reported via elog. So yeah β no sneaky error return to check. Errors go through elog, fr fr.
π xoxo from PostgreSQL 15.19, dated 2026 β stay slay and may your portals always be valid π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15-docs 15.19-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