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 fromSPI_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 matchingvaluesentry genuinely does not matter, like, at all)
π¨ important bestie alert:nullsis 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, or0for 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 πβ¨π
π¦ 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