SPI_FREETUPTABLE(3)

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

✨ 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, or NULL to 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