pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: postgresql.org@tgice.com
To: pgsql-odbc@postgresql.org
Subject: float8 auto truncation issue in ODBC v. PGSQL
Date: Tue, 13 Jun 2006 14:28:34 -0500
Message-ID: <448F11E2.1020504@tgice.com> (raw)

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 reason this came up is, for some uninteresting reason, I really need 
to see the former value (w/ the trailing 1) inside Postgres (a pl/pgsql 
function) when making a computation.

I'd appreciate any insight, and apologize if I missed something obvious 
in the docs or via my googling.

John



view thread (7+ messages)  latest in thread

Message-ID: <448F11E2.1020504@tgice.com>
Permalink:  ../448F11E2.1020504@tgice.com/
Also on:    postgresql.org/message-id/448F11E2.1020504@tgice.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: postgresql.org@tgice.com
  Subject: Re: float8 auto truncation issue in ODBC v. PGSQL
  In-Reply-To: <448F11E2.1020504@tgice.com>
  References: <448F11E2.1020504@tgice.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox