X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 69979528D0 for ; Fri, 3 Jun 2005 12:28:08 -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 91908-09 for ; Fri, 3 Jun 2005 15:28:06 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E22835292B for ; Fri, 3 Jun 2005 12:28:04 -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 j53FS2hj005277; Fri, 3 Jun 2005 11:28:02 -0400 (EDT) To: Bruno Wolff III Cc: Markus Bertheau ??? , Michael Glaesemann , PostgreSQL Subject: Re: 'true'::TEXT::BOOLEAN In-reply-to: <20050603151125.GA10971@wolff.to> References: <1117799555.9816.24.camel@dicaprio.akademie1.de> <3DCEDE55-9D4A-4F4E-8907-ADCC058A3398@myrealbox.com> <1117801417.9816.28.camel@dicaprio.akademie1.de> <20050603151125.GA10971@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Fri, 03 Jun 2005 10:11:25 -0500" Date: Fri, 03 Jun 2005 11:28:02 -0400 Message-ID: <5276.1117812482@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/53 X-Sequence-Number: 21654 Bruno Wolff III writes: > Markus Bertheau ??? wrote: >> I think casting from text to boolean should be possible, and use the >> same algorithm that's used when casting from "unknown" to boolean. > You probably want boolin. That won't actually work either, because boolin wants cstring: egression=# select boolin('f'::text); ERROR: function boolin(text) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts. You can get it to work like this, if you're determined: regression=# select boolin(textout('f'::text)); boolin -------- f (1 row) and of course regression=# select textin(boolout(true)); textin -------- t (1 row) There's been discussion of allowing all datatypes to be explicitly casted to or from text by generating conversions like these automatically. But I'm not sure if everyone's convinced it's a good idea or not. You'd also have to argue about whether varchar should be included in the special dispensation ... regards, tom lane