2 .\" Title: SPI_modifytuple
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_MODIFYTUPLE" "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_modifytuple \- create a row by replacing selected fields of a given row
35 HeapTuple SPI_modifytuple(Relation \fIrel\fR, HeapTuple \fIrow\fR, int \fIncols\fR,
36 int * \fIcolnum\fR, Datum * \fIvalues\fR, const char * \fInulls\fR)
41 creates a new row by substituting new values for selected columns, copying the original row\*(Aqs columns at other positions\&. The input row is not modified\&. The new row is returned in the upper executor context\&.
43 This function can only be used while connected to SPI\&. Otherwise, it returns NULL and sets
46 SPI_ERROR_UNCONNECTED\&.
51 Used only as the source of the row descriptor for the row\&. (Passing a relation rather than a row descriptor is a misfeature\&.)
61 number of columns to be changed
67 \fIncols\fR, containing the numbers of the columns that are to be changed (column numbers start at 1)
73 \fIncols\fR, containing the new values for the specified columns
76 const char * \fInulls\fR
79 \fIncols\fR, describing which new values are null
87 assumes that no new values are null\&. Otherwise, each entry of the
91 if the corresponding new value is non\-null, or
93 if the corresponding new value is null\&. (In the latter case, the actual value in the corresponding
95 entry doesn\*(Aqt matter\&.) Note that
97 is not a text string, just an array: it does not need a
103 new row with modifications, allocated in the upper executor context, or
107 for an error indication)
123 is less than or equal to 0, or if
132 SPI_ERROR_NOATTRIBUTE
136 contains an invalid column number (less than or equal to 0 or greater than the number of columns in
140 SPI_ERROR_UNCONNECTED