SPI_PREPARE_EXTENDED(3)
π 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 forparserSetupπ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
- alpine 3.23: postgresql18-doc 18.6-r0 Β· PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 Β· PostgreSQL
- arch rolling: postgresql 18.6-4 Β· PostgreSQL
- fedora 43: postgresql-server-devel 18.6-1.fc43 Β· PostgreSQL
- fedora 43: postgresql-server-devel 18.6-1.fc43 Β· PostgreSQL
- fedora 44: postgresql-server-devel 18.6-1.fc44 Β· PostgreSQL
- fedora 44: postgresql-server-devel 18.6-1.fc44 Β· PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-doc-18 18.6-0ubuntu0.26.04.1 Β· PostgreSQL
- ubuntu stonking: postgresql-doc-18 18.6-3build2 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms