SPI_EXECP(3)

πŸ’– SPI_EXECP β€” bestie's guide to running ur prepared statement in read/write mode πŸ’–

okay so this is SPI_EXECP(3), straight out of the PostgreSQL 18.6 Documentation bestie. it's a lil C function, she's short, she's sweet, she does exactly one thing and she does it flawlessly. let's get into it πŸŽ€


✨ NAME ✨

SPI_execp β€” execute a statement in read/write mode πŸ‘‘


🌸 SYNOPSIS 🌸

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so SPI_execp is literally just SPI_execute_plan, no cap β€” with one tiny lil' twist: the read_only parameter is always taken as false. that's it. that's the whole vibe. it's giving "same girl, different energy." ✨


πŸ’… ARGUMENTS πŸ’…

  • SPIPlanPtr plan β€” ur prepared statement, aka the lil' plan u got back from SPI_prepare 🫢
  • Datum * values β€” an array of the actual parameter values. it must have the same length as the statement's number of arguments, fr fr. no shorties allowed πŸ™ˆ
  • const char * nulls β€” an array describing which parameters are null. also has to match the statement's number of arguments in length, periodt.

if nulls is NULL, then SPI_execp just assumes no parameters are null ✨ otherwise, every entry in the nulls array should be:

  • ' ' if the corresponding parameter value is non-null πŸ’–
  • 'n' if the corresponding parameter value is null πŸ’€ (and when it's null, the actual value sitting in the matching values entry genuinely does not matter, like, at all)
🚨 important bestie alert: nulls is not a text string. it's just an array. it does not need a '\0' terminator. don't add one. iykyk 😭
  • long count β€” max number of rows to return, or 0 for no limit 🌈

⭐ RETURN VALUE ⭐

see SPI_execute_plan πŸ‘€

and if it succeeds, SPI_processed and SPI_tuptable get set exactly like in SPI_execute. slay. πŸ”₯


and that's the whole page bestie!! mwah πŸ’œ

β€” written under the PostgreSQL 18.6 era, dated 2026, filed as SPI_EXECP(3) in the good ol' section 3. go forth and execute responsibly, queen πŸ‘‘βœ¨πŸŽ€