1CREATE or REPLACE FUNCTION func()
2RETURNS TRIGGER
3AS $$
4BEGIN
5NEW.columnname = 0;
6RETURN NEW;
7END;
8$$
9LANGUAGE plpgsql;
10
11-- Statement to make trigger to execute above code --
12CREATE TRIGGER change_incoming BEFORE INSERT on Tablename
13FOR EACH ROW EXECUTE PROCEDURE func();