1SPI_RETURNTUPLE(3) PostgreSQL 14.3 Documentation SPI_RETURNTUPLE(3)
2
3
4
6 SPI_returntuple - prepare to return a tuple as a Datum
7
9 HeapTupleHeader SPI_returntuple(HeapTuple row, TupleDesc rowdesc)
10
12 SPI_returntuple makes a copy of a row in the upper executor context,
13 returning it in the form of a row type Datum. The returned pointer need
14 only be converted to Datum via PointerGetDatum before returning.
15
16 This function can only be used while connected to SPI. Otherwise, it
17 returns NULL and sets SPI_result to SPI_ERROR_UNCONNECTED.
18
19 Note that this should be used for functions that are declared to return
20 composite types. It is not used for triggers; use SPI_copytuple for
21 returning a modified row in a trigger.
22
24 HeapTuple row
25 row to be copied
26
27 TupleDesc rowdesc
28 descriptor for row (pass the same descriptor each time for most
29 effective caching)
30
32 HeapTupleHeader pointing to copied row, or NULL on error (see
33 SPI_result for an error indication)
34
35
36
37PostgreSQL 14.3 2022 SPI_RETURNTUPLE(3)