SPI_CURSOR_OPEN_WITH_PARAMLIST(3pg13)
π SPI_CURSOR_OPEN_WITH_PARAMLIST(3) β PostgreSQL 13.23 Documentation
okay so bestie, this is the page for SPI_cursor_open_with_paramlist from the PostgreSQL 13.23 docs β¨ buckle up, it's actually so good π«Ά
πΈ NAME πΈ
SPI_cursor_open_with_paramlist β set up a cursor using parameters π
β¨ SYNOPSIS β¨
Portal SPI_cursor_open_with_paramlist(const char *name,
SPIPlanPtr plan,
ParamListInfo params,
bool read_only)
look at her. four arguments. main character energy fr fr π
π¦ DESCRIPTION π¦
okay so SPI_cursor_open_with_paramlist sets up a cursor β internally that's a portal, yes the cool kids call it a portal π
β and that cursor will execute a statement you already prepped with SPI_prepare.
Here's the tea: this function is equivalent to SPI_cursor_open, except the info about the parameter values you're passing to the query is presented differently. That's it, that's the whole difference. Not me explaining it twice π
So why would you reach for this one? Because the ParamListInfo representation can be convenient when the values you want to pass down are already chillin' in that format. No conversion era needed. It also supports use of dynamic parameter sets via hook functions specified in ParamListInfo β iykyk β
And this part matters, so listen up: the passed-in parameter data will be copied into the cursor's portal, so you can free it while the cursor still exists. Go ahead, free it, she's got her own copy now π
π ARGUMENTS π
const char * nameβ name for the portal, orNULLto let the system select a name for you (letting the system pick is so valid of you)SPIPlanPtr planβ the prepared statement (the one returned bySPI_prepare)ParamListInfo paramsβ data structure containing parameter types and values;NULLif there aren't anybool read_onlyβtruefor read-only execution π§
π₯ RETURN VALUE π₯
Pointer to the portal containing the cursor. π«Ά
heads up bestie: there is no error return convention here. Any error gets reported via elog. So don't go checking a return value for failure, that's not the vibe π
π SEE ALSO π
lowkey there's nothing listed here in this page, so go off and read the rest of the SPI docs yourself, you've got this ππ
sign-off szn π β this little icon was brought to you by PostgreSQL 13.23, dated 2025. slay, bye bestie! π¦πΈβ¨
π¦ 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