pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vicente Alabau Gonzalvo <vicente.alabau-gonzalvo@cgey.com>
To: pgsql-sql@postgresql.org
Subject: numeric when compared to literal
Date: Mon, 03 Feb 2003 13:45:55 +0100
Message-ID: <3E3E6483.3060208@capgemini.es> (raw)

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)





view thread (2+ messages)  latest in thread

Message-ID: <3E3E6483.3060208@capgemini.es>
Permalink:  ../3E3E6483.3060208@capgemini.es/
Also on:    postgresql.org/message-id/3E3E6483.3060208@capgemini.es

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vicente.alabau-gonzalvo@cgey.com
  Subject: Re: numeric when compared to literal
  In-Reply-To: <3E3E6483.3060208@capgemini.es>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox