pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feednumeric when compared to literal
2+ messages / 2 participants
[nested] [flat]
* numeric when compared to literal
@ 2003-02-03 12:45 Vicente Alabau Gonzalvo <vicente.alabau-gonzalvo@cgey.com>
2003-02-06 20:29 ` Re: numeric when compared to literal Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Vicente Alabau Gonzalvo @ 2003-02-03 12:45 UTC (permalink / raw)
To: 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)
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: numeric when compared to literal
2003-02-03 12:45 numeric when compared to literal Vicente Alabau Gonzalvo <vicente.alabau-gonzalvo@cgey.com>
@ 2003-02-06 20:29 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2003-02-06 20:29 UTC (permalink / raw)
To: Vicente Alabau Gonzalvo <vicente.alabau-gonzalvo@cgey.com>; +Cc: pgsql-sql
Vicente Alabau Gonzalvo <vicente.alabau-gonzalvo@cgey.com> writes:
> db=> select * from tipos where _numeric_ <= 2147483648;
> ERROR: Unable to identify an operator '<=' for types 'numeric' and
> 'double precision'
7.3 is more forgiving about this (although there's no free lunch ---
some other cases are now less forgiving).
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-02-06 20:29 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-03 12:45 numeric when compared to literal Vicente Alabau Gonzalvo <vicente.alabau-gonzalvo@cgey.com>
2003-02-06 20:29 ` Tom Lane <tgl@sss.pgh.pa.us>
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