Seeking expected return type info for SPI function

From: "J(dot) Greg Davidson" <jgd(at)well(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Seeking expected return type info for SPI function
Date: 2009-12-10 02:44:37
Message-ID: 1260413077.8078.16.camel@shevek.puuhonua.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

When PostgreSQL calls a C function I get all kinds of interesting
information in the
struct FunctionCallInfoData
and
struct FmgrInfo
(details at bottom). I was hoping to get the oid of the expected
return type somewhere, but I don't see it. Am I missing something?
I'm trying to avoid the overhead of looking up the function in the
pgproc table while handling it.

(In case you were wondering, I'm trying to handle a large family
of similar types with a single set of C functions for their input
and output methods.)

Thanks,

_Greg

Excerpt from server/fmgr.h:

typedef struct FmgrInfo {
PGFunction fn_addr; /* pointer to function or handler to be called */
Oid fn_oid; /* OID of function (NOT of handler, if any) */
short fn_nargs; /* 0..FUNC_MAX_ARGS, or -1 if variable arg count */
bool fn_strict; /* function is "strict" (NULL in => NULL out) */
bool fn_retset; /* function returns a set */
unsigned char fn_stats; /* collect stats if track_functions > this */
void *fn_extra; /* extra space for use by handler */
MemoryContext fn_mcxt; /* memory context to store fn_extra in */
fmNodePtr fn_expr; /* expression parse tree for call, or NULL */
} FmgrInfo;

/*
* This struct is the data actually passed to an fmgr-called function.
*/
typedef struct FunctionCallInfoData {
FmgrInfo *flinfo; /* ptr to lookup info used for this call */
fmNodePtr context; /* pass info about context of call */
fmNodePtr 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vick Khera 2009-12-10 03:28:56 Re: Excessive (and slow) fsync() within single transaction
Previous Message Craig Ringer 2009-12-10 02:02:30 Re: pg_dump and ON DELETE CASCADE problem