SPI_CURSOR_OPEN_WITH_PARAMLIST(3pg13)

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

πŸ’… 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, or NULL to 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 by SPI_prepare)
  • ParamListInfo params β€” data structure containing parameter types and values; NULL if there aren't any
  • bool read_only β€” true for 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