SPI_FREETUPTABLE(3)
π SPI_FREETUPTABLE(3) π
okay bestie, welcome to the PostgreSQL 18.6 docs, section 3, and today's main character is SPI_freetuptable β the girl whose whole job is freeing a row set created by SPI_execute or a similar function. she's not glamorous, she's just necessary. π
β¨ NAME β¨
SPI_freetuptable β free a row set created by SPI_execute or a similar function
π¦ SYNOPSIS π¦
void SPI_freetuptable(SPITupleTable * tuptable)
π DESCRIPTION π
so SPI_freetuptable literally frees a row set that some prior SPI command execution function made β think SPI_execute and its friends. that's why you'll usually see her getting called with the global variable SPI_tuptable as her argument. it's giving "just take out the trash you already made" ποΈβ¨
she's highkey useful when your SPI-using C function needs to run multiple commands and does not want to be dragging the results of earlier commands around until the whole thing ends. like, let it go, girl. π
but fr fr, note this: any row sets you never freed will get freed anyway at SPI_finish. no cap. also β if a subtransaction gets 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. so the cleanup crew shows up either way. π§
and here's the glow-up: 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. π yeah. not iconic. we do not miss her.
πΈ ARGUMENTS πΈ
SPITupleTable * tuptableβ pointer to the row set to free, orNULLto do nothing (yes,NULLis the "lol never mind, no thoughts, head empty" option and she respects it π)
and that's the whole page, bestie β short, sweet, and fully slaying. this was PostgreSQL 18.6, dated 2026, brought to you by the fine folks who write the docs so we don't have to guess. π«Ά stay freed, stay safe, and always free your row sets before your function dips. πβ¨
π¦ 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