Re: simple update on boolean

From: Cedric Boudin <cedric(at)dreamgnu(dot)com>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: simple update on boolean
Date: 2007-12-06 13:53:13
Message-ID: 4757FEC9.9050705@dreamgnu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ivan Sergio Borgonovo wrote:
> On Thu, 06 Dec 2007 13:38:31 +0100
> Cedric Boudin <cedric(at)dreamgnu(dot)com> wrote:
>
>
>> It was indeed a forest problem.
>> both:
>>
>> set bolean_column= not bolean_column
>> and
>> set bolean_column= case when bolean_column then 'f'::bool else
>> 't'::bool end;
>>
>> do work perfectly.
>>
>
> 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.

cedric

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-12-06 14:14:30 Re: autovacuum is stopping automatically....
Previous Message A. Kretschmer 2007-12-06 13:25:06 Re: Error in creating function