A trigger is set to update a timestamp column on every row update. What will be the result after updating a row?
medium📝 query result Q5 of 15
PostgreSQL - Triggers in PostgreSQL
A trigger is set to update a timestamp column on every row update. What will be the result after updating a row?
AThe timestamp column remains unchanged
BThe timestamp column will update automatically to current time
CThe update will fail due to trigger conflict
DThe entire row will be deleted
Step-by-Step Solution
Solution:
Step 1: Understand trigger purpose for timestamp update
Triggers can automatically modify columns like timestamps when a row is updated.
Step 2: Evaluate options
The timestamp column will update automatically to current time correctly describes the expected behavior. Options A, B, and D describe incorrect or harmful outcomes.
Final Answer:
The timestamp column will update automatically to current time -> Option B
Quick Check:
Update trigger = Auto timestamp update [OK]
Quick Trick:Update triggers can auto-change columns like timestamps [OK]
Common Mistakes:
Expecting update failure due to triggers
Thinking triggers do not change data
Assuming triggers delete rows
Master "Triggers in PostgreSQL" in PostgreSQL
9 interactive learning modes - each teaches the same concept differently