X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8C049D8667; Thu, 1 Sep 2005 19:16:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41411-01; Thu, 1 Sep 2005 22:16:36 +0000 (GMT) Received: from hub.org (hub.org [200.46.204.220]) by svr1.postgresql.org (Postfix) with ESMTP id 89E27D87EA; Thu, 1 Sep 2005 19:16:36 -0300 (ADT) Received: from localhost (av.hub.org [200.46.204.144]) by hub.org (Postfix) with ESMTP id ABB9B64BFB2; Thu, 1 Sep 2005 19:16:54 -0300 (ADT) Received: from hub.org ([200.46.204.220]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37835-08; Thu, 1 Sep 2005 22:16:33 +0000 (GMT) Received: from ganymede.hub.org (blk-222-82-85.eastlink.ca [24.222.82.85]) by hub.org (Postfix) with ESMTP id 3F29B64BA5B; Thu, 1 Sep 2005 19:16:50 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 439BE353B2; Thu, 1 Sep 2005 19:16:38 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 420BD34235; Thu, 1 Sep 2005 19:16:38 -0300 (ADT) Date: Thu, 1 Sep 2005 19:16:38 -0300 (ADT) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: Tom Lane Cc: Andrew Dunstan , "Marc G. Fournier" , pgsql-hackers@postgresql.org Subject: Re: ALTER TABLE ( smallinto -> boolean ) ... In-Reply-To: <6793.1125610242@sss.pgh.pa.us> Message-ID: <20050901191422.K1044@ganymede.hub.org> References: <20050829201253.X1044@ganymede.hub.org> <15013.1125359379@sss.pgh.pa.us> <20050901174341.N1044@ganymede.hub.org> <6399.1125608205@sss.pgh.pa.us> <4317713C.10808@dunslane.net> <6793.1125610242@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.037 required=5 tests=[AWL=-0.013, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200509/90 X-Sequence-Number: 72487 On Thu, 1 Sep 2005, Tom Lane wrote: > Andrew Dunstan writes: >> Tom Lane wrote: >>> Sure you can. Make a SQL or PLPGSQL function that does the conversion >>> you want and then create a cast using it. > >> That probably won't help him much with "values(0)": > > If I remember the context of the original request, it wasn't about that > anyway, but about dealing with an existing smallint column. Nope, actually, the original was to just convert an existing table from using smallint->boolean, but what I'm looking at with the CREATE CAST is to avoid reducing the # of changes that I have to make to the existing application, so being able to auto-cast 0->'f' on an INSERT/UPDATE would help wtih that ... The app still needs to be fixed, but this would allow for the initial change to be made a bit easier ... ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664