Обсуждение: Unable to identify an operator '=' for types 'numeric' and 'float8'

Поиск
Список
Период
Сортировка

Unable to identify an operator '=' for types 'numeric' and 'float8'

От
Sridhar Bhamidi
Дата:
Hi
I am using PostgreSQL version 7.1.2
 and the problem that I am facing can be reproduced as below

create table numeric_tab (col1 numeric(20)) ;
CREATE
insert into numeric_tab values(123456789012345) ;
INSERT 222295 1
select col1 from numeric_tab where col1 = 123456789012345 ;
ERROR:  Unable to identify an operator '=' for types 'numeric' and 'float8'
    You will have to retype this query using an explicit cast

What I noticed is that if the value entered in the where clause is >
2147483647
(value of a signed int4) this error message is thrown.
This problem does not occur with a bigint type

create table bigint_tab(col1 bigint) ;
CREATE
insert into bigint_tab values (123456789012345) ;
INSERT 222306 1
select col1 from bigint_tab where col1 = 123456789012345 ;
      col1
-----------------
 123456789012345
(1 row)

My point is that if it works for a bigint type, then why not for a
numeric type.
I am currently using this as a workaround, but I would prefer a numeric
type.

This problem also occurs on the 7.2 version of postgres, only the
message is slightly
different

ERROR:  Unable to identify an operator '=' for types 'numeric' and
'double precision'
    You will have to retype this query using an explicit cast

I won't be able to cast the query because I am getting this as a
generated query
from an Application Server.

I have seen this problem on the archives of  Postgres, but could not
locate any
answer or a pointer on when this would be fixed.

Thanks
-Sridhar