Last active
October 5, 2018 00:45
-
-
Save anarazel/0bff313b1c8626005b2d0b67e85b03fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct NullableDatum | |
{ | |
Datum datum; | |
bool isnull; | |
/* FIXME: space for flags? */ | |
} NullableDatum; | |
typedef struct FunctionCallInfoDataVar | |
{ | |
FmgrInfo *flinfo; /* ptr to lookup info used for this call */ | |
fmNodePtr context; /* pass info about context of call */ | |
fmNodePtr resultinfo; /* pass or return extra info about result */ | |
Oid fncollation; /* collation for function to use */ | |
bool isnull; /* function must set true if result is NULL */ | |
short nargs; /* # arguments actually passed */ | |
NullableDatum args[FLEXIBLE_ARRAY_MEMBER]; | |
} FunctionCallInfoDataVar; | |
#define SizeForFunctionCallInfoData(nargs) (offsetof(FunctionCallInfoDataVar, args) + sizeof(NullableDatum) * (nargs)) | |
#define DirectFunctionCallVarColl(func, collation, ...) \ | |
DirectFunctionCallVarExec(func, collation, VA_ARGS_NARGS(__VA_ARGS__), \ | |
(&(\ | |
union { \ | |
struct FunctionCallInfoDataVar fcinfo; \ | |
char *fcinfo_data[SizeForFunctionCallInfoData(VA_ARGS_NARGS(__VA_ARGS__))]; \ | |
} \ | |
){.fcinfo = {\ | |
.flinfo = NULL, \ | |
.context = NULL, \ | |
.resultinfo = NULL, \ | |
.nargs = VA_ARGS_NARGS(__VA_ARGS__)}\ | |
}.fcinfo ), \ | |
(Datum[]){__VA_ARGS__}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment