Re: Bug : FAST_NUMBER_FAILED when getting NaN on BigDecimal

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: DocSea - Patrice Delorme <pdelorme(at)docsea(dot)com>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug : FAST_NUMBER_FAILED when getting NaN on BigDecimal
Date: 2012-09-13 12:34:26
Message-ID: CADK3HH+vtxxsmdkCGWLEFceDfgTR5BwX6Do=WNETfRPhjdOsvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Patrice,

Can you provide a test case which exhibits this behaviour. Preferably
one which inserts the invalid data and can't read it back.

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

On Wed, Sep 12, 2012 at 5:00 AM, DocSea - Patrice Delorme
<pdelorme(at)docsea(dot)com> wrote:
> Le 11/09/2012 16:10, Kevin Grittner a écrit :
>
>> DocSea - Patrice Delorme <pdelorme(at)docsea(dot)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.
>
>
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Alexander Stanier 2012-09-13 12:47:22 Change in Log Format and Prepared Statements
Previous Message Luis Flores 2012-09-12 15:33:28 Re: Bug : FAST_NUMBER_FAILED when getting NaN on BigDecimal