Bird
0
0

In PostgreSQL, what is the primary function of an INSTEAD OF trigger defined on a view?

easy📝 Conceptual Q1 of 15
PostgreSQL - Triggers in PostgreSQL
In PostgreSQL, what is the primary function of an INSTEAD OF trigger defined on a view?
AIt automatically updates the underlying tables without any user-defined function.
BIt intercepts data modification commands on the view and executes specified actions instead of the default behavior.
CIt prevents any data modification on the view by raising an error.
DIt duplicates the data modification commands to all tables in the database.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of INSTEAD OF triggers

    INSTEAD OF triggers on views allow intercepting INSERT, UPDATE, or DELETE commands on the view.
  2. Step 2: What happens when the trigger fires?

    Instead of the default behavior (which is not allowed on views), the trigger executes a user-defined function to handle the operation.
  3. Final Answer:

    It intercepts data modification commands on the view and executes specified actions instead of the default behavior. -> Option B
  4. Quick Check:

    INSTEAD OF triggers replace default view modifications [OK]
Quick Trick: INSTEAD OF triggers replace default view modifications [OK]
Common Mistakes:
  • Assuming views can be updated directly without triggers
  • Thinking INSTEAD OF triggers automatically update tables without functions
  • Confusing INSTEAD OF triggers with AFTER triggers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes