I hope this helps:
=> create table test(a int4 NOT NULL DEFAULT 1, b text);
=> create function tg_test() returns opaque as '
-> declare x text;
-> begin
-> new.a=old.a+1;
-> return new;
-> end;' language 'plpgsql';
=> insert into test(b) values('a');
INSERT 770064 1
=> update test set b='b';
UPDATE 1
=> select * from test;
a|b
-+-
2|b
(1 row)
Before this U need a createlang plpgsql too.
--
nek;(