From a45f4c25335e46c12fbd01381e99b445fe0b2912 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 20 Jul 2005 18:17:39 +0000 Subject: /contrib/btree_gist adjustments for new 'day' interval value. --- contrib/btree_gist/btree_time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'contrib/btree_gist/btree_time.c') diff --git a/contrib/btree_gist/btree_time.c b/contrib/btree_gist/btree_time.c index 491d05b631f..9dc3250cf1c 100644 --- a/contrib/btree_gist/btree_time.c +++ b/contrib/btree_gist/btree_time.c @@ -221,7 +221,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS) P_TimeADTGetDatum(origentry->upper))); /* see interval_larger */ - res = Max(intr->time + intr->month * (30 * 86400), 0); + res = Max(intr->time + intr->day * 86400 + intr->month * (30 * 86400), 0); intr = DatumGetIntervalP(DirectFunctionCall2( time_mi_time, @@ -229,7 +229,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS) P_TimeADTGetDatum(newentry->lower))); /* see interval_larger */ - res += Max(intr->time + intr->month * (30 * 86400), 0); + res += Max(intr->time + intr->day * 86400 + intr->month * (30 * 86400), 0); *result = 0.0; @@ -240,7 +240,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS) P_TimeADTGetDatum(origentry->upper), P_TimeADTGetDatum(origentry->lower))); *result += FLT_MIN; - *result += (float) (res / ((double) (res + intr->time + intr->month * (30 * 86400)))); + *result += (float) (res / ((double) (res + intr->time + intr->day * 86400 + intr->month * (30 * 86400)))); *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1)); } -- cgit v1.2.3