create table customer ( ikey integer NOT NULL, nick character varying(32), flags smallint, instdate date, ts timestamp without time zone DEFAULT ('now'::text)::timestamp(0) with time zone NOT NULL ); copy customer from stdin; 592 Vondruska Jiri 7 2003-01-01 2003-05-16 21:43:17 592 Datatrans CZ 7 2003-01-01 2003-05-16 21:43:17 592 Stechova Marcela 7 2003-01-01 2003-05-16 21:43:17 \. alter table customer add column _flags text; update customer set _flags='flag 1, flag 2, flag 3' where flags=7; alter table customer drop column flags; alter table customer rename column _flags to flags; select * from customer where (lower(to_ascii(ikey)) like '%hor%') or (lower(to_ascii(nick)) like '%hor%') or (lower(to_ascii(flags)) like '%hor%') or (lower(to_ascii(instdate)) like '%hor%') or (lower(to_ascii(ts)) like '%hor%') order by ikey; drop table customer;