SPI_CURSOR_OPEN_WITH_PARAMLIST(3pg17)

πŸ“¦ version 17.11, in opensuse-leap 16.0

πŸ’– 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, or NULL if 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 from SPI_prepare
  • ParamListInfo params β€” the data structure holding the parameter types and values; NULL if there are none πŸ™ˆ
  • bool read_only β€” true for 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 via elog. so don't go checking for a NULL return 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