入参必须为 FunctionCallInfo fcinfo,但为了简化书写以及保持接口形式统一,我们将其 define 成了一个宏 PG_FUNCTION_ARGS。 获取实际参数则需要使用专门的宏接口来获取,例如 PGGETARG_INT64(0) ,这一套接口一般都以 PG_GETARG为前缀,之后为数据类型,宏参数为函数参数下标。例如假如函数第三个参数为 bool,则
目前只实现了磁盘管理器magnetic disk。 smgr文件函数的参数Datum smgrin(PG_FUNCTION_ARGS) --> unsigned long smgrin(struct FunctionCallInfoData * fcinfo)。 PG_GETARG_CSTRING(n)预定义为DatumGetCString(PG_GETARG_DATUM(n))、DatumGetCString(x)预定义为((char) DatumGetPointer(x))、DatumGetPointer(x)预...
PG_FUNCTION_INFO_V1(squares_return_int); Datum squares_return_int(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); PG_RETURN_INT32(arg * arg); } PG_FUNCTION_INFO_V1(add); Datum add(PG_FUNCTION_ARGS) { int32 a = PG_GETARG_INT32(0); int32 b = PG_GETARG_INT32(1); ...
AI代码解释 typedef struct{Oidfoid;/* OID of the function */shortnargs;/* 0..FUNC_MAX_ARGS, or -1 if variable count */boolstrict;/* T if function is "strict" */boolretset;/* T if function returns a set */constchar*funcName;/* C name of the function */PGFunctionfunc;/* point...
pg_describe_object(PG_FUNCTION_ARGS) { Oid classid = PG_GETARG_OID(0); Oid objid = PG_GETARG_OID(1); int32 objsubid = PG_GETARG_INT32(2); ... 实例 代码语言:javascript 代码运行次数:0 运行 AI代码解释 -- 2615: pg_namespace(from pg_class) -- 2200: public(from pg_namespace) ...
extern Datum hashenum(PG_FUNCTION_ARGS); extern Datum hashfloat4(PG_FUNCTION_ARGS); extern Datum hashfloat8(PG_FUNCTION_ARGS); extern Datum hashoidvector(PG_FUNCTION_ARGS); extern Datum hashint2vector(PG_FUNCTION_ARGS); extern Datum hashname(PG_FUNCTION_ARGS); ...
Datum pg_stat_get_wal_receiver(PG_FUNCTION_ARGS) { TupleDesc tupdesc; Datum *values; bool *nulls; int pid; bool ready_to_display; WalRcvState state; XLogRecPtr receive_start_lsn, written_lsn, flushed_lsn, latest_end_lsn; TimeLineID receive_start_tli, received_tli; ...
static void handle_sigterm(SIGNAL_ARGS); static void execute_sql_string(const char *sql); @@ -115,7 +110,6 @@ static bool exists_binary_recv_fn(Oid type); PG_MODULE_MAGIC;PG_FUNCTION_INFO_V1(pg_background_launch); PG_FUNCTION_INFO_V1(pg_background_discard_result);...
pg_buffercache_pages(PG_FUNCTION_ARGS) { FuncCallContext*funcctx; Datum result; MemoryContext oldcontext; BufferCachePagesContext*fctx;/*User function context.*/TupleDesc tupledesc; HeapTuple tuple;if(SRF_IS_FIRSTCALL()) {inti;volatileBufferDesc *bufHdr; ...
extern Datum heap_tableam_handler(PG_FUNCTION_ARGS);extern Datum byteaout(PG_FUNCTION_ARGS);extern Datum charout(PG_FUNCTION_ARGS);... fmgrprotos.h为所有内置函数的声明: typedef struct{Oidfoid;/* OID of the function */shortnargs;/* 0..FUNC_MAX_ARGS, or -1 if variable count */boolstr...