SPI_PREPARE_EXTENDED(3)

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

πŸ’– SPI_PREPARE_EXTENDED β€” the spi_prepare_extended(3) glow-up πŸ’–

okay bestie, sit down, hydrate, and let's talk about SPI_prepare_extended β€” straight outta the PostgreSQL 18.6 docs, section 3 of the manual, and yes she's iconic ✨


✨ NAME ✨

SPI_prepare_extended β€” prep a statement, but like… don't run it yet πŸ’…


🌸 SYNOPSIS 🌸

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so SPI_prepare_extended literally creates and returns a prepared statement for the command you hand it, and then just… doesn't execute it. she's giving ✨patience✨, she's giving main character energy, she's waiting for her moment πŸŽ€

fr fr, this function is the same girl as SPI_prepare, except β€” and this is the slay β€” the caller gets to specify options that control how external parameter references get parsed, plus other little facets of query parsing and planning 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • const char * command β€” the command string, aka the whole vibe you're preparing πŸ’–
  • const SPIPrepareOptions * options β€” a struct holding the optional arguments, aka the lil extras 🌈
ok important bestie note: callers should always zero out the entire options struct first, and only then fill in whichever fields they actually wanna set. this is not a drill 🚨 it keeps your code forward-compatible, because any fields added to the struct in the future are defined to behave backwards-compatibly when they're zero. zero = default, periodt πŸ‘‘

the options fields available rn are:

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

⭐ RETURN VALUE ⭐

SPI_prepare_extended has the exact same return conventions as SPI_prepare. no cap, same energy, same rules 🌈


πŸ’€ lowkey a warning but make it cute: everything above is straight from the source, so don't be out here guessing at behavior. if it's not written here, it's not written here πŸ™ˆ

and that's the whole page, bestie πŸ§šβ€β™€οΈ go forth and prepare those statements responsibly β€” love u, stay parsed πŸ’–

PostgreSQL 18.6 Β· 2026 Β· SPI_PREPARE_EXTENDED(3) β€” mwah, signing off πŸ’‹πŸ‘‘

πŸ“¦ where this page comes from