108 (
errcode(ERRCODE_PROTOCOL_VIOLATION),
109 errmsg(
"invalid argument size %d in function call message",
164 else if (format == 1)
179 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
180 errmsg(
"unsupported format code: %d", format)));
220 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
221 errmsg(
"function with OID %u does not exist", func_id)));
226 elog(
ERROR,
"function %s has more than %d arguments",
229 fip->namespace = pp->pronamespace;
231 memcpy(fip->
argtypes, pp->proargtypes.values, pp->pronargs *
sizeof(
Oid));
269 bool was_logged =
false;
278 (
errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),
279 errmsg(
"current transaction is aborted, " 280 "commands ignored until end of transaction block")));
307 (
errmsg(
"fastpath function call: \"%s\" (OID %u)",
353 for (i = 0; i < fcinfo->nargs; i++)
355 if (fcinfo->args[i].isnull)
370 fcinfo->isnull =
true;
389 (
errmsg(
"duration: %s ms", msec_str)));
393 (
errmsg(
"duration: %s ms fastpath function call: \"%s\" (OID %u)",
394 msec_str, fip->
fname, fid)));
412 int16 *aformats = NULL;
420 for (i = 0; i < numAFormats; i++)
428 (
errcode(ERRCODE_PROTOCOL_VIOLATION),
429 errmsg(
"function call message contains %d arguments but function requires %d",
432 fcinfo->
nargs = nargs;
434 if (numAFormats > 1 && numAFormats != nargs)
436 (
errcode(ERRCODE_PROTOCOL_VIOLATION),
437 errmsg(
"function call message contains %d argument formats but %d arguments",
438 numAFormats, nargs)));
445 for (i = 0; i < nargs; ++
i)
460 (
errcode(ERRCODE_PROTOCOL_VIOLATION),
461 errmsg(
"invalid argument size %d in function call message",
472 aformat = aformats[
i];
473 else if (numAFormats > 0)
474 aformat = aformats[0];
500 if (pstring && pstring != abuf.
data)
503 else if (aformat == 1)
521 if (argsize != -1 && abuf.
cursor != abuf.
len)
523 (
errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
524 errmsg(
"incorrect binary data format in function argument %d",
529 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
530 errmsg(
"unsupported format code: %d", aformat)));
555 (
errcode(ERRCODE_PROTOCOL_VIOLATION),
556 errmsg(
"function call message contains %d arguments but function requires %d",
559 fcinfo->
nargs = nargs;
571 for (i = 0; i < nargs; ++
i)
590 (
errcode(ERRCODE_PROTOCOL_VIOLATION),
591 errmsg(
"invalid argument size %d in function call message",
606 (
errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
607 errmsg(
"incorrect binary data format in function argument %d",
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
int GetOldFunctionMessage(StringInfo buf)
bool IsAbortedTransactionBlockState(void)
int errcode(int sqlerrcode)
#define MemSet(start, val, len)
static void SendFunctionResult(Datum retval, bool isnull, Oid rettype, int16 format)
void PopActiveSnapshot(void)
#define PG_PROTOCOL_MAJOR(v)
Snapshot GetTransactionSnapshot(void)
#define OidIsValid(objectId)
AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid roleid, AclMode mode)
static int16 parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info *fip, FunctionCallInfo fcinfo)
#define InvokeNamespaceSearchHook(objectId, ereport_on_violation)
int check_log_duration(char *msec_str, bool was_logged)
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
void pfree(void *pointer)
char * pg_client_to_server(const char *s, int len)
#define ObjectIdGetDatum(X)
char * get_func_name(Oid funcid)
NullableDatum args[FLEXIBLE_ARRAY_MEMBER]
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Datum OidReceiveFunctionCall(Oid functionId, StringInfo buf, Oid typioparam, int32 typmod)
bytea * OidSendFunctionCall(Oid functionId, Datum val)
char * get_namespace_name(Oid nspid)
int pq_getbytes(char *s, size_t len)
#define FunctionCallInvoke(fcinfo)
void PushActiveSnapshot(Snapshot snap)
void enlargeStringInfo(StringInfo str, int needed)
void resetStringInfo(StringInfo str)
void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam)
void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
#define InvokeFunctionExecuteHook(objectId)
Oid argtypes[FUNC_MAX_ARGS]
void initStringInfo(StringInfo str)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
void getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena)
void ReleaseSysCache(HeapTuple tuple)
static int16 parse_fcall_arguments(StringInfo msgBuf, struct fp_info *fip, FunctionCallInfo fcinfo)
FormData_pg_proc * Form_pg_proc
#define ereport(elevel,...)
#define LOCAL_FCINFO(name, nargs)
size_t strlcpy(char *dst, const char *src, size_t siz)
#define HeapTupleIsValid(tuple)
#define Assert(condition)
void HandleFunctionRequest(StringInfo msgBuf)
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
static void fetch_fp_info(Oid func_id, struct fp_info *fip)
char * OidOutputFunctionCall(Oid functionId, Datum val)
int errmsg(const char *fmt,...)
AclResult pg_proc_aclcheck(Oid proc_oid, Oid roleid, AclMode mode)
int pq_getstring(StringInfo s)
#define CHECK_FOR_INTERRUPTS()
Datum OidInputFunctionCall(Oid functionId, char *str, Oid typioparam, int32 typmod)
ProtocolVersion FrontendProtocol
void appendBinaryStringInfo(StringInfo str, const char *data, int datalen)