From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Michael Glaesemann <grzm@myrealbox.com>
Cc: Markus Bertheau ☭ <twanger@bluetwanger.de>
Cc: PostgreSQL <pgsql-sql@postgresql.org>
Subject: Re: 'true'::TEXT::BOOLEAN
Date: Fri, 3 Jun 2005 15:46:48 +0300 (EEST)
Message-ID: <Pine.LNX.4.44.0506031545230.23350-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <D48E9C3D-6E0F-4949-8492-5C2459FA058E@myrealbox.com>
O Michael Glaesemann Ýãñáøå óôéò Jun 3, 2005 :
>
> On Jun 3, 2005, at 9:23 PM, Markus Bertheau â wrote:
>
> > This also bypasses the built in postgresql boolean literal parsing.
> >
> > I think casting from text to boolean should be possible, and use the
> > same algorithm that's used when casting from "unknown" to boolean.
>
> Actually, looking at the system tables, I don't think it is. There
> don't appear to be any casts to (or from) boolean. I may be looking
> at it wrong, but that's how it appears to me. Corrections, anyone?
>
> select type_source.typname as source, type_target.typname as target
> from pg_cast
> join pg_type type_source on (castsource = type_source.oid)
> join pg_type type_target on (casttarget = type_target.oid)
> where type_target.typname = 'bool'
> or type_source.typname = 'bool'
> order by type_source.typname;
>
> source | target
> --------+--------
> (0 rows)
>
> This is in v8.0.3
Also according to the docs:
http://www.postgresql.org/docs/current/static/datatype-boolean.html
"Tip: Values of the boolean type cannot be cast directly to other types
(e.g., CAST (boolval AS integer) does not work). This can be accomplished
using the CASE expression: CASE WHEN boolval THEN 'value if true' ELSE
'value if false' END."
I suppose the reverse must be true also.
>
> Michael Glaesemann
> grzm myrealbox com
>
> PS. Please don't top post.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
--
-Achilleus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: achill@matrix.gatewaynet.com, grzm@myrealbox.com, twanger@bluetwanger.de
Subject: Re: 'true'::TEXT::BOOLEAN
In-Reply-To: <Pine.LNX.4.44.0506031545230.23350-100000@matrix.gatewaynet.com>
References: <D48E9C3D-6E0F-4949-8492-5C2459FA058E@myrealbox.com> <Pine.LNX.4.44.0506031545230.23350-100000@matrix.gatewaynet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox