Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following security trigger - - Table for logging delete attempts CREATE TABLE audit _ log ( event _ id SERIAL PRIMARY KEY, event
Consider the following security trigger
Table for logging delete attempts
CREATE TABLE auditlog
eventid SERIAL PRIMARY KEY,
eventtime TIMESTAMP NOT NULL,
username TEXT NOT NULL,
tablename TEXT NOT NULL,
actiontaken TEXT NOT NULL
;
Trigger function to log delete attempts
CREATE OR REPLACE FUNCTION logdeleteattempt
RETURNS TRIGGER AS $$
BEGIN
INSERT INTO auditlogeventtime, username, tablename, actiontaken
VALUES now CURRENTUSER, TGTABLENAME, 'DELETE ATTEMPT';
RETURN OLD;
END;
$$ LANGUAGE plpgsql;
Trigger for delete attempts on sensitive table 'customerdata'
CREATE TRIGGER triggerlogdelete
BEFORE DELETE ON customerdata
FOR EACH ROW EXECUTE FUNCTION logdeleteattempt;
What does the auditlog table store?
Every login attempt by a user
Attempts to delete rows from the customerdata table
Every change to the database schema
All the INSERT operations in the database
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started