Question: 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 audit_log (
event_id SERIAL PRIMARY KEY,
event_time TIMESTAMP NOT NULL,
username TEXT NOT NULL,
table_name TEXT NOT NULL,
action_taken TEXT NOT NULL
;
-- Trigger function to log delete attempts
CREATE OR REPLACE FUNCTION log_delete_attempt ()
RETURNS TRIGGER AS $$
BEGIN
INSERT INTO audit_log(event_time, username, table_name, action_taken)
VALUES (now (), CURRENT_USER, TG_TABLE_NAME, 'DELETE ATTEMPT');
RETURN OLD;
END;
$$ LANGUAGE plpgsql;
-- Trigger for delete attempts on sensitive table 'customer_data'
CREATE TRIGGER trigger_log_delete
BEFORE DELETE ON customer_data
FOR EACH ROW EXECUTE FUNCTION log_delete_attempt();
What does the audit_log table store?
Every login attempt by a user
Attempts to delete rows from the customer_data table
Every change to the database schema
All the INSERT operations in the database
 Consider the following security trigger -- Table for logging delete attempts

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!