INSERT trigger function
CREATE OR REPLACE FUNCTION fi_person() RETURNS trigger LANGUAGE plpgsql AS $function$ BEGIN -- Insert current data into history INSERT INTO person_hst ( effective_until, effective_from, address, audit_id, date_of_birth, person_id, name ) SELECT 'infinity' AS effective_until, audit.timestamp, NEW.address, NEW.audit_id, NEW.date_of_birth, NEW.person_id, NEW.name FROM audit WHERE audit_id = NEW.audit_id; RETURN NEW; END; $function$ ;