Re: simple update on boolean

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: simple update on boolean
Date: 2007-12-06 15:19:19
Message-ID: 20071206161919.25e12aeb@webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 06 Dec 2007 14:53:13 +0100
Cedric Boudin <cedric(at)dreamgnu(dot)com> wrote:

> > What if boolean_column is NULL?
> >
> > btw set bolean_column= not bolean_column works "as expected".
> >
> > template1=# select (not 't'::boolean),(not 'f'::boolean),(not
> > NULL::boolean);
> >
> > ?column? | ?column? | ?column?
> > ----------+----------+----------
> > f | t |
> > (1 riga)

> If it was null before it has to be null afterwards (IMHO).
> If you don't want to have null,
> take care of it somewhere else but not here.

That is the "as expected" part.

The "case" case, other than being more verbose, do more than what I
would expect since all NULL are converted to t.

template1=# select case when NULL then 'f'::boolean else 't'::boolean
end;

case
------
t
(1 riga)

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Obe, Regina 2007-12-06 15:20:51 Re: simple update on boolean
Previous Message Bill Moran 2007-12-06 14:25:58 Re: Unreasonable size of table pg 8.2.5