From: | Louis-David Mitterrand <cunctator(at)apartia(dot)ch> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | pfree() after palloc() in trigger (was: Re: understanding Datum -> char * -> Datum conversions) |
Date: | 2000-05-25 12:40:07 |
Message-ID: | 20000525144007.A11821@styx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)apartia(dot)org - http://www.apartia.fr
I don't build computers, I'm a cooling engineer.
-- Seymour Cray, founder of Cray Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Bitmead | 2000-05-25 13:06:37 | gram.y PROBLEM with UNDER |
Previous Message | Louis-David Mitterrand | 2000-05-25 11:25:19 | Re: understanding Datum -> char * -> Datum conversions |