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

From Bruce Momjian
Subject Re: understanding Datum -> char * -> Datum conversions
Date
Msg-id 200005251342.JAA17089@candle.pha.pa.us
Whole thread Raw
In response to Re: understanding Datum -> char * -> Datum conversions  (Louis-David Mitterrand <cunctator@apartia.ch>)
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.

That was my fault.  I told you on IRC that float(float8) was float32,
and that float4 was float16.  In fact float(float8) is float64, and
float4 is float32.

--  Bruce Momjian                        |  http://www.op.net/~candle pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: "Matthias Urlichs"
Date:
Subject: Re: Berkeley DB...
Next
From: "Mikheev, Vadim"
Date:
Subject: RE: More Performance