1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-08 06:02:22 +03:00

Fix memory leak for timestamp(with and w/o tz) and time indexes

This commit is contained in:
Teodor Sigaev
2005-02-21 10:47:52 +00:00
parent 14fd629aea
commit f49d69b813
2 changed files with 21 additions and 17 deletions

View File

@@ -29,6 +29,8 @@ Datum gbt_ts_penalty(PG_FUNCTION_ARGS);
Datum gbt_ts_same(PG_FUNCTION_ARGS);
#define P_TimestampGetDatum(x) PointerGetDatum( &(x) )
static bool
gbt_tsgt(const void *a, const void *b)
{
@@ -231,8 +233,8 @@ gbt_ts_penalty(PG_FUNCTION_ARGS)
intr = DatumGetIntervalP(DirectFunctionCall2(
timestamp_mi,
TimestampGetDatum(newentry->upper),
TimestampGetDatum(origentry->upper)
P_TimestampGetDatum(newentry->upper),
P_TimestampGetDatum(origentry->upper)
));
/* see interval_larger */
@@ -242,8 +244,8 @@ gbt_ts_penalty(PG_FUNCTION_ARGS)
intr = DatumGetIntervalP(DirectFunctionCall2(
timestamp_mi,
TimestampGetDatum(origentry->lower),
TimestampGetDatum(newentry->lower)
P_TimestampGetDatum(origentry->lower),
P_TimestampGetDatum(newentry->lower)
));
/* see interval_larger */
@@ -256,8 +258,8 @@ gbt_ts_penalty(PG_FUNCTION_ARGS)
{
intr = DatumGetIntervalP(DirectFunctionCall2(
timestamp_mi,
TimestampGetDatum(origentry->upper),
TimestampGetDatum(origentry->lower)
P_TimestampGetDatum(origentry->upper),
P_TimestampGetDatum(origentry->lower)
));
*result += FLT_MIN;
*result += (float) (res / ((double) (res + intr->time + intr->month * (30 * 86400))));