From: Tom Lane Date: Thu, 23 Aug 2001 15:07:41 +0000 (+0000) Subject: tskey_cmp() should use timestamp_cmp() instead of doing its own X-Git-Tag: REL7_2_BETA1~637 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=07f6c02eac2d4606a13566fca455f88dcc545de6;p=postgresql tskey_cmp() should use timestamp_cmp() instead of doing its own interval arithmetic. From Teodor Sigaev. --- diff --git a/contrib/btree_gist/btree_gist.c b/contrib/btree_gist/btree_gist.c index 687610ebfc..999d199ff2 100644 --- a/contrib/btree_gist/btree_gist.c +++ b/contrib/btree_gist/btree_gist.c @@ -447,21 +447,13 @@ gts_binary_union(Datum *r1, char *r2) static int tskey_cmp(const void *a, const void *b) { - Interval *intr; - float result; - - intr = DatumGetIntervalP( DirectFunctionCall2( - timestamp_mi, - TimestampGetDatum( ((TSKEY*)(((RIX*)a)->r))->lower ), - TimestampGetDatum( ((TSKEY*)(((RIX*)b)->r))->lower )) ); - - /* see interval_larger */ - result = intr->time+intr->month * (30.0 * 86400); - pfree( intr ); - if ( result == 0.0 ) - return 0; - else - return ( result>0 ) ? 1 : 0; + return DatumGetInt32( + DirectFunctionCall2( + timestamp_cmp, + TimestampGetDatum( ((TSKEY*)(((RIX*)a)->r))->lower ), + TimestampGetDatum( ((TSKEY*)(((RIX*)b)->r))->lower ) + ) + ); } /**************************************************