X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 827A7475EE2 for ; Tue, 13 May 2003 17:01:37 -0400 (EDT) Received: from randalls-laptop.kicks-ass.net (h00062577286a.ne.client2.attbi.com [24.61.43.102]) by postgresql.org (Postfix) with ESMTP id ACADF475AA9 for ; Tue, 13 May 2003 17:01:36 -0400 (EDT) Received: from tercent.net (localhost [127.0.0.1]) by randalls-laptop.kicks-ass.net (8.12.9/8.12.6) with ESMTP id h4DL1Zfd017848 for ; Tue, 13 May 2003 17:01:36 -0400 (EDT) Date: Tue, 13 May 2003 17:01:34 -0400 Subject: Testing castability of text to numeric Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) From: Randall Lucas To: pgsql-sql@postgresql.org Content-Transfer-Encoding: 7bit In-Reply-To: <312680000.1052857873@lerlaptop.iadfw.net> Message-Id: <14ACA3C2-8586-11D7-8D9A-000A957653D6@tercent.net> X-Mailer: Apple Mail (2.552) X-Spam-Status: No, hits=-12.1 required=5.0 tests=BAYES_10,IN_REP_TO,USER_AGENT_APPLEMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/250 X-Sequence-Number: 13415 Hi All, I am trying to create a function that will test if a given text value may safely be cast to numeric, returning the numeric cast or null if impossible. Is there a way to "catch" the "ERROR: Bad numeric input format" error? I ask that rather than about what the numeric format is for regex-style testing because if this works I may want to use a similar method to check if a given text value casts safely to other types, like date. Best, Randall