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 0B3AD566ED for ; Fri, 11 Mar 2005 16:57:46 +0000 (GMT) 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 99835-01 for ; Fri, 11 Mar 2005 16:57:43 +0000 (GMT) Received: from happy.onesystem.ca (happy.onesystem.ca [205.206.61.17]) by svr1.postgresql.org (Postfix) with ESMTP id 76A6F566E2 for ; Fri, 11 Mar 2005 16:57:39 +0000 (GMT) Received: from elb_lx.onesystem.ca ([10.1.1.50]) by happy.onesystem.ca with asmtp (Exim 4.14) id 1D9nSE-0000to-4A for pgsql-sql@postgresql.org; Fri, 11 Mar 2005 09:57:38 -0700 Message-ID: <4231CE01.2090902@onesystem.com> Date: Fri, 11 Mar 2005 09:57:37 -0700 From: Edmund Bacon User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Conver bool to text Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200503/164 X-Sequence-Number: 20643 Is there a way to convert a boolean value to text and/or vice versa? You can select 'true'::boolean, which *seems* to convert a text string to boolean, but select 'true'::text::boolean earns the message ERROR: cannot cast type text to boolean You can't go the other way either SELECT true::text ERROR: cannot cast type boolean to text and to_char() doesn't know about booleans. It's not that difficult to write a fuction to convert boolean to text, but I'm wondering if there's already something that does this? -- Edmund Bacon