postgresql_16:6.10.1.5.1 Description
PostgreSQL 16 > Server Programming > Server Programming Interface > Interface Functions > SPI_execute_extended > Description
SPI_execute_extended executes a command that might include references to externally supplied parameters. The command text refers to a parameter as $*n*, and the options->params object (if supplied) provides values and type information for each such symbol. Various execution options can be specified in the options struct, too.
The options->params object should normally mark each parameter with the PARAM_FLAG_CONST flag, since a one-shot plan is always used for the query.
If options->dest is not NULL, then result tuples are passed to that object as they are generated by the executor, instead of being accumulated in SPI_tuptable. Using a caller-supplied DestReceiver 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.