Re: [GENERAL] simple update on boolean
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
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Received on Thu Dec 6 04:37:21 2007
This archive was generated by hypermail 2.1.8
: Mon Jun 16 2008 - 21:27:50 EDT
|