Re: Last call for comments: fmgr rewrite [LONG]

From: Chris Bitmead <chrisb(at)nimrod(dot)itg(dot)telstra(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Last call for comments: fmgr rewrite [LONG]
Date: 2000-05-21 23:54:46
Message-ID: 39287745.193A5521@nimrod.itg.telecom.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 extra info 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?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-05-22 00:03:57 Re: Last call for comments: fmgr rewrite [LONG]
Previous Message Chris Bitmead 2000-05-21 23:27:32 Re: OO Patch