Commit 0811ff20 authored by Tom Lane's avatar Tom Lane

Avoid using a local FunctionCallInfoData struct in ExecMakeFunctionResult

and related routines.

We already had a redundant FunctionCallInfoData struct in FuncExprState,
but were using that copy only in set-returning-function cases, to avoid
keeping function evaluation state in the expression tree for the benefit
of plpgsql's "simple expression" logic.  But of course that didn't work
anyway.  Given the recent fixes in plpgsql there is no need to have two
separate behaviors here.  Getting rid of the local FunctionCallInfoData
structs should make things a little faster (because we don't need to do
InitFunctionCallInfoData each time), and it also makes for a noticeable
reduction in stack space consumption during recursive calls.
parent 931b6db3
This diff is collapsed.
......@@ -623,13 +623,11 @@ typedef struct FuncExprState
* NULL */
/*
* We need to store argument values across calls when evaluating a SRF
* that uses value-per-call mode.
*
* setArgsValid is true when we are evaluating a set-valued function and
* we are in the middle of a call series; we want to pass the same
* argument values to the function again (and again, until it returns
* ExprEndResult).
* setArgsValid is true when we are evaluating a set-returning function
* that uses value-per-call mode and we are in the middle of a call
* series; we want to pass the same argument values to the function again
* (and again, until it returns ExprEndResult). This indicates that
* fcinfo_data already contains valid argument data.
*/
bool setArgsValid;
......@@ -649,10 +647,11 @@ typedef struct FuncExprState
bool shutdown_reg; /* a shutdown callback is registered */
/*
* Current argument data for a set-valued function; contains valid data
* only if setArgsValid is true.
* Call parameter structure for the function. This has been initialized
* (by InitFunctionCallInfoData) if func.fn_oid is valid. It also saves
* argument values between calls, when setArgsValid is true.
*/
FunctionCallInfoData setArgs;
FunctionCallInfoData fcinfo_data;
} FuncExprState;
/* ----------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment