Skip to content

Commit 07f6c02

Browse files
committed
tskey_cmp() should use timestamp_cmp() instead of doing its own
interval arithmetic. From Teodor Sigaev.
1 parent 839c792 commit 07f6c02

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

contrib/btree_gist/btree_gist.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -447,21 +447,13 @@ gts_binary_union(Datum *r1, char *r2)
447447

448448
static int
449449
tskey_cmp(const void *a, const void *b) {
450-
Interval *intr;
451-
float result;
452-
453-
intr = DatumGetIntervalP( DirectFunctionCall2(
454-
timestamp_mi,
455-
TimestampGetDatum( ((TSKEY*)(((RIX*)a)->r))->lower ),
456-
TimestampGetDatum( ((TSKEY*)(((RIX*)b)->r))->lower )) );
457-
458-
/* see interval_larger */
459-
result = intr->time+intr->month * (30.0 * 86400);
460-
pfree( intr );
461-
if ( result == 0.0 )
462-
return 0;
463-
else
464-
return ( result>0 ) ? 1 : 0;
450+
return DatumGetInt32(
451+
DirectFunctionCall2(
452+
timestamp_cmp,
453+
TimestampGetDatum( ((TSKEY*)(((RIX*)a)->r))->lower ),
454+
TimestampGetDatum( ((TSKEY*)(((RIX*)b)->r))->lower )
455+
)
456+
);
465457
}
466458

467459
/**************************************************

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy