1SPI_MODIFYTUPLE(3)       PostgreSQL 13.3 Documentation      SPI_MODIFYTUPLE(3)
2
3
4

NAME

6       SPI_modifytuple - create a row by replacing selected fields of a given
7       row
8

SYNOPSIS

10       HeapTuple SPI_modifytuple(Relation rel, HeapTuple row, int ncols,
11                                 int * colnum, Datum * values, const char * nulls)
12

DESCRIPTION

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.
18
19       This function can only be used while connected to SPI. Otherwise, it
20       returns NULL and sets SPI_result to SPI_ERROR_UNCONNECTED.
21

ARGUMENTS

23       Relation rel
24           Used only as the source of the row descriptor for the row. (Passing
25           a relation rather than a row descriptor is a misfeature.)
26
27       HeapTuple row
28           row to be modified
29
30       int ncols
31           number of columns to be changed
32
33       int * colnum
34           an array of length ncols, containing the numbers of the columns
35           that are to be changed (column numbers start at 1)
36
37       Datum * values
38           an array of length ncols, containing the new values for the
39           specified columns
40
41       const char * nulls
42           an array of length ncols, describing which new values are null
43
44           If nulls is NULL then SPI_modifytuple assumes that no new values
45           are null. Otherwise, each entry of the nulls array should be ' ' if
46           the corresponding new value is non-null, or 'n' if the
47           corresponding new value is null. (In the latter case, the actual
48           value in the corresponding values entry doesn't matter.) Note that
49           nulls is not a text string, just an array: it does not need a '\0'
50           terminator.
51

RETURN VALUE

53       new row with modifications, allocated in the upper executor context, or
54       NULL on error (see SPI_result for an error indication)
55
56       On error, SPI_result is set as follows:
57
58       SPI_ERROR_ARGUMENT
59           if rel is NULL, or if row is NULL, or if ncols is less than or
60           equal to 0, or if colnum is NULL, or if values is NULL.
61
62       SPI_ERROR_NOATTRIBUTE
63           if colnum contains an invalid column number (less than or equal to
64           0 or greater than the number of columns in row)
65
66       SPI_ERROR_UNCONNECTED
67           if SPI is not active
68
69
70
71PostgreSQL 13.3                      2021                   SPI_MODIFYTUPLE(3)
Impressum