SPI_FREETUPTABLE(3)
β¨ SPI_FREETUPTABLE(3) β¨
okay so bestie, welcome to the SPI_freetuptable page π
this is from the PostgreSQL 14.24 Documentation and honestly it's a lil shorty but she's important, so let's get into it π«Ά
πΈ NAME πΈ
SPI_freetuptable β free a row set created by SPI_execute or a similar function π
π¦ SYNOPSIS π¦
void SPI_freetuptable(SPITupleTable * tuptable)
like, one line, one job, no cap β¨
π DESCRIPTION π
So SPI_freetuptable frees a row set that was created by a prior SPI command execution function β think SPI_execute and friends π₯ because of that, you'll very often see her getting called with the global variable SPI_tuptable as her argument. it's giving "iconic duo" honestly π
This function is so useful when an SPI-using C function needs to run multiple commands and genuinely does not want to keep the results of earlier commands hanging around until the very end π like, release the baggage, bestie.
π heads up though: any unfreed row sets will be freed anyway at SPI_finish. so don't stress that you're leaking β you're just being tidy early.
Also, if a subtransaction is started and then aborted within execution of an SPI-using C function, SPI automatically frees any row sets that were created while the subtransaction was running π§ automatic cleanup queen behavior, we love to see it.
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 π fr fr, so this guard is a whole glow-up.
π ARGUMENTS π
SPITupleTable * tuptableβ pointer to the row set you want to free, orNULLto do nothing π (yes,NULLis totally valid and means "no-op, we chill")
okay that's the whole page, short and sweet, iykyk π
stay safe out there, free your tuple tables, and remember: this beauty is from PostgreSQL 14.24, dated 2026 β mwah π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14-docs 14.24-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