Re: Decimal values in

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Masterprojekt Naumann1 <mpws2013n1(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Decimal values in
Date: 2014-02-17 16:39:20
Message-ID: 32182.1392655160@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> Masterprojekt Naumann1 escribi:
>> inside execProcnode.c's ExecProcNode method we want to extract the value of
>> a tuple for a specific attribute. This works great for integers and
>> strings, but we are not able to figure out how to do this for floating
>> point numbers. Below is some example code snippet to show our problem:

> "DECIMAL_OID" (you probably mean NUMERICOID) points to datatype numeric,
> which is not floating point but a variable length datatype with its own
> special encoding for storage. If you want floating point you need
> FLOAT4OID and FLOAT8OID, and columns created with types float and
> "double precision", respectively.

Also, you should not be using casts, but the appropriate DatumGetXXX
macro. In some cases those reduce to a cast, but your code ought not
assume that.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-02-17 16:46:12 Re: Do you know the reason for increased max latency due to xlog scaling?
Previous Message MauMau 2014-02-17 16:35:52 Re: Do you know the reason for increased max latency due to xlog scaling?