SPI_COPYTUPLE(3)

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

πŸ’– NAME πŸ’–

okay bestie, this is the SPI_COPYTUPLE(3) page, straight from the PostgreSQL 17.11 docs β€” and the star of the show is SPI_copytuple, which makes a copy of a row in the upper executor context. iconic behavior, honestly. ✨


✨ SYNOPSIS ✨

HeapTuple SPI_copytuple(HeapTuple row)

🌸 DESCRIPTION 🌸

okay so SPI_copytuple makes a copy of a row in the upper executor context. This is normally used to return a modified row from a trigger. main character energy, fr fr.

🚨 bestie, listen: in a function declared to return a composite type, use SPI_returntuple instead. not this one. iykyk.

vibe check: this function can only be used while connected to SPI. Otherwise, it returns NULL and sets SPI_result to SPI_ERROR_UNCONNECTED. so if you're not connected to SPI, that's the whole situation. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • HeapTuple row β€” the row to be copied. that's the argument, bestie. 🫢

πŸ‘‘ RETURN VALUE πŸ‘‘

  • the copied row, or NULL on error (see SPI_result for an error indication). slay when you get the copied row; check SPI_result when you get NULL. πŸ’–

that's the whole page, no cap. ~ PostgreSQL 17.11, 2026, SPI_COPYTUPLE(3) ~ byeee πŸ’‹βœ¨

πŸ“¦ where this page comes from