SPI_FREETUPTABLE(3)
β¨ SPI_FREETUPTABLE β¨
okay so bestie, welcome to the SPI_freetuptable page from the PostgreSQL 16.15 Documentation β this is the little cleanup function that nobody thanks but everybody needs π
πΈ NAME πΈ
SPI_freetuptable β frees a row set created by SPI_execute or a similar function π§Ήβ¨
π SYNOPSIS π
void SPI_freetuptable(SPITupleTable * tuptable)
literally that's it, that's the whole signature, she's simple and she serves π
π¦ DESCRIPTION π¦
So SPI_freetuptable frees a row set that was created by a prior SPI command execution function β SPI_execute being the classic example, iykyk. Because of that, this function is often called with the global variable SPI_tuptable as its argument. iconic behavior honestly.
This one's your bestie if you're writing an SPI-using C function that needs to execute multiple commands and you do not want to be dragging the results of earlier commands around with you until the function ends. no cap, that's just clutter.
π«Ά heads up though: any row sets you don't free will get freed anyway at SPI_finish. so don't panic. also, if a subtransaction is started and then aborted within the execution of an SPI-using C function, SPI automatically frees any row sets that were created while that subtransaction was running. the system is literally looking out for you π
Now the glow-up lore: beginning in PostgreSQL 9.3, SPI_freetuptable contains guard logic to protect against duplicate deletion requests for the same row set. in previous releases, duplicate deletions would lead to crashes. π so yeah, if you're on something ancient β be careful, that's a whole vibe check you do not want to fail.
β ARGUMENTS β
SPITupleTable * tuptableβ pointer to the row set to free, orNULLto do nothing π
and that's the whole page, bestie, you ate that π
signing off from the PostgreSQL 16.15 docs, dated 2026 β stay freed, stay iconic, and please free your tuple tables πβ¨
π¦ 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