Re: error: operator does not exist: bigint = character varying

From: Edoardo Panfili <edoardo(at)aspix(dot)it>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: error: operator does not exist: bigint = character varying
Date: 2007-06-28 08:53:25
Message-ID: 46837705.5030008@aspix.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Tom Lane ha scritto:
> Edoardo Panfili <edoardo(at)aspix(dot)it> writes:
>> Now my application raises this exception (all was ok with 8.2):
>> org.postgresql.util.PSQLException: ERROR: operator does not exist:
>> bigint = character varying
>
>> this is my code fragment
>> ----------------------------------------------------------------------
>> PreparedStatement ps = connessione.prepareStatement("SELECT
>> strato.idplot, strato.idstrato, strato.nome, strato.copertura,
>> strato.altezza, strato.note FROM plot WHERE idplot=?");
>> ps.setString(1, rilievo.dato[Rilievo.ID]);
>> ----------------------------------------------------------------------
>> the type of idplot is
>> "idplot integer NOT NULL DEFAULT nextval('sequenza_plot'::regclass)"
>
> Better look again, because that error message says that the lefthand
> input is bigint not integer. Are you looking at the right table?
Only partially, there are other query that must be cleaned in my code,
(it seems that postgres does more type checking in every new version, a
good thing).

> In any case you should not be using setString() for an integer query
> parameter. This would have worked in 8.2 only for rather small values
> of "work" --- you would have gotten a textual not a numeric comparison,
> which among other things would have defeated the use of any index on the
> idplot column.
All goes well now,
thank you (also to Oliver).

Edoardo
--
Jabber: edoardopa(at)talk(dot)google(dot)com
tel: 075 9142766

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Goodenough 2007-06-28 09:58:17 setObject type for Interval objects
Previous Message Tom Lane 2007-06-28 04:47:08 Re: error: operator does not exist: bigint = character varying