Answer the question
In order to leave comments, you need to log in
It is necessary to make sure that only managers have access to information about the employee and can change it, how?
There is this code:
CREATE FUNCTION log_salary_access() RETURNS trigger AS $log_salary_access$
BEGIN
IF OLD.manager_id != current_user THEN
RAISE EXCEPTION 'access denied';
END IF;
RETURN NEW;
END;
$log_salary_access$ LANGUAGE plpgsql;
CREATE TRIGGER log_salary_access AFTER UPDATE ON employees
FOR EACH ROW EXECUTE PROCEDURE log_salary_access();
, Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question