SPI_CURSOR_OPEN_WITH_PARAMLIST(3pg17)
π SPI_CURSOR_OPEN_WITH_PARAMLIST π
okay so bestie, welcome to the 3pg17 zone β this is the PostgreSQL 17.11 Documentation page for SPI_CURSOR_OPEN_WITH_PARAMLIST(3), and yes the name is a mouthful, we're getting through it together π«Ά
β¨ NAME β¨
SPI_cursor_open_with_paramlist β set up a cursor using parameters, basically the glow-up version of opening a cursor when your params are already sitting pretty in a param list π
β¨ SYNOPSIS β¨
Portal SPI_cursor_open_with_paramlist(const char *name,
SPIPlanPtr plan,
ParamListInfo params,
bool read_only)
look at her. iconic signature. four args, zero chill πΈ
β¨ DESCRIPTION β¨
So SPI_cursor_open_with_paramlist sets up a cursor β and lowkey, internally, a cursor is a portal, which is the real main character here π β and that cursor is gonna execute a statement you already prepped with SPI_prepare.
Here's the tea: this function is equivalent to SPI_cursor_open, fr fr, except the info about the parameter values getting passed to your query is presented differently. The ParamListInfo representation can be super convenient when you're passing down values that are already chillin' in that format β no conversion era needed β¨
Oh and it also supports use of dynamic parameter sets via hook functions specified in ParamListInfo. we love a flexible icon π§
Also important, bestie: the parameter data you pass in gets copied into the cursor's portal, so you can free it while the cursor still exists. no dangling-vibes, no cap πβ‘οΈπ
β¨ ARGUMENTS β¨
const char * nameβ the name for the portal, orNULLif you want to let the system pick a name for you (letting the system choose is very delegating-queen of you π)SPIPlanPtr planβ your prepared statement, the one that came back fromSPI_prepareParamListInfo paramsβ the data structure holding the parameter types and values;NULLif there are none πbool read_onlyβtruefor read-only execution. just reading. no writing. hands off the database β
β¨ RETURN VALUE β¨
You get back a pointer to the portal containing the cursor π¦
β οΈ heads up: there is no error return convention here, okay? any error gets reported viaelog. so don't go checking for aNULLreturn like it's gonna save you β that's not the vibe check this function is doing π
π cute sign-off π
that's the whole page, bestie β brought to you by PostgreSQL 17.11, dated 2026, and yes the page footer really does say SPI_CURSO...PARAMLIST(3) because even the manpage abbreviations got truncated. she's mysterious like that πβ¨
now go open that cursor. slay. periodt π₯
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17-docs 17.11-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