Re: simple update on boolean - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject Re: simple update on boolean
Date
Msg-id 20071206161919.25e12aeb@webthatworks.it
Whole thread Raw
In response to Re: simple update on boolean  (Cedric Boudin <cedric@dreamgnu.com>)
Responses Re: simple update on boolean
List pgsql-general
On Thu, 06 Dec 2007 14:53:13 +0100
Cedric Boudin <cedric@dreamgnu.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


pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Unreasonable size of table pg 8.2.5
Next
From: "Obe, Regina"
Date:
Subject: Re: simple update on boolean