Tom Lane wrote:
> typedef struct
> {
> FmgrInfo *flinfo; /* ptr to lookup info used for this call */
> Node *context; /* pass info about context of call */
> Node *resultinfo; /* pass or return extra info about result */
> bool isnull; /* function must set true if result is NULL */
> short nargs; /* # arguments actually passed */
> Datum arg[FUNC_MAX_ARGS]; /* Arguments passed to function */
> bool argnull[FUNC_MAX_ARGS]; /* T if arg[i] is actually NULL */
> } FunctionCallInfoData;
Just wondering what the implications of FUNC_MAX_ARGS is, and whether
something like...
struct FuncArg
{ Datum arg; bool argnull;
};
typedef struct
{ FmgrInfo *flinfo; /* ptr to lookup info used for this call
*/ Node *context; /* pass info about context of call */ Node *resultinfo; /* pass or return
extrainfo about
result */ bool isnull; /* function must set true if result is
NULL */ short nargs; /* # arguments actually passed */ struct FuncArg args[];
} FunctionCallInfoData;
might remove an arbitrary argument limit?
> int32
> int4pl(int32 arg1, int32 arg2)
> {
> return arg1 + arg2;
> }
> to new-style
> Datum
> int4pl(FunctionCallInfo fcinfo)
> {
> /* we assume the function is marked "strict", so we can ignore
> * NULL-value handling */
>
> return Int32GetDatum(DatumGetInt32(fcinfo->arg[0]) +
> DatumGetInt32(fcinfo->arg[1]));
> }
Wondering if some stub code generator might be appropriate so that
functions can can continue to look as readable as before?