mirror of
https://github.com/postgres/postgres.git
synced 2025-11-29 23:43:17 +03:00
Implement an API to let foreign-data wrappers actually be functional.
This commit provides the core code and documentation needed. A contrib module test case will follow shortly. Shigeru Hanada, Jan Urbanski, Heikki Linnakangas
This commit is contained in:
@@ -1621,6 +1621,26 @@ FunctionCall9(FmgrInfo *flinfo, Datum arg1, Datum arg2,
|
||||
* by FunctionCallN(). If the same function is to be invoked repeatedly,
|
||||
* do the fmgr_info() once and then use FunctionCallN().
|
||||
*/
|
||||
Datum
|
||||
OidFunctionCall0(Oid functionId)
|
||||
{
|
||||
FmgrInfo flinfo;
|
||||
FunctionCallInfoData fcinfo;
|
||||
Datum result;
|
||||
|
||||
fmgr_info(functionId, &flinfo);
|
||||
|
||||
InitFunctionCallInfoData(fcinfo, &flinfo, 0, NULL, NULL);
|
||||
|
||||
result = FunctionCallInvoke(&fcinfo);
|
||||
|
||||
/* Check for null result, since caller is clearly not expecting one */
|
||||
if (fcinfo.isnull)
|
||||
elog(ERROR, "function %u returned NULL", flinfo.fn_oid);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Datum
|
||||
OidFunctionCall1(Oid functionId, Datum arg1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user