SPI_PREPARE_EXTENDED(3)

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

✨ SPI_PREPARE_EXTENDED ✨ (that's the SPI_PREPARE_EXTENDED(3) man page bestie, PostgreSQL 16.15 Documentation)

okay so picture this: you wanna get a statement all prepped and ready but you're SO not about executing it yet. that's literally this function. it's the fancy upgraded sibling of SPI_prepare and honestly? it ate. πŸ’…


🌸 NAME 🌸

SPI_prepare_extended β€” prepare a statement, without executing it yet πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

SPIPlanPtr SPI_prepare_extended(const char * command,
                                const SPIPrepareOptions * options)

πŸ’– DESCRIPTION πŸ’–

SPI_prepare_extended creates and returns a prepared statement for the command you pass in, but bestie it does not execute the command. not even a little. 🫢

it's equivalent to SPI_prepare, except β€” and this is the glow-up β€” the caller can specify options that control how external parameter references get parsed, plus other facets of query parsing and planning. highkey useful. ✨


🌈 ARGUMENTS 🌈

  • const char * command β€” the command string, iykyk
  • const SPIPrepareOptions * options β€” a struct containing optional arguments
okay so listen: callers should always zero out the entire options struct first, then fill in whichever fields they actually wanna set. this is the forward-compatibility slay β€” any fields added to the struct in the future are defined to behave backwards-compatibly if they're zero. so like, zero it out. no cap. 🧚

the currently available options fields are:

  • ParserSetupHook parserSetup β€” the parser hook setup function πŸ”₯
  • void * parserSetupArg β€” pass-through argument for parserSetup
  • RawParseMode parseMode β€” mode for raw parsing; RAW_PARSE_DEFAULT (zero) produces default behavior
  • int cursorOptions β€” integer bit mask of cursor options; zero produces default behavior ⭐

πŸ‘‘ RETURN VALUE πŸ‘‘

SPI_prepare_extended has the same return conventions as SPI_prepare. periodt. πŸ’œ


πŸ’€ SEE ALSO πŸ’€

(ngl this page didn't list any, so like… go read SPI_prepare(3) bestie, that's the whole vibe πŸ™ˆ)


kisses and prepared statements, mwah πŸ’‹ β€” this iconic lil page is from PostgreSQL 16.15, dated 2026, and it's filed under SPI_PREPARE_EXTENDED(3). bestie you're welcome. πŸ“

πŸ“¦ where this page comes from