SPI_FREETUPTABLE(3)

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

✨ 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, or NULL to do nothing πŸ™ˆ (yes, NULL is 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