CREATE RULE table_update AS ON UPDATE TO table DO INSERT INTO table_log ( id, titile, contents, pguser, date_modified ) VALUES ( OLD.id, OLD.title, OLD.description, getpgusername(), 'now'::text );