Bird
0
0

What is a likely cause?

hard📝 Application Q9 of 15
PostgreSQL - Triggers in PostgreSQL
You have a view with an INSTEAD OF UPDATE trigger that updates multiple underlying tables. After an update on the view, you notice some rows in one table are not updated as expected. What is a likely cause?
AThe view definition prevents updates on some columns.
BINSTEAD OF triggers cannot update multiple tables.
CThe trigger function did not include update statements for all related tables.
DPostgreSQL does not support INSTEAD OF triggers on views with joins.
Step-by-Step Solution
Solution:
  1. Step 1: Understand INSTEAD OF trigger responsibilities

    The trigger function must explicitly update all necessary tables; it does not do this automatically.
  2. Step 2: Analyze the problem

    Missing update statements in the trigger function cause some tables to remain unchanged.
  3. Final Answer:

    The trigger function did not include update statements for all related tables. -> Option C
  4. Quick Check:

    Trigger function must update all tables = The trigger function did not include update statements for all related tables. [OK]
Quick Trick: Ensure trigger updates all related tables explicitly [OK]
Common Mistakes:
  • Assuming INSTEAD OF triggers auto-update multiple tables
  • Blaming view definition without checking trigger code
  • Believing PostgreSQL disallows INSTEAD OF triggers on joins

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes