X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BC5CFD890E for ; Thu, 1 Sep 2005 18:15:25 -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 22336-08 for ; Thu, 1 Sep 2005 21:15:23 +0000 (GMT) Received: from hub.org (hub.org [200.46.204.220]) by svr1.postgresql.org (Postfix) with ESMTP id E7BFED8908 for ; Thu, 1 Sep 2005 18:15:22 -0300 (ADT) Received: from localhost (av.hub.org [200.46.204.144]) by hub.org (Postfix) with ESMTP id 9B9C364BE0D for ; Thu, 1 Sep 2005 18:15:40 -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 26026-02; Thu, 1 Sep 2005 21:15:20 +0000 (GMT) Received: from ganymede.hub.org (blk-222-82-85.eastlink.ca [24.222.82.85]) by hub.org (Postfix) with ESMTP id 220B464BE0C; Thu, 1 Sep 2005 18:15:38 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id A911B37B56; Thu, 1 Sep 2005 18:15:25 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id A83F037860; Thu, 1 Sep 2005 18:15:25 -0300 (ADT) Date: Thu, 1 Sep 2005 18:15:25 -0300 (ADT) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: [HACKERS] ALTER TABLE ( smallinto -> boolean ) ... In-Reply-To: <6399.1125608205@sss.pgh.pa.us> Message-ID: <20050901180607.V1044@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> 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.036 required=5 tests=[AWL=-0.014, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200509/1 X-Sequence-Number: 22548 Moved off of -hackers, since its long gotten out of that realm :) On Thu, 1 Sep 2005, Tom Lane wrote: > "Marc G. Fournier" writes: >> On Mon, 29 Aug 2005, Tom Lane wrote: >>> No, because there's no built-in cast from smallint to bool. > >> 'k, I just took a read through the "CREATE CAST" man page, and don't think >> I can use that for this, > > Sure you can. Make a SQL or PLPGSQL function that does the conversion > you want and then create a cast using it. Ah, okay, I just re-read the man page and think I stumbled upon what I overlooked the first time ... all I want to do is: CREATE CAST ( 0 AS boolean ) WITH FUNCTION AS ASSIGNMENT; And then each time I try to insert a '0' into a BOOLEAN field, it will auto convert that (based on my function) to 'f' ... And I'd need to do a second one for 1 -> 't' ... Am I reading it right this time ... ? ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664