X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D2CF6D1B538 for ; Tue, 9 Sep 2003 17:51:33 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 49429-09 for ; Tue, 9 Sep 2003 14:51:24 -0300 (ADT) Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) by svr1.postgresql.org (Postfix) with ESMTP id C084CD1B52B for ; Tue, 9 Sep 2003 14:51:22 -0300 (ADT) Received: from dunslane.net (x.ncshp.org [199.90.235.43]) (authenticated (0 bits)) by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id h89HhZQ29860 for ; Tue, 9 Sep 2003 12:43:35 -0500 Message-ID: <3F5E130F.8060109@dunslane.net> Date: Tue, 09 Sep 2003 13:51:11 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgresql Hackers Subject: Re: plpgsql doesn't coerce boolean expressions to boolean References: <15403.1063035632@sss.pgh.pa.us> <3F5E0A5D.2010803@Yahoo.com> <3559.1063128729@sss.pgh.pa.us> In-Reply-To: <3559.1063128729@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/622 X-Sequence-Number: 43634 Tom Lane wrote: >>>4. Use the parser's coerce_to_boolean procedure, so that nonbooleans >>>will be accepted in exactly the same cases where they'd be accepted >>>in a boolean-requiring SQL construct (such as CASE). (By default, >>>none are, so this isn't really different from #2. But people could >>>create casts to boolean to override this behavior in a controlled >>>fashion.) >>> >>> > >At this point I'm kinda leaning to #4, because (for example) people >could create a cast from integer to boolean to avoid having to fix their >plpgsql functions right away. #3 would not offer any configurability of >behavior. > > > Won't people have to analyse their functions to find out what sort of casts they need to create? If so, why don't they just fix the functions while they are about it? Surely the fixes in most cases will be quite trivial, and in all cases backwards compatible. Does anyone have a take on how many people would be affected? Or how much they would be affected? cheers andrew