Re: Format of BOOLEAN

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
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 18:20:43
Message-ID: Pine.LNX.4.30.0106122018570.756-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Lehmeier, Michael writes:

> testdb=# SELECT * FROM testtable WHERE acolumn = t;
> ERROR: Attribute 't' not found

SELECT * FROM testtable WHERE acolumn = 't';

Or better yet (SQL compatible):

SELECT * FROM testtable WHERE acolumn is true;

The latter is a special syntax, whereas in the former the 't' is just an
ordinary data literal.

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

case when acolumn then 'true' else 'false' end

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2001-06-12 18:20:46 Re: select, where and null-values (or: select null<>'1' is fuzzy)
Previous Message Limin Liu 2001-06-12 18:18:54 Big5 contains '\'