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

Re: Problem with java infinity mapping to postgres real column type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Johan Miller" <johanmiller(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problem with java infinity mapping to postgres real column type
Date: 2008-07-16 14:08:03
Message-ID: 7489.1216217283@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-jdbc
"Johan Miller" <johanmiller(at)gmail(dot)com> writes:
> I have found that when trying to insert a Java Float.POSITIVE_INFINITY or
> its negative counterpart into a database column with data type real using a
> jdbc driver 8.1-406 or 8.2-504 postgres will throw an overflow error.
> Since both Java and Postgres real data type support infinity then this seems
> very strange.

It sounds like "infinity" is getting translated to "some large number"
rather than the correct "Infinity" or "-Infinity" symbol.  The latter
two should work on IEEE-compliant platforms, but you might want to check
manually:

regression=# select 'infinity'::float4;
  float4  
----------
 Infinity
(1 row)

regression=# select '-infinity'::float4;
  float4   
-----------
 -Infinity
(1 row)

			regards, tom lane

In response to

Responses

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2008-07-17 03:52:19
Subject: Re: Problem with java infinity mapping to postgres real column type
Previous:From: Pushker ChaubeyDate: 2008-07-16 08:36:16
Subject: Re: Transaction handling through java

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