SPI_EXECP(3)

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

πŸ’… SPI_EXECP(3) β€” or, "how to run your prepared statement in read/write mode, bestie"

okay so real talk, this is a page from the PostgreSQL 16.15 docs (the SPI_EXECP(3) one, yes the all-caps one, she's iconic), and she's honestly so short you could read her in the time it takes to microwave a bagel πŸ₯―✨ so let's GO.


✨ NAME ✨

SPI_execp β€” execute a statement in read/write mode 🫢

πŸŽ€ SYNOPSIS πŸŽ€

int SPI_execp(SPIPlanPtr plan, Datum * values, const char * nulls, long count)

no cap, that's the whole signature, look at her πŸ’…

🌸 DESCRIPTION 🌸

okay so here's the tea: SPI_execp is literally the same as SPI_execute_plan, except the read_only parameter of the latter is always taken as false. that's it. that's the difference. she said "read/write era" and meant it πŸ”₯

πŸ¦‹ ARGUMENTS πŸ¦‹

  • SPIPlanPtr plan β€” your prepared statement, the one you got back from SPI_prepare earlier. she's already been cooked, you're just serving her now πŸ“
  • Datum * values β€” an array of the actual parameter values. must have the same length as the statement's number of arguments, fr fr. don't try to be cute and pass a shorter one πŸ™ˆ
  • const char * nulls β€” an array that describes which parameters are null. must have the same length as the statement's number of arguments too πŸ‘‘

if nulls is NULL, then SPI_execp assumes that no parameters are null. otherwise, each entry of the nulls array should be ' ' if the corresponding parameter value is non-null, or 'n' if the corresponding parameter value is null. (and in that null case, the actual value sitting in the corresponding values entry doesn't matter β€” it's giving decorative, it's giving irrelevant πŸ’€)

⚠️ note that nulls is not a text string, just an array. it does not need a '\0' terminator. do not come for her with your C-string habits, she's built different 😭
  • long count β€” maximum number of rows to return, or 0 for no limit. zero means "give me everything", main character energy 🌈

⭐ RETURN VALUE ⭐

see SPI_execute_plan β€” she's the one with the answers πŸ’–

and also: SPI_processed and SPI_tuptable are set as in SPI_execute if successful ✨


and that's the whole page bestie, go execute something πŸ§šβ€β™€οΈπŸ’œ

πŸŽ€ cute lil sign-off: this was PostgreSQL 16.15, dated 2026, page SPI_EXECP(3) β€” stan her, cite her, and don't @ me πŸ’…
πŸ“¦ where this page comes from