Re: Format of BOOLEAN - Mailing list pgsql-general

From Doug McNaught
Subject Re: Format of BOOLEAN
Date
Msg-id m31yopshtz.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to Format of BOOLEAN  ("Lehmeier, Michael" <michael.lehmeier@cognitech.de>)
List pgsql-general
"Lehmeier, Michael" <michael.lehmeier@cognitech.de> writes:

> Hello
>
> When I SELECT a row with a BOOLEAN in it I get either 't' or 'f'.
> But when I use this same value in the WHERE condition I get an error,
> because PostgreSQL demands either 'true' or 'false'.

If you quote the value you get back from Postgres (which you probably
should be doing anyway) it will work:

foo=# create table test1 (f1 boolean);
CREATE
foo=# insert into test1 values ('t');
INSERT 31078 1
foo=# select * from test1;
 f1
----
 t
(1 row)

foo=# select * from test1 where f1='t';
 f1
----
 t
(1 row)

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time...          --Dylan

pgsql-general by date:

Previous
From: "Flacco"
Date:
Subject: Rename database?
Next
From: Terry Fielder
Date:
Subject: Default value for bit datatype