]> granicus.if.org Git - postgresql/commitdiff
/contrib/btree_gist adjustments for new 'day' interval value.
authorBruce Momjian <bruce@momjian.us>
Wed, 20 Jul 2005 18:17:39 +0000 (18:17 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 20 Jul 2005 18:17:39 +0000 (18:17 +0000)
contrib/btree_gist/btree_interval.c
contrib/btree_gist/btree_time.c

index 206b4c9488ac28a1fc9bd85fca556b3ad62799a9..d3aa4939a38d014bbfa3b3b26a87551357b82201 100644 (file)
@@ -89,7 +89,7 @@ intr2num(const Interval *i)
        return (ret);
 }
 
-#define INTERVALSIZE 12
+#define INTERVALSIZE 16
 
 static const gbtree_ninfo tinfo =
 {
index 491d05b631f0fb164f71c37161c907392110776c..9dc3250cf1c09f62d9e6038c7739e665af8a0c63 100644 (file)
@@ -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));
        }