pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: DocSea - Patrice Delorme <pdelorme@docsea.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Bug : FAST_NUMBER_FAILED when getting NaN on BigDecimal
Date: Wed, 12 Sep 2012 11:00:03 +0200
Message-ID: <50504F13.2020607@docsea.com> (raw)
In-Reply-To: <504F0006020000250004A19B@gw.wicourts.gov>
References: <504F144C.20108@docsea.com>
	<504F0006020000250004A19B@gw.wicourts.gov>

Le 11/09/2012 16:10, Kevin Grittner a écrit :
> DocSea - Patrice Delorme <pdelorme@docsea.com> wrote:
>   
>> It is impossible to fetch data when numeric value in database is
>> NaN
>> It throws FAST_NUMBER_FAILED
>> (postgresql-jdbc-9.1-902:AbstractJdbc2ResultSet:2176) because my
>> value is not numeric (NaN).
>> This is incorect behaviour since 'NaN' is a legal value in
>> postgres for numeric type.
>   
> How do you expect what you read to be represented in Java?
>   
> -Kevin
>
>
Hi Kevin,

You are right, as a matter of Fact BigDecimal does not support NaN like 
Double, Float does.
However, postgres DOES support it and I find it disturbing that the 
driver fails so badly without explaination (I had to dig in the driver 
source to find out what the problem was).
The problem is that somehow I managed to write my Double NaN to database 
but wasn't able to read it back even though I was using the very same 
driver in both cases!
To me, behaviour is not coherent. Either wriiting of NaN is prevented or 
reading is functional !

Maybe a more explicit Exception like "numeric NaN values not supported" 
and not "org.postgresql.util.PSQLException: Bad value for type 
BigDecimal : NaN;" which is rather obscure
or to Extend BigDecimal with PgBigDecimal that supports NaN (and 
infinity)...

Best Regards,

P.





view thread (13+ messages)  latest in thread

Message-ID: <50504F13.2020607@docsea.com>
Permalink:  ../50504F13.2020607@docsea.com/
Also on:    postgresql.org/message-id/50504F13.2020607@docsea.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-jdbc@postgresql.org
  Cc: pdelorme@docsea.com, Kevin.Grittner@wicourts.gov
  Subject: Re: Bug : FAST_NUMBER_FAILED when getting NaN on BigDecimal
  In-Reply-To: <50504F13.2020607@docsea.com>
  References: <504F144C.20108@docsea.com> <504F0006020000250004A19B@gw.wicourts.gov> <50504F13.2020607@docsea.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