1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SPI_modifytuple</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="spi-memory.html" title="40.3.Memory Management">
<link rel="prev" href="spi-spi-returntuple.html" title="SPI_returntuple">
<link rel="next" href="spi-spi-freetuple.html" title="SPI_freetuple">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
<a name="spi-spi-modifytuple"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>SPI_modifytuple — create a row by replacing selected fields of a given row</p>
</div>
<a name="id739370"></a><div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">HeapTuple SPI_modifytuple(Relation <em class="parameter"><code>rel</code></em>, HeapTuple <em class="parameter"><code>row</code></em>, <em class="parameter"><code>ncols</code></em>, <em class="parameter"><code>colnum</code></em>, Datum * <em class="parameter"><code>values</code></em>, const char * <em class="parameter"><code>nulls</code></em>)</pre>
</div>
<div class="refsect1" lang="en">
<a name="id739422"></a><h2>Description</h2>
<p> <code class="function">SPI_modifytuple</code> 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.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id739437"></a><h2>Arguments</h2>
<div class="variablelist"><dl>
<dt><span class="term"><code class="literal">Relation <em class="parameter"><code>rel</code></em></code></span></dt>
<dd><p> Used only as the source of the row descriptor for the row.
(Passing a relation rather than a row descriptor is a
misfeature.)
</p></dd>
<dt><span class="term"><code class="literal">HeapTuple <em class="parameter"><code>row</code></em></code></span></dt>
<dd><p> row to be modified
</p></dd>
<dt><span class="term"><code class="literal">int <em class="parameter"><code>ncols</code></em></code></span></dt>
<dd><p> number of column numbers in the array
<em class="parameter"><code>colnum</code></em>
</p></dd>
<dt><span class="term"><code class="literal">int * <em class="parameter"><code>colnum</code></em></code></span></dt>
<dd><p> array of the numbers of the columns that are to be changed
(column numbers start at 1)
</p></dd>
<dt><span class="term"><code class="literal">Datum * <em class="parameter"><code>values</code></em></code></span></dt>
<dd><p> new values for the specified columns
</p></dd>
<dt><span class="term"><code class="literal">const char * <em class="parameter"><code>Nulls</code></em></code></span></dt>
<dd><p> which new values are null, if any (see
<code class="function">SPI_execute_plan</code> for the format)
</p></dd>
</dl></div>
</div>
<div class="refsect1" lang="en">
<a name="id739561"></a><h2>Return Value</h2>
<p> new row with modifications, allocated in the upper executor
context; <code class="symbol">NULL</code> only if <em class="parameter"><code>row</code></em>
is <code class="symbol">NULL</code>
</p>
<p> On error, <code class="varname">SPI_result</code> is set as follows:
</p>
<div class="variablelist"><dl>
<dt><span class="term"><code class="symbol">SPI_ERROR_ARGUMENT</code></span></dt>
<dd><p> if <em class="parameter"><code>rel</code></em> is <code class="symbol">NULL</code>, or if
<em class="parameter"><code>row</code></em> is <code class="symbol">NULL</code>, or if <em class="parameter"><code>ncols</code></em>
is less than or equal to 0, or if <em class="parameter"><code>colnum</code></em> is
<code class="symbol">NULL</code>, or if <em class="parameter"><code>values</code></em> is <code class="symbol">NULL</code>.
</p></dd>
<dt><span class="term"><code class="symbol">SPI_ERROR_NOATTRIBUTE</code></span></dt>
<dd><p> if <em class="parameter"><code>colnum</code></em> contains an invalid column number (less
than or equal to 0 or greater than the number of column in
<em class="parameter"><code>row</code></em>)
</p></dd>
</dl></div>
<p>
</p>
</div>
</div></body>
</html>
|