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 09A44D8572 for ; Thu, 1 Sep 2005 17:49:03 -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 16551-09 for ; Thu, 1 Sep 2005 20:49:01 +0000 (GMT) Received: from hub.org (hub.org [200.46.204.220]) by svr1.postgresql.org (Postfix) with ESMTP id 0E867D857B for ; Thu, 1 Sep 2005 17:49:01 -0300 (ADT) Received: from localhost (av.hub.org [200.46.204.144]) by hub.org (Postfix) with ESMTP id 58A6364BF97 for ; Thu, 1 Sep 2005 17:49:18 -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 17910-07; Thu, 1 Sep 2005 20:48:59 +0000 (GMT) Received: from ganymede.hub.org (blk-222-82-85.eastlink.ca [24.222.82.85]) by hub.org (Postfix) with ESMTP id 3496464BF9E; Thu, 1 Sep 2005 17:49:16 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id CB7D236BD8; Thu, 1 Sep 2005 17:49:02 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id BB69E36B20; Thu, 1 Sep 2005 17:49:02 -0300 (ADT) Date: Thu, 1 Sep 2005 17:49:02 -0300 (ADT) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: ALTER TABLE ( smallinto -> boolean ) ... In-Reply-To: <15013.1125359379@sss.pgh.pa.us> Message-ID: <20050901174341.N1044@ganymede.hub.org> References: <20050829201253.X1044@ganymede.hub.org> <15013.1125359379@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/77 X-Sequence-Number: 72474 On Mon, 29 Aug 2005, Tom Lane wrote: > "Marc G. Fournier" writes: >> # ALTER TABLE table ALTER COLUMN field1 type boolean; >> ERROR: column "field1" cannot be cast to type "pg_catalog.bool" > >> Should this not work? > > No, because there's no built-in cast from smallint to bool. You could > do something like > > ... type boolean using case when field1=0 then false else true end; 'k, I just took a read through the "CREATE CAST" man page, and don't think I can use that for this, but is there some way I can create a cast for this, so that we don't have to go through the complete application and change "VALUES ( 0 );" to "VALUES ( '0' );" ... Again, from reading the man page, I'm guessing not, but just want to make sure that I haven't missed anything ... ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664