Bug #845: JDBC driver have a problem with floating-point numbers - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #845: JDBC driver have a problem with floating-point numbers
Date
Msg-id 20021211112531.A8F1E475B8F@postgresql.org
Whole thread Raw
List pgsql-bugs
Maxim A. Karavaev (Maxim.Karavaev@arete.de) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
JDBC driver have a problem with floating-point numbers

Long Description
I found a problem for defining a floating-point numbers in PreparedStatement class. I use a method setBigDecimal() and
itchange a type of SQL parameter value in dependence with the argument value. 

For example:
I create a table with a numeric attribute type.
   CREATE TABLE test (name varchar(63), test_num numeric(16,3));
Prepare a statement like:
   PreparedStatement ps=con.prepareStatement("SELECT * FROM test WHERE test_num > ?");
Next the two test with a different results:
1. ps.setBigDecimal(1, new BigDecimal("1"); - passed
2. ps.setBigDecimal(1, new BigDecimal("1.0"); - failed with an exception: "ERROR:  Unable to identify an operator '>'
fortypes 'numeric' and 'double precision' You will have to retype this query using an explicit cast"! 

I use JDBC drivers version 7.2. The same result with the version 7.3.
I try the same test for oracle database and without any problem.

Please, can you help me? What I have made incorrectly?

Sample Code


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug #844: initdb fails on an ext2/3 fs mounted on /var/lib/pgsql/data
Next
From: Stéphane Aubry
Date:
Subject: bug jdbc 7.2 ?