Skip site navigation (1) Skip section navigation (2)

Re: float8 auto truncation issue in ODBC v. PGSQL

From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: postgresql(dot)org(at)tgice(dot)com
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: float8 auto truncation issue in ODBC v. PGSQL
Date: 2006-06-13 23:51:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
postgresql(dot)org(at)tgice(dot)com wrote:
> Not sure if the ODBC list is the best place for this question, but I've 
> encountered some strange behavior and was wondering if anyone had an 
> idea as to what's going on.
> I've got a float8 data type in a column.  I have a value '1.0475' 
> inserted into it.  That number cannot of course be perfectly represented 
> as a float8.
> When I perform a test like this in MSSQL 7, e.g., and select it using 
> any variety of tools I get this out:
>   1.0475000000000001
> When I use my own ODBC SQL client to select the same value from my 
> Postgres 8.0 database, I get the same thing:
>   1.0475000000000001
> *However*, and here's the troubling part, when I select the exact same 
> value using psql (and I have reason to believe the same thing is going 
> on inside pl/pgsql functions), the value that comes out is:
>   1.0475
> Now, some of you may say, "What's your problem?  That's actually the 
> correct value!"  That's true, it is.  However, I'm confused as to the 
> differences between the result I get *from* PG via my ODBC client and 
> what Postgres shows with it's internal tools.

The odbc driver automatically issues *set extra_float_digits to 2*
  command at the beginning.

Hiroshi Inoue

In response to

pgsql-odbc by date

Next:From: Tom LaneDate: 2006-06-14 02:19:15
Subject: Re: adding psqlodbc driver in ODBCconfig
Previous:From: ricarddDate: 2006-06-13 21:32:10
Subject: Re: adding psqlodbc driver in ODBCconfig

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group