SPI_COPYTUPLE(3)

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

πŸŽ€ NAME πŸŽ€

Okay bestie, welcome to the SPI_COPYTUPLE(3) page β€” the one where we learn how to make a copy of a row in the upper executor context πŸ’…

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. In a function declared to return a composite type, use SPI_returntuple instead.

Heads up, bestie: this function can only be used while connected to SPI. Otherwise, it returns NULL and sets SPI_result to SPI_ERROR_UNCONNECTED. No cap.

✨ SYNOPSIS ✨

HeapTuple SPI_copytuple(HeapTuple row)

πŸ¦‹ DESCRIPTION πŸ¦‹

SPI_copytuple makes a copy of a row in the upper executor context. It’s usually the move when you need to return a modified row from a trigger. But listen: if you’re in a function declared to return a composite type, use SPI_returntuple instead β€” that’s the icon for that job πŸ’–

This function can only be used while connected to SPI. Otherwise, it returns NULL and sets SPI_result to SPI_ERROR_UNCONNECTED. Literally cannot stress that enough β€” vibe check your SPI connection first 🫢


🌸 ARGUMENTS 🌸

  • HeapTuple row β€” the row to be copied ✨

πŸ’œ RETURN VALUE πŸ’œ

It gives you back the copied row, or NULL on error. For an error indication, check SPI_result β€” that’s your little status bestie πŸ”₯


kisses and clean builds, this page is from PostgreSQL 13.23, dated 2025 β€” mwah πŸ’œ

πŸ“¦ where this page comes from