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 1D7D7D6F5F; Mon, 29 Aug 2005 20:49: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 34965-08; Mon, 29 Aug 2005 23:49:36 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1BB58D6E21; Mon, 29 Aug 2005 20:49:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j7TNndjq015014; Mon, 29 Aug 2005 19:49:39 -0400 (EDT) To: "Marc G. Fournier" Cc: pgsql-hackers@postgresql.org Subject: Re: ALTER TABLE ( smallinto -> boolean ) ... In-reply-to: <20050829201253.X1044@ganymede.hub.org> References: <20050829201253.X1044@ganymede.hub.org> Comments: In-reply-to "Marc G. Fournier" message dated "Mon, 29 Aug 2005 20:15:41 -0300" Date: Mon, 29 Aug 2005 19:49:39 -0400 Message-ID: <15013.1125359379@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200508/1077 X-Sequence-Number: 72272 "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; regards, tom lane