| The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming Guide
by The PostgreSQL Global Development Group Paperback (6"x9"), 478 pages ISBN 9781906966065 RRP £14.95 ($19.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
13.3.6 SPI_modifytuple
Name
SPI_modifytuple -- create a row by replacing selected fields of a given row
Synopsis
HeapTuple SPI_modifytuple(Relation rel, HeapTuple row, int ncols, int * colnum, Datum * values, const char * nulls)
Description
SPI_modifytuple creates a new row by
substituting new values for selected columns, copying the original
row's columns at other positions. The input row is not modified.
Arguments
Relationrel- Used only as the source of the row descriptor for the row. (Passing a relation rather than a row descriptor is a misfeature.)
HeapTuplerow- row to be modified
intncols-
number of column numbers in the array
colnum int *colnum- array of the numbers of the columns that are to be changed (column numbers start at 1)
Datum *values- new values for the specified columns
const char *Nulls-
which new values are null, if any (see
SPI_execute_planfor the format)
Return Value
new row with modifications, allocated in the upper executor
context; NULL only if row
is NULL
On error, SPI_result is set as follows:
SPI_ERROR_ARGUMENT-
if
relisNULL, or ifrowisNULL, or ifncolsis less than or equal to 0, or ifcolnumisNULL, or ifvaluesisNULL. SPI_ERROR_NOATTRIBUTE-
if
colnumcontains an invalid column number (less than or equal to 0 or greater than the number of column inrow)
| ISBN 9781906966065 | The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming Guide | See the print edition |