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

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #845: JDBC driver have a problem with floating-point numbers
Date: 2002-12-11 11:25:31
Message-ID: 20021211112531.A8F1E475B8F@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Maxim A. Karavaev (Maxim(dot)Karavaev(at)arete(dot)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 it change 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 '>' for types '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

Browse pgsql-bugs by date

  From Date Subject
Next Message Juliano Niederauer 2002-12-11 12:41:40 PostgreSQL Bug?
Previous Message Tom Lane 2002-12-11 05:46:30 Re: Bug #844: initdb fails on an ext2/3 fs mounted on /var/lib/pgsql/data