SPI_CURSO...PARAMLIST(3)
β¨ SPI_CURSO...PARAMLIST(3) β¨
okay bestie, welcome to the SPI_cursor_open_with_paramlist page from the PostgreSQL 18.6 Documentation β yes the title is a whole mouthful, the man page authors really said "we're gonna truncate this and you're gonna deal" π
anyway it's giving C-spi-cursor-core and we're gonna eat it UP.
π 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 that signature. gorgeous. no notes. π«Ά
π¦ DESCRIPTION π¦
so what does this bad boy actually DO. SPI_cursor_open_with_paramlist sets up a cursor (and internally? it's literally a portal, iykyk) that will execute a statement prepared by SPI_prepare. β¨
it's equivalent to SPI_cursor_open β same energy, same vibes β EXCEPT the info about the parameter values you're passing to the query is presented differently. and the way it's different is that the ParamListInfo representation can be super convenient for passing down values that are already available in that format. like, no conversion era. no cap. it also supports use of dynamic parameter sets via hook functions specified in ParamListInfo. π₯
and here's the part that lowkey matters a lot: the passed-in parameter data will be copied into the cursor's portal, so it can be freed while the cursor still exists. yes bestie you heard that right β free it, the portal already has its own copy, it's fine, go off. π
π ARGUMENTS π
const char * nameβ name for the portal, orNULLto let the system select a name for you (letting the system pick? main character move honestly π)SPIPlanPtr planβ the prepared statement (the one returned bySPI_prepare)ParamListInfo paramsβ data structure containing parameter types and values;NULLif there are nonebool read_onlyβtruefor read-only execution
π RETURN VALUE π
a pointer to the portal containing the cursor. β¨
β οΈ and now the serious bit: there is no error return convention β any error will be reported viaelog. so don't go checking the return value for errors, that's not a thing, the errors just show up throughelog, periodt. π
π that's the whole page bestie π
every option, every arg, every caveat β we did not skip a single one, we would never π
cute little sign-off moment: this whole thing comes from PostgreSQL 18.6, dated 2026, and it lives at SPI_CURSO...PARAMLIST(3) in the man pages. slay, go forth, and free your parameter data with confidence π
β¨π¦
π¦ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 Β· PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 Β· PostgreSQL
- arch rolling: postgresql 18.6-4 Β· PostgreSQL
- fedora 43: postgresql-server-devel 18.6-1.fc43 Β· PostgreSQL
- fedora 43: postgresql-server-devel 18.6-1.fc43 Β· PostgreSQL
- fedora 44: postgresql-server-devel 18.6-1.fc44 Β· PostgreSQL
- fedora 44: postgresql-server-devel 18.6-1.fc44 Β· PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-doc-18 18.6-0ubuntu0.26.04.1 Β· PostgreSQL
- ubuntu stonking: postgresql-doc-18 18.6-3build2 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms