pfree() after palloc() in trigger (was: Re: understanding Datum -> char * -> Datum conversions)
От | Louis-David Mitterrand |
---|---|
Тема | pfree() after palloc() in trigger (was: Re: understanding Datum -> char * -> Datum conversions) |
Дата | |
Msg-id | 20000525144007.A11821@styx обсуждение исходный текст |
Ответ на | Re: understanding Datum -> char * -> Datum conversions (Louis-David Mitterrand <cunctator@apartia.ch>) |
Ответы |
Re: pfree() after palloc() in trigger (was: Re: understanding Datum -> char * -> Datum conversions)
|
Список | pgsql-hackers |
On Thu, May 25, 2000 at 01:25:19PM +0200, Louis-David Mitterrand wrote: > On Thu, May 25, 2000 at 12:51:52PM +0200, Karel Zak wrote: > > > > float32 result = (float32) palloc(sizeof(float32data)); SHould I pfree(result) before the end of the trigger function? > > *result = 10.5; > > SPI_modifytuple(relation, tupdesc, &attnum, Float32GetDatum(result), > > NULL); Instead of : float64 result = (float64) palloc(sizeof(float64data));SPI_modifytuple(relation, tupdesc, &attnum,Float32GetDatum(result),NULL); Can I do double result = 10.5; /* for example */SPI_modifytuple(relation, tupdesc, &attnum,Float32GetDatum(&result),NULL); ^^^ ie: pass the address of (regular double) "result" instead of using a pointer; -- Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.fr I don't build computers, I'm a cooling engineer. -- Seymour Cray, founder of Cray Inc.
В списке pgsql-hackers по дате отправления: