2 .\" Title: SPI_execute_extended
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_EXECUTE_EXTENDED" "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_execute_extended \- execute a command with out\-of\-line parameters
35 int SPI_execute_extended(const char *\fIcommand\fR,
36 const SPIExecuteOptions * \fIoptions\fR)
40 \fBSPI_execute_extended\fR
41 executes a command that might include references to externally supplied parameters\&. The command text refers to a parameter as
43 \fIoptions\->params\fR
44 object (if supplied) provides values and type information for each such symbol\&. Various execution options can be specified in the
49 \fIoptions\->params\fR
50 object should normally mark each parameter with the
52 flag, since a one\-shot plan is always used for the query\&.
56 is not NULL, then result tuples are passed to that object as they are generated by the executor, instead of being accumulated in
57 \fISPI_tuptable\fR\&. Using a caller\-supplied
59 object is particularly helpful for queries that might generate many tuples, since the data can be processed on\-the\-fly instead of being accumulated in memory\&.
62 const char * \fIcommand\fR
67 const SPIExecuteOptions * \fIoptions\fR
69 struct containing optional arguments
72 Callers should always zero out the entire
74 struct, then fill whichever fields they want to set\&. This ensures forward compatibility of code, since any fields that are added to the struct in future will be defined to behave backwards\-compatibly if they are zero\&. The currently available
78 ParamListInfo \fIparams\fR
80 data structure containing query parameter types and values; NULL if none
86 for read\-only execution
89 bool \fIallow_nonatomic\fR
92 allows non\-atomic execution of CALL and DO statements (but this field is ignored unless the
95 \fBSPI_connect_ext\fR)
98 bool \fImust_return_tuples\fR
101 true, raise error if the query is not of a kind that returns tuples (this does not forbid the case where it happens to return zero tuples)
106 maximum number of rows to return, or
111 DestReceiver * \fIdest\fR
114 object that will receive any tuples emitted by the query; if NULL, result tuples are accumulated into a
120 ResourceOwner \fIowner\fR
122 This field is present for consistency with
123 \fBSPI_execute_plan_extended\fR, but it is ignored, since the plan used by
124 \fBSPI_execute_extended\fR
129 The return value is the same as for
139 \fBSPI_execute\fR\&. When
145 is set to NULL\&. If a tuple count is required, the caller\*(Aqs
147 object must calculate it\&.