mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
tskey_cmp() should use timestamp_cmp() instead of doing its own
interval arithmetic. From Teodor Sigaev.
This commit is contained in:
parent
839c7924ec
commit
07f6c02eac
@ -447,21 +447,13 @@ gts_binary_union(Datum *r1, char *r2)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
tskey_cmp(const void *a, const void *b) {
|
tskey_cmp(const void *a, const void *b) {
|
||||||
Interval *intr;
|
return DatumGetInt32(
|
||||||
float result;
|
DirectFunctionCall2(
|
||||||
|
timestamp_cmp,
|
||||||
intr = DatumGetIntervalP( DirectFunctionCall2(
|
|
||||||
timestamp_mi,
|
|
||||||
TimestampGetDatum( ((TSKEY*)(((RIX*)a)->r))->lower ),
|
TimestampGetDatum( ((TSKEY*)(((RIX*)a)->r))->lower ),
|
||||||
TimestampGetDatum( ((TSKEY*)(((RIX*)b)->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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user