2 .\" Title: SPI_cursor_parse_open
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_CURSOR_PARSE_OPEN" "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_cursor_parse_open \- set up a cursor using a query string and parameters
35 Portal SPI_cursor_parse_open(const char *\fIname\fR,
36 const char *\fIcommand\fR,
37 const SPIParseOpenOptions * \fIoptions\fR)
41 \fBSPI_cursor_parse_open\fR
42 sets up a cursor (internally, a portal) that will execute the specified query string\&. This is comparable to
43 \fBSPI_prepare_cursor\fR
45 \fBSPI_cursor_open_with_paramlist\fR, except that parameter references within the query string are handled entirely by supplying a
49 For one\-time query execution, this function should be preferred over
50 \fBSPI_prepare_cursor\fR
52 \fBSPI_cursor_open_with_paramlist\fR\&. If the same command is to be executed with many different parameters, either method might be faster, depending on the cost of re\-planning versus the benefit of custom plans\&.
55 \fIoptions\->params\fR
56 object should normally mark each parameter with the
58 flag, since a one\-shot plan is always used for the query\&.
60 The passed\-in parameter data will be copied into the cursor\*(Aqs portal, so it can be freed while the cursor still exists\&.
63 const char * \fIname\fR
67 to let the system select a name
70 const char * \fIcommand\fR
75 const SPIParseOpenOptions * \fIoptions\fR
77 struct containing optional arguments
80 Callers should always zero out the entire
82 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
86 ParamListInfo \fIparams\fR
88 data structure containing query parameter types and values; NULL if none
91 int \fIcursorOptions\fR
93 integer bit mask of cursor options; zero produces default behavior
99 for read\-only execution
103 Pointer to portal containing the cursor\&. Note there is no error return convention; any error will be reported via