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 F07C2D893D; Thu, 1 Sep 2005 18:30:44 -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 29582-01; Thu, 1 Sep 2005 21:30:42 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E4D43D890F; Thu, 1 Sep 2005 18:30:41 -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 j81LUghw006794; Thu, 1 Sep 2005 17:30:42 -0400 (EDT) To: Andrew Dunstan Cc: "Marc G. Fournier" , pgsql-hackers@postgresql.org Subject: Re: ALTER TABLE ( smallinto -> boolean ) ... In-reply-to: <4317713C.10808@dunslane.net> 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> Comments: In-reply-to Andrew Dunstan message dated "Thu, 01 Sep 2005 17:23:08 -0400" Date: Thu, 01 Sep 2005 17:30:42 -0400 Message-ID: <6793.1125610242@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: 200509/82 X-Sequence-Number: 72479 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. > Is there a way to make the builtin int to bool cast implicit? I think you'd have to go and hack the pg_cast entry ... but that cast is new in 8.1 anyway, so it doesn't apply to Marc's problem (yet). If we want to make it cover that specific scenario, changing it to AS ASSIGNMENT would be sufficient; I don't think it needs to be IMPLICIT. (I generally find cross-type-category implicit casts to be dangerous.) regards, tom lane