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 3415F52855 for ; Fri, 3 Jun 2005 09:00:32 -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 32027-07 for ; Fri, 3 Jun 2005 12:00:22 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id CF4BA52802 for ; Fri, 3 Jun 2005 09:00:21 -0300 (ADT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id j53Bjd9W023401; Fri, 3 Jun 2005 14:45:39 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id j53BjdEb023397; Fri, 3 Jun 2005 14:45:39 +0300 Date: Fri, 3 Jun 2005 14:45:39 +0300 (EEST) From: Achilleus Mantzios To: Markus Bertheau =?UTF-8?Q?=E2=98=AD?= Cc: "'PostgreSQL'" Subject: Re: 'true'::TEXT::BOOLEAN In-Reply-To: <1117799555.9816.24.camel@dicaprio.akademie1.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT 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/38 X-Sequence-Number: 21639 O Markus Bertheau â^ح Ýãñáøå óôéò Jun 3, 2005 : > В Птн, 03/06/2005 в 14:20 +0300, Achilleus Mantzios пишет: > > O Markus Bertheau β^Ψ­ έγραψε στις Jun 3, 2005 : > > > > > Hi, > > > > > > What's the type I need to convert text to before I can convert it to > > > boolean? > > > > just 't' will suffice. > > Well, that's not my question. I have a plpgsql function like that: > > CREATE FUNCTION object_new(class TEXT, properties TEXT[]) > > which I call like > > object_new('Car', ARRAY['color', 'red', 'new', 'true']) > > That means set color to red and new to true. In the function I need to > call > > object_set_boolean_property(object_id INT, property_name TEXT, > property_value BOOLEAN) > > And I can't call it with a TEXT variable, because casting from TEXT to > BOOLEAN isn't possible. Then use the case when ... then ... when ... then ... else ... end construct, e.g. case when mytext='true' then 't'::boolean else 'f'::boolean end Hmm, why dont you leave it as 'true' or 'false' without any castings. > > Markus > -- -Achilleus