DELETE helper function 

CREATE OR REPLACE FUNCTION fr_person(person, bigint)
    RETURNS boolean
    LANGUAGE plpgsql
AS $function$
BEGIN
    -- Update the end_date on the previous record
    UPDATE person_hst
    SET    effective_until  = (
        SELECT timestamp
        FROM   audit
        WHERE  audit.audit_id = $2
    )
    WHERE  person_hst.person_id = $1.person_id
    AND    effective_until  = 'infinity';

    -- Insert the new HST record
    INSERT INTO person_hst (
        effective_until,
        effective_from,
        removed,
        audit_id,
        address,
        date_of_birth,
        person_id,
        name
    ) SELECT
        'infinity' AS effective_until,
        audit.timestamp,
        TRUE,
        $2,
        $1.address,
        $1.date_of_birth,
        $1.person_id,
        $1.name
    FROM   audit
    WHERE  audit.audit_id = $2;

    -- Delete the current record
    DELETE FROM person
    WHERE  person.person_id = $1.person_id;

    RETURN TRUE;
END;
$function$
;