SPI_EXECP(3)
π 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 fromSPI_prepareearlier. 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 thatnullsis 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, or0for 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 wasPostgreSQL 16.15, dated2026, pageSPI_EXECP(3)β stan her, cite her, and don't @ me π
π¦ 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