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

Re: JDBC driver doesn't handle NaN values

From: Kris Jurka <books(at)ejurka(dot)com>
To: Jonathan Purvis <jon(at)reeltwo(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC driver doesn't handle NaN values
Date: 2004-01-09 09:30:12
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugspgsql-jdbc

On Fri, 9 Jan 2004, Jonathan Purvis wrote:

> The JDBC driver that ships with PostgreSQL 7.4.1 doesn't insert floats
> of value NaN.  As it uses Float.toString(x) to convert the value for
> insertion into the database, it tries to insert NaN instead of 'NaN' and
> gets the error "Attribute 'nan' not found".  The same bug occurs for
> doubles and will probably occur for infinite values as well (i haven't
> tested it).  This bug also exists in 7.2.4 and in the 7.2.1 version
> currently in Debian stable.

As you noted this is a problem with positive and negative infinity, but
there are some more problems as evidenced by the attached test case.

Double.MIN_VALUE will cause underflow.
Double.MAX_VALUE goes in alright, but comes out as POSITIVE_INFINITY

when trying Float.MAX_VALUE and MIN_VALUE on a real or float4 field they
overflow and underflow respectively.

Kris Jurka

Description: text/plain (1.5 KB)

In response to

pgsql-bugs by date

Next:From: Martin HolzDate: 2004-01-09 11:12:39
Subject: Re: jdbc1.AbstractJdbc1Statement.setBinaryStream bug and
Previous:From: Kris JurkaDate: 2004-01-09 08:46:04
Subject: Re: jdbc1.AbstractJdbc1Statement.setBinaryStream bug and

pgsql-jdbc by date

Next:From: Xavier BugaudDate: 2004-01-09 09:53:04
Subject: RE : Nmber of rows in a ResultSet
Previous:From: Antonio GallardoDate: 2004-01-09 09:17:53
Subject: Re: [BUG] - Invalid UNICODE character sequence found

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