DROP FUNCTION IF EXISTS ies.t_document_insert_update CASCADE;
CREATE  FUNCTION ies.t_document_insert_update()
RETURNS TRIGGER AS $$
BEGIN
	
    new.editdate = now();

    RETURN NEW;
END;
$$ LANGUAGE plpgsql;


DROP TRIGGER IF EXISTS t_document_before_insert_update ON ies.t_document;
CREATE TRIGGER t_document_before_insert_update
BEFORE INSERT OR UPDATE ON ies.t_document
FOR EACH ROW EXECUTE FUNCTION ies.t_document_insert_update();