SPI_COPYTUPLE(3)
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 returnsNULLand setsSPI_resulttoSPI_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
NULLon error (seeSPI_resultfor an error indication). So if you getNULL, go checkSPI_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
- opensuse-leap 16.0: postgresql15-docs 15.19-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