SPI_COPYTUPLE(3)
π 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 returnsNULLand setsSPI_resulttoSPI_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
- opensuse-leap 16.0: postgresql13-docs 13.23-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