SPI_COPYTUPLE(3)

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

okay so bestie, you opened the SPI_COPYTUPLE(3) page and I’m obsessed already. It’s giving PostgreSQL internals, main-character energy, and one very specific row-copying job. Let’s go. πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

  • SPI_copytuple β€” make a copy of a row in the upper executor context.

✨ SYNOPSIS ✨

HeapTuple SPI_copytuple(HeapTuple row)

πŸ’– DESCRIPTION πŸ’–

SPI_copytuple makes a copy of a row in the upper executor context. That’s the whole vibe. It’s normally used to return a modified row from a trigger.

And listen, bestie: in a function declared to return a composite type, use SPI_returntuple instead. That’s the assignment, not this one. 🫢

⚠️ This function can only be used while connected to SPI. Otherwise, it returns NULL and sets SPI_result to SPI_ERROR_UNCONNECTED. No connection, no copy, periodt. πŸ’€

πŸ¦‹ ARGUMENTS πŸ¦‹

  • HeapTuple row β€” the row to be copied. That’s it. That’s the whole argument. πŸŽ€

🌸 RETURN VALUE 🌸

  • the copied row, or NULL on error (see SPI_result for an error indication). So if you get NULL, go check SPI_result β€” it’s literally holding the tea. 😭

okay bye bestie! this page is from PostgreSQL 15.19, dated 2026, and it’s the SPI_COPYTUPLE(3) manual page β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from