Gunnar Lindholm <gunnar(at)gunix(dot)mine(dot)nu> writes:
> Hello. I'm a total newbie when it comes to plpgsql and trigger functions, but
> here is my code that does not work
You need a BEFORE INSERT trigger, not AFTER INSERT. After the insertion
is too late to change the row that will be stored.
regards, tom lane