Re: Format of BOOLEAN

From: "Thalis A(dot) Kalfigopoulos" <thalis(at)cs(dot)pitt(dot)edu>
To: "Lehmeier, Michael" <michael(dot)lehmeier(at)cognitech(dot)de>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Format of BOOLEAN
Date: 2001-06-12 17:59:10
Message-ID: Pine.LNX.4.21.0106121357060.19889-100000@aluminum.cs.pitt.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 7 Jun 2001, Lehmeier, Michael wrote:

> 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'.
>
> Example:
>
> testdb=# create table testtable (acolumn BOOLEAN);
> CREATE
> testdb=# INSERT INTO testtable VALUES (true);
> INSERT 161246 1
> testdb=# SELECT * FROM testtable;
> acolumn
> ---------
> t
> (1 row)
>
> testdb=# SELECT * FROM testtable WHERE acolumn = t;
> ERROR: Attribute 't' not found
>
> This is a real problem for me since I am currently writing on a mostly
> database independent engine. PostgreSQL would be the the first time that
> I can't write into a database what I read from it.

you mean read from a db what you wrote into it

>
> Is it possible to change the settings of PostgreSQL somewhere so that
> I get 'true' or 'false'?
>
> Thank you!

You have to give

SELECT * FROM testtable WHERE col='t'; [single quote the value]

It also works with WHERE col='true';

cheers,
thalis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nicolas Huillard 2001-06-12 18:01:32 RE: Format of BOOLEAN
Previous Message Doug McNaught 2001-06-12 17:56:08 Re: Format of BOOLEAN