Re: understanding Datum -> char * -> Datum conversions - Mailing list pgsql-hackers

From Louis-David Mitterrand
Subject Re: understanding Datum -> char * -> Datum conversions
Date
Msg-id 20000525132519.A11355@styx
Whole thread Raw
In response to Re: understanding Datum -> char * -> Datum conversions  (Karel Zak <zakkr@zf.jcu.cz>)
Responses pfree() after palloc() in trigger (was: Re: understanding Datum -> char * -> Datum conversions)
Re: understanding Datum -> char * -> Datum conversions
List pgsql-hackers
On Thu, May 25, 2000 at 12:51:52PM +0200, Karel Zak wrote:
> > 
> > I'm reading these files but still got a problem:
> 
> 
>     float32  result = (float32) palloc(sizeof(float32data));
>      
>     *result = 10.5;
>     SPI_modifytuple(relation, tupdesc, &attnum, Float32GetDatum(result),
>                                 NULL);
>  Right?

Yes! It works now. My error was using a float32 instead of a float64, as
the internal type is really a float8. The confusion comes from defining
my tables with the type "float" which apparently defaults to float8.

Many thanks,

-- 
Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.fr

"2c98611832ea3f6f5fdda95d3704fbb8" (a truly random sig)


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: AW: Berkeley DB...
Next
From: Louis-David Mitterrand
Date:
Subject: pfree() after palloc() in trigger (was: Re: understanding Datum -> char * -> Datum conversions)