Skip to content

Commit a45f4c2

Browse files
committed
/contrib/btree_gist adjustments for new 'day' interval value.
1 parent ddc038c commit a45f4c2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

contrib/btree_gist/btree_interval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ intr2num(const Interval *i)
8989
return (ret);
9090
}
9191

92-
#define INTERVALSIZE 12
92+
#define INTERVALSIZE 16
9393

9494
static const gbtree_ninfo tinfo =
9595
{

contrib/btree_gist/btree_time.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
221221
P_TimeADTGetDatum(origentry->upper)));
222222

223223
/* see interval_larger */
224-
res = Max(intr->time + intr->month * (30 * 86400), 0);
224+
res = Max(intr->time + intr->day * 86400 + intr->month * (30 * 86400), 0);
225225

226226
intr = DatumGetIntervalP(DirectFunctionCall2(
227227
time_mi_time,
228228
P_TimeADTGetDatum(origentry->lower),
229229
P_TimeADTGetDatum(newentry->lower)));
230230

231231
/* see interval_larger */
232-
res += Max(intr->time + intr->month * (30 * 86400), 0);
232+
res += Max(intr->time + intr->day * 86400 + intr->month * (30 * 86400), 0);
233233

234234
*result = 0.0;
235235

@@ -240,7 +240,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
240240
P_TimeADTGetDatum(origentry->upper),
241241
P_TimeADTGetDatum(origentry->lower)));
242242
*result += FLT_MIN;
243-
*result += (float) (res / ((double) (res + intr->time + intr->month * (30 * 86400))));
243+
*result += (float) (res / ((double) (res + intr->time + intr->day * 86400 + intr->month * (30 * 86400))));
244244
*result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
245245
}
246246

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