X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 107A0475AE6 for ; Mon, 3 Feb 2003 07:47:04 -0500 (EST) Received: from door.cgey.com (rpapar1.cgey.com [194.3.224.25]) by postgresql.org (Postfix) with ESMTP id 46C49475A9E for ; Mon, 3 Feb 2003 07:47:01 -0500 (EST) Received: from pasteur2.capgemini.fr (capmail.capgemini.fr [10.67.1.90]) by door.cgey.com (8.12.1/8.11.3) with ESMTP id h13Cl37v013796 for ; Mon, 3 Feb 2003 13:47:04 +0100 (MET) Received: from pasteur.capgemini.fr (localhost [127.0.0.1]) by pasteur2.capgemini.fr (8.12.6/8.12.6) with ESMTP id h13CmeP1012523 for ; Mon, 3 Feb 2003 13:48:40 +0100 (MET) Received: from capgemini.es ([10.68.8.28]) by pasteur.capgemini.fr (8.12.6/8.12.6) with ESMTP id h13CmdGT012511 for ; Mon, 3 Feb 2003 13:48:40 +0100 (MET) Message-ID: <3E3E6483.3060208@capgemini.es> Date: Mon, 03 Feb 2003 13:45:55 +0100 From: Vicente Alabau Gonzalvo User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; ca; rv:1.2.1) Gecko/20021130 MultiZilla/v1.1.22 X-Accept-Language: ca-es MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: numeric when compared to literal Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/122 X-Sequence-Number: 11520 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)