2 .\" Title: SPI_returntuple
3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "SPI_RETURNTUPLE" "3" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 SPI_returntuple \- prepare to return a tuple as a Datum
35 HeapTupleHeader SPI_returntuple(HeapTuple \fIrow\fR, TupleDesc \fIrowdesc\fR)
40 makes a copy of a row in the upper executor context, returning it in the form of a row type
41 Datum\&. The returned pointer need only be converted to
47 This function can only be used while connected to SPI\&. Otherwise, it returns NULL and sets
50 SPI_ERROR_UNCONNECTED\&.
52 Note that this should be used for functions that are declared to return composite types\&. It is not used for triggers; use
54 for returning a modified row in a trigger\&.
62 TupleDesc \fIrowdesc\fR
64 descriptor for row (pass the same descriptor each time for most effective caching)
69 pointing to copied row, or
73 for an error indication)