Bug #775: Unable to identify an operator '=' for types 'numeric' and 'double precision'

Started by PostgreSQL Bugs Listover 23 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Daniel Serodio (daniel@checkforte.com.br) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Unable to identify an operator '=' for types 'numeric' and 'double precision'

Long Description
If I create a table with a 'numeric' column, and try to make a query using a "large" numeric literal, it complains about not finding the '=' operator for types 'numeric' and 'double precision'.

CREATE TABLE test_numeric (value numeric);
INSERT INTO test_numeric (value) VALUES (5000469541);
SELECT * FROM test_numeric WHERE value = 5000469541;
ERROR: Unable to identify an operator '=' for types 'numeric' and 'double precision'
You will have to retype this query using an explicit cast

The same happens with the '+' operator, for example.

UPDATE test_numeric SET value = value + 14524565363;
ERROR: Unable to identify an operator '+' for types 'numeric' and 'double precision'
You will have to retype this query using an explicit cast

Sample Code

No file was uploaded with this report

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #775: Unable to identify an operator '=' for types 'numeric' and 'double precision'

pgsql-bugs@postgresql.org writes:

Unable to identify an operator '=' for types 'numeric' and 'double precision'

At the moment you have to cast the literal to numeric (or cast the
column to float8, if you'd rather use float arithmetic, which I
imagine you wouldn't). The existing parser doesn't see any reason
to prefer either choice over the other, so it throws up its hands.

In 7.3 I expect this will behave the way you'd like.

regards, tom lane