4 SPI_modifytuple — create a row by replacing selected fields of a given
9 HeapTuple SPI_modifytuple(Relation rel, HeapTuple row, int ncols,
10 int * colnum, Datum * values, const char * nulls)
14 SPI_modifytuple creates a new row by substituting new values for
15 selected columns, copying the original row's columns at other
16 positions. The input row is not modified. The new row is returned in
17 the upper executor context.
19 This function can only be used while connected to SPI. Otherwise, it
20 returns NULL and sets SPI_result to SPI_ERROR_UNCONNECTED.
25 Used only as the source of the row descriptor for the row.
26 (Passing a relation rather than a row descriptor is a
33 number of columns to be changed
36 an array of length ncols, containing the numbers of the columns
37 that are to be changed (column numbers start at 1)
40 an array of length ncols, containing the new values for the
44 an array of length ncols, describing which new values are null
46 If nulls is NULL then SPI_modifytuple assumes that no new values
47 are null. Otherwise, each entry of the nulls array should be ' '
48 if the corresponding new value is non-null, or 'n' if the
49 corresponding new value is null. (In the latter case, the actual
50 value in the corresponding values entry doesn't matter.) Note
51 that nulls is not a text string, just an array: it does not need
56 new row with modifications, allocated in the upper executor context, or
57 NULL on error (see SPI_result for an error indication)
59 On error, SPI_result is set as follows:
62 if rel is NULL, or if row is NULL, or if ncols is less than or
63 equal to 0, or if colnum is NULL, or if values is NULL.
66 if colnum contains an invalid column number (less than or equal
67 to 0 or greater than the number of columns in row)