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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: error: operator does not exist: bigint = character varying
Дата
Msg-id 20532.1183006028@sss.pgh.pa.us
обсуждение исходный текст
Ответ на error: operator does not exist: bigint = character varying  (Edoardo Panfili <edoardo@aspix.it>)
Ответы Re: error: operator does not exist: bigint = character varying
Список pgsql-jdbc
Edoardo Panfili <edoardo@aspix.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?

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.

            regards, tom lane

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: error: operator does not exist: bigint = character varying
Следующее
От: "Bojan Skaljac"
Дата:
Сообщение: New update for Serbian translation