Re: simple update on boolean

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: simple update on boolean
Дата
Msg-id 20071206093601.GE2743@a-kretschmer.de
обсуждение исходный текст
Ответ на simple update on boolean  (Cedric Boudin <cedric@dreamgnu.com>)
Ответы Re: simple update on boolean
Список pgsql-general
am  Thu, dem 06.12.2007, um 10:25:26 +0100 mailte Cedric Boudin folgendes:
> Most honourable members of the list,
>
> this is a simple one, but I can't find the solution ( probably a
> forest/tree problem).
>
> update table set bolean_column = set_it_to_its_inverse where fk =
> some_value;

test=# create table forrest (id int, b bool);
CREATE TABLE
test=*# insert into forrest values (1,'f'::bool);
INSERT 0 1
test=*# insert into forrest values (2,'t'::bool);
INSERT 0 1
test=*# update forrest set b = case when b then 'f'::bool else 't'::bool end;
UPDATE 2
test=*# select * from forrest ;
 id | b
----+---
  1 | t
  2 | f
(2 rows)


Okay?



Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

В списке pgsql-general по дате отправления:

Предыдущее
От: Cedric Boudin
Дата:
Сообщение: simple update on boolean
Следующее
От: Daniel Drotos
Дата:
Сообщение: Re: simple update on boolean