00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef FMGR_H
00019 #define FMGR_H
00020
00021
00022 typedef struct Node *fmNodePtr;
00023
00024
00025 typedef struct StringInfoData *fmStringInfo;
00026
00027
00028
00029
00030
00031
00032
00033
00034 typedef struct FunctionCallInfoData *FunctionCallInfo;
00035
00036 typedef Datum (*PGFunction) (FunctionCallInfo fcinfo);
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 typedef struct FmgrInfo
00050 {
00051 PGFunction fn_addr;
00052 Oid fn_oid;
00053 short fn_nargs;
00054
00055 bool fn_strict;
00056 bool fn_retset;
00057 unsigned char fn_stats;
00058 void *fn_extra;
00059 MemoryContext fn_mcxt;
00060 fmNodePtr fn_expr;
00061 } FmgrInfo;
00062
00063
00064
00065
00066 typedef struct FunctionCallInfoData
00067 {
00068 FmgrInfo *flinfo;
00069 fmNodePtr context;
00070 fmNodePtr resultinfo;
00071 Oid fncollation;
00072 bool isnull;
00073 short nargs;
00074 Datum arg[FUNC_MAX_ARGS];
00075 bool argnull[FUNC_MAX_ARGS];
00076 } FunctionCallInfoData;
00077
00078
00079
00080
00081
00082 extern void fmgr_info(Oid functionId, FmgrInfo *finfo);
00083
00084
00085
00086
00087
00088
00089 extern void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo,
00090 MemoryContext mcxt);
00091
00092
00093 #define fmgr_info_set_expr(expr, finfo) \
00094 ((finfo)->fn_expr = (expr))
00095
00096
00097
00098
00099 extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo,
00100 MemoryContext destcxt);
00101
00102
00103
00104
00105
00106
00107
00108
00109 #define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo) \
00110 do { \
00111 (Fcinfo).flinfo = (Flinfo); \
00112 (Fcinfo).context = (Context); \
00113 (Fcinfo).resultinfo = (Resultinfo); \
00114 (Fcinfo).fncollation = (Collation); \
00115 (Fcinfo).isnull = false; \
00116 (Fcinfo).nargs = (Nargs); \
00117 } while (0)
00118
00119
00120
00121
00122
00123
00124
00125
00126 #define FunctionCallInvoke(fcinfo) ((* (fcinfo)->flinfo->fn_addr) (fcinfo))
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 #define PG_FUNCTION_ARGS FunctionCallInfo fcinfo
00148
00149
00150
00151
00152 #define PG_GET_COLLATION() (fcinfo->fncollation)
00153
00154
00155
00156
00157 #define PG_NARGS() (fcinfo->nargs)
00158
00159
00160
00161
00162
00163 #define PG_ARGISNULL(n) (fcinfo->argnull[n])
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 extern struct varlena *pg_detoast_datum(struct varlena * datum);
00188 extern struct varlena *pg_detoast_datum_copy(struct varlena * datum);
00189 extern struct varlena *pg_detoast_datum_slice(struct varlena * datum,
00190 int32 first, int32 count);
00191 extern struct varlena *pg_detoast_datum_packed(struct varlena * datum);
00192
00193 #define PG_DETOAST_DATUM(datum) \
00194 pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
00195 #define PG_DETOAST_DATUM_COPY(datum) \
00196 pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))
00197 #define PG_DETOAST_DATUM_SLICE(datum,f,c) \
00198 pg_detoast_datum_slice((struct varlena *) DatumGetPointer(datum), \
00199 (int32) (f), (int32) (c))
00200
00201 #define PG_DETOAST_DATUM_PACKED(datum) \
00202 pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum))
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213 #define PG_FREE_IF_COPY(ptr,n) \
00214 do { \
00215 if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
00216 pfree(ptr); \
00217 } while (0)
00218
00219
00220
00221 #define PG_GETARG_DATUM(n) (fcinfo->arg[n])
00222 #define PG_GETARG_INT32(n) DatumGetInt32(PG_GETARG_DATUM(n))
00223 #define PG_GETARG_UINT32(n) DatumGetUInt32(PG_GETARG_DATUM(n))
00224 #define PG_GETARG_INT16(n) DatumGetInt16(PG_GETARG_DATUM(n))
00225 #define PG_GETARG_UINT16(n) DatumGetUInt16(PG_GETARG_DATUM(n))
00226 #define PG_GETARG_CHAR(n) DatumGetChar(PG_GETARG_DATUM(n))
00227 #define PG_GETARG_BOOL(n) DatumGetBool(PG_GETARG_DATUM(n))
00228 #define PG_GETARG_OID(n) DatumGetObjectId(PG_GETARG_DATUM(n))
00229 #define PG_GETARG_POINTER(n) DatumGetPointer(PG_GETARG_DATUM(n))
00230 #define PG_GETARG_CSTRING(n) DatumGetCString(PG_GETARG_DATUM(n))
00231 #define PG_GETARG_NAME(n) DatumGetName(PG_GETARG_DATUM(n))
00232
00233 #define PG_GETARG_FLOAT4(n) DatumGetFloat4(PG_GETARG_DATUM(n))
00234 #define PG_GETARG_FLOAT8(n) DatumGetFloat8(PG_GETARG_DATUM(n))
00235 #define PG_GETARG_INT64(n) DatumGetInt64(PG_GETARG_DATUM(n))
00236
00237 #define PG_GETARG_RAW_VARLENA_P(n) ((struct varlena *) PG_GETARG_POINTER(n))
00238
00239 #define PG_GETARG_VARLENA_P(n) PG_DETOAST_DATUM(PG_GETARG_DATUM(n))
00240
00241 #define PG_GETARG_VARLENA_PP(n) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n))
00242
00243 #define DatumGetByteaP(X) ((bytea *) PG_DETOAST_DATUM(X))
00244 #define DatumGetByteaPP(X) ((bytea *) PG_DETOAST_DATUM_PACKED(X))
00245 #define DatumGetTextP(X) ((text *) PG_DETOAST_DATUM(X))
00246 #define DatumGetTextPP(X) ((text *) PG_DETOAST_DATUM_PACKED(X))
00247 #define DatumGetBpCharP(X) ((BpChar *) PG_DETOAST_DATUM(X))
00248 #define DatumGetBpCharPP(X) ((BpChar *) PG_DETOAST_DATUM_PACKED(X))
00249 #define DatumGetVarCharP(X) ((VarChar *) PG_DETOAST_DATUM(X))
00250 #define DatumGetVarCharPP(X) ((VarChar *) PG_DETOAST_DATUM_PACKED(X))
00251 #define DatumGetHeapTupleHeader(X) ((HeapTupleHeader) PG_DETOAST_DATUM(X))
00252
00253 #define DatumGetByteaPCopy(X) ((bytea *) PG_DETOAST_DATUM_COPY(X))
00254 #define DatumGetTextPCopy(X) ((text *) PG_DETOAST_DATUM_COPY(X))
00255 #define DatumGetBpCharPCopy(X) ((BpChar *) PG_DETOAST_DATUM_COPY(X))
00256 #define DatumGetVarCharPCopy(X) ((VarChar *) PG_DETOAST_DATUM_COPY(X))
00257 #define DatumGetHeapTupleHeaderCopy(X) ((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X))
00258
00259 #define DatumGetByteaPSlice(X,m,n) ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))
00260 #define DatumGetTextPSlice(X,m,n) ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
00261 #define DatumGetBpCharPSlice(X,m,n) ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
00262 #define DatumGetVarCharPSlice(X,m,n) ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
00263
00264 #define PG_GETARG_BYTEA_P(n) DatumGetByteaP(PG_GETARG_DATUM(n))
00265 #define PG_GETARG_BYTEA_PP(n) DatumGetByteaPP(PG_GETARG_DATUM(n))
00266 #define PG_GETARG_TEXT_P(n) DatumGetTextP(PG_GETARG_DATUM(n))
00267 #define PG_GETARG_TEXT_PP(n) DatumGetTextPP(PG_GETARG_DATUM(n))
00268 #define PG_GETARG_BPCHAR_P(n) DatumGetBpCharP(PG_GETARG_DATUM(n))
00269 #define PG_GETARG_BPCHAR_PP(n) DatumGetBpCharPP(PG_GETARG_DATUM(n))
00270 #define PG_GETARG_VARCHAR_P(n) DatumGetVarCharP(PG_GETARG_DATUM(n))
00271 #define PG_GETARG_VARCHAR_PP(n) DatumGetVarCharPP(PG_GETARG_DATUM(n))
00272 #define PG_GETARG_HEAPTUPLEHEADER(n) DatumGetHeapTupleHeader(PG_GETARG_DATUM(n))
00273
00274 #define PG_GETARG_BYTEA_P_COPY(n) DatumGetByteaPCopy(PG_GETARG_DATUM(n))
00275 #define PG_GETARG_TEXT_P_COPY(n) DatumGetTextPCopy(PG_GETARG_DATUM(n))
00276 #define PG_GETARG_BPCHAR_P_COPY(n) DatumGetBpCharPCopy(PG_GETARG_DATUM(n))
00277 #define PG_GETARG_VARCHAR_P_COPY(n) DatumGetVarCharPCopy(PG_GETARG_DATUM(n))
00278 #define PG_GETARG_HEAPTUPLEHEADER_COPY(n) DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n))
00279
00280 #define PG_GETARG_BYTEA_P_SLICE(n,a,b) DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b)
00281 #define PG_GETARG_TEXT_P_SLICE(n,a,b) DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b)
00282 #define PG_GETARG_BPCHAR_P_SLICE(n,a,b) DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b)
00283 #define PG_GETARG_VARCHAR_P_SLICE(n,a,b) DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b)
00284
00285
00286 #define PG_RETURN_NULL() \
00287 do { fcinfo->isnull = true; return (Datum) 0; } while (0)
00288
00289
00290 #define PG_RETURN_VOID() return (Datum) 0
00291
00292
00293
00294 #define PG_RETURN_DATUM(x) return (x)
00295 #define PG_RETURN_INT32(x) return Int32GetDatum(x)
00296 #define PG_RETURN_UINT32(x) return UInt32GetDatum(x)
00297 #define PG_RETURN_INT16(x) return Int16GetDatum(x)
00298 #define PG_RETURN_CHAR(x) return CharGetDatum(x)
00299 #define PG_RETURN_BOOL(x) return BoolGetDatum(x)
00300 #define PG_RETURN_OID(x) return ObjectIdGetDatum(x)
00301 #define PG_RETURN_POINTER(x) return PointerGetDatum(x)
00302 #define PG_RETURN_CSTRING(x) return CStringGetDatum(x)
00303 #define PG_RETURN_NAME(x) return NameGetDatum(x)
00304
00305 #define PG_RETURN_FLOAT4(x) return Float4GetDatum(x)
00306 #define PG_RETURN_FLOAT8(x) return Float8GetDatum(x)
00307 #define PG_RETURN_INT64(x) return Int64GetDatum(x)
00308
00309 #define PG_RETURN_BYTEA_P(x) PG_RETURN_POINTER(x)
00310 #define PG_RETURN_TEXT_P(x) PG_RETURN_POINTER(x)
00311 #define PG_RETURN_BPCHAR_P(x) PG_RETURN_POINTER(x)
00312 #define PG_RETURN_VARCHAR_P(x) PG_RETURN_POINTER(x)
00313 #define PG_RETURN_HEAPTUPLEHEADER(x) PG_RETURN_POINTER(x)
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332 typedef struct
00333 {
00334 int api_version;
00335
00336 } Pg_finfo_record;
00337
00338
00339 typedef const Pg_finfo_record *(*PGFInfoFunction) (void);
00340
00341
00342
00343
00344
00345
00346 #define PG_FUNCTION_INFO_V1(funcname) \
00347 extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \
00348 const Pg_finfo_record * \
00349 CppConcat(pg_finfo_,funcname) (void) \
00350 { \
00351 static const Pg_finfo_record my_finfo = { 1 }; \
00352 return &my_finfo; \
00353 } \
00354 extern int no_such_variable
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383 typedef struct
00384 {
00385 int len;
00386 int version;
00387 int funcmaxargs;
00388 int indexmaxkeys;
00389 int namedatalen;
00390 int float4byval;
00391 int float8byval;
00392 } Pg_magic_struct;
00393
00394
00395 #define PG_MODULE_MAGIC_DATA \
00396 { \
00397 sizeof(Pg_magic_struct), \
00398 PG_VERSION_NUM / 100, \
00399 FUNC_MAX_ARGS, \
00400 INDEX_MAX_KEYS, \
00401 NAMEDATALEN, \
00402 FLOAT4PASSBYVAL, \
00403 FLOAT8PASSBYVAL \
00404 }
00405
00406
00407
00408
00409
00410 typedef const Pg_magic_struct *(*PGModuleMagicFunction) (void);
00411
00412 #define PG_MAGIC_FUNCTION_NAME Pg_magic_func
00413 #define PG_MAGIC_FUNCTION_NAME_STRING "Pg_magic_func"
00414
00415 #define PG_MODULE_MAGIC \
00416 extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \
00417 const Pg_magic_struct * \
00418 PG_MAGIC_FUNCTION_NAME(void) \
00419 { \
00420 static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA; \
00421 return &Pg_magic_data; \
00422 } \
00423 extern int no_such_variable
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435 extern Datum DirectFunctionCall1Coll(PGFunction func, Oid collation,
00436 Datum arg1);
00437 extern Datum DirectFunctionCall2Coll(PGFunction func, Oid collation,
00438 Datum arg1, Datum arg2);
00439 extern Datum DirectFunctionCall3Coll(PGFunction func, Oid collation,
00440 Datum arg1, Datum arg2,
00441 Datum arg3);
00442 extern Datum DirectFunctionCall4Coll(PGFunction func, Oid collation,
00443 Datum arg1, Datum arg2,
00444 Datum arg3, Datum arg4);
00445 extern Datum DirectFunctionCall5Coll(PGFunction func, Oid collation,
00446 Datum arg1, Datum arg2,
00447 Datum arg3, Datum arg4, Datum arg5);
00448 extern Datum DirectFunctionCall6Coll(PGFunction func, Oid collation,
00449 Datum arg1, Datum arg2,
00450 Datum arg3, Datum arg4, Datum arg5,
00451 Datum arg6);
00452 extern Datum DirectFunctionCall7Coll(PGFunction func, Oid collation,
00453 Datum arg1, Datum arg2,
00454 Datum arg3, Datum arg4, Datum arg5,
00455 Datum arg6, Datum arg7);
00456 extern Datum DirectFunctionCall8Coll(PGFunction func, Oid collation,
00457 Datum arg1, Datum arg2,
00458 Datum arg3, Datum arg4, Datum arg5,
00459 Datum arg6, Datum arg7, Datum arg8);
00460 extern Datum DirectFunctionCall9Coll(PGFunction func, Oid collation,
00461 Datum arg1, Datum arg2,
00462 Datum arg3, Datum arg4, Datum arg5,
00463 Datum arg6, Datum arg7, Datum arg8,
00464 Datum arg9);
00465
00466
00467
00468
00469
00470 extern Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation,
00471 Datum arg1);
00472 extern Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation,
00473 Datum arg1, Datum arg2);
00474 extern Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation,
00475 Datum arg1, Datum arg2,
00476 Datum arg3);
00477 extern Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation,
00478 Datum arg1, Datum arg2,
00479 Datum arg3, Datum arg4);
00480 extern Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation,
00481 Datum arg1, Datum arg2,
00482 Datum arg3, Datum arg4, Datum arg5);
00483 extern Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation,
00484 Datum arg1, Datum arg2,
00485 Datum arg3, Datum arg4, Datum arg5,
00486 Datum arg6);
00487 extern Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation,
00488 Datum arg1, Datum arg2,
00489 Datum arg3, Datum arg4, Datum arg5,
00490 Datum arg6, Datum arg7);
00491 extern Datum FunctionCall8Coll(FmgrInfo *flinfo, Oid collation,
00492 Datum arg1, Datum arg2,
00493 Datum arg3, Datum arg4, Datum arg5,
00494 Datum arg6, Datum arg7, Datum arg8);
00495 extern Datum FunctionCall9Coll(FmgrInfo *flinfo, Oid collation,
00496 Datum arg1, Datum arg2,
00497 Datum arg3, Datum arg4, Datum arg5,
00498 Datum arg6, Datum arg7, Datum arg8,
00499 Datum arg9);
00500
00501
00502
00503
00504
00505
00506
00507 extern Datum OidFunctionCall0Coll(Oid functionId, Oid collation);
00508 extern Datum OidFunctionCall1Coll(Oid functionId, Oid collation,
00509 Datum arg1);
00510 extern Datum OidFunctionCall2Coll(Oid functionId, Oid collation,
00511 Datum arg1, Datum arg2);
00512 extern Datum OidFunctionCall3Coll(Oid functionId, Oid collation,
00513 Datum arg1, Datum arg2,
00514 Datum arg3);
00515 extern Datum OidFunctionCall4Coll(Oid functionId, Oid collation,
00516 Datum arg1, Datum arg2,
00517 Datum arg3, Datum arg4);
00518 extern Datum OidFunctionCall5Coll(Oid functionId, Oid collation,
00519 Datum arg1, Datum arg2,
00520 Datum arg3, Datum arg4, Datum arg5);
00521 extern Datum OidFunctionCall6Coll(Oid functionId, Oid collation,
00522 Datum arg1, Datum arg2,
00523 Datum arg3, Datum arg4, Datum arg5,
00524 Datum arg6);
00525 extern Datum OidFunctionCall7Coll(Oid functionId, Oid collation,
00526 Datum arg1, Datum arg2,
00527 Datum arg3, Datum arg4, Datum arg5,
00528 Datum arg6, Datum arg7);
00529 extern Datum OidFunctionCall8Coll(Oid functionId, Oid collation,
00530 Datum arg1, Datum arg2,
00531 Datum arg3, Datum arg4, Datum arg5,
00532 Datum arg6, Datum arg7, Datum arg8);
00533 extern Datum OidFunctionCall9Coll(Oid functionId, Oid collation,
00534 Datum arg1, Datum arg2,
00535 Datum arg3, Datum arg4, Datum arg5,
00536 Datum arg6, Datum arg7, Datum arg8,
00537 Datum arg9);
00538
00539
00540
00541
00542
00543 #define DirectFunctionCall1(func, arg1) \
00544 DirectFunctionCall1Coll(func, InvalidOid, arg1)
00545 #define DirectFunctionCall2(func, arg1, arg2) \
00546 DirectFunctionCall2Coll(func, InvalidOid, arg1, arg2)
00547 #define DirectFunctionCall3(func, arg1, arg2, arg3) \
00548 DirectFunctionCall3Coll(func, InvalidOid, arg1, arg2, arg3)
00549 #define DirectFunctionCall4(func, arg1, arg2, arg3, arg4) \
00550 DirectFunctionCall4Coll(func, InvalidOid, arg1, arg2, arg3, arg4)
00551 #define DirectFunctionCall5(func, arg1, arg2, arg3, arg4, arg5) \
00552 DirectFunctionCall5Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5)
00553 #define DirectFunctionCall6(func, arg1, arg2, arg3, arg4, arg5, arg6) \
00554 DirectFunctionCall6Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
00555 #define DirectFunctionCall7(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
00556 DirectFunctionCall7Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
00557 #define DirectFunctionCall8(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
00558 DirectFunctionCall8Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
00559 #define DirectFunctionCall9(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
00560 DirectFunctionCall9Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
00561 #define FunctionCall1(flinfo, arg1) \
00562 FunctionCall1Coll(flinfo, InvalidOid, arg1)
00563 #define FunctionCall2(flinfo, arg1, arg2) \
00564 FunctionCall2Coll(flinfo, InvalidOid, arg1, arg2)
00565 #define FunctionCall3(flinfo, arg1, arg2, arg3) \
00566 FunctionCall3Coll(flinfo, InvalidOid, arg1, arg2, arg3)
00567 #define FunctionCall4(flinfo, arg1, arg2, arg3, arg4) \
00568 FunctionCall4Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4)
00569 #define FunctionCall5(flinfo, arg1, arg2, arg3, arg4, arg5) \
00570 FunctionCall5Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5)
00571 #define FunctionCall6(flinfo, arg1, arg2, arg3, arg4, arg5, arg6) \
00572 FunctionCall6Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
00573 #define FunctionCall7(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
00574 FunctionCall7Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
00575 #define FunctionCall8(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
00576 FunctionCall8Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
00577 #define FunctionCall9(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
00578 FunctionCall9Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
00579 #define OidFunctionCall0(functionId) \
00580 OidFunctionCall0Coll(functionId, InvalidOid)
00581 #define OidFunctionCall1(functionId, arg1) \
00582 OidFunctionCall1Coll(functionId, InvalidOid, arg1)
00583 #define OidFunctionCall2(functionId, arg1, arg2) \
00584 OidFunctionCall2Coll(functionId, InvalidOid, arg1, arg2)
00585 #define OidFunctionCall3(functionId, arg1, arg2, arg3) \
00586 OidFunctionCall3Coll(functionId, InvalidOid, arg1, arg2, arg3)
00587 #define OidFunctionCall4(functionId, arg1, arg2, arg3, arg4) \
00588 OidFunctionCall4Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4)
00589 #define OidFunctionCall5(functionId, arg1, arg2, arg3, arg4, arg5) \
00590 OidFunctionCall5Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5)
00591 #define OidFunctionCall6(functionId, arg1, arg2, arg3, arg4, arg5, arg6) \
00592 OidFunctionCall6Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
00593 #define OidFunctionCall7(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
00594 OidFunctionCall7Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
00595 #define OidFunctionCall8(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
00596 OidFunctionCall8Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
00597 #define OidFunctionCall9(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
00598 OidFunctionCall9Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
00599
00600
00601
00602 extern Datum InputFunctionCall(FmgrInfo *flinfo, char *str,
00603 Oid typioparam, int32 typmod);
00604 extern Datum OidInputFunctionCall(Oid functionId, char *str,
00605 Oid typioparam, int32 typmod);
00606 extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val);
00607 extern char *OidOutputFunctionCall(Oid functionId, Datum val);
00608 extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf,
00609 Oid typioparam, int32 typmod);
00610 extern Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf,
00611 Oid typioparam, int32 typmod);
00612 extern bytea *SendFunctionCall(FmgrInfo *flinfo, Datum val);
00613 extern bytea *OidSendFunctionCall(Oid functionId, Datum val);
00614
00615
00616
00617
00618
00619 extern const Pg_finfo_record *fetch_finfo_record(void *filehandle, char *funcname);
00620 extern void clear_external_function_hash(void *filehandle);
00621 extern Oid fmgr_internal_function(const char *proname);
00622 extern Oid get_fn_expr_rettype(FmgrInfo *flinfo);
00623 extern Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum);
00624 extern Oid get_call_expr_argtype(fmNodePtr expr, int argnum);
00625 extern bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum);
00626 extern bool get_call_expr_arg_stable(fmNodePtr expr, int argnum);
00627 extern bool get_fn_expr_variadic(FmgrInfo *flinfo);
00628
00629
00630
00631
00632 extern char *Dynamic_library_path;
00633
00634 extern PGFunction load_external_function(char *filename, char *funcname,
00635 bool signalNotFound, void **filehandle);
00636 extern PGFunction lookup_external_function(void *filehandle, char *funcname);
00637 extern void load_file(const char *filename, bool restricted);
00638 extern void **find_rendezvous_variable(const char *varName);
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648 #define AGG_CONTEXT_AGGREGATE 1
00649 #define AGG_CONTEXT_WINDOW 2
00650
00651 extern int AggCheckCallContext(FunctionCallInfo fcinfo,
00652 MemoryContext *aggcontext);
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663 typedef enum FmgrHookEventType
00664 {
00665 FHET_START,
00666 FHET_END,
00667 FHET_ABORT
00668 } FmgrHookEventType;
00669
00670 typedef bool (*needs_fmgr_hook_type) (Oid fn_oid);
00671
00672 typedef void (*fmgr_hook_type) (FmgrHookEventType event,
00673 FmgrInfo *flinfo, Datum *arg);
00674
00675 extern PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook;
00676 extern PGDLLIMPORT fmgr_hook_type fmgr_hook;
00677
00678 #define FmgrHookIsNeeded(fn_oid) \
00679 (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid))
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694 extern char *fmgr(Oid procedureId,...);
00695
00696 #endif