Thread: Bug #845: JDBC driver have a problem with floating-point numbers

Bug #845: JDBC driver have a problem with floating-point numbers

From
pgsql-bugs@postgresql.org
Date:
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