From: | KÖPFERL Robert <robert(dot)koepferl(at)sonorys(dot)at> |
---|---|
To: | |
Cc: | Sql-Postgre <pgsql-sql(at)postgresql(dot)org> |
Subject: | Converting varchar to bool |
Date: | 2005-06-15 12:14:46 |
Message-ID: | ED4E30DD9C43D5118DFB00508BBBA76EB1676C@neptun.sonorys.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
I have currently trouble working with boolean values and variables in
functions.
As one would expect, a
select '1'::bool, 't'::bool, 'true'::unknown::boolean
works.
As a select '1' tells us this seems as a conversion unknown->bool
or ??maybe?? a boolean literal??
what-o-ever, at least my function gets not accepted:
CREATE OR REPLACE FUNCTION testbool(varchar)
RETURNS boolean AS
$BODY$
SELECT $1::boolean
$BODY$
LANGUAGE 'sql' STABLE STRICT SECURITY DEFINER;
Postgres complains that it can't convert varchar to boolean.
Actually neither $1::unknown::bool works.
It turns out that there exists no conversion varchar/text/unknown ->
boolean.
Actually there's not any conversion -> boolean.
How should this be treaten?
*being confused*
sorry for duplicating (I'm sure) this topic, at least I tried to find it in
the listarcive.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Prévost | 2005-06-15 12:22:11 | Re: update syntax |
Previous Message | Praveen Raja | 2005-06-15 11:39:11 | update syntax |