Re: simple update on boolean

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема Re: simple update on boolean
Дата
Msg-id 20071206161919.25e12aeb@webthatworks.it
обсуждение исходный текст
Ответ на Re: simple update on boolean  (Cedric Boudin <cedric@dreamgnu.com>)
Ответы Re: simple update on boolean
Список 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 по дате отправления:

Предыдущее
От: Bill Moran
Дата:
Сообщение: Re: Unreasonable size of table pg 8.2.5
Следующее
От: "Obe, Regina"
Дата:
Сообщение: Re: simple update on boolean