SPI_CURSOR_OPEN_WITH_PARAMLIST(3pg15)

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

✨ NAME ✨

SPI_cursor_open_with_paramlist β€” set up a cursor using parameters. This is the SPI_CURSOR_OPEN_WITH_PARAMLIST(3pg15) page, bestie, and we’re getting into it πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

Portal SPI_cursor_open_with_paramlist(const char *name,
                                      SPIPlanPtr plan,
                                      ParamListInfo params,
                                      bool read_only)

That’s the whole shape of it β€” no cap ✨


🌸 DESCRIPTION 🌸

Okay so SPI_cursor_open_with_paramlist sets up a cursor (internally, a portal) that will execute a statement prepared by SPI_prepare. Literally iconic behavior.

This function is equivalent to SPI_cursor_open except that information about the parameter values to be passed to the query is presented differently. The ParamListInfo representation can be convenient for passing down values that are already available in that format. It also supports use of dynamic parameter sets via hook functions specified in ParamListInfo. It’s giving β€œI already have my params in exactly this format, slay.”

The passed-in parameter data will be copied into the cursor’s portal, so it can be freed while the cursor still exists. Translation: you don’t have to keep that parameter data alive forever β€” the cursor has its own copy, periodt.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • const char * name β€” name for portal, or NULL to let the system select a name. Let the system cook πŸ“
  • SPIPlanPtr plan β€” prepared statement (returned by SPI_prepare). Your prepared-statement main character.
  • ParamListInfo params β€” data structure containing parameter types and values; NULL if none. No params? Just pass NULL, bestie.
  • bool read_only β€” true for read-only execution. Read-only mode: engaged πŸ’œ

πŸ‘‘ RETURN VALUE πŸ‘‘

Pointer to portal containing the cursor. You get a portal, you get a cursor, everybody wins.

Note there is no error return convention; any error will be reported via elog. So yeah β€” no sneaky error return to check. Errors go through elog, fr fr.


πŸ’– xoxo from PostgreSQL 15.19, dated 2026 β€” stay slay and may your portals always be valid πŸ’…

πŸ“¦ where this page comes from