/* *Formerly,thiscodeattemptedtocachethefunctionandtypeinfo *lookedupbyfetch_fp_info,butonlyforthedurationofasingle *transactioncommand(sinceintheorytheinfocouldchangebetween *commands).Thiswasutterlyuseless,becausepostgres.cexecutes *eachfastpathcallasaseparatetransactioncommand,andsothe *cacheddatacouldneveractuallyhavebeenreused.Ifithadworked *asintended,itwouldhavehadproblemsanywaywithdanglingreferences *intheFmgrInfostruct.So,forgetaboutcachingandjustrepeatthe *syscachefetchesoneachusage.They'renot*that*expensive.
*/ struct fp_info
{
Oid funcid;
FmgrInfo flinfo; /* function lookup info for funcid */
Oid namespace; /* other stuff from pg_proc */
Oid rettype;
Oid argtypes[FUNC_MAX_ARGS]; char fname[NAMEDATALEN]; /* function name for logging */
};
func_htp = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_id)); if (!HeapTupleIsValid(func_htp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("function with OID %u does not exist", func_id)));
pp = (Form_pg_proc) GETSTRUCT(func_htp);
/* reject pg_proc entries that are unsafe to call via fastpath */ if (pp->prokind != PROKIND_FUNCTION || pp->proretset)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot call function \"%s\" via fastpath interface",
NameStr(pp->proname))));
/* watch out for catalog entries with more than FUNC_MAX_ARGS args */ if (pp->pronargs > FUNC_MAX_ARGS)
elog(ERROR, "function %s has more than %d arguments",
NameStr(pp->proname), FUNC_MAX_ARGS);
/* *WeonlyacceptCOMMIT/ABORTifweareinanabortedtransaction,and *COMMIT/ABORTcannotbeexecutedthroughthefastpathinterface.
*/ if (IsAbortedTransactionBlockState())
ereport(ERROR,
(errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),
errmsg("current transaction is aborted, " "commands ignored until end of transaction block")));
/* Log as soon as we have the function OID and name */ if (log_statement == LOGSTMT_ALL)
{
ereport(LOG,
(errmsg("fastpath function call: \"%s\" (OID %u)",
fip->fname, fid)));
was_logged = true;
}
/* *Copysuppliedargumentsintoargvector.
*/ for (i = 0; i < nargs; ++i)
{ int argsize;
int16 aformat;
argsize = pq_getmsgint(msgBuf, 4); if (argsize == -1)
{
fcinfo->args[i].isnull = true;
} else
{
fcinfo->args[i].isnull = false; if (argsize < 0)
ereport(ERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("invalid argument size %d in function call message",
argsize)));
/* Reset abuf to empty, and insert raw data into it */
resetStringInfo(&abuf);
appendBinaryStringInfo(&abuf,
pq_getmsgbytes(msgBuf, argsize),
argsize);
}
fcinfo->args[i].value = OidInputFunctionCall(typinput, pstring,
typioparam, -1); /* Free result of encoding conversion, if any */ if (pstring && pstring != abuf.data)
pfree(pstring);
} elseif (aformat == 1)
{
Oid typreceive;
Oid typioparam;
StringInfo bufptr;
/* Trouble if it didn't eat the whole buffer */ if (argsize != -1 && abuf.cursor != abuf.len)
ereport(ERROR,
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
errmsg("incorrect binary data format in function argument %d",
i + 1)));
} else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unsupported format code: %d", aformat)));
}
/* Return result format code */ return (int16) pq_getmsgint(msgBuf, 2);
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.15Bemerkung:
(vorverarbeitet am 2026-08-08)
¤