Allow SQL-language functions to return the output of an INSERT/UPDATE/DELETE
Tom Lane <tgl@sss.pgh.pa.us>
Allow SQL-language functions to return the output of an INSERT/UPDATE/DELETE RETURNING clause, not just a SELECT as formerly. A side effect of this patch is that when a set-returning SQL function is used in a FROM clause, performance is improved because the output is collected into a tuplestore within the function, rather than using the less efficient value-per-call mechanism.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/xfunc.sgml | modified | +60 −39 |
| src/backend/executor/execQual.c | modified | +37 −23 |
| src/backend/executor/functions.c | modified | +473 −237 |
| src/backend/tcop/dest.c | modified | +8 −1 |
| src/backend/utils/fmgr/README | modified | +4 −2 |
| src/include/executor/functions.h | modified | +4 −1 |
| src/include/nodes/execnodes.h | modified | +5 −3 |
| src/include/tcop/dest.h | modified | +3 −2 |
| src/test/regress/expected/rangefuncs.out | modified | +176 −0 |
| src/test/regress/output/create_function_1.source | modified | +1 −1 |
| src/test/regress/sql/rangefuncs.sql | modified | +59 −0 |