Re: Matching types

From: Daniel Serodio <daniel(at)checkforte(dot)com(dot)br>
To: Vicente Alabau Gonzalvo <vicente(dot)alabau-gonzalvo(at)cgey(dot)com>
Cc: PostgreSQL JDBC List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Matching types
Date: 2003-02-06 19:45:16
Message-ID: 1044560716.837.52.camel@kelly.ckf
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I had the same problem. It's a backend problem, not JDBC related. If you
try to "select val2 from test where val1=123.45" in a table defined as
"create table test (val1 numeric, val2 int)" in psql or any other
frontend you will have the exact same problem.

I was told that this would be fixed in PostgreSQL 7.3, but I don't have
a 7.3 server to check if it was fixed or not.

Bottom line: use an explicit cast. That's how we solved it. BTW, you
need to use explicit casts anyway if you want the server to use indices.

Hope this helps,
Daniel Serodio

On Mon, 2003-02-03 at 06:01, Vicente Alabau Gonzalvo wrote:
> Does anybody know how to get BigDecimal from numeric and how to put
> BigDecimal to numeric using jdbc?
> The first thing seems to work automaticaly.
> BigDecimal seems to be converted into double precision when put in a
> query. Then it can't be compared with a numeric value.
>
> ERROR: Unable to identify an operator '=' for types 'numeric' and
> 'double precision'
> You will have to retype this query using an explicit cast
>
> Can it be done without doing an explicit cast?
>
> Thanks in advance.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
--
Daniel Serodio <daniel(at)checkforte(dot)com(dot)br>
CheckForte

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jim Rosenberg 2003-02-06 19:54:57 Re: moveToInsertRow SQL Exception "No Primary Keys"
Previous Message Kris Jurka 2003-02-06 18:47:49 Re: Obtaining precision and scale of NUMERIC types