提交 a45f4c25 编写于 作者: B Bruce Momjian

/contrib/btree_gist adjustments for new 'day' interval value.

上级 ddc038ca
...@@ -89,7 +89,7 @@ intr2num(const Interval *i) ...@@ -89,7 +89,7 @@ intr2num(const Interval *i)
return (ret); return (ret);
} }
#define INTERVALSIZE 12 #define INTERVALSIZE 16
static const gbtree_ninfo tinfo = static const gbtree_ninfo tinfo =
{ {
......
...@@ -221,7 +221,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS) ...@@ -221,7 +221,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
P_TimeADTGetDatum(origentry->upper))); P_TimeADTGetDatum(origentry->upper)));
/* see interval_larger */ /* 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( intr = DatumGetIntervalP(DirectFunctionCall2(
time_mi_time, time_mi_time,
...@@ -229,7 +229,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS) ...@@ -229,7 +229,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
P_TimeADTGetDatum(newentry->lower))); P_TimeADTGetDatum(newentry->lower)));
/* see interval_larger */ /* 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; *result = 0.0;
...@@ -240,7 +240,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS) ...@@ -240,7 +240,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
P_TimeADTGetDatum(origentry->upper), P_TimeADTGetDatum(origentry->upper),
P_TimeADTGetDatum(origentry->lower))); P_TimeADTGetDatum(origentry->lower)));
*result += FLT_MIN; *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)); *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册