> TypeCacheEntry *typcache;
> PG_RETURN_RANGE_P(range_serialize(typcache, &lower, &upper, false));
The use of typcache really confuses me. range_get_typcache() is used in order to initialize typcache
> typcache =range_get_typcache(fcinfo, RangeTypeGetOid(r1));
In my case, I do not have a range as an argument, I am receiving 2 int, which I am using to create a range. How can I initialize typcache in this case?
That's the part where I am really stuck.
Datum
make_range_griis(PG_FUNCTION_ARGS){
RangeBound lower;
RangeBound upper;
int32 start = PG_GETARG_INT32(0);
int32 finish = PG_GETARG_INT32(1);
lower.val = (Datum) (start);
lower.infinite = false;
lower.lower = true;
upper.val = (Datum) (finish);
upper.infinite = false;
upper.lower = false;
if (!lower.infinite && !lower.inclusive){
lower.val = DirectFunctionCall2(int4pl, lower.val, Int32GetDatum(1));
lower.inclusive = true;
}
if (!upper.infinite && upper.inclusive){
upper.val = DirectFunctionCall2(int4pl, upper.val, Int32GetDatum(1));
upper.inclusive = false;
}
TypeCacheEntry *typcache;
//> typcache = ??????;
PG_RETURN_RANGE_P(range_serialize(typcache, &lower, &upper, false));
}
regards,
Andjasubu Bungama, Patrick