pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabios@logi-track.com>
To: Antony Paul <antonypaul24@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ERROR: column "total_cost" is of type numeric but expression
Date: Fri, 11 Feb 2005 12:02:41 +0100
Message-ID: <420C90D1.1000405@logi-track.com> (raw)
In-Reply-To: <2989532e050211024126b599f9@mail.gmail.com>
References: <2989532e050211024126b599f9@mail.gmail.com>

Hi, Antony,

Antony Paul schrieb:

>     I am testing PostgreSQL 8.0.1. I compiled and installed it.
> Downloaded JDBC driver postgresql-8.0-310.jdbc3.jar for JDK 1.4.(I was
> unable to find it in source) Dumped my 7.3.3 database. Restored it in
> new installation. Run the application and it gives this error.
>     The error is when I use setString() to insert into a numeric
> field. I hope it is bug. Otherwise we have to rewrite our application.
>     The error message can be seen in server log also.

Using setString() to insert anything else from text types is not
possible any more using pgjdbc 8.0 jars, as the new driver makes
stricter use of type checking. One of our third-party apps also suffers
from this problems.

I can three solutions / workarounds for your problem:

- Use the pgjdbc 7.4 jar file, it should work fine against a postgresql
8.0 server. You can also stay with the 7.3 jar you used against your
7.3.3 server, as AFAIK pg8.0 still supports the V2 query protocol.

- Use a "?::numeric" cast in your prepared statement (not tested here).

- Update your application to use the proper numeric types.

Markus

--
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios@logi-track.com | www.logi-track.com

Attachments:

  signature.asc (application/pgp-signature, 255B) download

view thread (6+ messages)  latest in thread

Message-ID: <420C90D1.1000405@logi-track.com>
Permalink:  ../420C90D1.1000405@logi-track.com/
Also on:    postgresql.org/message-id/420C90D1.1000405@logi-track.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: schabios@logi-track.com, antonypaul24@gmail.com
  Subject: Re: ERROR: column "total_cost" is of type numeric but expression
  In-Reply-To: <420C90D1.1000405@logi-track.com>
  References: <2989532e050211024126b599f9@mail.gmail.com> <420C90D1.1000405@logi-track.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox