static void gts_binary_union(Datum *r1, char *r2);
static int tskey_cmp(const void *a, const void *b);
+#define TimestampGetDatumFast(X) Float8GetDatumFast(X)
+
/* define for comparison */
#define TSGE( ts1, ts2 ) (DatumGetBool(DirectFunctionCall2( \
timestamp_ge, \
if (entry->leafkey)
{
TSKEY *r = (TSKEY *) palloc(sizeof(TSKEY));
-
retval = palloc(sizeof(GISTENTRY));
- if (entry->key)
- {
- r->lower = r->upper = *(Timestamp *) (entry->key);
-
- gistentryinit(*retval, PointerGetDatum(r),
- entry->rel, entry->page,
- entry->offset, sizeof(TSKEY), FALSE);
-
- }
- else
- {
- gistentryinit(*retval, PointerGetDatum(NULL),
- entry->rel, entry->page,
- entry->offset, 0, FALSE);
- }
+ r->lower = r->upper = *(Timestamp *) (entry->key);
+ gistentryinit(*retval, PointerGetDatum(r),
+ entry->rel, entry->page,
+ entry->offset, sizeof(TSKEY), FALSE);
}
else
retval = entry;
intr = DatumGetIntervalP(DirectFunctionCall2(
timestamp_mi,
- TimestampGetDatum(newentry->upper),
- TimestampGetDatum(origentry->upper)));
+ TimestampGetDatumFast(newentry->upper),
+ TimestampGetDatumFast(origentry->upper)));
/* see interval_larger */
*result = Max(intr->time + intr->month * (30.0 * 86400), 0);
intr = DatumGetIntervalP(DirectFunctionCall2(
timestamp_mi,
- TimestampGetDatum(origentry->lower),
- TimestampGetDatum(newentry->lower)));
+ TimestampGetDatumFast(origentry->lower),
+ TimestampGetDatumFast(newentry->lower)));
/* see interval_larger */
*result += Max(intr->time + intr->month * (30.0 * 86400), 0);
return DatumGetInt32(
DirectFunctionCall2(
timestamp_cmp,
- TimestampGetDatum(((TSKEY *) (((RIX *) a)->r))->lower),
- TimestampGetDatum(((TSKEY *) (((RIX *) b)->r))->lower)
+ TimestampGetDatumFast(((TSKEY *) (((RIX *) a)->r))->lower),
+ TimestampGetDatumFast(((TSKEY *) (((RIX *) b)->r))->lower)
)
);
}