numeric when compared to literal

From: Vicente Alabau Gonzalvo <vicente(dot)alabau-gonzalvo(at)cgey(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: numeric when compared to literal
Date: 2003-02-03 12:45:55
Message-ID: 3E3E6483.3060208@capgemini.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

When a numeric is compared to a literal < 2^31 - 1 it works
well, but compared to a greater literal, it is casted to double
precision. Why? How can I correct this without explicit cast?

db=> \d tipos
Table "tipos"
Column | Type | Modifiers
-----------+---------+-----------
_numeric_ | numeric |
_decimal_ | numeric |

db=> select * from tipos where _numeric_ <= 2147483648;
ERROR: Unable to identify an operator '<=' for types 'numeric' and
'double precision'
You will have to retype this query using an explicit cast

db=> select * from tipos where _numeric_ <= 2147483647;
_numeric_ | _decimal_
-----------+-----------
10 | 20
(1 row)

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah. 2003-02-03 14:02:08 cannot EXPLAIN query...
Previous Message Vicente Alabau Gonzalvo 2003-02-03 12:08:21 Automatic casting