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 E0A8A5288E for ; Fri, 3 Jun 2005 09:14:31 -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 35505-09 for ; Fri, 3 Jun 2005 12:14:23 +0000 (GMT) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id F1B0152861 for ; Fri, 3 Jun 2005 09:14:21 -0300 (ADT) Received: from [172.16.1.104] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.5 $ on Linux via secured & encrypted transport (TLS); Fri, 03 Jun 2005 06:14:22 -0600 In-Reply-To: <1117799555.9816.24.camel@dicaprio.akademie1.de> References: <1117799555.9816.24.camel@dicaprio.akademie1.de> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed Message-Id: <3DCEDE55-9D4A-4F4E-8907-ADCC058A3398@myrealbox.com> Cc: PostgreSQL Content-Transfer-Encoding: quoted-printable From: Michael Glaesemann Subject: Re: 'true'::TEXT::BOOLEAN Date: Fri, 3 Jun 2005 21:14:18 +0900 To: =?UTF-8?Q?Markus_Bertheau_=E2=98=AD?= X-Mailer: Apple Mail (2.730) 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: 200506/40 X-Sequence-Number: 21641 On Jun 3, 2005, at 8:52 PM, Markus Bertheau =E2=98=AD wrote: > And I can't call it with a TEXT variable, because casting from TEXT to > BOOLEAN isn't possible. I'd be surprised if there weren't a some way to coerce the cast from =20 text to boolean, but you might want to just make a simple convenience =20= function in the interim: test=3D# create or replace function text2bool (text) returns boolean language sql as $$ select case when lower($1) =3D 'true' then true else false end; $$; CREATE FUNCTION test=3D# select text2bool('true'); text2bool ----------- t (1 row) test=3D# select text2bool('false'); text2bool ----------- f (1 row) Just an idea. Michael Glaesemann grzm myrealbox com