SPI_PREPARE_EXTENDED(3)
β¨ 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, iykykconst 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 forparserSetupRawParseMode parseModeβ mode for raw parsing;RAW_PARSE_DEFAULT(zero) produces default behaviorint 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
- opensuse-leap 16.0: postgresql16-docs 16.15-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms