Re: [HACKERS] Followup on the UnixWare Optimizer bug. - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: [HACKERS] Followup on the UnixWare Optimizer bug. |
Date | |
Msg-id | 200508250130.j7P1Ubk02017@candle.pha.pa.us Whole thread Raw |
Responses |
Re: [HACKERS] Followup on the UnixWare Optimizer bug.
|
List | pgsql-patches |
Larry Rosenman wrote: > The following is from my SCO Internal contact about the bug. It's > definitely their bug. Towards the end of the > Exact diagnosis, is a suggested work-around for now, as well as a (possible) > memory leak. ... > Also note that there appears to be a memory leak in the interval_**** > routines. For example interval_div() allocates a "result" Interval. > It eventually passes this result through to interval_justify_hours() which > allocates another Interval "result" and that "result" is what gets passed > back to caller on interval_div(). The 1st Interval allocated appears to be > left around....... Good catch on the memory leak. I have applied the following fix. Thanks to SCO for the report. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: doc/src/sgml/func.sgml =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v retrieving revision 1.282 diff -c -c -r1.282 func.sgml *** doc/src/sgml/func.sgml 24 Aug 2005 20:49:35 -0000 1.282 --- doc/src/sgml/func.sgml 25 Aug 2005 01:26:36 -0000 *************** *** 5189,5194 **** --- 5189,5200 ---- </table> <para> + If you are using both <function>justify_hours</> and <function>justify_days</>, + it is best to use <function>justify_hours</> first so any additional days will + justified by <function>justify_days</>. + </para> + + <para> In addition to these functions, the SQL <literal>OVERLAPS</> operator is supported: <synopsis> Index: src/backend/utils/adt/timestamp.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v retrieving revision 1.148 diff -c -c -r1.148 timestamp.c *** src/backend/utils/adt/timestamp.c 12 Aug 2005 18:23:54 -0000 1.148 --- src/backend/utils/adt/timestamp.c 25 Aug 2005 01:26:39 -0000 *************** *** 1892,1898 **** { Timestamp dt1 = PG_GETARG_TIMESTAMP(0); Timestamp dt2 = PG_GETARG_TIMESTAMP(1); ! Interval *result; result = (Interval *) palloc(sizeof(Interval)); --- 1892,1898 ---- { Timestamp dt1 = PG_GETARG_TIMESTAMP(0); Timestamp dt2 = PG_GETARG_TIMESTAMP(1); ! Interval *result, *result2; result = (Interval *) palloc(sizeof(Interval)); *************** *** 1914,1922 **** result->month = 0; result->day = 0; ! result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours, IntervalPGetDatum(result))); ! PG_RETURN_INTERVAL_P(result); } /* interval_justify_hours() --- 1914,1923 ---- result->month = 0; result->day = 0; ! result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours, IntervalPGetDatum(result))); ! pfree(result); ! PG_RETURN_INTERVAL_P(result2); } /* interval_justify_hours() *************** *** 2263,2269 **** Interval *span = PG_GETARG_INTERVAL_P(0); float8 factor = PG_GETARG_FLOAT8(1); double month_remainder, day_remainder; ! Interval *result; result = (Interval *) palloc(sizeof(Interval)); --- 2264,2270 ---- Interval *span = PG_GETARG_INTERVAL_P(0); float8 factor = PG_GETARG_FLOAT8(1); double month_remainder, day_remainder; ! Interval *result, *result2; result = (Interval *) palloc(sizeof(Interval)); *************** *** 2289,2297 **** day_remainder * SECS_PER_DAY); #endif ! result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours, IntervalPGetDatum(result))); ! PG_RETURN_INTERVAL_P(result); } Datum --- 2290,2299 ---- day_remainder * SECS_PER_DAY); #endif ! result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours, IntervalPGetDatum(result))); ! pfree(result); ! PG_RETURN_INTERVAL_P(result2); } Datum *************** *** 2310,2316 **** Interval *span = PG_GETARG_INTERVAL_P(0); float8 factor = PG_GETARG_FLOAT8(1); double month_remainder, day_remainder; ! Interval *result; result = (Interval *) palloc(sizeof(Interval)); --- 2312,2318 ---- Interval *span = PG_GETARG_INTERVAL_P(0); float8 factor = PG_GETARG_FLOAT8(1); double month_remainder, day_remainder; ! Interval *result, *result2; result = (Interval *) palloc(sizeof(Interval)); *************** *** 2341,2349 **** result->time = JROUND(result->time); #endif ! result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours, IntervalPGetDatum(result))); ! PG_RETURN_INTERVAL_P(result); } /* --- 2343,2352 ---- result->time = JROUND(result->time); #endif ! result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours, IntervalPGetDatum(result))); ! pfree(result); ! PG_RETURN_INTERVAL_P(result2); } /*
pgsql-patches by date: